@telus-uds/components-base 1.15.0 → 1.16.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 +18 -2
- package/component-docs.json +393 -5
- package/lib/Carousel/Carousel.js +18 -2
- package/lib/Carousel/CarouselTabs/CarouselTabs.js +6 -7
- package/lib/Skeleton/Skeleton.js +18 -13
- package/lib/Skeleton/useSkeletonNativeAnimation.js +4 -2
- package/lib/ToggleSwitch/ToggleSwitch.js +24 -19
- package/lib/utils/props/a11yProps.js +50 -47
- package/lib-module/Carousel/Carousel.js +16 -2
- package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +7 -6
- package/lib-module/Skeleton/Skeleton.js +15 -13
- package/lib-module/Skeleton/useSkeletonNativeAnimation.js +3 -2
- package/lib-module/ToggleSwitch/ToggleSwitch.js +24 -19
- package/lib-module/utils/props/a11yProps.js +50 -47
- package/package.json +4 -4
- package/src/Carousel/Carousel.jsx +15 -2
- package/src/Carousel/CarouselTabs/CarouselTabs.jsx +5 -3
- package/src/Skeleton/Skeleton.jsx +25 -19
- package/src/Skeleton/useSkeletonNativeAnimation.js +3 -3
- package/src/ToggleSwitch/ToggleSwitch.jsx +3 -3
- package/src/utils/props/a11yProps.js +61 -68
|
@@ -36,54 +36,57 @@ const nativeA11yPropTypes = {
|
|
|
36
36
|
onAccessibilityEscape: PropTypes.func,
|
|
37
37
|
onAccessibilityTap: PropTypes.func
|
|
38
38
|
};
|
|
39
|
-
const a11yPropTypes =
|
|
39
|
+
const a11yPropTypes = { ...nativeA11yPropTypes,
|
|
40
40
|
// React Native Web adds many a11y props that alias aria-* attributes
|
|
41
41
|
// Types based on https://necolas.github.io/react-native-web/docs/accessibility/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
42
|
+
accessibilityActiveDescendant: PropTypes.string,
|
|
43
|
+
accessibilityAtomic: PropTypes.bool,
|
|
44
|
+
accessibilityAutoComplete: PropTypes.string,
|
|
45
|
+
accessibilityBusy: PropTypes.bool,
|
|
46
|
+
accessibilityChecked: PropTypes.oneOf([true, false, 'mixed']),
|
|
47
|
+
accessibilityColumnCount: PropTypes.number,
|
|
48
|
+
accessibilityColumnIndex: PropTypes.number,
|
|
49
|
+
accessibilityColumnSpan: PropTypes.number,
|
|
50
|
+
accessibilityControls: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
51
|
+
accessibilityCurrent: PropTypes.oneOf([true, false, 'page', 'step', 'location', 'date', 'time']),
|
|
52
|
+
accessibilityDescribedBy: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
53
|
+
accessibilityDetails: PropTypes.string,
|
|
54
|
+
accessibilityDisabled: PropTypes.bool,
|
|
55
|
+
accessibilityErrorMessage: PropTypes.string,
|
|
56
|
+
accessibilityExpanded: PropTypes.bool,
|
|
57
|
+
accessibilityFlowTo: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
58
|
+
accessibilityHasPopup: PropTypes.string,
|
|
59
|
+
accessibilityHidden: PropTypes.bool,
|
|
60
|
+
accessibilityInvalid: PropTypes.bool,
|
|
61
|
+
accessibilityKeyShortcuts: PropTypes.string,
|
|
62
|
+
accessibilityLabelledBy: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
63
|
+
accessibilityLevel: PropTypes.number,
|
|
64
|
+
accessibilityModal: PropTypes.bool,
|
|
65
|
+
accessibilityMultiline: PropTypes.bool,
|
|
66
|
+
accessibilityMultiSelectable: PropTypes.bool,
|
|
67
|
+
accessibilityOrientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
68
|
+
accessibilityOwns: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
69
|
+
accessibilityPlaceholder: PropTypes.string,
|
|
70
|
+
accessibilityPosInSet: PropTypes.number,
|
|
71
|
+
accessibilityPressed: PropTypes.bool,
|
|
72
|
+
accessibilityReadOnly: PropTypes.bool,
|
|
73
|
+
accessibilityRequired: PropTypes.bool,
|
|
74
|
+
accessibilityRoleDescription: PropTypes.string,
|
|
75
|
+
accessibilityRowCount: PropTypes.number,
|
|
76
|
+
accessibilityRowIndex: PropTypes.number,
|
|
77
|
+
accessibilityRowSpan: PropTypes.number,
|
|
78
|
+
accessibilitySelected: PropTypes.bool,
|
|
79
|
+
accessibilitySetSize: PropTypes.number,
|
|
80
|
+
accessibilitySort: PropTypes.oneOf(['ascending', 'descending', 'none', 'other']),
|
|
81
|
+
accessibilityValueMax: PropTypes.number,
|
|
82
|
+
accessibilityValueMin: PropTypes.number,
|
|
83
|
+
accessibilityValueNow: PropTypes.number,
|
|
84
|
+
accessibilityValueText: PropTypes.string
|
|
85
|
+
};
|
|
86
|
+
const a11yPropTypesByPlatform = Platform.select({
|
|
87
|
+
// React Native Web adds many a11y props that alias aria-* attributes
|
|
88
|
+
// Types based on https://necolas.github.io/react-native-web/docs/accessibility/
|
|
89
|
+
web: a11yPropTypes,
|
|
87
90
|
// Ignore web-only props in native builds
|
|
88
91
|
default: nativeA11yPropTypes
|
|
89
92
|
}); // These RNW-only props only exist in RNW >=0.18. Catch them and map them according to platform
|
|
@@ -255,7 +258,7 @@ export default {
|
|
|
255
258
|
* then spread the returned object into the component's props (usually its outer container).
|
|
256
259
|
*/
|
|
257
260
|
select: getPropSelector( // Allow all React Native accessibility props
|
|
258
|
-
|
|
261
|
+
a11yPropTypesByPlatform, // Allow any `aria-*` attribute on web; ignore them on native
|
|
259
262
|
Platform.OS === 'web' && /^aria-/, // For the props added and deprecated in React Native Web 0.18, convert them to
|
|
260
263
|
// a form that is platform-appropriate and RNW-version safe
|
|
261
264
|
(key, value) => {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"airbnb-prop-types": "^2.16.0",
|
|
11
11
|
"@telus-uds/system-constants": "^1.0.4",
|
|
12
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
12
|
+
"@telus-uds/system-theme-tokens": "^2.5.0",
|
|
13
13
|
"lodash.debounce": "^4.0.8",
|
|
14
14
|
"lodash.merge": "^4.6.2",
|
|
15
15
|
"prop-types": "^15.7.2",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"module": "lib-module/index.js",
|
|
42
42
|
"name": "@telus-uds/components-base",
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"react": "^17.0.2 ||
|
|
45
|
-
"react-dom": "^17.0.2 ||
|
|
44
|
+
"react": "^17.0.2 || ^18.0.0",
|
|
45
|
+
"react-dom": "^17.0.2 || ^18.0.0",
|
|
46
46
|
"react-native": "*",
|
|
47
47
|
"react-native-web": "~0.17.7 || ~0.18.7"
|
|
48
48
|
},
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"standard-engine": {
|
|
67
67
|
"skip": true
|
|
68
68
|
},
|
|
69
|
-
"version": "1.
|
|
69
|
+
"version": "1.16.0"
|
|
70
70
|
}
|
|
@@ -22,6 +22,8 @@ import SkipLink from '../SkipLink'
|
|
|
22
22
|
import A11yText from '../A11yText'
|
|
23
23
|
import CarouselStepTracker from './CarouselStepTracker'
|
|
24
24
|
import CarouselThumbnailNavigation from './CarouselThumbnailNavigation'
|
|
25
|
+
import CarouselTabsPanel from './CarouselTabs/CarouselTabsPanel'
|
|
26
|
+
import CarouselTabsPanelItem from './CarouselTabs/CarouselTabsPanelItem'
|
|
25
27
|
import dictionary from './dictionary'
|
|
26
28
|
|
|
27
29
|
const staticStyles = StyleSheet.create({
|
|
@@ -150,7 +152,8 @@ const Carousel = React.forwardRef(
|
|
|
150
152
|
onAnimationEnd,
|
|
151
153
|
onIndexChanged,
|
|
152
154
|
skipLinkHref,
|
|
153
|
-
|
|
155
|
+
tabs,
|
|
156
|
+
refocus = Boolean(tabs),
|
|
154
157
|
title = 'carousel',
|
|
155
158
|
springConfig = undefined,
|
|
156
159
|
thumbnails = undefined,
|
|
@@ -177,6 +180,7 @@ const Carousel = React.forwardRef(
|
|
|
177
180
|
nextIcon,
|
|
178
181
|
showPreviousNextNavigation,
|
|
179
182
|
showPanelNavigation,
|
|
183
|
+
showPanelTabs,
|
|
180
184
|
spaceBetweenSlideAndPreviousNextNavigation
|
|
181
185
|
} = themeTokens
|
|
182
186
|
const [activeIndex, setActiveIndex] = React.useState(0)
|
|
@@ -415,6 +419,9 @@ const Carousel = React.forwardRef(
|
|
|
415
419
|
[activeIndex, childrenArray.length, itemLabel, getCopy, title]
|
|
416
420
|
)
|
|
417
421
|
|
|
422
|
+
const activePanelNavigation =
|
|
423
|
+
tabs && showPanelTabs ? <CarouselTabsPanel items={tabs} /> : panelNavigation
|
|
424
|
+
|
|
418
425
|
return (
|
|
419
426
|
<CarouselProvider
|
|
420
427
|
activeIndex={activeIndex}
|
|
@@ -511,7 +518,7 @@ const Carousel = React.forwardRef(
|
|
|
511
518
|
</View>
|
|
512
519
|
)}
|
|
513
520
|
</View>
|
|
514
|
-
{showPanelNavigation ?
|
|
521
|
+
{showPanelNavigation ? activePanelNavigation : null}
|
|
515
522
|
</CarouselProvider>
|
|
516
523
|
)
|
|
517
524
|
}
|
|
@@ -587,6 +594,12 @@ Carousel.propTypes = {
|
|
|
587
594
|
* with the ID of a focusable element immediately after the Carousel, e.g. `'#section-2-heading'`.
|
|
588
595
|
*/
|
|
589
596
|
skipLinkHref: PropTypes.string,
|
|
597
|
+
/**
|
|
598
|
+
* If provided, defaults the navigation panel to a CarouselTabsPanel element passing each item as props for one tab.
|
|
599
|
+
*
|
|
600
|
+
* Be careful to ensure that the order of each element in the items array matches the order of each child in the Carousel.
|
|
601
|
+
*/
|
|
602
|
+
tabs: PropTypes.arrayOf(PropTypes.shape(CarouselTabsPanelItem.propTypes || {})),
|
|
590
603
|
/**
|
|
591
604
|
* If true, whenever a new slide comes into view, the focus of the Carousel switches to the start.
|
|
592
605
|
*
|
|
@@ -3,13 +3,15 @@ import PropTypes from 'prop-types'
|
|
|
3
3
|
|
|
4
4
|
import { useResponsiveProp } from '../../utils'
|
|
5
5
|
import Carousel from '../Carousel'
|
|
6
|
-
import CarouselTabsPanel from './CarouselTabsPanel'
|
|
7
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Please use Carousel and pass the `tabs` prop.
|
|
9
|
+
*/
|
|
8
10
|
const CarouselTabs = forwardRef(({ items, refocus = true, ...carouselProps }, ref) => {
|
|
9
|
-
const
|
|
11
|
+
const tabs = useResponsiveProp({ md: items })
|
|
10
12
|
|
|
11
13
|
return (
|
|
12
|
-
<Carousel refocus={refocus} {...carouselProps} ref={ref}
|
|
14
|
+
<Carousel refocus={refocus} {...carouselProps} ref={ref} tabs={tabs}>
|
|
13
15
|
{items.map(({ title, content }) => (
|
|
14
16
|
<React.Fragment key={title}>{content}</React.Fragment>
|
|
15
17
|
))}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
|
-
import { Animated, Platform } from 'react-native'
|
|
2
|
+
import { Animated, Platform, StyleSheet, View } from 'react-native'
|
|
3
3
|
import propTypes from 'prop-types'
|
|
4
4
|
import StackView from '../StackView'
|
|
5
5
|
import { useThemeTokens } from '../ThemeProvider'
|
|
@@ -19,11 +19,10 @@ import skeletonWebAnimation from './skeletonWebAnimation'
|
|
|
19
19
|
|
|
20
20
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps])
|
|
21
21
|
|
|
22
|
-
const selectSkeletonStyles = ({ color, radius
|
|
22
|
+
const selectSkeletonStyles = ({ color, radius }) => ({
|
|
23
23
|
backgroundColor: color,
|
|
24
24
|
borderRadius: radius,
|
|
25
|
-
maxWidth: '100%'
|
|
26
|
-
...fadeAnimation
|
|
25
|
+
maxWidth: '100%'
|
|
27
26
|
})
|
|
28
27
|
|
|
29
28
|
const selectLineStyles = ({ skeletonHeight, lineWidth }) => ({
|
|
@@ -66,12 +65,13 @@ const Skeleton = forwardRef(
|
|
|
66
65
|
const skeletonHeight = useSpacingScale(spacingScaleValue)
|
|
67
66
|
const nativeAnimation = useSkeletonNativeAnimation()
|
|
68
67
|
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const getAnimationBasedOnPlatform = () => {
|
|
69
|
+
const animation = Platform.OS === 'web' ? skeletonWebAnimation : nativeAnimation
|
|
70
|
+
// We must pass the animation styles through `StyleSheet.create`
|
|
71
|
+
// @see https://github.com/necolas/react-native-web/issues/2387
|
|
72
|
+
const styles = StyleSheet.create({ animation })
|
|
73
73
|
|
|
74
|
-
return
|
|
74
|
+
return styles.animation
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const getLineWidth = () => {
|
|
@@ -97,16 +97,22 @@ const Skeleton = forwardRef(
|
|
|
97
97
|
return selectLineStyles({ skeletonHeight, lineWidth: getLineWidth() })
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
const renderSkeleton = (index = 0) =>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
const renderSkeleton = (index = 0) => {
|
|
101
|
+
// @see https://github.com/necolas/react-native-web/issues/2387
|
|
102
|
+
const Component = Platform.OS === 'web' ? View : Animated.View
|
|
103
|
+
|
|
104
|
+
return (
|
|
105
|
+
<Component
|
|
106
|
+
testID="skeleton"
|
|
107
|
+
key={`skeleton-${index + 1}`}
|
|
108
|
+
style={[
|
|
109
|
+
selectSkeletonStyles(themeTokens),
|
|
110
|
+
getAnimationBasedOnPlatform(),
|
|
111
|
+
getStyledBasedOnShape()
|
|
112
|
+
]}
|
|
113
|
+
/>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
110
116
|
|
|
111
117
|
return (
|
|
112
118
|
<StackView space={themeTokens.spaceBetweenLines} ref={ref} {...selectProps(rest)}>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react'
|
|
2
|
-
import { Animated } from 'react-native'
|
|
2
|
+
import { Animated, Platform } from 'react-native'
|
|
3
3
|
import { ANIMATION_DURATION, DEFAULT_OPACITY, OPACITY_STOP } from './skeleton.constant'
|
|
4
4
|
|
|
5
5
|
const useSkeletonNativeAnimation = () => {
|
|
@@ -10,12 +10,12 @@ const useSkeletonNativeAnimation = () => {
|
|
|
10
10
|
Animated.timing(fadeAnimation, {
|
|
11
11
|
toValue: OPACITY_STOP,
|
|
12
12
|
duration: ANIMATION_DURATION,
|
|
13
|
-
useNativeDriver:
|
|
13
|
+
useNativeDriver: Platform.OS !== 'web'
|
|
14
14
|
}),
|
|
15
15
|
Animated.timing(fadeAnimation, {
|
|
16
16
|
toValue: DEFAULT_OPACITY,
|
|
17
17
|
duration: ANIMATION_DURATION,
|
|
18
|
-
useNativeDriver:
|
|
18
|
+
useNativeDriver: Platform.OS !== 'web'
|
|
19
19
|
})
|
|
20
20
|
])
|
|
21
21
|
Animated.loop(fade).start()
|
|
@@ -26,7 +26,9 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([
|
|
|
26
26
|
viewProps
|
|
27
27
|
])
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
// We need to drop the icon before passing it to the `ButtonBase`, because it's
|
|
30
|
+
// being handled separately in this case
|
|
31
|
+
const selectButtonTokens = ({ icon: _, ...tokens }) =>
|
|
30
32
|
selectTokens('Button', {
|
|
31
33
|
...tokens,
|
|
32
34
|
// Width tokens are applied to our inner track. Disable Button width token so it wraps our track width.
|
|
@@ -215,8 +217,6 @@ ToggleSwitch.propTypes = {
|
|
|
215
217
|
|
|
216
218
|
const staticStyles = StyleSheet.create({
|
|
217
219
|
track: {
|
|
218
|
-
flexGrow: 1,
|
|
219
|
-
alignSelf: 'stretch',
|
|
220
220
|
flexDirection: 'row'
|
|
221
221
|
},
|
|
222
222
|
switch: {
|
|
@@ -40,75 +40,68 @@ const nativeA11yPropTypes = {
|
|
|
40
40
|
onAccessibilityTap: PropTypes.func
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const a11yPropTypes =
|
|
43
|
+
const a11yPropTypes = {
|
|
44
|
+
...nativeA11yPropTypes,
|
|
44
45
|
// React Native Web adds many a11y props that alias aria-* attributes
|
|
45
46
|
// Types based on https://necolas.github.io/react-native-web/docs/accessibility/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
accessibilitySelected: PropTypes.bool,
|
|
105
|
-
accessibilitySetSize: PropTypes.number,
|
|
106
|
-
accessibilitySort: PropTypes.oneOf(['ascending', 'descending', 'none', 'other']),
|
|
107
|
-
accessibilityValueMax: PropTypes.number,
|
|
108
|
-
accessibilityValueMin: PropTypes.number,
|
|
109
|
-
accessibilityValueNow: PropTypes.number,
|
|
110
|
-
accessibilityValueText: PropTypes.string
|
|
111
|
-
},
|
|
47
|
+
accessibilityActiveDescendant: PropTypes.string,
|
|
48
|
+
accessibilityAtomic: PropTypes.bool,
|
|
49
|
+
accessibilityAutoComplete: PropTypes.string,
|
|
50
|
+
accessibilityBusy: PropTypes.bool,
|
|
51
|
+
accessibilityChecked: PropTypes.oneOf([true, false, 'mixed']),
|
|
52
|
+
accessibilityColumnCount: PropTypes.number,
|
|
53
|
+
accessibilityColumnIndex: PropTypes.number,
|
|
54
|
+
accessibilityColumnSpan: PropTypes.number,
|
|
55
|
+
accessibilityControls: PropTypes.oneOfType([
|
|
56
|
+
PropTypes.string,
|
|
57
|
+
PropTypes.arrayOf(PropTypes.string)
|
|
58
|
+
]),
|
|
59
|
+
accessibilityCurrent: PropTypes.oneOf([true, false, 'page', 'step', 'location', 'date', 'time']),
|
|
60
|
+
accessibilityDescribedBy: PropTypes.oneOfType([
|
|
61
|
+
PropTypes.string,
|
|
62
|
+
PropTypes.arrayOf(PropTypes.string)
|
|
63
|
+
]),
|
|
64
|
+
accessibilityDetails: PropTypes.string,
|
|
65
|
+
accessibilityDisabled: PropTypes.bool,
|
|
66
|
+
accessibilityErrorMessage: PropTypes.string,
|
|
67
|
+
accessibilityExpanded: PropTypes.bool,
|
|
68
|
+
accessibilityFlowTo: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
69
|
+
accessibilityHasPopup: PropTypes.string,
|
|
70
|
+
accessibilityHidden: PropTypes.bool,
|
|
71
|
+
accessibilityInvalid: PropTypes.bool,
|
|
72
|
+
accessibilityKeyShortcuts: PropTypes.string,
|
|
73
|
+
accessibilityLabelledBy: PropTypes.oneOfType([
|
|
74
|
+
PropTypes.string,
|
|
75
|
+
PropTypes.arrayOf(PropTypes.string)
|
|
76
|
+
]),
|
|
77
|
+
accessibilityLevel: PropTypes.number,
|
|
78
|
+
accessibilityModal: PropTypes.bool,
|
|
79
|
+
accessibilityMultiline: PropTypes.bool,
|
|
80
|
+
accessibilityMultiSelectable: PropTypes.bool,
|
|
81
|
+
accessibilityOrientation: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
82
|
+
accessibilityOwns: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
|
|
83
|
+
accessibilityPlaceholder: PropTypes.string,
|
|
84
|
+
accessibilityPosInSet: PropTypes.number,
|
|
85
|
+
accessibilityPressed: PropTypes.bool,
|
|
86
|
+
accessibilityReadOnly: PropTypes.bool,
|
|
87
|
+
accessibilityRequired: PropTypes.bool,
|
|
88
|
+
accessibilityRoleDescription: PropTypes.string,
|
|
89
|
+
accessibilityRowCount: PropTypes.number,
|
|
90
|
+
accessibilityRowIndex: PropTypes.number,
|
|
91
|
+
accessibilityRowSpan: PropTypes.number,
|
|
92
|
+
accessibilitySelected: PropTypes.bool,
|
|
93
|
+
accessibilitySetSize: PropTypes.number,
|
|
94
|
+
accessibilitySort: PropTypes.oneOf(['ascending', 'descending', 'none', 'other']),
|
|
95
|
+
accessibilityValueMax: PropTypes.number,
|
|
96
|
+
accessibilityValueMin: PropTypes.number,
|
|
97
|
+
accessibilityValueNow: PropTypes.number,
|
|
98
|
+
accessibilityValueText: PropTypes.string
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const a11yPropTypesByPlatform = Platform.select({
|
|
102
|
+
// React Native Web adds many a11y props that alias aria-* attributes
|
|
103
|
+
// Types based on https://necolas.github.io/react-native-web/docs/accessibility/
|
|
104
|
+
web: a11yPropTypes,
|
|
112
105
|
// Ignore web-only props in native builds
|
|
113
106
|
default: nativeA11yPropTypes
|
|
114
107
|
})
|
|
@@ -214,7 +207,7 @@ export default {
|
|
|
214
207
|
*/
|
|
215
208
|
select: getPropSelector(
|
|
216
209
|
// Allow all React Native accessibility props
|
|
217
|
-
|
|
210
|
+
a11yPropTypesByPlatform,
|
|
218
211
|
// Allow any `aria-*` attribute on web; ignore them on native
|
|
219
212
|
Platform.OS === 'web' && /^aria-/,
|
|
220
213
|
// For the props added and deprecated in React Native Web 0.18, convert them to
|