@telus-uds/components-base 1.60.0 → 1.62.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 (66) hide show
  1. package/CHANGELOG.md +19 -2
  2. package/component-docs.json +306 -116
  3. package/lib/Autocomplete/Autocomplete.js +483 -0
  4. package/lib/Autocomplete/Loading.js +51 -0
  5. package/lib/Autocomplete/Suggestions.js +85 -0
  6. package/lib/Autocomplete/constants.js +14 -0
  7. package/lib/Autocomplete/dictionary.js +19 -0
  8. package/lib/Autocomplete/index.js +13 -0
  9. package/lib/IconButton/IconButton.js +28 -9
  10. package/lib/Listbox/GroupControl.js +121 -0
  11. package/lib/Listbox/Listbox.js +198 -0
  12. package/lib/Listbox/ListboxGroup.js +142 -0
  13. package/lib/Listbox/ListboxItem.js +97 -0
  14. package/lib/Listbox/ListboxOverlay.js +106 -0
  15. package/lib/Listbox/PressableItem.js +0 -2
  16. package/lib/Listbox/index.js +5 -24
  17. package/lib/SideNav/Item.js +7 -15
  18. package/lib/TextInput/TextInputBase.js +8 -1
  19. package/lib/Tooltip/Tooltip.js +5 -1
  20. package/lib/Tooltip/Tooltip.native.js +5 -1
  21. package/lib/Tooltip/shared.js +5 -0
  22. package/lib/index.js +17 -13
  23. package/lib/utils/useOverlaidPosition.js +6 -4
  24. package/lib-module/Autocomplete/Autocomplete.js +448 -0
  25. package/lib-module/Autocomplete/Loading.js +36 -0
  26. package/lib-module/Autocomplete/Suggestions.js +66 -0
  27. package/lib-module/Autocomplete/constants.js +4 -0
  28. package/lib-module/Autocomplete/dictionary.js +12 -0
  29. package/lib-module/Autocomplete/index.js +2 -0
  30. package/lib-module/IconButton/IconButton.js +30 -10
  31. package/lib-module/Listbox/GroupControl.js +102 -0
  32. package/lib-module/Listbox/Listbox.js +172 -0
  33. package/lib-module/Listbox/ListboxGroup.js +117 -0
  34. package/lib-module/Listbox/ListboxItem.js +71 -0
  35. package/lib-module/Listbox/ListboxOverlay.js +80 -0
  36. package/lib-module/Listbox/PressableItem.js +0 -2
  37. package/lib-module/Listbox/index.js +2 -2
  38. package/lib-module/SideNav/Item.js +7 -15
  39. package/lib-module/TextInput/TextInputBase.js +8 -1
  40. package/lib-module/Tooltip/Tooltip.js +5 -1
  41. package/lib-module/Tooltip/Tooltip.native.js +5 -1
  42. package/lib-module/Tooltip/shared.js +5 -0
  43. package/lib-module/index.js +2 -1
  44. package/lib-module/utils/useOverlaidPosition.js +5 -4
  45. package/package.json +4 -2
  46. package/src/Autocomplete/Autocomplete.jsx +411 -0
  47. package/src/Autocomplete/Loading.jsx +18 -0
  48. package/src/Autocomplete/Suggestions.jsx +54 -0
  49. package/src/Autocomplete/constants.js +4 -0
  50. package/src/Autocomplete/dictionary.js +12 -0
  51. package/src/Autocomplete/index.js +3 -0
  52. package/src/IconButton/IconButton.jsx +62 -35
  53. package/src/Listbox/GroupControl.jsx +93 -0
  54. package/src/Listbox/Listbox.jsx +165 -0
  55. package/src/Listbox/ListboxGroup.jsx +120 -0
  56. package/src/Listbox/ListboxItem.jsx +76 -0
  57. package/src/Listbox/ListboxOverlay.jsx +82 -0
  58. package/src/Listbox/PressableItem.jsx +0 -2
  59. package/src/Listbox/index.js +3 -2
  60. package/src/SideNav/Item.jsx +7 -13
  61. package/src/TextInput/TextInputBase.jsx +4 -1
  62. package/src/Tooltip/Tooltip.jsx +15 -2
  63. package/src/Tooltip/Tooltip.native.jsx +15 -2
  64. package/src/Tooltip/shared.js +4 -0
  65. package/src/index.js +2 -1
  66. package/src/utils/useOverlaidPosition.js +6 -5
