@telus-uds/components-base 3.1.0 → 3.3.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 +35 -2
- package/lib/cjs/Card/CardBase.js +2 -1
- package/lib/cjs/Carousel/Carousel.js +202 -51
- package/lib/cjs/Carousel/CarouselItem/CarouselItem.js +1 -15
- package/lib/cjs/Carousel/CarouselStepTracker/CarouselStepTracker.js +6 -6
- package/lib/cjs/ExpandCollapse/Control.js +3 -1
- package/lib/cjs/ExpandCollapseMini/ExpandCollapseMini.js +1 -1
- package/lib/cjs/List/ListItemBase.js +1 -2
- package/lib/cjs/List/ListItemMark.js +6 -2
- package/lib/cjs/Modal/ModalContent.js +1 -1
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/lib/cjs/Notification/Notification.js +15 -25
- package/lib/cjs/TextInput/TextArea.js +10 -1
- package/lib/cjs/Typography/Typography.js +9 -3
- package/lib/esm/Card/CardBase.js +2 -1
- package/lib/esm/Carousel/Carousel.js +203 -52
- package/lib/esm/Carousel/CarouselItem/CarouselItem.js +2 -16
- package/lib/esm/Carousel/CarouselStepTracker/CarouselStepTracker.js +6 -6
- package/lib/esm/ExpandCollapse/Control.js +3 -1
- package/lib/esm/ExpandCollapseMini/ExpandCollapseMini.js +1 -1
- package/lib/esm/List/ListItemBase.js +1 -2
- package/lib/esm/List/ListItemMark.js +6 -2
- package/lib/esm/Modal/ModalContent.js +1 -1
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +2 -2
- package/lib/esm/Notification/Notification.js +16 -26
- package/lib/esm/TextInput/TextArea.js +10 -1
- package/lib/esm/Typography/Typography.js +9 -3
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Card/CardBase.jsx +2 -1
- package/src/Carousel/Carousel.jsx +200 -55
- package/src/Carousel/CarouselItem/CarouselItem.jsx +1 -7
- package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +5 -4
- package/src/ExpandCollapse/Control.jsx +3 -1
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +1 -1
- package/src/List/ListItemBase.jsx +1 -2
- package/src/List/ListItemMark.jsx +9 -3
- package/src/Modal/ModalContent.jsx +1 -1
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +1 -1
- package/src/Notification/Notification.jsx +14 -17
- package/src/TextInput/TextArea.jsx +11 -1
- package/src/Typography/Typography.jsx +9 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { View
|
|
3
|
-
|
|
2
|
+
import { View } from 'react-native'
|
|
4
3
|
import PropTypes from 'prop-types'
|
|
4
|
+
import { viewports } from '@telus-uds/system-constants'
|
|
5
|
+
|
|
5
6
|
import {
|
|
6
7
|
applyTextStyles,
|
|
7
8
|
useTheme,
|
|
@@ -16,7 +17,6 @@ import {
|
|
|
16
17
|
variantProp,
|
|
17
18
|
viewProps,
|
|
18
19
|
wrapStringsInText,
|
|
19
|
-
useResponsiveProp,
|
|
20
20
|
createMediaQueryStyles,
|
|
21
21
|
StyleSheet
|
|
22
22
|
} from '../utils'
|
|
@@ -65,8 +65,8 @@ const selectDismissButtonContainerStyles = ({ dismissButtonGap }) => ({
|
|
|
65
65
|
})
|
|
66
66
|
|
|
67
67
|
const selectContentContainerStyle = (themeTokens, maxWidth, viewport, system) => ({
|
|
68
|
-
maxWidth: viewport === 'xl' && system === true ? maxWidth : '
|
|
69
|
-
|
|
68
|
+
maxWidth: viewport === 'xl' && system === true ? maxWidth : '100%',
|
|
69
|
+
width: '100%',
|
|
70
70
|
paddingRight: themeTokens?.containerPaddingRight,
|
|
71
71
|
paddingLeft: themeTokens?.containerPaddingLeft
|
|
72
72
|
})
|
|
@@ -74,6 +74,7 @@ const selectContentContainerStyle = (themeTokens, maxWidth, viewport, system) =>
|
|
|
74
74
|
const getMediaQueryStyles = (
|
|
75
75
|
themeTokens,
|
|
76
76
|
themeOptions,
|
|
77
|
+
maxWidth,
|
|
77
78
|
mediaIdsRef,
|
|
78
79
|
dismissible,
|
|
79
80
|
viewport,
|
|
@@ -91,7 +92,7 @@ const getMediaQueryStyles = (
|
|
|
91
92
|
|
|
92
93
|
const { ids: containerIds, styles: containerStyles } = StyleSheet.create({
|
|
93
94
|
container: {
|
|
94
|
-
flexDirection:
|
|
95
|
+
flexDirection: 'column',
|
|
95
96
|
...selectContainerMediaQueryStyles
|
|
96
97
|
}
|
|
97
98
|
})
|
|
@@ -101,13 +102,8 @@ const getMediaQueryStyles = (
|
|
|
101
102
|
flexDirection: 'row',
|
|
102
103
|
flexShrink: 1,
|
|
103
104
|
justifyContent: 'space-between',
|
|
104
|
-
...
|
|
105
|
-
|
|
106
|
-
md: { maxWidth: themeOptions?.contentMaxWidth?.md || '100%' },
|
|
107
|
-
lg: { maxWidth: themeOptions?.contentMaxWidth?.lg || '100%' },
|
|
108
|
-
sm: { maxWidth: themeOptions?.contentMaxWidth?.sm || '100%' },
|
|
109
|
-
xl: { maxWidth: themeOptions?.contentMaxWidth?.xl || '100%' }
|
|
110
|
-
})
|
|
105
|
+
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system),
|
|
106
|
+
...(system && { alignSelf: 'center' })
|
|
111
107
|
}
|
|
112
108
|
})
|
|
113
109
|
|
|
@@ -162,8 +158,7 @@ const getMediaQueryStyles = (
|
|
|
162
158
|
const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible, viewport, system) => ({
|
|
163
159
|
containerStyles: {
|
|
164
160
|
container: {
|
|
165
|
-
flexDirection:
|
|
166
|
-
(system === true && viewport === 'xl') || Platform.OS === 'android' ? 'row' : 'inherit',
|
|
161
|
+
flexDirection: 'column',
|
|
167
162
|
...selectContainerStyles(themeTokens)
|
|
168
163
|
}
|
|
169
164
|
},
|
|
@@ -172,7 +167,8 @@ const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible, view
|
|
|
172
167
|
flexDirection: 'row',
|
|
173
168
|
flexShrink: 1,
|
|
174
169
|
justifyContent: 'space-between',
|
|
175
|
-
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system)
|
|
170
|
+
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system),
|
|
171
|
+
...(system && { alignSelf: 'center' })
|
|
176
172
|
}
|
|
177
173
|
},
|
|
178
174
|
staticContentContainerStyles: {
|
|
@@ -256,7 +252,7 @@ const Notification = React.forwardRef(
|
|
|
256
252
|
system: isSystemEnabled,
|
|
257
253
|
viewport
|
|
258
254
|
})
|
|
259
|
-
const maxWidth =
|
|
255
|
+
const maxWidth = viewports.map.get(viewports.xl)
|
|
260
256
|
|
|
261
257
|
const notificationComponentRef = React.useRef({
|
|
262
258
|
containerStyles: {},
|
|
@@ -283,6 +279,7 @@ const Notification = React.forwardRef(
|
|
|
283
279
|
notificationComponentRef.current = getMediaQueryStyles(
|
|
284
280
|
themeTokens,
|
|
285
281
|
themeOptions,
|
|
282
|
+
maxWidth,
|
|
286
283
|
mediaIdsRef,
|
|
287
284
|
dismissible,
|
|
288
285
|
viewport,
|
|
@@ -54,6 +54,8 @@ const TextArea = React.forwardRef(({ tokens, variant = {}, ...rest }, ref) => {
|
|
|
54
54
|
const themeTokens = useThemeTokens('TextArea', tokens, variant)
|
|
55
55
|
const [inputHeight, setInputHeight] = React.useState()
|
|
56
56
|
|
|
57
|
+
const isUpdatingHeight = React.useRef(false)
|
|
58
|
+
|
|
57
59
|
// adjust the text area's height as new lines are added to the content
|
|
58
60
|
const onHeightChange = ({
|
|
59
61
|
nativeEvent: {
|
|
@@ -61,8 +63,16 @@ const TextArea = React.forwardRef(({ tokens, variant = {}, ...rest }, ref) => {
|
|
|
61
63
|
}
|
|
62
64
|
}) => {
|
|
63
65
|
// on native this is happens out of the box
|
|
64
|
-
if (Platform.OS === 'web') {
|
|
66
|
+
if (Platform.OS === 'web' && !isUpdatingHeight.current) {
|
|
67
|
+
isUpdatingHeight.current = true
|
|
65
68
|
setInputHeight(height)
|
|
69
|
+
// setTimeout is used to “wait” for the next update cycle before allowing a new height adjustment,
|
|
70
|
+
// avoiding multiple updates in the same render and preventing a possible infinite loop or constant re-renders.
|
|
71
|
+
setTimeout(() => {
|
|
72
|
+
isUpdatingHeight.current = false
|
|
73
|
+
}, 0)
|
|
74
|
+
} else {
|
|
75
|
+
setInputHeight(null)
|
|
66
76
|
}
|
|
67
77
|
}
|
|
68
78
|
|
|
@@ -74,7 +74,7 @@ const Typography = React.forwardRef(
|
|
|
74
74
|
tag = typeof heading === 'string' ? heading : undefined,
|
|
75
75
|
accessibilityRole = heading === true ? 'header' : undefined,
|
|
76
76
|
block = false,
|
|
77
|
-
align = undefined,
|
|
77
|
+
align = Platform.OS === 'web' ? 'inherit' : undefined,
|
|
78
78
|
tokens,
|
|
79
79
|
dataSet,
|
|
80
80
|
strikeThrough = false,
|
|
@@ -138,6 +138,12 @@ const Typography = React.forwardRef(
|
|
|
138
138
|
: styles
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Added to maintain previous behavior, as the 'auto' value for the 'align' prop now defaults to 'inherit' on the web,
|
|
143
|
+
* maintaining the previous behavior that was changed in the Text component of react-native.
|
|
144
|
+
*/
|
|
145
|
+
const resolvedAlign = Platform.OS === 'web' && align === 'auto' ? 'inherit' : align
|
|
146
|
+
|
|
141
147
|
let textStyles
|
|
142
148
|
let mediaIds
|
|
143
149
|
|
|
@@ -146,7 +152,7 @@ const Typography = React.forwardRef(
|
|
|
146
152
|
(acc, [vp, viewportTokens]) => {
|
|
147
153
|
acc[vp] = selectTextStyles(
|
|
148
154
|
{
|
|
149
|
-
textAlign:
|
|
155
|
+
textAlign: resolvedAlign,
|
|
150
156
|
textDecorationLine,
|
|
151
157
|
...viewportTokens
|
|
152
158
|
},
|
|
@@ -177,7 +183,7 @@ const Typography = React.forwardRef(
|
|
|
177
183
|
} else {
|
|
178
184
|
textStyles = selectTextStyles(
|
|
179
185
|
{
|
|
180
|
-
textAlign:
|
|
186
|
+
textAlign: resolvedAlign,
|
|
181
187
|
textDecorationLine,
|
|
182
188
|
...themeTokens
|
|
183
189
|
},
|