@telus-uds/components-web 2.41.0 → 2.43.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.
@@ -47,11 +47,14 @@ const StyledItemBase = styled(ItemBase)(
47
47
  counterIncrement: OL_COUNTER_NAME,
48
48
  '::before': {
49
49
  content: `counter(${OL_COUNTER_NAME})'.'`,
50
- display: 'inline-flex',
50
+ display: 'inline-block',
51
51
  color: itemColor || itemTextColor,
52
52
  width: itemBulletContainerWidth,
53
53
  paddingRight: listGutter,
54
- justifyContent: itemBulletTextAlign,
54
+ textAlign: itemBulletTextAlign,
55
+ flexShrink: 0,
56
+ whiteSpace: 'nowrap',
57
+ overflow: 'hidden',
55
58
  ...applyTextStyles({
56
59
  fontWeight: itemFontWeight,
57
60
  fontSize: itemFontSize,
@@ -65,7 +68,9 @@ const StyledItemBase = styled(ItemBase)(
65
68
  )
66
69
 
67
70
  const ItemContent = styled.div({
68
- flex: 1
71
+ display: 'flex',
72
+ flexDirection: 'column',
73
+ gap: 5
69
74
  })
70
75
 
71
76
  const Item = React.forwardRef(
@@ -96,7 +101,7 @@ const Item = React.forwardRef(
96
101
  <ItemContent {...themeTokens}>{itemContent}</ItemContent>
97
102
  </StackView>
98
103
  ) : (
99
- itemContent
104
+ <ItemContent>{itemContent}</ItemContent>
100
105
  )}
101
106
  </StyledItemBase>
102
107
  )
@@ -17,6 +17,7 @@ import { htmlAttrs, warn } from '../utils'
17
17
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
18
18
 
19
19
  const PriceLockupContainer = styled.div`
20
+ align-items: ${({ alignItemsText }) => alignItemsText};
20
21
  display: flex;
21
22
  flex-direction: column;
22
23
  width: fit-content;
@@ -129,6 +130,7 @@ const PriceLockup = React.forwardRef(
129
130
  fontColor,
130
131
  dividerColor,
131
132
  footnoteLinkFontSize,
133
+ alignItemsText,
132
134
  ...themeTokens
133
135
  } = useThemeTokens(
134
136
  'PriceLockup',
@@ -234,7 +236,7 @@ const PriceLockup = React.forwardRef(
234
236
  }
235
237
 
236
238
  return (
237
- <PriceLockupContainer {...selectProps(rest)} ref={ref}>
239
+ <PriceLockupContainer {...selectProps(rest)} alignItemsText={alignItemsText} ref={ref}>
238
240
  {topText && (
239
241
  <TopTextContainer topTextMarginBottom={`${topTextMarginBottom}px`}>
240
242
  {renderTypography(topText, typographyTokens.topText)}
@@ -7,7 +7,8 @@ import {
7
7
  useThemeTokens,
8
8
  a11yProps,
9
9
  viewProps,
10
- variantProp
10
+ variantProp,
11
+ applyShadowToken
11
12
  } from '@telus-uds/components-base'
12
13
  import styled from 'styled-components'
13
14
 
@@ -16,13 +17,12 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
16
17
 
17
18
  const { Bar: ProgressBarBase } = Progress
18
19
  const Gradient = styled.div.attrs({ 'data-testid': 'ProgressBar-Gradient' })(
19
- ({ percentage, gradient: { angle, stops, type } }) => ({
20
+ ({ gradient: { angle, stops, type }, borderRadius, shadow }) => ({
20
21
  height: '100%',
21
- // As per the design specs, we need to have the gradient expanding to 100% and being
22
- // revealed by bar width, so we need to stretch it beyond the parent (progress element)
23
- // to the full length of the progress bar
24
- width: `${(100 * 100) / percentage}%`,
25
- background: `${type}-gradient(${angle}deg, ${stops[0].color}, ${stops[1].color})`
22
+ width: '100%',
23
+ background: `${type}-gradient(${angle}deg, ${stops[0].color}, ${stops[1].color})`,
24
+ borderRadius,
25
+ ...applyShadowToken(shadow)
26
26
  })
27
27
  )
28
28
 
@@ -49,7 +49,7 @@ const ProgressBar = React.forwardRef(({ percentage, tokens, variant, ...rest },
49
49
  ref={ref}
50
50
  {...selectedProps}
51
51
  >
52
- {themeTokens.gradient && <Gradient {...themeTokens} percentage={percentage} />}
52
+ {themeTokens.gradient && <Gradient {...themeTokens} />}
53
53
  </ProgressBarBase>
54
54
  )
55
55
  })
@@ -60,8 +60,8 @@ const Table = ({
60
60
 
61
61
  useSafeLayoutEffect(() => {
62
62
  const updateDimensions = () => {
63
- const containerClientWidth = containerRef.current.clientWidth
64
- const responsiveTableWidth = fullWidth ? containerClientWidth : tableRef.current.clientWidth
63
+ const containerClientWidth = containerRef.current?.clientWidth
64
+ const responsiveTableWidth = fullWidth ? containerClientWidth : tableRef.current?.clientWidth
65
65
  setContainerWidth(containerClientWidth)
66
66
  setTableWidth(responsiveTableWidth)
67
67
  }
@@ -9,7 +9,11 @@ import {
9
9
  useCopy,
10
10
  useThemeTokens,
11
11
  useViewport,
12
- getTokensPropType
12
+ getTokensPropType,
13
+ useTheme,
14
+ useResponsiveThemeTokens,
15
+ createMediaQueryStyles,
16
+ StyleSheet
13
17
  } from '@telus-uds/components-base'
14
18
  import ExpandCollapse from './ExpandCollapse'
15
19
  import OrderedListBase from '../OrderedList/OrderedListBase'
@@ -90,7 +94,65 @@ const TermsAndConditions = React.forwardRef(
90
94
  const hasNonIndexedContent = nonIndexedContent.length > 0
91
95
 
92
96
  const viewport = useViewport()
93
- const themeTokens = useThemeTokens('TermsAndConditions', tokens, variant, { viewport })
97
+ const { themeOptions } = useTheme()
98
+
99
+ const { enableMediaQueryStyleSheet } = themeOptions
100
+
101
+ const useTokens = enableMediaQueryStyleSheet ? useResponsiveThemeTokens : useThemeTokens
102
+ const themeTokens = useTokens(
103
+ 'TermsAndConditions',
104
+ tokens,
105
+ variant,
106
+ !enableMediaQueryStyleSheet && { viewport }
107
+ )
108
+
109
+ let listItemStyles
110
+ let listItemMediaIds
111
+ let nonIndexedContentStyles
112
+ let nonIndexedContentMediaIds
113
+
114
+ if (enableMediaQueryStyleSheet) {
115
+ const { transformedListItemThemeTokens, transformedNonIndexedContentThemeTokens } =
116
+ Object.entries(themeTokens).reduce(
117
+ (acc, [vp, viewportTokens]) => {
118
+ acc.transformedListItemThemeTokens[vp] = {
119
+ marginLeft: viewportTokens.listMarginLeft
120
+ }
121
+ acc.transformedNonIndexedContentThemeTokens[vp] = {
122
+ paddingLeft: viewportTokens.titlePaddingLeft
123
+ }
124
+ return acc
125
+ },
126
+ {
127
+ transformedListItemThemeTokens: {},
128
+ transformedNonIndexedContentThemeTokens: {}
129
+ }
130
+ )
131
+
132
+ const listItemMediaQueryStyles = createMediaQueryStyles(transformedListItemThemeTokens)
133
+ const nonIndexedContentMediaQueryStyles = createMediaQueryStyles(
134
+ transformedNonIndexedContentThemeTokens
135
+ )
136
+
137
+ const { ids, styles } = StyleSheet.create({
138
+ listItem: {
139
+ ...themeTokens[viewport],
140
+ ...listItemMediaQueryStyles
141
+ },
142
+ nonIndexedContent: {
143
+ ...themeTokens[viewport],
144
+ ...nonIndexedContentMediaQueryStyles
145
+ }
146
+ })
147
+
148
+ listItemStyles = styles.listItem
149
+ listItemMediaIds = ids.listItem
150
+ nonIndexedContentStyles = styles.nonIndexedContent
151
+ nonIndexedContentMediaIds = ids.nonIndexedContent
152
+ } else {
153
+ listItemStyles = themeTokens
154
+ nonIndexedContentStyles = themeTokens
155
+ }
94
156
 
95
157
  return (
96
158
  <div {...selectProps(rest)}>
@@ -107,7 +169,7 @@ const TermsAndConditions = React.forwardRef(
107
169
  <Ordered tokens={themeTokens}>
108
170
  {indexedContent.map((contentItem, idx) => (
109
171
  // eslint-disable-next-line react/no-array-index-key
110
- <ListItem tokens={themeTokens} key={idx}>
172
+ <ListItem tokens={listItemStyles} key={idx} media={listItemMediaIds}>
111
173
  {renderStructuredContent(contentItem)}
112
174
  </ListItem>
113
175
  ))}
@@ -115,7 +177,10 @@ const TermsAndConditions = React.forwardRef(
115
177
  )}
116
178
  {hasNonIndexedContent && (
117
179
  <Box between={3}>
118
- <NonIndexedContentTitle tokens={themeTokens}>
180
+ <NonIndexedContentTitle
181
+ tokens={nonIndexedContentStyles}
182
+ media={nonIndexedContentMediaIds}
183
+ >
119
184
  <Typography
120
185
  block
121
186
  heading
@@ -132,7 +197,7 @@ const TermsAndConditions = React.forwardRef(
132
197
  <Unordered tokens={themeTokens}>
133
198
  {nonIndexedContent.map((contentItem, idx) => (
134
199
  // eslint-disable-next-line react/no-array-index-key
135
- <ListItem tokens={themeTokens} key={idx}>
200
+ <ListItem tokens={listItemStyles} key={idx} media={listItemMediaIds}>
136
201
  {renderStructuredContent(contentItem)}
137
202
  </ListItem>
138
203
  ))}
@@ -1,22 +1,22 @@
1
1
  import type { ComponentType } from 'react'
2
2
 
3
- declare interface ThemeMetadata {
3
+ export interface ThemeMetadata {
4
4
  themeTokensVersion: string
5
5
  name: string
6
6
  }
7
7
 
8
- declare interface DefaultTheme {
8
+ export interface Theme {
9
9
  metadata: ThemeMetadata
10
10
  }
11
11
 
12
- declare interface ThemeOptions {
12
+ export interface ThemeOptions {
13
13
  forceAbsoluteFontSizing?: boolean
14
14
  forceZIndex?: boolean
15
15
  }
16
16
 
17
17
  export interface BaseProviderProps {
18
18
  themeOptions?: ThemeOptions
19
- defaultTheme: DefaultTheme
19
+ defaultTheme: Theme
20
20
  children: React.ReactNode
21
21
  }
22
22
 
@@ -0,0 +1,41 @@
1
+ // TODO: Duplicate of the one in components-base. TS module resolution doesn't seem to be working from web -> base.
2
+ import type { ComponentType } from 'react'
3
+
4
+ export interface FileUploadTokens {
5
+ buttonBackgroundColor?: string
6
+ buttonBorderColor?: string
7
+ buttonBorderRadius?: number
8
+ buttonBorderWidth?: string
9
+ buttonTextColor?: string
10
+ buttonHeight?: string
11
+ buttonMinWidth?: string
12
+ buttonWidth?: string
13
+ notificationBackgroundColor?: string
14
+ notificationBorderColor?: string
15
+ notificationBorderRadius?: number
16
+ notificationTextColor?: string
17
+ notificationDismissButtonGap?: string
18
+ notificationDismissIcon?: string
19
+ notificationDismissIconColor?: string
20
+ notificationIcon?: string
21
+ notificationIconColor?: string
22
+ notificationIconGap?: string
23
+ notificationIconSize?: number
24
+ }
25
+
26
+ export interface FileUploadProps {
27
+ tokens?: FileUploadTokens
28
+ variant?: Record<string, any>
29
+ copy?: 'en' | 'fr'
30
+ fileTypes?: string[]
31
+ allowMultipleFiles?: boolean
32
+ maxFileSize?: number
33
+ maxFilesCount?: number
34
+ onUpload?: (files: any) => void
35
+ onDelete?: (file: any) => void
36
+ documentPicker?: Record<string, any>
37
+ }
38
+
39
+ declare const FileUpload: ComponentType<FileUploadProps>
40
+
41
+ export default FileUpload
package/types/index.d.ts CHANGED
@@ -8,6 +8,9 @@ export type { AutocompleteProps, AutocompleteItem } from './Autocomplete'
8
8
  export { default as Badge } from './Badge'
9
9
  export type { BadgeProps } from './Badge'
10
10
 
11
+ export { default as BaseProvider } from './BaseProvider'
12
+ export type { BaseProviderProps, ThemeOptions, Theme, ThemeMetadata } from './BaseProvider'
13
+
11
14
  export { default as BlockQuote } from './BlockQuote'
12
15
  export type { BlockQuoteProps } from './BlockQuote'
13
16
 
@@ -35,6 +38,10 @@ export type { DatePickerProps } from './DatePicker'
35
38
 
36
39
  declare const Disclaimer: ComponentType<Props>
37
40
  declare const ExpandCollapseMini: ComponentType<Props>
41
+
42
+ export { default as FileUpload } from './FileUpload'
43
+ export type { FileUploadProps, FileUploadTokens } from './FileUpload'
44
+
38
45
  declare const Footnote: ComponentType<Props> & {
39
46
  Link: ComponentType<Props>
40
47
  }
@@ -115,7 +122,7 @@ declare const Pagination: ComponentType<Props> & {
115
122
 
116
123
  export { default as QuantitySelector } from './QuantitySelector'
117
124
  export type { QuantitySelectorProps } from './QuantitySelector'
118
- export { default as BaseProvider } from './BaseProvider'
125
+
119
126
  declare const QuickLinks: ComponentType<Props> & {
120
127
  Item: ComponentType<Props>
121
128
  }