@@ -0,0 +1,102 @@
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 Text from "react-native-web/dist/exports/Text";
6
+ import { useThemeTokens } from '../ThemeProvider';
7
+ import Icon from '../Icon';
8
+ import Spacer from '../Spacer';
9
+ import { useListboxContext } from './ListboxContext';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
12
+ const styles = StyleSheet.create({
13
+ controlWrapper: {
14
+ width: '100%',
15
+ flex: 1,
16
+ alignItems: 'center',
17
+ flexDirection: 'row',
18
+ justifyContent: 'space-between',
19
+ boxSizing: 'border-box'
20
+ }
21
+ });
22
+
23
+ const GroupControl = _ref => {
24
+ let {
25
+ expanded,
26
+ pressed,
27
+ hover,
28
+ focus,
29
+ label,
30
+ id
31
+ } = _ref;
32
+ const {
33
+ selectedId,
34
+ setSelectedId
35
+ } = useListboxContext();
36
+ const tokens = useThemeTokens('Listbox', {}, {}, {
37
+ expanded,
38
+ pressed,
39
+ hover,
40
+ current: selectedId === id && id !== undefined,
41
+ focus
42
+ });
43
+ const {
44
+ groupFontName,
45
+ groupFontWeight,
46
+ groupFontSize,
47
+ groupColor,
48
+ groupBackgroundColor,
49
+ groupBorderColor,
50
+ groupBorderWidth,
51
+ groupBorderRadius,
52
+ groupPaddingLeft,
53
+ groupPaddingRight,
54
+ groupPaddingTop,
55
+ groupPaddingBottom,
56
+ itemTextDecoration,
57
+ itemOutline,
58
+ groupHeight
59
+ } = tokens;
60
+ return /*#__PURE__*/_jsxs(View, {
61
+ onPress: () => setSelectedId(id),
62
+ style: [styles.controlWrapper, {
63
+ fontFamily: `${groupFontName}${groupFontWeight}normal`,
64
+ fontSize: groupFontSize,
65
+ color: groupColor,
66
+ textDecoration: itemTextDecoration,
67
+ backgroundColor: groupBackgroundColor,
68
+ outline: itemOutline,
69
+ height: groupHeight,
70
+ border: `${groupBorderWidth}px solid ${groupBorderColor}`,
71
+ borderRadius: groupBorderRadius,
72
+ paddingLeft: groupPaddingLeft - groupBorderWidth,
73
+ paddingRight: groupPaddingRight - groupBorderWidth,
74
+ paddingTop: groupPaddingTop - groupBorderWidth,
75
+ paddingBottom: groupPaddingBottom - groupBorderWidth
76
+ }],
77
+ children: [/*#__PURE__*/_jsx(Text, {
78
+ children: label
79
+ }), /*#__PURE__*/_jsx(Spacer, {
80
+ space: 1,
81
+ direction: "row"
82
+ }), /*#__PURE__*/_jsx(Icon, {
83
+ icon: tokens.groupIcon,
84
+ tokens: {
85
+ color: tokens.groupColor
86
+ },
87
+ variant: {
88
+ size: 'micro'
89
+ }
90
+ })]
91
+ });
92
+ };
93
+
94
+ GroupControl.propTypes = {
95
+ id: PropTypes.string,
96
+ expanded: PropTypes.bool,
97
+ pressed: PropTypes.bool,
98
+ hover: PropTypes.bool,
99
+ focus: PropTypes.bool,
100
+ label: PropTypes.string
101
+ };
102
+ export default GroupControl;
@@ -0,0 +1,172 @@
1
+ import React, { useCallback, useEffect, useRef, useState } 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 Platform from "react-native-web/dist/exports/Platform";
6
+ import { useThemeTokens } from '../ThemeProvider';
7
+ import { withLinkRouter, getTokensPropType } from '../utils';
8
+ import ExpandCollapse from '../ExpandCollapse';
9
+ import ListboxGroup from './ListboxGroup';
10
+ import ListboxItem from './ListboxItem';
11
+ import { ListboxContext } from './ListboxContext';
12
+ import DropdownOverlay from './ListboxOverlay';
13
+ import { createElement as _createElement } from "react";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
+ const styles = StyleSheet.create({
16
+ list: {
17
+ padding: 0,
18
+ margin: 0
19
+ }
20
+ });
21
+
22
+ const getInitialOpen = (items, selectedId) => items.filter(item => item.items && item.items.some(nestedItem => (nestedItem.id ?? nestedItem.label) === selectedId)).map(item => item.id ?? item.label);
23
+
24
+ const Listbox = _ref => {
25
+ let {
26
+ items = [],
27
+ firstItemRef = null,
28
+ // focus will be moved to this one once within the menu
29
+ parentRef = null,
30
+ // to return focus to after leaving the last menu item
31
+ selectedId: defaultSelectedId,
32
+ LinkRouter,
33
+ itemRouterProps,
34
+ onClose,
35
+ variant,
36
+ tokens
37
+ } = _ref;
38
+ const initialOpen = getInitialOpen(items, defaultSelectedId);
39
+ const [selectedId, setSelectedId] = useState(defaultSelectedId);
40
+ const {
41
+ minHeight,
42
+ minWidth
43
+ } = useThemeTokens('Listbox', variant, tokens); // We need to keep track of each item's ref in order to be able to
44
+ // focus on a specific item via keyboard navigation
45
+
46
+ const itemRefs = useRef([]);
47
+ if (firstItemRef !== null && firstItemRef !== void 0 && firstItemRef.current) itemRefs.current[0] = firstItemRef.current;
48
+ const [focusedIndex, setFocusedIndex] = useState(0);
49
+ const handleKeydown = useCallback(event => {
50
+ const nextItemRef = itemRefs.current[focusedIndex + 1];
51
+ const prevItemRef = itemRefs.current[focusedIndex - 1];
52
+
53
+ if (event.key === 'ArrowUp' || event.shiftKey && event.key === 'Tab') {
54
+ var _parentRef$current;
55
+
56
+ // Move the focus to the previous item or to the parent one if on the first
57
+ if (prevItemRef) {
58
+ event.preventDefault();
59
+ prevItemRef.focus();
60
+ } else if (parentRef) (_parentRef$current = parentRef.current) === null || _parentRef$current === void 0 ? void 0 : _parentRef$current.focus();
61
+
62
+ setFocusedIndex(focusedIndex - 1);
63
+ } else if ((event.key === 'ArrowDown' || event.key === 'Tab') && nextItemRef) {
64
+ event.preventDefault();
65
+ setFocusedIndex(focusedIndex + 1);
66
+ nextItemRef.focus();
67
+ } else if (event.key === 'Escape') {
68
+ var _parentRef$current2, _parentRef$current3;
69
+
70
+ // Close the dropdown
71
+ parentRef === null || parentRef === void 0 ? void 0 : (_parentRef$current2 = parentRef.current) === null || _parentRef$current2 === void 0 ? void 0 : _parentRef$current2.click(); // Return focus to the dropdown control after leaving the last item
72
+
73
+ parentRef === null || parentRef === void 0 ? void 0 : (_parentRef$current3 = parentRef.current) === null || _parentRef$current3 === void 0 ? void 0 : _parentRef$current3.focus();
74
+ if (onClose) onClose(event);
75
+ }
76
+ }, [focusedIndex, onClose, parentRef]); // Add listeners for mouse clicks outside and for key presses
77
+
78
+ useEffect(() => {
79
+ if (Platform.OS === 'web') {
80
+ window.addEventListener('click', onClose);
81
+ window.addEventListener('keydown', handleKeydown);
82
+ window.addEventListener('touchstart', onClose);
83
+ return () => {
84
+ window.removeEventListener('click', onClose);
85
+ window.removeEventListener('keydown', handleKeydown);
86
+ window.removeEventListener('touchstart', onClose);
87
+ };
88
+ }
89
+
90
+ return () => {};
91
+ }, [onClose, handleKeydown]);
92
+ return /*#__PURE__*/_jsx(ListboxContext.Provider, {
93
+ value: {
94
+ selectedId,
95
+ setSelectedId
96
+ },
97
+ children: /*#__PURE__*/_jsx(ExpandCollapse, {
98
+ initialOpen: initialOpen,
99
+ maxOpen: 1,
100
+ children: expandProps => /*#__PURE__*/_jsx(View, {
101
+ style: [styles.list, {
102
+ minHeight,
103
+ minWidth
104
+ }],
105
+ role: "listbox",
106
+ children: items.map((item, index) => {
107
+ const {
108
+ id,
109
+ label,
110
+ items: nestedItems
111
+ } = item;
112
+ const itemId = id ?? label; // Give the list of refs.
113
+
114
+ const itemRef = ref => {
115
+ itemRefs.current[index] = ref;
116
+ return ref;
117
+ };
118
+
119
+ return nestedItems ? /*#__PURE__*/_createElement(ListboxGroup, { ...item,
120
+ expandProps: expandProps,
121
+ LinkRouter: LinkRouter,
122
+ itemRouterProps: itemRouterProps,
123
+ prevItemRef: itemRefs.current[index - 1] ?? null,
124
+ nextItemRef: itemRefs.current[index + 1] ?? null,
125
+ ref: index === 0 ? firstItemRef : itemRef,
126
+ key: itemId
127
+ }) : /*#__PURE__*/_createElement(ListboxItem, { ...item,
128
+ key: itemId,
129
+ id: itemId,
130
+ LinkRouter: LinkRouter,
131
+ itemRouterProps: itemRouterProps,
132
+ prevItemRef: itemRefs.current[index - 1] ?? null,
133
+ nextItemRef: itemRefs.current[index + 1] ?? null,
134
+ ref: index === 0 ? firstItemRef : itemRef
135
+ });
136
+ })
137
+ })
138
+ })
139
+ });
140
+ };
141
+
142
+ Listbox.propTypes = { ...withLinkRouter.propTypes,
143
+
144
+ /**
145
+ * Focus will be moved to the item with this ref once within the menu.
146
+ */
147
+ firstItemRef: PropTypes.object,
148
+
149
+ /**
150
+ * Focus will be returned to the dropdown control with this ref after leaving
151
+ * the last menu item.
152
+ */
153
+ parentRef: PropTypes.object,
154
+
155
+ /**
156
+ * `Listbox` items
157
+ */
158
+ items: PropTypes.array,
159
+
160
+ /**
161
+ * To select an item by default
162
+ */
163
+ selectedId: PropTypes.string,
164
+
165
+ /**
166
+ * onClose event
167
+ */
168
+ onClose: PropTypes.func,
169
+ tokens: getTokensPropType('Listbox')
170
+ };
171
+ Listbox.Overlay = DropdownOverlay;
172
+ export default Listbox;
@@ -0,0 +1,117 @@
1
+ /* eslint-disable react-native-a11y/has-valid-accessibility-role */
2
+ import React, { forwardRef } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import View from "react-native-web/dist/exports/View";
5
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
6
+ import { withLinkRouter } from '../utils';
7
+ import ExpandCollapse from '../ExpandCollapse';
8
+ import ListboxItem from './ListboxItem';
9
+ import { useListboxContext } from './ListboxContext';
10
+ import GroupControl from './GroupControl';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ const styles = StyleSheet.create({
13
+ groupWrapper: {
14
+ margin: 0,
15
+ padding: 0,
16
+ overflow: 'hidden'
17
+ },
18
+ list: {
19
+ margin: 0,
20
+ padding: 0
21
+ }
22
+ });
23
+ const ListboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
24
+ let {
25
+ id,
26
+ label,
27
+ items,
28
+ LinkRouter,
29
+ linkRouterProps,
30
+ expandProps,
31
+ onLastItemBlur,
32
+ nextItemRef,
33
+ prevItemRef
34
+ } = _ref;
35
+ const {
36
+ selectedId
37
+ } = useListboxContext(); // TODO: implement keyboard navigation via refs for grouped items separately here
38
+
39
+ return /*#__PURE__*/_jsx(View, {
40
+ id: "test",
41
+ style: styles.groupWrapper,
42
+ accessibilityRole: "listitem",
43
+ children: /*#__PURE__*/_jsx(ExpandCollapse.Panel, {
44
+ panelId: id ?? label,
45
+ controlTokens: {
46
+ icon: null,
47
+ paddingLeft: 0,
48
+ paddingRight: 0,
49
+ paddingTop: 0,
50
+ paddingBottom: 0,
51
+ backgroundColor: 'transparent',
52
+ borderColor: 'transparent',
53
+ textLine: 'none',
54
+ borderWidth: 0
55
+ } // TODO refactor
56
+ // eslint-disable-next-line react/no-unstable-nested-components
57
+ ,
58
+ control: controlProps => /*#__PURE__*/_jsx(GroupControl, {
59
+ id: id ?? label,
60
+ ...controlProps,
61
+ label: label
62
+ }),
63
+ ...expandProps,
64
+ tokens: {
65
+ contentPaddingLeft: 0,
66
+ contentPaddingRight: 0,
67
+ contentPaddingTop: 0,
68
+ contentPaddingBottom: 0,
69
+ borderColor: 'transparent',
70
+ borderRadius: 0,
71
+ borderWidth: 0,
72
+ marginBottom: 0
73
+ },
74
+ controlRef: ref,
75
+ children: /*#__PURE__*/_jsx(View, {
76
+ style: styles.list,
77
+ children: items.map((item, index) => {
78
+ return /*#__PURE__*/_jsx(ListboxItem, {
79
+ id: item.id ?? item.label,
80
+ ...item,
81
+ selected: item.id && item.id === selectedId || item.label && item.label === selectedId,
82
+ isChild: true,
83
+ LinkRouter: LinkRouter,
84
+ linkRouterProps: linkRouterProps,
85
+ ...(index === 0 && {
86
+ prevItemRef
87
+ }),
88
+ ...(index === items.length - 1 && {
89
+ nextItemRef
90
+ }),
91
+ ...(index === items.length - 1 && {
92
+ onBlur: onLastItemBlur
93
+ })
94
+ }, item.label);
95
+ })
96
+ })
97
+ })
98
+ });
99
+ });
100
+ ListboxGroup.displayName = 'ListboxGroup';
101
+ ListboxGroup.propTypes = { ...withLinkRouter.propTypes,
102
+ label: PropTypes.string,
103
+ items: PropTypes.arrayOf(PropTypes.shape({
104
+ href: PropTypes.string,
105
+ label: PropTypes.string,
106
+ current: PropTypes.bool
107
+ })),
108
+ expandProps: PropTypes.object,
109
+ nextItemRef: PropTypes.object,
110
+ prevItemRef: PropTypes.object,
111
+
112
+ /**
113
+ * Use this callback to redirect the focus after it leaves the last item of the group.
114
+ */
115
+ onLastItemBlur: PropTypes.func
116
+ };
117
+ export default ListboxGroup;
@@ -0,0 +1,71 @@
1
+ /* eslint-disable react/require-default-props */
2
+ import React, { forwardRef } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import View from "react-native-web/dist/exports/View";
5
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
6
+ import { selectSystemProps, withLinkRouter, htmlAttrs } from '../utils';
7
+ import PressableItem from './PressableItem';
8
+ import { useThemeTokensCallback } from '../ThemeProvider';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
11
+ const styles = StyleSheet.create({
12
+ itemContainer: {
13
+ display: 'flex',
14
+ margin: 0
15
+ },
16
+ childContainer: {
17
+ paddingLeft: 16
18
+ }
19
+ });
20
+ const ListboxItem = /*#__PURE__*/forwardRef((_ref, ref) => {
21
+ let {
22
+ href,
23
+ label,
24
+ isChild = false,
25
+ onBlur,
26
+ nextItemRef,
27
+ prevItemRef,
28
+ tokens,
29
+ variant = {},
30
+ LinkRouter,
31
+ linkRouterProps,
32
+ id,
33
+ onPress = () => {},
34
+ ...rest
35
+ } = _ref;
36
+ const selectedProps = selectProps({
37
+ href,
38
+ ...rest
39
+ });
40
+ const getTokens = useThemeTokensCallback('Listbox', tokens, variant, {
41
+ isChild
42
+ });
43
+ return /*#__PURE__*/_jsx(View, {
44
+ style: [styles.itemContainer, isChild && styles.childContainer],
45
+ role: "option",
46
+ children: /*#__PURE__*/_jsx(PressableItem, {
47
+ href: href,
48
+ isChild: isChild,
49
+ onPress: onPress,
50
+ onBlur: onBlur,
51
+ nextItemRef: nextItemRef,
52
+ prevItemRef: prevItemRef,
53
+ ref: ref,
54
+ tokens: getTokens,
55
+ selectedProps: selectedProps,
56
+ id: id,
57
+ children: label
58
+ })
59
+ });
60
+ });
61
+ ListboxItem.displayName = 'ListboxItem';
62
+ ListboxItem.propTypes = { ...selectedSystemPropTypes,
63
+ ...withLinkRouter.propTypes,
64
+ href: PropTypes.string,
65
+ isChild: PropTypes.bool,
66
+ label: PropTypes.node.isRequired,
67
+ nextItemRef: PropTypes.object,
68
+ prevItemRef: PropTypes.object,
69
+ onPress: PropTypes.func
70
+ };
71
+ export default withLinkRouter(ListboxItem);
@@ -0,0 +1,80 @@
1
+ /* eslint-disable react/require-default-props */
2
+ import React, { forwardRef } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import View from "react-native-web/dist/exports/View";
5
+ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
6
+ import Platform from "react-native-web/dist/exports/Platform";
7
+ import { Portal } from '@gorhom/portal';
8
+ import { useThemeTokens } from '../ThemeProvider';
9
+ import Card from '../Card';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const staticStyles = StyleSheet.create({
12
+ positioner: {
13
+ flex: 1,
14
+ // Grow to maxWidth when possible, shrink when not possible
15
+ position: 'absolute',
16
+ zIndex: 1000000000000000 // Position on top of all the other overlays, including backdrops and modals
17
+
18
+ },
19
+ hidden: {
20
+ // Use opacity not visibility to hide the dropdown during positioning
21
+ // so on web, children may be focused from the first render
22
+ opacity: 0
23
+ }
24
+ });
25
+ const paddingVertical = 0;
26
+ const paddingHorizontal = 0;
27
+ const DropdownOverlay = /*#__PURE__*/forwardRef((_ref, ref) => {
28
+ let {
29
+ children,
30
+ isReady = false,
31
+ overlaidPosition,
32
+ maxWidth,
33
+ minWidth,
34
+ onLayout
35
+ } = _ref;
36
+ const systemTokens = useThemeTokens('Listbox', {}, {});
37
+ return /*#__PURE__*/_jsx(View, {
38
+ ref: ref,
39
+ onLayout: onLayout,
40
+ style: [overlaidPosition, {
41
+ maxWidth,
42
+ minWidth
43
+ }, staticStyles.positioner, !isReady && staticStyles.hidden],
44
+ children: /*#__PURE__*/_jsx(Card, {
45
+ tokens: {
46
+ shadow: systemTokens.shadow,
47
+ paddingBottom: paddingVertical,
48
+ paddingTop: paddingVertical,
49
+ paddingLeft: paddingHorizontal,
50
+ paddingRight: paddingHorizontal
51
+ },
52
+ children: children
53
+ })
54
+ });
55
+ });
56
+
57
+ const withPortal = Overlay => {
58
+ // eslint-disable-next-line react/display-name, react/no-multi-comp
59
+ return props => {
60
+ return /*#__PURE__*/_jsx(Portal, {
61
+ children: /*#__PURE__*/_jsx(Overlay, { ...props
62
+ })
63
+ });
64
+ };
65
+ };
66
+
67
+ DropdownOverlay.displayName = 'DropdownOverlay';
68
+ DropdownOverlay.propTypes = {
69
+ children: PropTypes.node.isRequired,
70
+ isReady: PropTypes.bool,
71
+ overlaidPosition: PropTypes.shape({
72
+ top: PropTypes.number,
73
+ left: PropTypes.number,
74
+ width: PropTypes.number
75
+ }),
76
+ maxWidth: PropTypes.number,
77
+ minWidth: PropTypes.number,
78
+ onLayout: PropTypes.func
79
+ };
80
+ export default Platform.OS === 'web' ? withPortal(DropdownOverlay) : DropdownOverlay;
@@ -21,7 +21,6 @@ const getItemStyles = _ref => {
21
21
  itemPaddingRight,
22
22
  itemBackgroundColor,
23
23
  itemColor,
24
- itemDisplay,
25
24
  itemOutline,
26
25
  itemTextDecoration,
27
26
  itemBorderLeftColor,
@@ -43,7 +42,6 @@ const getItemStyles = _ref => {
43
42
  width: '100%',
44
43
  backgroundColor: itemBackgroundColor,
45
44
  color: itemColor,
46
- display: itemDisplay,
47
45
  outline: itemOutline,
48
46
  textDecoration: itemTextDecoration,
49
47
  borderLeft: `${itemBorderLeftWidth}px solid ${itemBorderLeftColor}`,
@@ -1,2 +1,2 @@
1
- export * from './ListboxContext';
2
- export { default as PressableItem } from './PressableItem';
1
+ import Listbox from './Listbox';
2
+ export default Listbox;
@@ -116,13 +116,13 @@ Item.propTypes = { ...selectedSystemPropTypes,
116
116
  children: PropTypes.node.isRequired,
117
117
 
118
118
  /**
119
- *
119
+ * @ignore
120
120
  * Set internally in `SideNav` render function - used to keep track of active item.
121
121
  */
122
122
  itemId: PropTypes.string,
123
123
 
124
124
  /**
125
- *
125
+ * @ignore
126
126
  * Set internally in `SideNav` render function - used to keep track of expanded items groups.
127
127
  */
128
128
  groupId: PropTypes.string,
@@ -136,27 +136,19 @@ Item.propTypes = { ...selectedSystemPropTypes,
136
136
  hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
137
137
 
138
138
  /**
139
- *
139
+ * @ignore
140
140
  * Set internally in `SideNav` render function.
141
141
  */
142
142
  isActive: PropTypes.bool,
143
143
 
144
144
  /**
145
- *
145
+ * @ignore
146
146
  * Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
147
147
  */
148
148
  isExpanded: PropTypes.bool,
149
- tokens: getTokensPropType('SideNavItem'),
150
- variant: variantProp.propType,
151
-
152
- /**
153
- * Accesibility Role
154
- */
155
149
  accessibilityRole: PropTypes.string,
156
-
157
- /**
158
- * test ID
159
- */
160
- testID: PropTypes.number
150
+ testID: PropTypes.number,
151
+ tokens: getTokensPropType('SideNavItem'),
152
+ variant: variantProp.propType
161
153
  };
162
154
  export default Item;
@@ -269,7 +269,12 @@ const TextInputBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
269
269
  variant: {
270
270
  compact: true,
271
271
  password: true,
272
- inactive: !!variant.inactive
272
+ inactive: variant.inactive,
273
+ size: 'large'
274
+ },
275
+ tokens: {
276
+ width: 40,
277
+ height: 40
273
278
  }
274
279
  }, !showPassword ? 'hide' : 'show'));
