@telus-uds/components-base 1.8.1 → 1.8.4

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 (288) hide show
  1. package/CHANGELOG.md +35 -2
  2. package/component-docs.json +711 -669
  3. package/lib/A11yInfoProvider/index.js +4 -3
  4. package/lib/A11yText/index.js +6 -5
  5. package/lib/ActivityIndicator/Spinner.js +14 -13
  6. package/lib/ActivityIndicator/Spinner.native.js +10 -8
  7. package/lib/ActivityIndicator/index.js +6 -5
  8. package/lib/ActivityIndicator/shared.js +1 -1
  9. package/lib/BaseProvider/index.js +13 -10
  10. package/lib/Box/Box.js +20 -19
  11. package/lib/Button/Button.js +7 -6
  12. package/lib/Button/ButtonBase.js +97 -79
  13. package/lib/Button/ButtonGroup.js +34 -32
  14. package/lib/Button/ButtonLink.js +9 -7
  15. package/lib/Button/index.js +4 -4
  16. package/lib/Button/propTypes.js +1 -1
  17. package/lib/Card/Card.js +8 -7
  18. package/lib/Card/CardBase.js +35 -31
  19. package/lib/Card/PressableCardBase.js +14 -12
  20. package/lib/Checkbox/Checkbox.js +97 -83
  21. package/lib/Checkbox/CheckboxGroup.js +29 -27
  22. package/lib/Checkbox/CheckboxInput.js +12 -10
  23. package/lib/Divider/Divider.js +10 -9
  24. package/lib/ExpandCollapse/Control.js +42 -36
  25. package/lib/ExpandCollapse/ExpandCollapse.js +11 -10
  26. package/lib/ExpandCollapse/Panel.js +29 -40
  27. package/lib/Feedback/Feedback.js +48 -35
  28. package/lib/Fieldset/Fieldset.js +16 -15
  29. package/lib/Fieldset/FieldsetContainer.js +16 -13
  30. package/lib/Fieldset/FieldsetContainer.native.js +11 -8
  31. package/lib/Fieldset/Legend.js +10 -7
  32. package/lib/Fieldset/Legend.native.js +10 -7
  33. package/lib/FlexGrid/Col/Col.js +18 -17
  34. package/lib/FlexGrid/FlexGrid.js +15 -14
  35. package/lib/FlexGrid/Row/Row.js +13 -12
  36. package/lib/HorizontalScroll/HorizontalScroll.js +25 -20
  37. package/lib/HorizontalScroll/HorizontalScrollButton.js +18 -14
  38. package/lib/HorizontalScroll/ScrollViewEnd.js +6 -5
  39. package/lib/HorizontalScroll/ScrollViewEnd.native.js +12 -9
  40. package/lib/HorizontalScroll/itemPositions.js +19 -13
  41. package/lib/Icon/Icon.js +11 -10
  42. package/lib/Icon/IconText.js +8 -7
  43. package/lib/Icon/index.js +5 -5
  44. package/lib/IconButton/IconButton.js +50 -42
  45. package/lib/InputLabel/InputLabel.js +37 -30
  46. package/lib/InputLabel/LabelContent.js +12 -9
  47. package/lib/InputLabel/LabelContent.native.js +9 -6
  48. package/lib/InputSupports/InputSupports.js +11 -10
  49. package/lib/InputSupports/useInputSupports.js +7 -6
  50. package/lib/Link/ChevronLink.js +9 -8
  51. package/lib/Link/InlinePressable.js +13 -10
  52. package/lib/Link/InlinePressable.native.js +20 -16
  53. package/lib/Link/Link.js +10 -9
  54. package/lib/Link/LinkBase.js +96 -78
  55. package/lib/Link/TextButton.js +9 -8
  56. package/lib/List/List.js +20 -13
  57. package/lib/List/ListItem.js +103 -79
  58. package/lib/Modal/Modal.js +74 -60
  59. package/lib/Notification/Notification.js +46 -33
  60. package/lib/Pagination/PageButton.js +13 -12
  61. package/lib/Pagination/Pagination.js +43 -30
  62. package/lib/Pagination/SideButton.js +21 -18
  63. package/lib/Pagination/usePagination.js +7 -6
  64. package/lib/Progress/Progress.js +23 -19
  65. package/lib/Progress/ProgressBar.js +25 -21
  66. package/lib/Progress/ProgressBarBackground.js +7 -6
  67. package/lib/Radio/Radio.js +80 -69
  68. package/lib/Radio/RadioButton.js +63 -53
  69. package/lib/Radio/RadioGroup.js +30 -28
  70. package/lib/Radio/RadioInput.js +12 -10
  71. package/lib/RadioCard/RadioCard.js +16 -15
  72. package/lib/RadioCard/RadioCardGroup.js +30 -28
  73. package/lib/Search/Search.js +52 -32
  74. package/lib/Select/Group.js +5 -4
  75. package/lib/Select/Group.native.js +4 -3
  76. package/lib/Select/Item.js +10 -7
  77. package/lib/Select/Item.native.js +1 -9
  78. package/lib/Select/Picker.js +16 -15
  79. package/lib/Select/Picker.native.js +49 -38
  80. package/lib/Select/Select.js +134 -113
  81. package/lib/SideNav/Item.js +39 -33
  82. package/lib/SideNav/ItemContent.js +15 -12
  83. package/lib/SideNav/ItemsGroup.js +13 -11
  84. package/lib/SideNav/SideNav.js +21 -18
  85. package/lib/Skeleton/Skeleton.js +60 -44
  86. package/lib/Skeleton/skeleton.constant.js +1 -1
  87. package/lib/Skeleton/skeletonWebAnimation.js +1 -1
  88. package/lib/Spacer/Spacer.js +6 -5
  89. package/lib/StackView/StackView.js +12 -11
  90. package/lib/StackView/StackWrap.js +5 -3
  91. package/lib/StackView/StackWrapBox.js +12 -11
  92. package/lib/StackView/StackWrapGap.js +11 -10
  93. package/lib/StackView/common.js +14 -11
  94. package/lib/StackView/getStackedContent.js +10 -9
  95. package/lib/StackView/index.js +1 -1
  96. package/lib/StepTracker/Step.js +122 -103
  97. package/lib/StepTracker/StepTracker.js +48 -38
  98. package/lib/Tabs/Tabs.js +57 -27
  99. package/lib/Tabs/TabsItem.js +78 -68
  100. package/lib/Tags/Tags.js +68 -62
  101. package/lib/TextInput/TextArea.js +26 -20
  102. package/lib/TextInput/TextInput.js +20 -15
  103. package/lib/TextInput/TextInputBase.js +74 -62
  104. package/lib/TextInput/index.js +4 -4
  105. package/lib/ThemeProvider/ThemeProvider.js +6 -5
  106. package/lib/ThemeProvider/index.js +5 -5
  107. package/lib/ThemeProvider/useSetTheme.js +6 -3
  108. package/lib/ThemeProvider/useThemeTokens.js +7 -2
  109. package/lib/ThemeProvider/utils/styles.js +50 -43
  110. package/lib/ThemeProvider/utils/theme-tokens.js +33 -21
  111. package/lib/ToggleSwitch/ToggleSwitch.js +90 -74
  112. package/lib/ToggleSwitch/ToggleSwitchGroup.js +37 -35
  113. package/lib/Tooltip/Backdrop.js +6 -13
  114. package/lib/Tooltip/Backdrop.native.js +5 -4
  115. package/lib/Tooltip/Tooltip.js +81 -65
  116. package/lib/Tooltip/getTooltipPosition.js +29 -18
  117. package/lib/TooltipButton/TooltipButton.js +28 -21
  118. package/lib/Typography/Typography.js +37 -33
  119. package/lib/ViewportProvider/ViewportProvider.js +4 -3
  120. package/lib/ViewportProvider/useViewportListener.js +6 -3
  121. package/lib/index.js +54 -54
  122. package/lib/utils/a11y/semantics.js +5 -2
  123. package/lib/utils/a11y/textSize.js +8 -6
  124. package/lib/utils/animation/useVerticalExpandAnimation.js +46 -19
  125. package/lib/utils/children.js +4 -3
  126. package/lib/utils/index.js +10 -10
  127. package/lib/utils/input.js +28 -29
  128. package/lib/utils/pressability.js +36 -22
  129. package/lib/utils/props/clickProps.js +2 -1
  130. package/lib/utils/props/componentPropType.js +3 -3
  131. package/lib/utils/props/getPropSelector.js +6 -3
  132. package/lib/utils/props/handlerProps.js +25 -19
  133. package/lib/utils/props/hrefAttrsProp.js +14 -11
  134. package/lib/utils/props/index.js +12 -12
  135. package/lib/utils/props/inputSupportsProps.js +15 -12
  136. package/lib/utils/props/linkProps.js +7 -6
  137. package/lib/utils/props/pressProps.js +1 -1
  138. package/lib/utils/props/selectSystemProps.js +2 -2
  139. package/lib/utils/props/tokens.js +29 -15
  140. package/lib/utils/ssr.js +6 -2
  141. package/lib/utils/useCopy.js +6 -4
  142. package/lib/utils/useHash.js +2 -1
  143. package/lib/utils/useResponsiveProp.js +1 -1
  144. package/lib/utils/useSpacingScale.js +3 -1
  145. package/lib/utils/useUniqueId.js +3 -2
  146. package/lib/utils/withLinkRouter.js +6 -5
  147. package/lib-module/A11yInfoProvider/index.js +4 -3
  148. package/lib-module/A11yText/index.js +6 -5
  149. package/lib-module/ActivityIndicator/Spinner.js +14 -13
  150. package/lib-module/ActivityIndicator/Spinner.native.js +9 -8
  151. package/lib-module/ActivityIndicator/index.js +6 -5
  152. package/lib-module/BaseProvider/index.js +13 -10
  153. package/lib-module/Box/Box.js +20 -19
  154. package/lib-module/Button/Button.js +7 -6
  155. package/lib-module/Button/ButtonBase.js +96 -79
  156. package/lib-module/Button/ButtonGroup.js +34 -32
  157. package/lib-module/Button/ButtonLink.js +8 -7
  158. package/lib-module/Card/Card.js +8 -7
  159. package/lib-module/Card/CardBase.js +35 -31
  160. package/lib-module/Card/PressableCardBase.js +12 -11
  161. package/lib-module/Checkbox/Checkbox.js +97 -83
  162. package/lib-module/Checkbox/CheckboxGroup.js +29 -27
  163. package/lib-module/Checkbox/CheckboxInput.js +12 -10
  164. package/lib-module/Divider/Divider.js +10 -9
  165. package/lib-module/ExpandCollapse/Control.js +42 -36
  166. package/lib-module/ExpandCollapse/ExpandCollapse.js +11 -10
  167. package/lib-module/ExpandCollapse/Panel.js +29 -37
  168. package/lib-module/Feedback/Feedback.js +46 -33
  169. package/lib-module/Fieldset/Fieldset.js +16 -15
  170. package/lib-module/Fieldset/FieldsetContainer.js +16 -13
  171. package/lib-module/Fieldset/FieldsetContainer.native.js +11 -8
  172. package/lib-module/Fieldset/Legend.js +10 -7
  173. package/lib-module/Fieldset/Legend.native.js +10 -7
  174. package/lib-module/FlexGrid/Col/Col.js +18 -17
  175. package/lib-module/FlexGrid/FlexGrid.js +15 -14
  176. package/lib-module/FlexGrid/Row/Row.js +13 -12
  177. package/lib-module/HorizontalScroll/HorizontalScroll.js +24 -19
  178. package/lib-module/HorizontalScroll/HorizontalScrollButton.js +18 -14
  179. package/lib-module/HorizontalScroll/ScrollViewEnd.js +6 -5
  180. package/lib-module/HorizontalScroll/ScrollViewEnd.native.js +12 -9
  181. package/lib-module/HorizontalScroll/itemPositions.js +18 -12
  182. package/lib-module/Icon/Icon.js +10 -9
  183. package/lib-module/Icon/IconText.js +9 -7
  184. package/lib-module/IconButton/IconButton.js +48 -41
  185. package/lib-module/InputLabel/InputLabel.js +37 -30
  186. package/lib-module/InputLabel/LabelContent.js +12 -9
  187. package/lib-module/InputLabel/LabelContent.native.js +9 -6
  188. package/lib-module/InputSupports/InputSupports.js +11 -10
  189. package/lib-module/InputSupports/useInputSupports.js +7 -6
  190. package/lib-module/Link/ChevronLink.js +9 -8
  191. package/lib-module/Link/InlinePressable.js +13 -10
  192. package/lib-module/Link/InlinePressable.native.js +20 -16
  193. package/lib-module/Link/Link.js +10 -9
  194. package/lib-module/Link/LinkBase.js +94 -77
  195. package/lib-module/Link/TextButton.js +9 -8
  196. package/lib-module/List/List.js +20 -13
  197. package/lib-module/List/ListItem.js +103 -78
  198. package/lib-module/Modal/Modal.js +74 -60
  199. package/lib-module/Notification/Notification.js +46 -33
  200. package/lib-module/Pagination/PageButton.js +13 -12
  201. package/lib-module/Pagination/Pagination.js +43 -30
  202. package/lib-module/Pagination/SideButton.js +21 -18
  203. package/lib-module/Pagination/usePagination.js +7 -6
  204. package/lib-module/Progress/Progress.js +23 -19
  205. package/lib-module/Progress/ProgressBar.js +25 -21
  206. package/lib-module/Progress/ProgressBarBackground.js +7 -6
  207. package/lib-module/Radio/Radio.js +80 -69
  208. package/lib-module/Radio/RadioButton.js +62 -52
  209. package/lib-module/Radio/RadioGroup.js +30 -28
  210. package/lib-module/Radio/RadioInput.js +12 -10
  211. package/lib-module/RadioCard/RadioCard.js +16 -15
  212. package/lib-module/RadioCard/RadioCardGroup.js +30 -28
  213. package/lib-module/Search/Search.js +52 -32
  214. package/lib-module/Select/Group.js +5 -4
  215. package/lib-module/Select/Group.native.js +4 -3
  216. package/lib-module/Select/Item.js +10 -7
  217. package/lib-module/Select/Item.native.js +1 -7
  218. package/lib-module/Select/Picker.js +16 -15
  219. package/lib-module/Select/Picker.native.js +46 -36
  220. package/lib-module/Select/Select.js +134 -113
  221. package/lib-module/SideNav/Item.js +39 -33
  222. package/lib-module/SideNav/ItemContent.js +14 -11
  223. package/lib-module/SideNav/ItemsGroup.js +13 -11
  224. package/lib-module/SideNav/SideNav.js +21 -18
  225. package/lib-module/Skeleton/Skeleton.js +60 -44
  226. package/lib-module/Skeleton/skeletonWebAnimation.js +1 -1
  227. package/lib-module/Spacer/Spacer.js +6 -5
  228. package/lib-module/StackView/StackView.js +12 -11
  229. package/lib-module/StackView/StackWrap.js +5 -3
  230. package/lib-module/StackView/StackWrapBox.js +12 -11
  231. package/lib-module/StackView/StackWrapGap.js +11 -10
  232. package/lib-module/StackView/common.js +14 -11
  233. package/lib-module/StackView/getStackedContent.js +10 -9
  234. package/lib-module/StepTracker/Step.js +122 -103
  235. package/lib-module/StepTracker/StepTracker.js +48 -38
  236. package/lib-module/Tabs/Tabs.js +57 -27
  237. package/lib-module/Tabs/TabsItem.js +77 -68
  238. package/lib-module/Tags/Tags.js +68 -62
  239. package/lib-module/TextInput/TextArea.js +26 -20
  240. package/lib-module/TextInput/TextInput.js +19 -15
  241. package/lib-module/TextInput/TextInputBase.js +74 -62
  242. package/lib-module/ThemeProvider/ThemeProvider.js +5 -4
  243. package/lib-module/ThemeProvider/useSetTheme.js +6 -3
  244. package/lib-module/ThemeProvider/useThemeTokens.js +7 -2
  245. package/lib-module/ThemeProvider/utils/styles.js +48 -41
  246. package/lib-module/ThemeProvider/utils/theme-tokens.js +32 -20
  247. package/lib-module/ToggleSwitch/ToggleSwitch.js +90 -74
  248. package/lib-module/ToggleSwitch/ToggleSwitchGroup.js +37 -35
  249. package/lib-module/Tooltip/Backdrop.js +6 -13
  250. package/lib-module/Tooltip/Backdrop.native.js +5 -4
  251. package/lib-module/Tooltip/Tooltip.js +81 -65
  252. package/lib-module/Tooltip/getTooltipPosition.js +29 -18
  253. package/lib-module/TooltipButton/TooltipButton.js +28 -21
  254. package/lib-module/Typography/Typography.js +35 -31
  255. package/lib-module/ViewportProvider/ViewportProvider.js +4 -3
  256. package/lib-module/ViewportProvider/useViewportListener.js +6 -3
  257. package/lib-module/utils/a11y/semantics.js +4 -1
  258. package/lib-module/utils/a11y/textSize.js +7 -5
  259. package/lib-module/utils/animation/useVerticalExpandAnimation.js +47 -20
  260. package/lib-module/utils/children.js +4 -3
  261. package/lib-module/utils/input.js +28 -29
  262. package/lib-module/utils/pressability.js +35 -21
  263. package/lib-module/utils/props/clickProps.js +2 -1
  264. package/lib-module/utils/props/componentPropType.js +3 -3
  265. package/lib-module/utils/props/getPropSelector.js +6 -3
  266. package/lib-module/utils/props/handlerProps.js +24 -18
  267. package/lib-module/utils/props/hrefAttrsProp.js +14 -11
  268. package/lib-module/utils/props/inputSupportsProps.js +15 -12
  269. package/lib-module/utils/props/linkProps.js +7 -6
  270. package/lib-module/utils/props/selectSystemProps.js +2 -2
  271. package/lib-module/utils/props/tokens.js +27 -14
  272. package/lib-module/utils/ssr.js +5 -2
  273. package/lib-module/utils/useCopy.js +6 -4
  274. package/lib-module/utils/useHash.js +2 -1
  275. package/lib-module/utils/useSpacingScale.js +3 -1
  276. package/lib-module/utils/useUniqueId.js +3 -2
  277. package/lib-module/utils/withLinkRouter.js +6 -5
  278. package/package.json +13 -11
  279. package/src/ExpandCollapse/Panel.jsx +2 -19
  280. package/src/List/List.jsx +34 -19
  281. package/src/List/ListItem.jsx +12 -2
  282. package/src/Modal/Modal.jsx +2 -1
  283. package/src/Pagination/Pagination.jsx +3 -0
  284. package/src/Search/Search.jsx +11 -0
  285. package/src/Select/Item.native.jsx +0 -7
  286. package/src/Tabs/Tabs.jsx +24 -2
  287. package/src/Tabs/TabsItem.jsx +6 -5
  288. package/src/utils/animation/useVerticalExpandAnimation.js +47 -13
