@telus-uds/components-base 1.14.2 → 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.
Files changed (161) hide show
  1. package/CHANGELOG.md +40 -2
  2. package/__tests17__/A11yText/A11yText.test.jsx +34 -0
  3. package/__tests17__/ActivityIndicator/ActivityIndicator.test.jsx +68 -0
  4. package/__tests17__/ActivityIndicator/__snapshots__/ActivityIndicator.test.jsx.snap +299 -0
  5. package/__tests17__/Box/Box.test.jsx +111 -0
  6. package/__tests17__/Button/Button.test.jsx +86 -0
  7. package/__tests17__/Button/ButtonBase.test.jsx +82 -0
  8. package/__tests17__/Button/ButtonGroup.test.jsx +347 -0
  9. package/__tests17__/Button/ButtonLink.test.jsx +61 -0
  10. package/__tests17__/Card/Card.test.jsx +63 -0
  11. package/__tests17__/Carousel/Carousel.test.jsx +128 -0
  12. package/__tests17__/Carousel/CarouselTabs.test.jsx +142 -0
  13. package/__tests17__/Checkbox/Checkbox.test.jsx +94 -0
  14. package/__tests17__/Checkbox/CheckboxGroup.test.jsx +246 -0
  15. package/__tests17__/Divider/Divider.test.jsx +91 -0
  16. package/__tests17__/ExpandCollapse/ExpandCollapse.test.jsx +109 -0
  17. package/__tests17__/Feedback/Feedback.test.jsx +42 -0
  18. package/__tests17__/FlexGrid/Col.test.jsx +261 -0
  19. package/__tests17__/FlexGrid/FlexGrid.test.jsx +136 -0
  20. package/__tests17__/FlexGrid/Row.test.jsx +273 -0
  21. package/__tests17__/HorizontalScroll/HorizontalScroll.test.jsx +165 -0
  22. package/__tests17__/Icon/Icon.test.jsx +61 -0
  23. package/__tests17__/IconButton/IconButton.test.jsx +52 -0
  24. package/__tests17__/InputLabel/InputLabel.test.jsx +28 -0
  25. package/__tests17__/InputLabel/__snapshots__/InputLabel.test.jsx.snap +3 -0
  26. package/__tests17__/InputSupports/InputSupports.test.jsx +60 -0
  27. package/__tests17__/Link/Link.test.jsx +63 -0
  28. package/__tests17__/Link/TextButton.test.jsx +35 -0
  29. package/__tests17__/List/List.test.jsx +82 -0
  30. package/__tests17__/Modal/Modal.test.jsx +47 -0
  31. package/__tests17__/Notification/Notification.test.jsx +20 -0
  32. package/__tests17__/Pagination/Pagination.test.jsx +160 -0
  33. package/__tests17__/Progress/Progress.test.jsx +79 -0
  34. package/__tests17__/Radio/Radio.test.jsx +87 -0
  35. package/__tests17__/Radio/RadioGroup.test.jsx +220 -0
  36. package/__tests17__/RadioCard/RadioCard.test.jsx +87 -0
  37. package/__tests17__/RadioCard/RadioCardGroup.test.jsx +246 -0
  38. package/__tests17__/Search/Search.test.jsx +87 -0
  39. package/__tests17__/Select/Select.test.jsx +94 -0
  40. package/__tests17__/SideNav/SideNav.test.jsx +110 -0
  41. package/__tests17__/Skeleton/Skeleton.test.jsx +61 -0
  42. package/__tests17__/SkipLink/SkipLink.test.jsx +61 -0
  43. package/__tests17__/Spacer/Spacer.test.jsx +63 -0
  44. package/__tests17__/StackView/StackView.test.jsx +211 -0
  45. package/__tests17__/StackView/StackWrap.test.jsx +47 -0
  46. package/__tests17__/StackView/getStackedContent.test.jsx +295 -0
  47. package/__tests17__/StepTracker/StepTracker.test.jsx +108 -0
  48. package/__tests17__/Tabs/Tabs.test.jsx +49 -0
  49. package/__tests17__/Tags/Tags.test.jsx +327 -0
  50. package/__tests17__/TextInput/TextArea.test.jsx +35 -0
  51. package/__tests17__/TextInput/TextInputBase.test.jsx +125 -0
  52. package/__tests17__/ThemeProvider/ThemeProvider.test.jsx +80 -0
  53. package/__tests17__/ThemeProvider/useThemeTokens.test.jsx +514 -0
  54. package/__tests17__/ThemeProvider/utils/theme-tokens.test.js +41 -0
  55. package/__tests17__/ToggleSwitch/ToggleSwitch.test.jsx +82 -0
  56. package/__tests17__/ToggleSwitch/ToggleSwitchGroup.test.jsx +192 -0
  57. package/__tests17__/Tooltip/Tooltip.test.jsx +65 -0
  58. package/__tests17__/Tooltip/getTooltipPosition.test.js +79 -0
  59. package/__tests17__/Typography/typography.test.jsx +90 -0
  60. package/__tests17__/utils/children.test.jsx +128 -0
  61. package/__tests17__/utils/containUniqueFields.test.js +25 -0
  62. package/__tests17__/utils/input.test.js +375 -0
  63. package/__tests17__/utils/props.test.js +36 -0
  64. package/__tests17__/utils/semantics.test.jsx +34 -0
  65. package/__tests17__/utils/useCopy.test.js +42 -0
  66. package/__tests17__/utils/useResponsiveProp.test.jsx +202 -0
  67. package/__tests17__/utils/useSpacingScale.test.jsx +273 -0
  68. package/__tests17__/utils/useUniqueId.test.js +31 -0
  69. package/component-docs.json +120 -85
  70. package/lib/A11yInfoProvider/index.js +14 -5
  71. package/lib/Button/ButtonGroup.js +3 -2
  72. package/lib/Carousel/Carousel.js +18 -2
  73. package/lib/Carousel/CarouselTabs/CarouselTabs.js +6 -7
  74. package/lib/Checkbox/Checkbox.js +9 -6
  75. package/lib/ExpandCollapse/Control.js +6 -5
  76. package/lib/ExpandCollapse/Panel.js +5 -4
  77. package/lib/List/ListItem.js +10 -236
  78. package/lib/List/ListItemBase.js +162 -0
  79. package/lib/List/ListItemContent.js +85 -0
  80. package/lib/List/ListItemMark.js +158 -0
  81. package/lib/List/PressableListItemBase.js +147 -0
  82. package/lib/Notification/Notification.js +2 -1
  83. package/lib/Pagination/Pagination.js +4 -3
  84. package/lib/Radio/Radio.js +9 -6
  85. package/lib/RadioCard/RadioCard.js +9 -6
  86. package/lib/Select/Select.js +1 -0
  87. package/lib/Skeleton/Skeleton.js +18 -13
  88. package/lib/Skeleton/useSkeletonNativeAnimation.js +4 -2
  89. package/lib/Tabs/Tabs.js +12 -3
  90. package/lib/Tags/Tags.js +3 -3
  91. package/lib/TextInput/TextInput.js +5 -4
  92. package/lib/ToggleSwitch/ToggleSwitch.js +24 -19
  93. package/lib/ViewportProvider/useViewportListener.js +11 -5
  94. package/lib/utils/hasOwnProperty.js +18 -0
  95. package/lib/utils/props/a11yProps.js +171 -1
  96. package/lib/utils/props/getPropSelector.js +47 -5
  97. package/lib/utils/ssr.js +116 -1
  98. package/lib/utils/useResponsiveProp.js +5 -3
  99. package/lib/utils/withLinkRouter.js +3 -5
  100. package/lib-module/A11yInfoProvider/index.js +14 -4
  101. package/lib-module/Button/ButtonGroup.js +3 -2
  102. package/lib-module/Carousel/Carousel.js +16 -2
  103. package/lib-module/Carousel/CarouselTabs/CarouselTabs.js +7 -6
  104. package/lib-module/Checkbox/Checkbox.js +9 -6
  105. package/lib-module/ExpandCollapse/Control.js +6 -5
  106. package/lib-module/ExpandCollapse/Panel.js +5 -4
  107. package/lib-module/List/ListItem.js +13 -235
  108. package/lib-module/List/ListItemBase.js +139 -0
  109. package/lib-module/List/ListItemContent.js +66 -0
  110. package/lib-module/List/ListItemMark.js +143 -0
  111. package/lib-module/List/PressableListItemBase.js +117 -0
  112. package/lib-module/Notification/Notification.js +2 -1
  113. package/lib-module/Pagination/Pagination.js +5 -3
  114. package/lib-module/Radio/Radio.js +9 -6
  115. package/lib-module/RadioCard/RadioCard.js +9 -6
  116. package/lib-module/Select/Select.js +1 -0
  117. package/lib-module/Skeleton/Skeleton.js +15 -13
  118. package/lib-module/Skeleton/useSkeletonNativeAnimation.js +3 -2
  119. package/lib-module/Tabs/Tabs.js +13 -4
  120. package/lib-module/Tags/Tags.js +3 -3
  121. package/lib-module/TextInput/TextInput.js +5 -4
  122. package/lib-module/ToggleSwitch/ToggleSwitch.js +24 -19
  123. package/lib-module/ViewportProvider/useViewportListener.js +10 -4
  124. package/lib-module/utils/hasOwnProperty.js +11 -0
  125. package/lib-module/utils/props/a11yProps.js +169 -1
  126. package/lib-module/utils/props/getPropSelector.js +44 -5
  127. package/lib-module/utils/ssr.js +106 -0
  128. package/lib-module/utils/useResponsiveProp.js +3 -4
  129. package/lib-module/utils/withLinkRouter.js +3 -5
  130. package/package.json +12 -17
  131. package/src/A11yInfoProvider/index.jsx +20 -4
  132. package/src/Button/ButtonGroup.jsx +4 -2
  133. package/src/Carousel/Carousel.jsx +15 -2
  134. package/src/Carousel/CarouselTabs/CarouselTabs.jsx +5 -3
  135. package/src/Checkbox/Checkbox.jsx +7 -3
  136. package/src/ExpandCollapse/Control.jsx +8 -5
  137. package/src/ExpandCollapse/Panel.jsx +7 -5
  138. package/src/List/ListItem.jsx +12 -191
  139. package/src/List/ListItemBase.jsx +118 -0
  140. package/src/List/ListItemContent.jsx +52 -0
  141. package/src/List/ListItemMark.jsx +99 -0
  142. package/src/List/PressableListItemBase.jsx +102 -0
  143. package/src/Notification/Notification.jsx +1 -1
  144. package/src/Pagination/Pagination.jsx +6 -1
  145. package/src/Radio/Radio.jsx +7 -3
  146. package/src/RadioCard/RadioCard.jsx +7 -3
  147. package/src/Select/Select.jsx +1 -1
  148. package/src/Skeleton/Skeleton.jsx +25 -19
  149. package/src/Skeleton/useSkeletonNativeAnimation.js +3 -3
  150. package/src/Tabs/Tabs.jsx +19 -2
  151. package/src/Tags/Tags.jsx +3 -3
  152. package/src/TextInput/TextInput.jsx +4 -4
  153. package/src/ToggleSwitch/ToggleSwitch.jsx +3 -3
  154. package/src/ViewportProvider/useViewportListener.js +10 -5
  155. package/src/utils/hasOwnProperty.js +11 -0
  156. package/src/utils/props/a11yProps.js +107 -1
  157. package/src/utils/props/getPropSelector.js +45 -4
  158. package/src/utils/ssr.jsx +124 -0
  159. package/src/utils/useResponsiveProp.js +3 -3
  160. package/src/utils/withLinkRouter.jsx +1 -3
  161. package/src/utils/ssr.js +0 -35
