@telus-uds/components-base 3.0.0 → 3.2.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 +38 -2
- package/lib/cjs/Carousel/Carousel.js +6 -7
- package/lib/cjs/ExpandCollapse/Panel.js +29 -7
- package/lib/cjs/Icon/Icon.js +5 -1
- package/lib/cjs/Link/LinkBase.js +1 -1
- package/lib/cjs/List/ListItemMark.js +6 -2
- package/lib/cjs/Modal/Modal.js +2 -4
- package/lib/cjs/Modal/ModalContent.js +1 -1
- package/lib/cjs/MultiSelectFilter/MultiSelectFilter.js +3 -1
- package/lib/cjs/Notification/Notification.js +15 -26
- package/lib/cjs/Tabs/TabsItem.js +6 -2
- package/lib/cjs/TextInput/TextInputBase.js +1 -30
- package/lib/cjs/Typography/Typography.js +1 -1
- package/lib/esm/Carousel/Carousel.js +6 -7
- package/lib/esm/ExpandCollapse/Panel.js +29 -7
- package/lib/esm/Icon/Icon.js +6 -2
- package/lib/esm/Link/LinkBase.js +1 -1
- package/lib/esm/List/ListItemMark.js +6 -2
- package/lib/esm/Modal/Modal.js +2 -4
- package/lib/esm/Modal/ModalContent.js +1 -1
- package/lib/esm/MultiSelectFilter/MultiSelectFilter.js +3 -1
- package/lib/esm/Notification/Notification.js +16 -27
- package/lib/esm/Tabs/TabsItem.js +6 -2
- package/lib/esm/TextInput/TextInputBase.js +1 -30
- package/lib/esm/Typography/Typography.js +1 -1
- package/lib/package.json +2 -2
- package/package.json +2 -2
- package/src/Carousel/Carousel.jsx +7 -7
- package/src/ExpandCollapse/Panel.jsx +44 -14
- package/src/Icon/Icon.jsx +4 -3
- package/src/Link/LinkBase.jsx +3 -1
- package/src/List/ListItemMark.jsx +9 -3
- package/src/Modal/Modal.jsx +2 -2
- package/src/Modal/ModalContent.jsx +1 -1
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +3 -1
- package/src/Notification/Notification.jsx +14 -18
- package/src/Tabs/TabsItem.jsx +6 -2
- package/src/TextInput/TextInputBase.jsx +1 -30
- package/src/Typography/Typography.jsx +1 -1
- package/types/Listbox.d.ts +60 -0
- package/types/index.d.ts +3 -0
|
@@ -128,7 +128,7 @@ const ModalContent = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
128
128
|
},
|
|
129
129
|
children: subHeading
|
|
130
130
|
})
|
|
131
|
-
}), Boolean(bodyText && hasHeadingSection) && /*#__PURE__*/_jsx(Spacer, {
|
|
131
|
+
}), Boolean((bodyText || children) && hasHeadingSection) && /*#__PURE__*/_jsx(Spacer, {
|
|
132
132
|
space: 3
|
|
133
133
|
})]
|
|
134
134
|
}), bodyText && /*#__PURE__*/_jsx(Box, {
|
|
@@ -105,6 +105,7 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
105
105
|
headerFontColor,
|
|
106
106
|
headerFontSize,
|
|
107
107
|
buttonDirection,
|
|
108
|
+
buttonIconBackgroundColor,
|
|
108
109
|
headerFontWeight,
|
|
109
110
|
headerLineHeight,
|
|
110
111
|
subHeaderFontWeight,
|
|
@@ -148,7 +149,8 @@ const MultiSelectFilter = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
148
149
|
paddingTop: labelPaddingTop,
|
|
149
150
|
paddingBottom: labelPaddingBottom,
|
|
150
151
|
paddingLeft: labelPaddingLeft,
|
|
151
|
-
paddingRight: labelPaddingRight
|
|
152
|
+
paddingRight: labelPaddingRight,
|
|
153
|
+
iconBackground: buttonIconBackgroundColor
|
|
152
154
|
};
|
|
153
155
|
const getButtonDropdownTokens = useThemeTokensCallback('ButtonDropdown', dropdownTokens, variant);
|
|
154
156
|
const getButtonTokens = buttonState => selectTokens('ButtonDropdown', getButtonDropdownTokens(buttonState));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import View from "react-native-web/dist/exports/View";
|
|
3
|
-
import Platform from "react-native-web/dist/exports/Platform";
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { viewports } from '@telus-uds/system-constants';
|
|
5
5
|
import { applyTextStyles, useTheme, useThemeTokens, useResponsiveThemeTokens } from '../ThemeProvider';
|
|
6
|
-
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText,
|
|
6
|
+
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText, createMediaQueryStyles, StyleSheet } from '../utils';
|
|
7
7
|
import IconButton from '../IconButton';
|
|
8
8
|
import useCopy from '../utils/useCopy';
|
|
9
9
|
import dictionary from './dictionary';
|
|
@@ -64,12 +64,12 @@ const selectDismissButtonContainerStyles = _ref4 => {
|
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
66
|
const selectContentContainerStyle = (themeTokens, maxWidth, viewport, system) => ({
|
|
67
|
-
maxWidth: viewport === 'xl' && system === true ? maxWidth : '
|
|
68
|
-
|
|
67
|
+
maxWidth: viewport === 'xl' && system === true ? maxWidth : '100%',
|
|
68
|
+
width: '100%',
|
|
69
69
|
paddingRight: themeTokens?.containerPaddingRight,
|
|
70
70
|
paddingLeft: themeTokens?.containerPaddingLeft
|
|
71
71
|
});
|
|
72
|
-
const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible, viewport, system) => {
|
|
72
|
+
const getMediaQueryStyles = (themeTokens, themeOptions, maxWidth, mediaIdsRef, dismissible, viewport, system) => {
|
|
73
73
|
const transformedSelectContainerStyles = Object.entries(themeTokens).reduce((acc, _ref5) => {
|
|
74
74
|
let [vp, viewportTokens] = _ref5;
|
|
75
75
|
acc[vp] = selectContainerStyles({
|
|
@@ -83,7 +83,7 @@ const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible
|
|
|
83
83
|
styles: containerStyles
|
|
84
84
|
} = StyleSheet.create({
|
|
85
85
|
container: {
|
|
86
|
-
flexDirection:
|
|
86
|
+
flexDirection: 'column',
|
|
87
87
|
...selectContainerMediaQueryStyles
|
|
88
88
|
}
|
|
89
89
|
});
|
|
@@ -95,22 +95,9 @@ const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible
|
|
|
95
95
|
flexDirection: 'row',
|
|
96
96
|
flexShrink: 1,
|
|
97
97
|
justifyContent: 'space-between',
|
|
98
|
-
...
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
md: {
|
|
103
|
-
maxWidth: themeOptions?.contentMaxWidth?.md || '100%'
|
|
104
|
-
},
|
|
105
|
-
lg: {
|
|
106
|
-
maxWidth: themeOptions?.contentMaxWidth?.lg || '100%'
|
|
107
|
-
},
|
|
108
|
-
sm: {
|
|
109
|
-
maxWidth: themeOptions?.contentMaxWidth?.sm || '100%'
|
|
110
|
-
},
|
|
111
|
-
xl: {
|
|
112
|
-
maxWidth: themeOptions?.contentMaxWidth?.xl || '100%'
|
|
113
|
-
}
|
|
98
|
+
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system),
|
|
99
|
+
...(system && {
|
|
100
|
+
alignSelf: 'center'
|
|
114
101
|
})
|
|
115
102
|
}
|
|
116
103
|
});
|
|
@@ -175,17 +162,19 @@ const getMediaQueryStyles = (themeTokens, themeOptions, mediaIdsRef, dismissible
|
|
|
175
162
|
const getDefaultStyles = (themeTokens, themeOptions, maxWidth, dismissible, viewport, system) => ({
|
|
176
163
|
containerStyles: {
|
|
177
164
|
container: {
|
|
178
|
-
flexDirection:
|
|
165
|
+
flexDirection: 'column',
|
|
179
166
|
...selectContainerStyles(themeTokens)
|
|
180
167
|
}
|
|
181
168
|
},
|
|
182
169
|
contentContainerStyles: {
|
|
183
170
|
contentContainer: {
|
|
184
|
-
flex: 1,
|
|
185
171
|
flexDirection: 'row',
|
|
186
172
|
flexShrink: 1,
|
|
187
173
|
justifyContent: 'space-between',
|
|
188
|
-
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system)
|
|
174
|
+
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system),
|
|
175
|
+
...(system && {
|
|
176
|
+
alignSelf: 'center'
|
|
177
|
+
})
|
|
189
178
|
}
|
|
190
179
|
},
|
|
191
180
|
staticContentContainerStyles: {
|
|
@@ -303,7 +292,7 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
303
292
|
system: isSystemEnabled,
|
|
304
293
|
viewport
|
|
305
294
|
});
|
|
306
|
-
const maxWidth =
|
|
295
|
+
const maxWidth = viewports.map.get(viewports.xl);
|
|
307
296
|
const notificationComponentRef = React.useRef({
|
|
308
297
|
containerStyles: {},
|
|
309
298
|
contentContainerStyles: {},
|
|
@@ -325,7 +314,7 @@ const Notification = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
|
325
314
|
selectDismissIconPropsIds: {}
|
|
326
315
|
});
|
|
327
316
|
if (enableMediaQueryStyleSheet) {
|
|
328
|
-
notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions, mediaIdsRef, dismissible, viewport, isSystemEnabled);
|
|
317
|
+
notificationComponentRef.current = getMediaQueryStyles(themeTokens, themeOptions, maxWidth, mediaIdsRef, dismissible, viewport, isSystemEnabled);
|
|
329
318
|
} else {
|
|
330
319
|
notificationComponentRef.current = getDefaultStyles(themeTokens, themeOptions, maxWidth, dismissible, viewport, isSystemEnabled);
|
|
331
320
|
}
|
package/lib/esm/Tabs/TabsItem.js
CHANGED
|
@@ -61,7 +61,9 @@ const selectContainerStyles = _ref3 => {
|
|
|
61
61
|
borderWidth = 0,
|
|
62
62
|
borderRadius,
|
|
63
63
|
paddingHorizontal = 0,
|
|
64
|
-
paddingVertical = 0
|
|
64
|
+
paddingVertical = 0,
|
|
65
|
+
marginHorizontal = 0,
|
|
66
|
+
marginVertical = 0
|
|
65
67
|
} = _ref3;
|
|
66
68
|
return {
|
|
67
69
|
backgroundColor,
|
|
@@ -69,7 +71,9 @@ const selectContainerStyles = _ref3 => {
|
|
|
69
71
|
borderWidth,
|
|
70
72
|
borderRadius,
|
|
71
73
|
paddingHorizontal: paddingHorizontal - borderWidth,
|
|
72
|
-
paddingVertical: paddingVertical - borderWidth
|
|
74
|
+
paddingVertical: paddingVertical - borderWidth,
|
|
75
|
+
marginHorizontal,
|
|
76
|
+
marginVertical
|
|
73
77
|
};
|
|
74
78
|
};
|
|
75
79
|
|
|
@@ -363,32 +363,6 @@ const TextInputBase = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
363
363
|
...themeTokens,
|
|
364
364
|
height
|
|
365
365
|
}, themeOptions, inactive, type, buttons?.length, themeTokens.buttonSize, buttonsGapSize, isPassword, iconLeftWidth, iconLeftGap, direction);
|
|
366
|
-
const {
|
|
367
|
-
minHeight = 0,
|
|
368
|
-
maxHeight = Infinity
|
|
369
|
-
} = nativeInputStyle;
|
|
370
|
-
const [inputHeight, setInputHeight] = React.useState(minHeight || 0);
|
|
371
|
-
|
|
372
|
-
/* get the new height between the limits and update
|
|
373
|
-
the state with the new height */
|
|
374
|
-
const measureHeightWeb = React.useCallback(() => {
|
|
375
|
-
const el = inputRef.current;
|
|
376
|
-
const scrollHeight = el.scrollHeight || 0;
|
|
377
|
-
let newHeight = Math.max(scrollHeight, minHeight);
|
|
378
|
-
newHeight = Math.min(newHeight, maxHeight);
|
|
379
|
-
setInputHeight(newHeight);
|
|
380
|
-
}, [inputRef, minHeight, maxHeight]);
|
|
381
|
-
|
|
382
|
-
/* restores the height and the value first to then
|
|
383
|
-
calculate the height correctly */
|
|
384
|
-
React.useEffect(() => {
|
|
385
|
-
if (Platform.OS === 'web' && inputRef.current) {
|
|
386
|
-
const el = inputRef.current;
|
|
387
|
-
el.style.height = 'auto';
|
|
388
|
-
el.value = currentValue;
|
|
389
|
-
measureHeightWeb();
|
|
390
|
-
}
|
|
391
|
-
}, [currentValue, measureHeightWeb, inputRef]);
|
|
392
366
|
const shouldShowSubmitIcon = submitIcon && direction === 'left' && !inactive;
|
|
393
367
|
return /*#__PURE__*/_jsxs(View, {
|
|
394
368
|
style: selectOuterBorderStyles(themeTokens),
|
|
@@ -408,10 +382,7 @@ const TextInputBase = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
|
408
382
|
ref: inputRef,
|
|
409
383
|
keyboardType: isNumeric ? 'numeric' : 'default',
|
|
410
384
|
inputMode: isNumeric ? 'numeric' : undefined,
|
|
411
|
-
style:
|
|
412
|
-
...nativeInputStyle,
|
|
413
|
-
height: Math.max(inputHeight, minHeight)
|
|
414
|
-
},
|
|
385
|
+
style: nativeInputStyle,
|
|
415
386
|
secureTextEntry: isPassword && !showPassword,
|
|
416
387
|
...inputProps
|
|
417
388
|
}), IconComponent && /*#__PURE__*/_jsx(View, {
|
|
@@ -63,7 +63,7 @@ const Typography = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
|
63
63
|
tag = typeof heading === 'string' ? heading : undefined,
|
|
64
64
|
accessibilityRole = heading === true ? 'header' : undefined,
|
|
65
65
|
block = false,
|
|
66
|
-
align = undefined,
|
|
66
|
+
align = Platform.OS === 'web' ? 'inherit' : undefined,
|
|
67
67
|
tokens,
|
|
68
68
|
dataSet,
|
|
69
69
|
strikeThrough = false,
|
package/lib/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@gorhom/portal": "^1.0.14",
|
|
13
13
|
"@react-native-picker/picker": "^2.9.0",
|
|
14
14
|
"@telus-uds/system-constants": "^3.0.0",
|
|
15
|
-
"@telus-uds/system-theme-tokens": "^4.
|
|
15
|
+
"@telus-uds/system-theme-tokens": "^4.2.0",
|
|
16
16
|
"airbnb-prop-types": "^2.16.0",
|
|
17
17
|
"css-mediaquery": "^0.1.2",
|
|
18
18
|
"expo-document-picker": "^13.0.1",
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"standard-engine": {
|
|
84
84
|
"skip": true
|
|
85
85
|
},
|
|
86
|
-
"version": "3.
|
|
86
|
+
"version": "3.2.0",
|
|
87
87
|
"types": "types/index.d.ts"
|
|
88
88
|
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@gorhom/portal": "^1.0.14",
|
|
13
13
|
"@react-native-picker/picker": "^2.9.0",
|
|
14
14
|
"@telus-uds/system-constants": "^3.0.0",
|
|
15
|
-
"@telus-uds/system-theme-tokens": "^4.
|
|
15
|
+
"@telus-uds/system-theme-tokens": "^4.2.0",
|
|
16
16
|
"airbnb-prop-types": "^2.16.0",
|
|
17
17
|
"css-mediaquery": "^0.1.2",
|
|
18
18
|
"expo-document-picker": "^13.0.1",
|
|
@@ -83,6 +83,6 @@
|
|
|
83
83
|
"standard-engine": {
|
|
84
84
|
"skip": true
|
|
85
85
|
},
|
|
86
|
-
"version": "3.
|
|
86
|
+
"version": "3.2.0",
|
|
87
87
|
"types": "types/index.d.ts"
|
|
88
88
|
}
|
|
@@ -47,12 +47,7 @@ const staticStyles = StyleSheet.create({
|
|
|
47
47
|
alignItems: 'center',
|
|
48
48
|
position: 'relative',
|
|
49
49
|
top: 0,
|
|
50
|
-
left: 0
|
|
51
|
-
...Platform.select({
|
|
52
|
-
web: {
|
|
53
|
-
outline: 'none'
|
|
54
|
-
}
|
|
55
|
-
})
|
|
50
|
+
left: 0
|
|
56
51
|
},
|
|
57
52
|
animationControlButton: {
|
|
58
53
|
position: 'absolute',
|
|
@@ -872,7 +867,12 @@ const Carousel = React.forwardRef(
|
|
|
872
867
|
width={containerLayout.width}
|
|
873
868
|
>
|
|
874
869
|
<View
|
|
875
|
-
style={[
|
|
870
|
+
style={[
|
|
871
|
+
staticStyles.root,
|
|
872
|
+
{
|
|
873
|
+
...(Platform.OS === 'web' ? { outline: 'none' } : {})
|
|
874
|
+
}
|
|
875
|
+
]}
|
|
876
876
|
onLayout={onContainerLayout}
|
|
877
877
|
ref={ref}
|
|
878
878
|
{...systemProps}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Animated, Platform, View, Text } from 'react-native'
|
|
2
|
+
import { Animated, Platform, View, Text, StyleSheet, ScrollView } from 'react-native'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
import ABBPropTypes from 'airbnb-prop-types'
|
|
5
5
|
|
|
@@ -117,7 +117,7 @@ const ExpandCollapsePanel = React.forwardRef(
|
|
|
117
117
|
})
|
|
118
118
|
|
|
119
119
|
const handleControlPress = (event) => {
|
|
120
|
-
onToggle(panelId, event)
|
|
120
|
+
onToggle?.(panelId, event)
|
|
121
121
|
if (onPress) onPress(panelId, event)
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -141,7 +141,7 @@ const ExpandCollapsePanel = React.forwardRef(
|
|
|
141
141
|
|
|
142
142
|
return content ? (
|
|
143
143
|
<View
|
|
144
|
-
style={selectContentPanelStyles(themeTokens)}
|
|
144
|
+
style={[selectContentPanelStyles(themeTokens), staticStyles.panelContainer]}
|
|
145
145
|
accessibilityLabel={panelAccessibilityLabel}
|
|
146
146
|
>
|
|
147
147
|
{typeof children === 'string' ? (
|
|
@@ -156,7 +156,11 @@ const ExpandCollapsePanel = React.forwardRef(
|
|
|
156
156
|
)}
|
|
157
157
|
</View>
|
|
158
158
|
) : (
|
|
159
|
-
<View
|
|
159
|
+
<View
|
|
160
|
+
ref={ref}
|
|
161
|
+
style={[themeTokens, staticStyles.container]}
|
|
162
|
+
accessibilityLabel={panelAccessibilityLabel}
|
|
163
|
+
>
|
|
160
164
|
<View style={selectControlPanelStyles(themeTokens)}>
|
|
161
165
|
<ExpandCollapseControl
|
|
162
166
|
{...selectedProps}
|
|
@@ -179,32 +183,58 @@ const ExpandCollapsePanel = React.forwardRef(
|
|
|
179
183
|
}}
|
|
180
184
|
/>
|
|
181
185
|
)}
|
|
182
|
-
<Animated.
|
|
186
|
+
<Animated.ScrollView ref={animatedRef} style={animatedStyles} {...focusabilityProps}>
|
|
183
187
|
<View
|
|
184
188
|
onLayout={onContainerLayout}
|
|
185
189
|
style={{
|
|
186
190
|
...Platform.select({
|
|
187
191
|
default: {
|
|
188
|
-
flex: 1
|
|
192
|
+
flex: 1,
|
|
193
|
+
overflow: 'hidden'
|
|
189
194
|
},
|
|
190
|
-
web: {
|
|
195
|
+
web: {
|
|
196
|
+
overflow: 'hidden'
|
|
197
|
+
}
|
|
191
198
|
})
|
|
192
199
|
}}
|
|
193
200
|
>
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
201
|
+
{Platform.OS === 'web' ? (
|
|
202
|
+
<View
|
|
203
|
+
style={selectContainerStyles(themeTokens)}
|
|
204
|
+
accessibilityLabel={subPanelAccessibilityLabel}
|
|
205
|
+
>
|
|
206
|
+
{children}
|
|
207
|
+
</View>
|
|
208
|
+
) : (
|
|
209
|
+
<ScrollView
|
|
210
|
+
onContentSizeChange={(_, height) => {
|
|
211
|
+
setContainerHeight(height)
|
|
212
|
+
}}
|
|
213
|
+
style={selectContainerStyles(themeTokens)}
|
|
214
|
+
accessibilityLabel={subPanelAccessibilityLabel}
|
|
215
|
+
>
|
|
216
|
+
{children}
|
|
217
|
+
</ScrollView>
|
|
218
|
+
)}
|
|
200
219
|
</View>
|
|
201
|
-
</Animated.
|
|
220
|
+
</Animated.ScrollView>
|
|
202
221
|
</View>
|
|
203
222
|
)
|
|
204
223
|
}
|
|
205
224
|
)
|
|
206
225
|
ExpandCollapsePanel.displayName = 'ExpandCollapsePanel'
|
|
207
226
|
|
|
227
|
+
const staticStyles = StyleSheet.create({
|
|
228
|
+
container: {
|
|
229
|
+
flex: 1,
|
|
230
|
+
justifyContent: 'flex-start'
|
|
231
|
+
},
|
|
232
|
+
panelContainer: {
|
|
233
|
+
flexGrow: 1,
|
|
234
|
+
alignSelf: 'stretch'
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
|
|
208
238
|
ExpandCollapsePanel.propTypes = {
|
|
209
239
|
...selectedSystemPropTypes,
|
|
210
240
|
variant: variantProp.propType,
|
package/src/Icon/Icon.jsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Platform, View } from 'react-native'
|
|
2
|
+
import { Platform, View, useWindowDimensions } from 'react-native'
|
|
3
3
|
import PropTypes from 'prop-types'
|
|
4
4
|
|
|
5
5
|
import { useThemeTokens } from '../ThemeProvider'
|
|
6
|
-
import { getTokensPropType,
|
|
6
|
+
import { getTokensPropType, variantProp } from '../utils'
|
|
7
7
|
|
|
8
8
|
const Icon = React.forwardRef(
|
|
9
9
|
(
|
|
@@ -19,8 +19,9 @@ const Icon = React.forwardRef(
|
|
|
19
19
|
ref
|
|
20
20
|
) => {
|
|
21
21
|
const themeTokens = useThemeTokens('Icon', tokens, variant)
|
|
22
|
+
const { fontScale } = useWindowDimensions()
|
|
22
23
|
|
|
23
|
-
const size = scalesWithText ?
|
|
24
|
+
const size = scalesWithText ? themeTokens.size * fontScale : themeTokens.size
|
|
24
25
|
|
|
25
26
|
const iconContent = (
|
|
26
27
|
<IconComponent title={accessibilityLabel} size={size} color={themeTokens.color} />
|
package/src/Link/LinkBase.jsx
CHANGED
|
@@ -89,7 +89,9 @@ const selectIconTokens = ({ color, iconSize, blockFontSize, iconTranslateX, icon
|
|
|
89
89
|
* where X = blockFontSize, Y = iconSize and Z = translateY
|
|
90
90
|
*/
|
|
91
91
|
const translateY =
|
|
92
|
-
iconTranslateY
|
|
92
|
+
iconTranslateY && iconTranslateY !== 0
|
|
93
|
+
? iconTranslateY
|
|
94
|
+
: blockFontSize / 4 + iconSize / 4 - 4 - Math.abs(iconSize - blockFontSize)
|
|
93
95
|
return {
|
|
94
96
|
color,
|
|
95
97
|
translateX: iconTranslateX,
|
|
@@ -27,8 +27,13 @@ const selectBulletPositioningStyles = ({ itemIconSize }) => ({
|
|
|
27
27
|
height: itemIconSize
|
|
28
28
|
})
|
|
29
29
|
|
|
30
|
-
const selectBulletContainerStyles = ({
|
|
30
|
+
const selectBulletContainerStyles = ({
|
|
31
|
+
itemBulletContainerWidth,
|
|
32
|
+
itemBulletContainerHeight,
|
|
33
|
+
itemBulletContainerAlign
|
|
34
|
+
}) => ({
|
|
31
35
|
width: itemBulletContainerWidth,
|
|
36
|
+
height: itemBulletContainerHeight,
|
|
32
37
|
alignItems: itemBulletContainerAlign
|
|
33
38
|
})
|
|
34
39
|
|
|
@@ -45,11 +50,12 @@ const ListItemMark = React.forwardRef(({ icon, iconColor, iconSize, tokens = {}
|
|
|
45
50
|
const themeTokens = typeof tokens === 'function' ? tokens() : tokens
|
|
46
51
|
|
|
47
52
|
const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens)
|
|
53
|
+
const bulletContainerStyles = selectBulletContainerStyles(themeTokens)
|
|
48
54
|
|
|
49
55
|
if (icon) {
|
|
50
56
|
const iconTokens = selectItemIconTokens(themeTokens)
|
|
51
57
|
return (
|
|
52
|
-
<View style={sideItemContainerStyles}>
|
|
58
|
+
<View style={[sideItemContainerStyles, bulletContainerStyles]}>
|
|
53
59
|
<IconComponent size={iconSize || iconTokens.size} color={iconColor || iconTokens.color} />
|
|
54
60
|
</View>
|
|
55
61
|
)
|
|
@@ -66,7 +72,7 @@ const ListItemMark = React.forwardRef(({ icon, iconColor, iconSize, tokens = {}
|
|
|
66
72
|
style={[staticStyles.bulletPositioning, itemBulletPositioningStyles]}
|
|
67
73
|
testID="unordered-item-bullet"
|
|
68
74
|
>
|
|
69
|
-
<Icon icon={bulletIcon} tokens={{ color: bulletColor }} />
|
|
75
|
+
<Icon icon={bulletIcon} tokens={{ color: bulletColor, size: themeTokens.itemIconSize }} />
|
|
70
76
|
</View>
|
|
71
77
|
</View>
|
|
72
78
|
)
|
package/src/Modal/Modal.jsx
CHANGED
|
@@ -241,10 +241,10 @@ const Modal = React.forwardRef(
|
|
|
241
241
|
cancelButtonText={cancelButtonText}
|
|
242
242
|
cancelButtonType={cancelButtonType}
|
|
243
243
|
>
|
|
244
|
-
{Platform !== 'web' ? (
|
|
244
|
+
{Platform.OS !== 'web' ? (
|
|
245
245
|
<ScrollView style={selectScrollViewStyles}>{children}</ScrollView>
|
|
246
246
|
) : (
|
|
247
|
-
|
|
247
|
+
children
|
|
248
248
|
)}
|
|
249
249
|
</ModalContent>
|
|
250
250
|
</View>
|
|
@@ -117,7 +117,7 @@ const ModalContent = React.forwardRef(
|
|
|
117
117
|
<Typography variant={{ size: subHeadingSize }}>{subHeading}</Typography>
|
|
118
118
|
</View>
|
|
119
119
|
)}
|
|
120
|
-
{Boolean(bodyText && hasHeadingSection) && <Spacer space={3} />}
|
|
120
|
+
{Boolean((bodyText || children) && hasHeadingSection) && <Spacer space={3} />}
|
|
121
121
|
</View>
|
|
122
122
|
)}
|
|
123
123
|
{bodyText && (
|
|
@@ -109,6 +109,7 @@ const MultiSelectFilter = React.forwardRef(
|
|
|
109
109
|
headerFontColor,
|
|
110
110
|
headerFontSize,
|
|
111
111
|
buttonDirection,
|
|
112
|
+
buttonIconBackgroundColor,
|
|
112
113
|
headerFontWeight,
|
|
113
114
|
headerLineHeight,
|
|
114
115
|
subHeaderFontWeight,
|
|
@@ -151,7 +152,8 @@ const MultiSelectFilter = React.forwardRef(
|
|
|
151
152
|
paddingTop: labelPaddingTop,
|
|
152
153
|
paddingBottom: labelPaddingBottom,
|
|
153
154
|
paddingLeft: labelPaddingLeft,
|
|
154
|
-
paddingRight: labelPaddingRight
|
|
155
|
+
paddingRight: labelPaddingRight,
|
|
156
|
+
iconBackground: buttonIconBackgroundColor
|
|
155
157
|
}
|
|
156
158
|
const getButtonDropdownTokens = useThemeTokensCallback(
|
|
157
159
|
'ButtonDropdown',
|
|
@@ -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,18 +158,17 @@ 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
|
},
|
|
170
165
|
contentContainerStyles: {
|
|
171
166
|
contentContainer: {
|
|
172
|
-
flex: 1,
|
|
173
167
|
flexDirection: 'row',
|
|
174
168
|
flexShrink: 1,
|
|
175
169
|
justifyContent: 'space-between',
|
|
176
|
-
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system)
|
|
170
|
+
...selectContentContainerStyle(themeTokens, maxWidth, viewport, system),
|
|
171
|
+
...(system && { alignSelf: 'center' })
|
|
177
172
|
}
|
|
178
173
|
},
|
|
179
174
|
staticContentContainerStyles: {
|
|
@@ -257,7 +252,7 @@ const Notification = React.forwardRef(
|
|
|
257
252
|
system: isSystemEnabled,
|
|
258
253
|
viewport
|
|
259
254
|
})
|
|
260
|
-
const maxWidth =
|
|
255
|
+
const maxWidth = viewports.map.get(viewports.xl)
|
|
261
256
|
|
|
262
257
|
const notificationComponentRef = React.useRef({
|
|
263
258
|
containerStyles: {},
|
|
@@ -284,6 +279,7 @@ const Notification = React.forwardRef(
|
|
|
284
279
|
notificationComponentRef.current = getMediaQueryStyles(
|
|
285
280
|
themeTokens,
|
|
286
281
|
themeOptions,
|
|
282
|
+
maxWidth,
|
|
287
283
|
mediaIdsRef,
|
|
288
284
|
dismissible,
|
|
289
285
|
viewport,
|
package/src/Tabs/TabsItem.jsx
CHANGED
|
@@ -60,14 +60,18 @@ const selectContainerStyles = ({
|
|
|
60
60
|
borderWidth = 0,
|
|
61
61
|
borderRadius,
|
|
62
62
|
paddingHorizontal = 0,
|
|
63
|
-
paddingVertical = 0
|
|
63
|
+
paddingVertical = 0,
|
|
64
|
+
marginHorizontal = 0,
|
|
65
|
+
marginVertical = 0
|
|
64
66
|
}) => ({
|
|
65
67
|
backgroundColor,
|
|
66
68
|
borderColor,
|
|
67
69
|
borderWidth,
|
|
68
70
|
borderRadius,
|
|
69
71
|
paddingHorizontal: paddingHorizontal - borderWidth,
|
|
70
|
-
paddingVertical: paddingVertical - borderWidth
|
|
72
|
+
paddingVertical: paddingVertical - borderWidth,
|
|
73
|
+
marginHorizontal,
|
|
74
|
+
marginVertical
|
|
71
75
|
})
|
|
72
76
|
|
|
73
77
|
/**
|
|
@@ -361,32 +361,6 @@ const TextInputBase = React.forwardRef(
|
|
|
361
361
|
direction
|
|
362
362
|
)
|
|
363
363
|
|
|
364
|
-
const { minHeight = 0, maxHeight = Infinity } = nativeInputStyle
|
|
365
|
-
const [inputHeight, setInputHeight] = React.useState(minHeight || 0)
|
|
366
|
-
|
|
367
|
-
/* get the new height between the limits and update
|
|
368
|
-
the state with the new height */
|
|
369
|
-
const measureHeightWeb = React.useCallback(() => {
|
|
370
|
-
const el = inputRef.current
|
|
371
|
-
const scrollHeight = el.scrollHeight || 0
|
|
372
|
-
|
|
373
|
-
let newHeight = Math.max(scrollHeight, minHeight)
|
|
374
|
-
newHeight = Math.min(newHeight, maxHeight)
|
|
375
|
-
|
|
376
|
-
setInputHeight(newHeight)
|
|
377
|
-
}, [inputRef, minHeight, maxHeight])
|
|
378
|
-
|
|
379
|
-
/* restores the height and the value first to then
|
|
380
|
-
calculate the height correctly */
|
|
381
|
-
React.useEffect(() => {
|
|
382
|
-
if (Platform.OS === 'web' && inputRef.current) {
|
|
383
|
-
const el = inputRef.current
|
|
384
|
-
el.style.height = 'auto'
|
|
385
|
-
el.value = currentValue
|
|
386
|
-
measureHeightWeb()
|
|
387
|
-
}
|
|
388
|
-
}, [currentValue, measureHeightWeb, inputRef])
|
|
389
|
-
|
|
390
364
|
const shouldShowSubmitIcon = submitIcon && direction === 'left' && !inactive
|
|
391
365
|
|
|
392
366
|
return (
|
|
@@ -413,10 +387,7 @@ const TextInputBase = React.forwardRef(
|
|
|
413
387
|
ref={inputRef}
|
|
414
388
|
keyboardType={isNumeric ? 'numeric' : 'default'}
|
|
415
389
|
inputMode={isNumeric ? 'numeric' : undefined}
|
|
416
|
-
style={
|
|
417
|
-
...nativeInputStyle,
|
|
418
|
-
height: Math.max(inputHeight, minHeight)
|
|
419
|
-
}}
|
|
390
|
+
style={nativeInputStyle}
|
|
420
391
|
secureTextEntry={isPassword && !showPassword}
|
|
421
392
|
{...inputProps}
|
|
422
393
|
/>
|