@@ -47,20 +47,21 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, foc
47
47
  * or the internal state in case of uncontrolled radio button.
48
48
  */
49
49
 
50
- const RadioCard = /*#__PURE__*/forwardRef(({
51
- tokens,
52
- variant,
53
- title,
54
- children,
55
- inactive,
56
- defaultChecked,
57
- checked,
58
- name: inputName,
59
- value,
60
- id,
61
- onChange,
62
- ...rest
63
- }, ref) => {
50
+ const RadioCard = /*#__PURE__*/forwardRef((_ref, ref) => {
51
+ let {
52
+ tokens,
53
+ variant,
54
+ title,
55
+ children,
56
+ inactive,
57
+ defaultChecked,
58
+ checked,
59
+ name: inputName,
60
+ value,
61
+ id,
62
+ onChange,
63
+ ...rest
64
+ } = _ref;
64
65
  const {
65
66
  currentValue: isChecked,
66
67
  setValue: setIsChecked,
@@ -78,7 +79,7 @@ const RadioCard = /*#__PURE__*/forwardRef(({
78
79
  };
79
80
 
80
81
  const uniqueId = useUniqueId('RadioCard');
81
- const inputId = id ?? uniqueId;
82
+ const inputId = id !== null && id !== void 0 ? id : uniqueId;
82
83
  const getTokens = useThemeTokensCallback('RadioCard', tokens, variant);
83
84
 
84
85
  const getCardTokens = cardState => selectPressableCardTokens(getTokens(cardState));
@@ -60,25 +60,26 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
60
60
  * ```
61
61
  */
62
62
 
63
- const RadioCardGroup = /*#__PURE__*/forwardRef(({
64
- copy = 'en',
65
- tokens,
66
- radioCardTokens,
67
- variant,
68
- items = [],
69
- legend,
70
- tooltip,
71
- hint,
72
- validation,
73
- feedback,
74
- initialCheckedId,
75
- checkedId,
76
- onChange,
77
- readOnly,
78
- name: inputGroupName,
79
- inactive,
80
- ...rest
81
- }, ref) => {
63
+ const RadioCardGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
64
+ let {
65
+ copy = 'en',
66
+ tokens,
67
+ radioCardTokens,
68
+ variant,
69
+ items = [],
70
+ legend,
71
+ tooltip,
72
+ hint,
73
+ validation,
74
+ feedback,
75
+ initialCheckedId,
76
+ checkedId,
77
+ onChange,
78
+ readOnly,
79
+ name: inputGroupName,
80
+ inactive,
81
+ ...rest
82
+ } = _ref;
82
83
  const viewport = useViewport();
83
84
  const {
84
85
  space,
@@ -103,7 +104,7 @@ const RadioCardGroup = /*#__PURE__*/forwardRef(({
103
104
  const uniqueFields = ['id'];
104
105
 
105
106
  if (!containUniqueFields(items, uniqueFields)) {
106
- throw new Error(`RadioCardGroup items must have unique ${uniqueFields.join(', ')}`);
107
+ throw new Error("RadioCardGroup items must have unique ".concat(uniqueFields.join(', ')));
107
108
  }
108
109
 
109
110
  return /*#__PURE__*/_jsx(Fieldset, {
@@ -122,14 +123,15 @@ const RadioCardGroup = /*#__PURE__*/forwardRef(({
122
123
  children: props => /*#__PURE__*/_jsx(StackContainer, {
123
124
  space: space,
124
125
  accessibilityRole: "radiogroup",
125
- children: items.map(({
126
- title,
127
- content,
128
- id,
129
- onChange: itemOnChange,
130
- ...itemRest
131
- }, index) => {
132
- const cardId = id || `RadioCard[${index}]`;
126
+ children: items.map((_ref2, index) => {
127
+ let {
128
+ title,
129
+ content,
130
+ id,
131
+ onChange: itemOnChange,
132
+ ...itemRest
133
+ } = _ref2;
134
+ const cardId = id || "RadioCard[".concat(index, "]");
133
135
 
134
136
  const handleChange = (newCheckedState, event) => {
135
137
  if (typeof itemOnChange === 'function') itemOnChange(newCheckedState, event);
@@ -14,11 +14,12 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
14
14
  const [selectContainerProps, selectedContainerPropTypes] = selectSystemProps([a11yProps, viewProps]);
15
15
  const [selectInputProps, selectedInputPropTypes] = selectSystemProps([textInputHandlerProps, textInputProps]);
16
16
 
17
- const selectInputTokens = ({
18
- searchTokens,
19
- buttonTokens,
20
- buttonsGapSize
21
- }) => {
17
+ const selectInputTokens = _ref => {
18
+ let {
19
+ searchTokens,
20
+ buttonTokens,
21
+ buttonsGapSize
22
+ } = _ref;
22
23
  const {
23
24
  paddingRight: inputPaddingRight,
24
25
  clearButtonIcon,
@@ -38,19 +39,25 @@ const selectInputTokens = ({
38
39
 
39
40
  const selectButtonTokens = tokens => selectTokens('Button', tokens);
40
41
 
41
- const selectIconsContainerStyle = ({
42
- paddingRight
43
- }) => ({
44
- paddingRight
45
- });
42
+ const selectIconsContainerStyle = _ref2 => {
43
+ let {
44
+ paddingRight
45
+ } = _ref2;
46
+ return {
47
+ paddingRight
48
+ };
49
+ };
46
50
 
47
- const selectIconTokens = ({
48
- iconSize,
49
- iconColor
50
- }) => ({
51
- color: iconColor,
52
- size: iconSize
53
- });
51
+ const selectIconTokens = _ref3 => {
52
+ let {
53
+ iconSize,
54
+ iconColor
55
+ } = _ref3;
56
+ return {
57
+ color: iconColor,
58
+ size: iconSize
59
+ };
60
+ };
54
61
  /**
55
62
  * The `Search` component is a combination of a `TextInput` and 2 different kinds of custom buttons.
56
63
  * Use `Search` to feature autocomplete interactions.
@@ -66,20 +73,22 @@ const selectIconTokens = ({
66
73
  */
67
74
 
68
75
 
69
- const Search = /*#__PURE__*/forwardRef(({
70
- initialValue,
71
- value,
72
- placeholder,
73
- inactive,
74
- onChange,
75
- onSubmit,
76
- onClear,
77
- accessibilityLabel,
78
- copy = 'en',
79
- tokens,
80
- variant,
81
- ...rest
82
- }, ref) => {
76
+ const Search = /*#__PURE__*/forwardRef((_ref4, ref) => {
77
+ let {
78
+ initialValue,
79
+ value,
80
+ placeholder,
81
+ inactive,
82
+ onChange,
83
+ onSubmit,
84
+ onClear,
85
+ onFocus,
86
+ accessibilityLabel,
87
+ copy = 'en',
88
+ tokens,
89
+ variant,
90
+ ...rest
91
+ } = _ref4;
83
92
  const {
84
93
  currentValue = '',
85
94
  setValue
@@ -117,11 +126,15 @@ const Search = /*#__PURE__*/forwardRef(({
117
126
  if (onClear !== undefined) onClear('', event);
118
127
  };
119
128
 
129
+ const handleFocus = event => {
130
+ if (onFocus !== undefined) onFocus(event);
131
+ };
132
+
120
133
  const isEmpty = currentValue === ''; // Accessibility label should always be present and correctly localised
121
134
 
122
135
  const a11yLabelText = accessibilityLabel || getCopy('accessibilityLabel'); // Placeholder is optional and may be unset by passing an empty string
123
136
 
124
- const placeholderText = placeholder ?? a11yLabelText;
137
+ const placeholderText = placeholder !== null && placeholder !== void 0 ? placeholder : a11yLabelText;
125
138
  return /*#__PURE__*/_jsxs(View, {
126
139
  style: staticStyles.container,
127
140
  ...selectContainerProps(rest),
@@ -141,6 +154,7 @@ const Search = /*#__PURE__*/forwardRef(({
141
154
  value: currentValue,
142
155
  onChange: setValue,
143
156
  onSubmitEditing: handleSubmit,
157
+ onFocus: handleFocus,
144
158
  accessibilityLabel: a11yLabelText
145
159
  }), /*#__PURE__*/_jsx(View, {
146
160
  style: [staticStyles.iconsContainer, selectIconsContainerStyle(themeTokens)],
@@ -211,6 +225,12 @@ Search.propTypes = { ...selectedContainerPropTypes,
211
225
  onClear: PropTypes.func,
212
226
 
213
227
  /**
228
+ * Triggered when the search input is focused.
229
+ */
230
+ onFocus: PropTypes.func,
231
+
232
+ /**
233
+ *
214
234
  * Use to provide an accessible label for the input (visually hidden).
215
235
  */
216
236
  accessibilityLabel: PropTypes.string,
@@ -3,10 +3,11 @@ import PropTypes from 'prop-types';
3
3
  import { componentPropType } from '../utils';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
 
6
- const Group = ({
7
- children,
8
- label
9
- }) => {
6
+ const Group = _ref => {
7
+ let {
8
+ children,
9
+ label
10
+ } = _ref;
10
11
  return /*#__PURE__*/_jsx("optgroup", {
11
12
  label: label,
12
13
  children: children
@@ -1,9 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import { componentPropType } from '../utils';
3
3
 
4
- const Group = ({
5
- children
6
- }) => {
4
+ const Group = _ref => {
5
+ let {
6
+ children
7
+ } = _ref;
7
8
  return children;
8
9
  };
9
10
 
@@ -2,13 +2,16 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
 
5
- const Item = ({
6
- children,
7
- value
8
- }) => /*#__PURE__*/_jsx("option", {
9
- value: value,
10
- children: children
11
- });
5
+ const Item = _ref => {
6
+ let {
7
+ children,
8
+ value
9
+ } = _ref;
10
+ return /*#__PURE__*/_jsx("option", {
11
+ value: value,
12
+ children: children
13
+ });
14
+ };
12
15
 
13
16
  export default Item;
14
17
  Item.propTypes = {
@@ -1,9 +1,3 @@
1
- import PropTypes from 'prop-types';
2
-
3
1
  const Item = () => null;
4
2
 
5
- export default Item;
6
- Item.propTypes = {
7
- children: PropTypes.string.isRequired,
8
- value: PropTypes.string.isRequired
9
- };
3
+ export default Item;
@@ -3,21 +3,22 @@ import PropTypes from 'prop-types';
3
3
  import { componentPropType } from '../utils';
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { jsxs as _jsxs } from "react/jsx-runtime";
6
- const Picker = /*#__PURE__*/forwardRef(({
7
- value,
8
- onChange,
9
- onFocus,
10
- onBlur,
11
- onMouseOver,
12
- onMouseOut,
13
- style,
14
- inactive,
15
- children,
16
- placeholder,
17
- nativeID,
18
- testID,
19
- ...rest
20
- }, ref) => {
6
+ const Picker = /*#__PURE__*/forwardRef((_ref, ref) => {
7
+ let {
8
+ value,
9
+ onChange,
10
+ onFocus,
11
+ onBlur,
12
+ onMouseOver,
13
+ onMouseOut,
14
+ style,
15
+ inactive,
16
+ children,
17
+ placeholder,
18
+ nativeID,
19
+ testID,
20
+ ...rest
21
+ } = _ref;
21
22
  const {
22
23
  accessibilityLabel,
23
24
  accessibilityDescribedBy,
@@ -9,39 +9,46 @@ import Group from './Group'; // styling of the native input is very limited, mos
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
11
11
 
12
- const selectAndroidInputStyles = ({
13
- height = 0,
14
- paddingBottom = 0,
15
- paddingTop = 0,
16
- borderWidth = 0,
17
- color
18
- }) => ({
19
- height: height - paddingTop - paddingBottom - 2 * borderWidth,
20
- color
21
- }); // the native input has a side padding of 8px, which can't be adjusted, so we have to account for that in the container
12
+ const selectAndroidInputStyles = _ref => {
13
+ let {
14
+ height = 0,
15
+ paddingBottom = 0,
16
+ paddingTop = 0,
17
+ borderWidth = 0,
18
+ color
19
+ } = _ref;
20
+ return {
21
+ height: height - paddingTop - paddingBottom - 2 * borderWidth,
22
+ color
23
+ };
24
+ }; // the native input has a side padding of 8px, which can't be adjusted, so we have to account for that in the container
22
25
 
23
26
 
24
- const selectAndroidContainerStyles = ({
25
- paddingLeft = 0,
26
- paddingRight = 0,
27
- ...rest
28
- }) => ({
29
- paddingLeft: paddingLeft > 8 ? paddingLeft - 8 : 0,
30
- paddingRight: paddingRight > 8 ? paddingRight - 8 : 0,
31
- ...rest
32
- });
27
+ const selectAndroidContainerStyles = _ref2 => {
28
+ let {
29
+ paddingLeft = 0,
30
+ paddingRight = 0,
31
+ ...rest
32
+ } = _ref2;
33
+ return {
34
+ paddingLeft: paddingLeft > 8 ? paddingLeft - 8 : 0,
35
+ paddingRight: paddingRight > 8 ? paddingRight - 8 : 0,
36
+ ...rest
37
+ };
38
+ };
33
39
 
34
- const Picker = /*#__PURE__*/forwardRef(({
35
- value,
36
- onChange,
37
- onFocus,
38
- onBlur,
39
- style,
40
- inactive,
41
- children,
42
- placeholder,
43
- ...rest
44
- }, ref) => {
40
+ const Picker = /*#__PURE__*/forwardRef((_ref3, ref) => {
41
+ let {
42
+ value,
43
+ onChange,
44
+ onFocus,
45
+ onBlur,
46
+ style,
47
+ inactive,
48
+ children,
49
+ placeholder,
50
+ ...rest
51
+ } = _ref3;
45
52
  // ungroup items, since there's no way to support groups on native
46
53
  const flatChildren = Children.toArray(children).flatMap(child => {
47
54
  if (child.type === Group) {
@@ -50,12 +57,15 @@ const Picker = /*#__PURE__*/forwardRef(({
50
57
 
51
58
  return child;
52
59
  });
53
- const items = flatChildren.map(({
54
- props
55
- }) => ({
56
- label: props.children,
57
- value: props.value
58
- })); // Unlike other input components, react-native-picker-select doesn't pass an event to its change fn.
60
+ const items = flatChildren.map(_ref4 => {
61
+ let {
62
+ props
63
+ } = _ref4;
64
+ return {
65
+ label: props.children,
66
+ value: props.value
67
+ };
68
+ }); // Unlike other input components, react-native-picker-select doesn't pass an event to its change fn.
59
69
 
60
70
  const handleChange = (newValue, index) => {
61
71
  if (onChange) onChange(newValue, {