275
280
  }
@@ -347,6 +352,8 @@ export default TextInputBase;
347
352
  const staticStyles = StyleSheet.create({
348
353
  buttonsContainer: {
349
354
  position: 'absolute',
355
+ flexDirection: 'row',
356
+ alignItems: 'center',
350
357
  right: 0,
351
358
  top: 0,
352
359
  bottom: 0,
@@ -123,6 +123,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
123
123
  content,
124
124
  position = 'auto',
125
125
  copy = 'en',
126
+ onPress = () => {},
126
127
  tokens,
127
128
  variant,
128
129
  inline = false,
@@ -163,7 +164,10 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
163
164
  });
164
165
  const themeTokens = useThemeTokens('Tooltip', tokens, variant);
165
166
 
166
- const toggleIsOpen = () => setIsOpen(!isOpen);
167
+ const toggleIsOpen = () => {
168
+ onPress();
169
+ setIsOpen(!isOpen);
170
+ };
167
171
 
168
172
  const close = () => setIsOpen(false);
169
173
 
@@ -150,6 +150,7 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
150
150
  content,
151
151
  position = 'auto',
152
152
  copy = 'en',
153
+ onPress = () => {},
153
154
  tokens,
154
155
  variant,
155
156
  inline = false,
@@ -180,7 +181,10 @@ const Tooltip = /*#__PURE__*/forwardRef((_ref6, ref) => {
180
181
  return () => subscription === null || subscription === void 0 ? void 0 : subscription.remove();
181
182
  });
182
183
 
183
- const toggleIsOpen = () => setIsOpen(!isOpen);
184
+ const toggleIsOpen = () => {
185
+ onPress();
186
+ setIsOpen(!isOpen);
187
+ };
184
188
 
185
189
  const close = () => setIsOpen(false);
186
190
 
@@ -26,6 +26,11 @@ const propTypes = {
26
26
  * Display tooltip icon button as an inline element.
27
27
  */
28
28
  inline: PropTypes.bool,
29
+
30
+ /**
31
+ * Callback function triggered when the tooltip is pressed.
32
+ */
33
+ onPress: PropTypes.func,
29
34
  tokens: getTokensPropType('Tooltip'),
30
35
  variant: variantProp.propType
31
36
  };