@@ -0,0 +1,143 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import View from "react-native-web/dist/exports/View";
4
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
+ import { Fragment as _Fragment } from "react/jsx-runtime";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ export const tokenTypes = {
8
+ itemIconSize: PropTypes.number.isRequired,
9
+ itemIconColor: PropTypes.string.isRequired,
10
+ listGutter: PropTypes.number.isRequired,
11
+ iconMarginTop: PropTypes.number.isRequired
12
+ };
13
+
14
+ const selectItemIconTokens = _ref => {
15
+ let {
16
+ itemIconSize,
17
+ itemIconColor
18
+ } = _ref;
19
+ return {
20
+ size: itemIconSize,
21
+ color: itemIconColor
22
+ };
23
+ };
24
+
25
+ const selectSideItemContainerStyles = _ref2 => {
26
+ let {
27
+ listGutter,
28
+ iconMarginTop
29
+ } = _ref2;
30
+ return {
31
+ marginTop: iconMarginTop,
32
+ marginRight: listGutter
33
+ };
34
+ }; // Align bullets with the top line of text the same way icons are aligned
35
+
36
+
37
+ const selectBulletPositioningStyles = _ref3 => {
38
+ let {
39
+ itemIconSize
40
+ } = _ref3;
41
+ return {
42
+ width: itemIconSize,
43
+ height: itemIconSize
44
+ };
45
+ };
46
+
47
+ const selectBulletStyles = _ref4 => {
48
+ let {
49
+ itemBulletWidth,
50
+ itemBulletHeight,
51
+ itemBulletColor
52
+ } = _ref4;
53
+ return {
54
+ width: itemBulletWidth,
55
+ height: itemBulletHeight,
56
+ borderRadius: itemBulletHeight / 2,
57
+ backgroundColor: itemBulletColor
58
+ };
59
+ };
60
+
61
+ const selectBulletContainerStyles = _ref5 => {
62
+ let {
63
+ itemBulletContainerWidth,
64
+ itemBulletContainerAlign
65
+ } = _ref5;
66
+ return {
67
+ width: itemBulletContainerWidth,
68
+ alignItems: itemBulletContainerAlign
69
+ };
70
+ };
71
+ /**
72
+ * Subcomponent used within ListItem and similar components for rendering bullets or icons
73
+ * that sit alongside a ListIconContent in a { flexDirection: row } container.
74
+ *
75
+ * It's the responsibility of themes to make sure that the supplied tokens align the
76
+ * icon or bullet nicely against the first line of text in a ListIconContent.
77
+ */
78
+
79
+
80
+ const ListItemMark = _ref6 => {
81
+ let {
82
+ icon,
83
+ iconColor,
84
+ iconSize,
85
+ tokens = {}
86
+ } = _ref6;
87
+
88
+ const IconComponent = icon || /*#__PURE__*/_jsx(_Fragment, {});
89
+
90
+ const themeTokens = typeof tokens === 'function' ? tokens() : tokens;
91
+ const sideItemContainerStyles = selectSideItemContainerStyles(themeTokens);
92
+
93
+ if (icon) {
94
+ const iconTokens = selectItemIconTokens(themeTokens);
95
+ return /*#__PURE__*/_jsx(View, {
96
+ style: sideItemContainerStyles,
97
+ children: /*#__PURE__*/_jsx(IconComponent, {
98
+ size: iconSize || iconTokens.size,
99
+ color: iconColor || iconTokens.color
100
+ })
101
+ });
102
+ }
103
+
104
+ const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
105
+ const itemBulletStyles = selectBulletStyles(themeTokens);
106
+ const itemBulletPositioningStyles = selectBulletPositioningStyles(themeTokens);
107
+ return /*#__PURE__*/_jsx(View, {
108
+ style: [sideItemContainerStyles, itemBulletContainerStyles],
109
+ children: /*#__PURE__*/_jsx(View, {
110
+ style: [staticStyles.bulletPositioning, itemBulletPositioningStyles],
111
+ children: /*#__PURE__*/_jsx(View, {
112
+ style: itemBulletStyles,
113
+ testID: "unordered-item-bullet"
114
+ })
115
+ })
116
+ });
117
+ };
118
+
119
+ ListItemMark.propTypes = {
120
+ tokens: PropTypes.shape(tokenTypes).isRequired,
121
+
122
+ /**
123
+ * Renders side item icon
124
+ */
125
+ icon: PropTypes.elementType,
126
+
127
+ /**
128
+ * Will set display icon color
129
+ */
130
+ iconColor: PropTypes.string,
131
+
132
+ /**
133
+ * Allow the user define the icon size
134
+ */
135
+ iconSize: PropTypes.number
136
+ };
137
+ const staticStyles = StyleSheet.create({
138
+ bulletPositioning: {
139
+ alignItems: 'center',
140
+ justifyContent: 'center'
141
+ }
142
+ });
143
+ export default ListItemMark;
@@ -0,0 +1,117 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import ABBPropTypes from 'airbnb-prop-types';
4
+ import Pressable from "react-native-web/dist/exports/Pressable";
5
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
6
+ import Platform from "react-native-web/dist/exports/Platform";
7
+ import { resolvePressableTokens, clickProps, linkProps, hrefAttrsProp, withLinkRouter } from '../utils';
8
+ import ListItemBase from './ListItemBase';
9
+ import ListItemContent, { tokenTypes as contentTokenTypes } from './ListItemContent';
10
+ import ListItemMark, { tokenTypes as markTokenTypes } from './ListItemMark';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { jsxs as _jsxs } from "react/jsx-runtime";
14
+
15
+ const selectPressableStyles = _ref => {
16
+ let {
17
+ backgroundColor,
18
+ paddingLeft,
19
+ paddingRight,
20
+ paddingTop,
21
+ paddingBottom,
22
+ interItemMargin
23
+ } = _ref;
24
+ return {
25
+ backgroundColor,
26
+ paddingLeft,
27
+ paddingRight,
28
+ paddingTop,
29
+ paddingBottom,
30
+ marginBottom: interItemMargin,
31
+ ...Platform.select({
32
+ web: {
33
+ outline: 'none'
34
+ }
35
+ })
36
+ };
37
+ };
38
+
39
+ const PressableListItemBase = /*#__PURE__*/forwardRef((_ref2, ref) => {
40
+ let {
41
+ href,
42
+ tokens,
43
+ icon,
44
+ children,
45
+ listItemRef,
46
+ ...rest
47
+ } = _ref2;
48
+ const {
49
+ onPress,
50
+ ...props
51
+ } = clickProps.toPressProps(rest);
52
+ const {
53
+ hrefAttrs,
54
+ rest: listItemProps
55
+ } = hrefAttrsProp.bundle(props);
56
+ const handlePress = linkProps.handleHref({
57
+ href,
58
+ onPress
59
+ });
60
+ return /*#__PURE__*/_jsx(ListItemBase, {
61
+ ref: listItemRef,
62
+ tokens: tokens(),
63
+ ...listItemProps,
64
+ children: _ref3 => {
65
+ let {
66
+ isLastItem
67
+ } = _ref3;
68
+
69
+ const getTokens = pressableState => resolvePressableTokens(tokens, pressableState, {
70
+ last: isLastItem
71
+ });
72
+
73
+ const getPressableStyle = pressableState => [staticStyles.itemContainer, selectPressableStyles(getTokens(pressableState))];
74
+
75
+ return /*#__PURE__*/_jsx(Pressable, {
76
+ onPress: handlePress,
77
+ href: href,
78
+ hrefAttrs: hrefAttrs,
79
+ style: getPressableStyle,
80
+ ref: ref,
81
+ children: pressableState => {
82
+ const themeTokens = getTokens(pressableState);
83
+ return /*#__PURE__*/_jsxs(_Fragment, {
84
+ children: [/*#__PURE__*/_jsx(ListItemMark, {
85
+ icon: icon,
86
+ tokens: themeTokens
87
+ }), /*#__PURE__*/_jsx(ListItemContent, {
88
+ tokens: themeTokens,
89
+ children: typeof children === 'function' ? children(pressableState) : children
90
+ })]
91
+ });
92
+ }
93
+ });
94
+ }
95
+ });
96
+ });
97
+ PressableListItemBase.displayName = 'PressableListItemBase';
98
+ const staticStyles = StyleSheet.create({
99
+ itemContainer: {
100
+ flexDirection: 'row',
101
+ flex: 1
102
+ },
103
+ tokens: { ...contentTokenTypes,
104
+ ...markTokenTypes
105
+ }
106
+ });
107
+ PressableListItemBase.propTypes = {
108
+ href: PropTypes.string,
109
+ onPress: PropTypes.func,
110
+ // TODO - type this better, maybe import the subcomponent token types and run it through util
111
+ // eslint-disable-next-line react/forbid-prop-types
112
+ tokens: PropTypes.any,
113
+ icon: PropTypes.elementType,
114
+ children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
115
+ listItemRef: ABBPropTypes.ref()
116
+ };
117
+ export default withLinkRouter(PressableListItemBase);
@@ -143,7 +143,8 @@ const Notification = /*#__PURE__*/forwardRef((_ref5, ref) => {
143
143
 
144
144
  const textStyles = selectTextStyles(themeTokens, themeOptions);
145
145
  const content = wrapStringsInText(typeof children === 'function' ? children({
146
- textStyles
146
+ textStyles,
147
+ variant
147
148
  }) : children, {
148
149
  style: textStyles
149
150
  });
@@ -10,6 +10,7 @@ import usePagination from './usePagination';
10
10
  import PageButton from './PageButton';
11
11
  import SideButton from './SideButton';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { createElement as _createElement } from "react";
13
14
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
14
15
 
15
16
  const selectTextStyles = (_ref, themeOptions) => {
@@ -93,12 +94,13 @@ const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
93
94
  };
94
95
 
95
96
  if (shouldRenderButton(itemIndex)) {
96
- return /*#__PURE__*/_jsx(PageButton, { ...itemProps,
97
+ return /*#__PURE__*/_createElement(PageButton, { ...itemProps,
97
98
  LinkRouter: ItemLinkRouter,
98
99
  linkRouterProps: itemLinkRouterProps,
99
100
  label: buttonLabel,
100
101
  copy: copy,
101
- isActive: isItemActive(itemIndex)
102
+ isActive: isItemActive(itemIndex),
103
+ key: buttonLabel
102
104
  });
103
105
  }
104
106
 
@@ -106,7 +108,7 @@ const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
106
108
  return /*#__PURE__*/_jsx(Text, {
107
109
  style: ellipsisTextStyles,
108
110
  children: "..."
109
- });
111
+ }, "...");
110
112
  }
111
113
 
112
114
  return null;
@@ -151,17 +151,20 @@ const Radio = /*#__PURE__*/forwardRef((_ref4, ref) => {
151
151
 
152
152
  const uniqueId = useUniqueId('radio');
153
153
  const inputId = id !== null && id !== void 0 ? id : uniqueId;
154
+ const selectedProps = selectProps({
155
+ accessibilityRole: 'radio',
156
+ accessibilityState: {
157
+ checked: isChecked,
158
+ disabled: inactive
159
+ },
160
+ ...rest
161
+ });
154
162
  return /*#__PURE__*/_jsx(Pressable, {
155
163
  ref: ref,
156
164
  disabled: inactive,
157
165
  onKeyDown: handleKeyDown,
158
166
  onPress: handleChange,
159
- accessibilityRole: "radio",
160
- accessibilityState: {
161
- checked: isChecked,
162
- disabled: inactive
163
- },
164
- ...selectProps(rest),
167
+ ...selectedProps,
165
168
  children: _ref5 => {
166
169
  let {
167
170
  focused: focus,
@@ -87,18 +87,21 @@ const RadioCard = /*#__PURE__*/forwardRef((_ref, ref) => {
87
87
  const {
88
88
  themeOptions
89
89
  } = useTheme();
90
+ const selectedProps = selectProps({
91
+ accessibilityRole: 'radio',
92
+ accessibilityState: {
93
+ checked: isChecked,
94
+ disabled: inactive
95
+ },
96
+ ...rest
97
+ });
90
98
  return /*#__PURE__*/_jsx(PressableCardBase, {
91
99
  ref: ref,
92
100
  inactive: inactive,
93
101
  checked: isChecked,
94
102
  tokens: getCardTokens,
95
103
  onPress: handleChange,
96
- accessibilityRole: "radio",
97
- accessibilityState: {
98
- checked: isChecked,
99
- disabled: inactive
100
- },
101
- ...selectProps(rest),
104
+ ...selectedProps,
102
105
  children: cardState => {
103
106
  const {
104
107
  radioSpace,
@@ -234,6 +234,7 @@ const Select = /*#__PURE__*/forwardRef((_ref7, ref) => {
234
234
  } = useTheme();
235
235
  return /*#__PURE__*/_jsx(InputSupports, { ...supportsProps,
236
236
  ...selectedProps,
237
+ validation: validation,
237
238
  children: _ref8 => {
238
239
  let {
239
240
  inputId,
@@ -1,6 +1,8 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import Animated from "react-native-web/dist/exports/Animated";
3
3
  import Platform from "react-native-web/dist/exports/Platform";
4
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
5
+ import View from "react-native-web/dist/exports/View";
4
6
  import propTypes from 'prop-types';
5
7
  import StackView from '../StackView';
6
8
  import { useThemeTokens } from '../ThemeProvider';
@@ -13,14 +15,12 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
13
15
  const selectSkeletonStyles = _ref => {
14
16
  let {
15
17
  color,
16
- radius,
17
- fadeAnimation
18
+ radius
18
19
  } = _ref;
19
20
  return {
20
21
  backgroundColor: color,
21
22
  borderRadius: radius,
22
- maxWidth: '100%',
23
- ...fadeAnimation
23
+ maxWidth: '100%'
24
24
  };
25
25
  };
26
26
 
@@ -78,12 +78,14 @@ const Skeleton = /*#__PURE__*/forwardRef((_ref5, ref) => {
78
78
  const skeletonHeight = useSpacingScale(spacingScaleValue);
79
79
  const nativeAnimation = useSkeletonNativeAnimation();
80
80
 
81
- const getAnimationBaseOnPlatform = () => {
82
- if (Platform.OS !== 'web') {
83
- return nativeAnimation;
84
- }
81
+ const getAnimationBasedOnPlatform = () => {
82
+ const animation = Platform.OS === 'web' ? skeletonWebAnimation : nativeAnimation; // We must pass the animation styles through `StyleSheet.create`
83
+ // @see https://github.com/necolas/react-native-web/issues/2387
85
84
 
86
- return skeletonWebAnimation;
85
+ const styles = StyleSheet.create({
86
+ animation
87
+ });
88
+ return styles.animation;
87
89
  };
88
90
 
89
91
  const getLineWidth = () => {
@@ -117,11 +119,11 @@ const Skeleton = /*#__PURE__*/forwardRef((_ref5, ref) => {
117
119
 
118
120
  const renderSkeleton = function () {
119
121
  let index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
120
- return /*#__PURE__*/_jsx(Animated.View, {
122
+ // @see https://github.com/necolas/react-native-web/issues/2387
123
+ const Component = Platform.OS === 'web' ? View : Animated.View;
124
+ return /*#__PURE__*/_jsx(Component, {
121
125
  testID: "skeleton",
122
- style: [selectSkeletonStyles({ ...themeTokens,
123
- fadeAnimation: getAnimationBaseOnPlatform()
124
- }), getStyledBasedOnShape()]
126
+ style: [selectSkeletonStyles(themeTokens), getAnimationBasedOnPlatform(), getStyledBasedOnShape()]
125
127
  }, "skeleton-".concat(index + 1));
126
128
  };
127
129
 
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useRef } from 'react';
2
2
  import Animated from "react-native-web/dist/exports/Animated";
3
+ import Platform from "react-native-web/dist/exports/Platform";
3
4
  import { ANIMATION_DURATION, DEFAULT_OPACITY, OPACITY_STOP } from './skeleton.constant';
4
5
 
5
6
  const useSkeletonNativeAnimation = () => {
@@ -8,11 +9,11 @@ const useSkeletonNativeAnimation = () => {
8
9
  const fade = Animated.sequence([Animated.timing(fadeAnimation, {
9
10
  toValue: OPACITY_STOP,
10
11
  duration: ANIMATION_DURATION,
11
- useNativeDriver: true
12
+ useNativeDriver: Platform.OS !== 'web'
12
13
  }), Animated.timing(fadeAnimation, {
13
14
  toValue: DEFAULT_OPACITY,
14
15
  duration: ANIMATION_DURATION,
15
- useNativeDriver: true
16
+ useNativeDriver: Platform.OS !== 'web'
16
17
  })]);
17
18
  Animated.loop(fade).start();
18
19
  }, [fadeAnimation]);
@@ -3,11 +3,12 @@ import PropTypes from 'prop-types';
3
3
  import ABBPropTypes from 'airbnb-prop-types';
4
4
  import { useThemeTokens } from '../ThemeProvider';
5
5
  import StackView from '../StackView';
6
- import { a11yProps, getTokensPropType, selectSystemProps, useHash, useInputValue, variantProp, viewProps, withLinkRouter } from '../utils';
6
+ import { a11yProps, getTokensPropType, focusHandlerProps, pressProps, selectSystemProps, useHash, useInputValue, variantProp, viewProps, withLinkRouter } from '../utils';
7
7
  import HorizontalScroll, { horizontalScrollUtils, HorizontalScrollButton } from '../HorizontalScroll';
8
8
  import TabsItem from './TabsItem';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
11
+ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, pressProps, viewProps]);
11
12
  const {
12
13
  selectHorizontalScrollTokens,
13
14
  useItemPositions
@@ -94,15 +95,21 @@ const Tabs = /*#__PURE__*/forwardRef((_ref, ref) => {
94
95
  label,
95
96
  id,
96
97
  accessibilityRole = defaultTabItemAccessibiltyRole,
98
+ onPress,
97
99
  ref: itemRef,
98
100
  LinkRouter: ItemLinkRouter = LinkRouter,
99
- linkRouterProps: itemLinkRouterProps
101
+ linkRouterProps: itemLinkRouterProps,
102
+ ...itemRest
100
103
  } = _ref3;
101
104
  const itemId = id !== null && id !== void 0 ? id : label;
102
105
  const isSelected = Boolean(currentValue && currentValue === itemId);
103
106
 
104
- const handlePress = event => setValue(itemId, event);
107
+ const handlePress = event => {
108
+ if (typeof onPress === 'function') onPress(event);
109
+ setValue(itemId, event);
110
+ };
105
111
 
112
+ const itemProps = selectItemProps(itemRest);
106
113
  return /*#__PURE__*/_jsx(TabsItem, {
107
114
  ref: itemRef,
108
115
  href: href,
@@ -117,6 +124,7 @@ const Tabs = /*#__PURE__*/forwardRef((_ref, ref) => {
117
124
  linkRouterProps: { ...linkRouterProps,
118
125
  ...itemLinkRouterProps
119
126
  },
127
+ ...itemProps,
120
128
  children: label
121
129
  }, itemId);
122
130
  })
@@ -126,7 +134,8 @@ const Tabs = /*#__PURE__*/forwardRef((_ref, ref) => {
126
134
  Tabs.displayName = 'Tabs';
127
135
  Tabs.propTypes = { ...selectedSystemPropTypes,
128
136
  ...withLinkRouter.PropTypes,
129
- items: PropTypes.arrayOf(PropTypes.shape({ ...withLinkRouter.PropTypes,
137
+ items: PropTypes.arrayOf(PropTypes.shape({ ...selectedItemPropTypes,
138
+ ...withLinkRouter.PropTypes,
130
139
  href: PropTypes.string,
131
140
  label: PropTypes.string,
132
141
  id: PropTypes.string,
@@ -131,14 +131,14 @@ const Tags = /*#__PURE__*/forwardRef((_ref2, ref) => {
131
131
  toggleOneValue(id, event);
132
132
  };
133
133
 
134
- const itemProps = {
134
+ const itemProps = selectItemProps({
135
135
  accessibilityState: {
136
136
  checked: isSelected
137
137
  },
138
138
  accessibilityRole: itemA11yRole,
139
139
  ...a11yProps.getPositionInSet(items.length, index),
140
- ...selectItemProps(itemRest)
141
- };
140
+ ...itemRest
141
+ });
142
142
  return /*#__PURE__*/_jsx(ButtonBase, {
143
143
  ref: itemRef,
144
144
  ...pressHandlers,
@@ -27,6 +27,7 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, foc
27
27
  const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
28
28
  let {
29
29
  tokens,
30
+ nativeID,
30
31
  variant = {},
31
32
  ...rest
32
33
  } = _ref;
@@ -41,18 +42,18 @@ const TextInput = /*#__PURE__*/forwardRef((_ref, ref) => {
41
42
  }
42
43
  };
43
44
  return /*#__PURE__*/_jsx(InputSupports, {
44
- nativeID: selectedProps.nativeID,
45
+ nativeID: nativeID,
45
46
  ...supportsProps,
46
47
  children: _ref2 => {
47
48
  let {
48
49
  inputId,
49
- ...props
50
+ ...propsFromInputSupports
50
51
  } = _ref2;
51
52
  return /*#__PURE__*/_jsx(TextInputBase, {
52
53
  ref: ref,
53
- ...inputProps,
54
54
  nativeID: inputId,
55
- ...props
55
+ ...propsFromInputSupports,
56
+ ...inputProps
56
57
  });
57
58
  }
58
59
  });
@@ -11,32 +11,39 @@ import { a11yProps, focusHandlerProps, getTokensPropType, selectTokens, pressPro
11
11
  import { useInputValue } from '../utils/input';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { jsxs as _jsxs } from "react/jsx-runtime";
14
- const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, pressProps, viewProps]);
14
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, focusHandlerProps, pressProps, viewProps]); // We need to drop the icon before passing it to the `ButtonBase`, because it's
15
+ // being handled separately in this case
15
16
 
16
- const selectButtonTokens = tokens => selectTokens('Button', { ...tokens,
17
- // Width tokens are applied to our inner track. Disable Button width token so it wraps our track width.
18
- width: null
19
- }); // Map and rename icon-specific tokens to name used within Icon
17
+ const selectButtonTokens = _ref => {
18
+ let {
19
+ icon: _,
20
+ ...tokens
21
+ } = _ref;
22
+ return selectTokens('Button', { ...tokens,
23
+ // Width tokens are applied to our inner track. Disable Button width token so it wraps our track width.
24
+ width: null
25
+ });
26
+ }; // Map and rename icon-specific tokens to name used within Icon
20
27
 
21
28
 
22
- const selectIconTokens = _ref => {
29
+ const selectIconTokens = _ref2 => {
23
30
  let {
24
31
  iconSize,
25
32
  iconColor
26
- } = _ref;
33
+ } = _ref2;
27
34
  return {
28
35
  size: iconSize,
29
36
  color: iconColor
30
37
  };
31
38
  };
32
39
 
33
- const selectTrackStyles = _ref2 => {
40
+ const selectTrackStyles = _ref3 => {
34
41
  let {
35
42
  trackBorderWidth,
36
43
  trackBorderColor,
37
44
  trackBorderRadius,
38
45
  width
39
- } = _ref2;
46
+ } = _ref3;
40
47
  return {
41
48
  borderWidth: trackBorderWidth,
42
49
  borderColor: trackBorderColor,
@@ -45,7 +52,7 @@ const selectTrackStyles = _ref2 => {
45
52
  };
46
53
  };
47
54
 
48
- const selectSwitchStyles = _ref3 => {
55
+ const selectSwitchStyles = _ref4 => {
49
56
  let {
50
57
  switchSize,
51
58
  switchColor,
@@ -53,7 +60,7 @@ const selectSwitchStyles = _ref3 => {
53
60
  switchBorderColor,
54
61
  switchBorderRadius,
55
62
  switchShadow
56
- } = _ref3;
63
+ } = _ref4;
57
64
  return {
58
65
  width: switchSize,
59
66
  height: switchSize,
@@ -71,23 +78,23 @@ const selectSwitchStyles = _ref3 => {
71
78
  };
72
79
  };
73
80
 
74
- const selectLabelStyles = _ref4 => {
81
+ const selectLabelStyles = _ref5 => {
75
82
  let {
76
83
  labelMarginLeft
77
- } = _ref4;
84
+ } = _ref5;
78
85
  return {
79
86
  marginLeft: labelMarginLeft
80
87
  };
81
88
  };
82
89
 
83
- const selectLabelTokens = _ref5 => {
90
+ const selectLabelTokens = _ref6 => {
84
91
  let {
85
92
  labelColor,
86
93
  labelFontName,
87
94
  labelFontSize,
88
95
  labelFontWeight,
89
96
  labelLineHeight
90
- } = _ref5;
97
+ } = _ref6;
91
98
  return {
92
99
  color: labelColor,
93
100
  fontName: labelFontName,
@@ -97,7 +104,7 @@ const selectLabelTokens = _ref5 => {
97
104
  };
98
105
  };
99
106
 
100
- const ToggleSwitch = /*#__PURE__*/forwardRef((_ref6, ref) => {
107
+ const ToggleSwitch = /*#__PURE__*/forwardRef((_ref7, ref) => {
101
108
  let {
102
109
  copy = 'en',
103
110
  value,
@@ -112,7 +119,7 @@ const ToggleSwitch = /*#__PURE__*/forwardRef((_ref6, ref) => {
112
119
  accessibilityRole = 'switch',
113
120
  accessibilityLabel = label,
114
121
  ...rest
115
- } = _ref6;
122
+ } = _ref7;
116
123
  const getTokens = useThemeTokensCallback('ToggleSwitch', tokens, variant);
117
124
  const themeTokens = getTokens();
118
125
  const {
@@ -235,8 +242,6 @@ ToggleSwitch.propTypes = { ...selectedSystemPropTypes,
235
242
  };
236
243
  const staticStyles = StyleSheet.create({
237
244
  track: {
238
- flexGrow: 1,
239
- alignSelf: 'stretch',
240
245
  flexDirection: 'row'
241
246
  },
242
247
  switch: {