@telus-uds/components-base 1.83.0 → 1.84.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,5 +1,5 @@
1
1
  import React, { forwardRef } from 'react'
2
- import { View } from 'react-native'
2
+ import { View, StyleSheet } from 'react-native'
3
3
  import PropTypes from 'prop-types'
4
4
 
5
5
  import { useThemeTokens } from '../ThemeProvider'
@@ -46,10 +46,12 @@ const ExpandCollapse = forwardRef(
46
46
  const themeTokens = useThemeTokens('ExpandCollapse', tokens, variant)
47
47
 
48
48
  return (
49
- <View ref={ref} style={selectBorderStyles(themeTokens)} {...selectProps(rest)}>
50
- {typeof children === 'function'
51
- ? children({ openIds, onToggle, resetValues, setValues, unsetValues })
52
- : children}
49
+ <View style={staticStyles.container} ref={ref} {...selectProps(rest)}>
50
+ <View style={selectBorderStyles(themeTokens)}>
51
+ {typeof children === 'function'
52
+ ? children({ openIds, onToggle, resetValues, setValues, unsetValues })
53
+ : children}
54
+ </View>
53
55
  </View>
54
56
  )
55
57
  }
@@ -86,3 +88,9 @@ ExpandCollapse.propTypes = {
86
88
  }
87
89
 
88
90
  export default ExpandCollapse
91
+
92
+ const staticStyles = StyleSheet.create({
93
+ container: {
94
+ display: 'flex'
95
+ }
96
+ })
@@ -11,9 +11,12 @@ import {
11
11
  selectSystemProps,
12
12
  useVerticalExpandAnimation,
13
13
  variantProp,
14
- viewProps
14
+ viewProps,
15
+ useCopy
15
16
  } from '../utils'
16
17
 
18
+ import dictionary from './dictionary'
19
+
17
20
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
18
21
 
19
22
  // just void functions for now, since there are no style tokens for a panel or control at this point
@@ -92,12 +95,14 @@ const ExpandCollapsePanel = forwardRef(
92
95
  variant,
93
96
  controlRef,
94
97
  content,
98
+ copy = 'en',
95
99
  ...rest
96
100
  },
97
101
  ref
98
102
  ) => {
99
103
  const [containerHeight, setContainerHeight] = useState(null)
100
104
  const isExpanded = openIds.includes(panelId)
105
+ const getCopy = useCopy({ dictionary, copy })
101
106
 
102
107
  const selectedProps = selectProps({
103
108
  ...rest,
@@ -130,16 +135,28 @@ const ExpandCollapsePanel = forwardRef(
130
135
  })
131
136
 
132
137
  const focusabilityProps = isExpanded ? {} : a11yProps.nonFocusableProps
138
+
139
+ const panelAccessibilityLabel = `${panelId} ${getCopy('panel')}`
140
+ const subPanelAccessibilityLabel = `${panelId} ${getCopy('subPanel')}`
141
+
133
142
  return content ? (
134
- <View style={selectContentPanelStyles(themeTokens)}>
143
+ <View
144
+ style={selectContentPanelStyles(themeTokens)}
145
+ accessibilityLabel={panelAccessibilityLabel}
146
+ >
135
147
  {typeof children === 'string' ? (
136
- <Text style={selectTextStyles(themeTokens)}>{children}</Text>
148
+ <Text
149
+ style={selectTextStyles(themeTokens)}
150
+ accessibilityLabel={subPanelAccessibilityLabel}
151
+ >
152
+ {children}
153
+ </Text>
137
154
  ) : (
138
155
  children
139
156
  )}
140
157
  </View>
141
158
  ) : (
142
- <View ref={ref} style={themeTokens}>
159
+ <View ref={ref} style={themeTokens} accessibilityLabel={panelAccessibilityLabel}>
143
160
  <View style={selectControlPanelStyles(themeTokens)}>
144
161
  <ExpandCollapseControl
145
162
  {...selectedProps}
@@ -174,7 +191,12 @@ const ExpandCollapsePanel = forwardRef(
174
191
  })
175
192
  }}
176
193
  >
177
- <View style={selectContainerStyles(themeTokens)}>{children}</View>
194
+ <View
195
+ style={selectContainerStyles(themeTokens)}
196
+ accessibilityLabel={subPanelAccessibilityLabel}
197
+ >
198
+ {children}
199
+ </View>
178
200
  </View>
179
201
  </Animated.View>
180
202
  </View>
@@ -0,0 +1,10 @@
1
+ export default {
2
+ en: {
3
+ panel: 'Panel',
4
+ subPanel: 'SubPanel'
5
+ },
6
+ fr: {
7
+ panel: 'Panneau',
8
+ subPanel: 'Sous-Panneau'
9
+ }
10
+ }
@@ -31,8 +31,10 @@ const IconText = forwardRef(
31
31
  */
32
32
  const resultY = valueTranslateY ? Math.floor(-1 * (valueTranslateY - 4)) : 0
33
33
 
34
- const iconAdjustedAndriod = (
35
- <View style={{ transform: [{ translateY: size * 0.2 }] }}>{iconContent}</View>
34
+ const iconAdjustedAndroid = (
35
+ <View style={{ transform: [{ translateY: valueTranslateY ? size * 0.2 : size * 0.01 }] }}>
36
+ {iconContent}
37
+ </View>
36
38
  )
37
39
 
38
40
  const iconAdjustedIOS = (
@@ -41,7 +43,7 @@ const IconText = forwardRef(
41
43
  </View>
42
44
  )
43
45
 
44
- const mobile = Platform.OS === 'android' ? iconAdjustedAndriod : iconAdjustedIOS
46
+ const mobile = Platform.OS === 'android' ? iconAdjustedAndroid : iconAdjustedIOS
45
47
  const adjustedContainer = Platform.OS === 'web' ? iconContent : mobile
46
48
 
47
49
  return getStackedContent(
@@ -16,7 +16,10 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
16
16
  const WebModal = ({ children, ...rest }) => {
17
17
  return (
18
18
  <View style={staticStyles.container} {...selectProps(rest)}>
19
- <View style={staticStyles.content}>{children}</View>
19
+ {/* eslint-disable-next-line react-native-a11y/has-valid-accessibility-role */}
20
+ <View style={staticStyles.content} accessibilityRole="dialog">
21
+ {children}
22
+ </View>
20
23
  </View>
21
24
  )
22
25
  }
@@ -46,14 +49,15 @@ const staticStyles = StyleSheet.create({
46
49
  minHeight: 0,
47
50
  minWidth: 0,
48
51
  padding: 0,
49
- textDecoration: 'none',
50
- zIndex: 1
52
+ textDecorationLine: 'none',
53
+ zIndex: 1000
51
54
  },
52
55
  content: {
53
56
  flex: 1,
54
57
  flexGrow: 1,
55
58
  flexShrink: 1,
56
- flexBasis: 0
59
+ flexBasis: 0,
60
+ zIndex: 1000
57
61
  }
58
62
  })
59
63