@telus-uds/components-base 1.59.2 → 1.61.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 (90) hide show
  1. package/CHANGELOG.md +26 -2
  2. package/component-docs.json +526 -76
  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/Button/ButtonLink.js +7 -3
  10. package/lib/ExpandCollapse/Panel.js +7 -0
  11. package/lib/IconButton/IconButton.js +8 -0
  12. package/lib/Link/ChevronLink.js +9 -2
  13. package/lib/Link/LinkBase.js +14 -0
  14. package/lib/Link/TextButton.js +12 -1
  15. package/lib/Listbox/GroupControl.js +121 -0
  16. package/lib/Listbox/Listbox.js +198 -0
  17. package/lib/Listbox/ListboxGroup.js +142 -0
  18. package/lib/Listbox/ListboxItem.js +97 -0
  19. package/lib/Listbox/ListboxOverlay.js +106 -0
  20. package/lib/Listbox/PressableItem.js +0 -2
  21. package/lib/Listbox/index.js +5 -24
  22. package/lib/Pagination/dictionary.js +3 -3
  23. package/lib/Progress/ProgressBarBackground.js +2 -2
  24. package/lib/SideNav/Item.js +15 -5
  25. package/lib/Tags/Tags.js +6 -1
  26. package/lib/TextInput/TextInputBase.js +2 -0
  27. package/lib/Tooltip/Tooltip.js +6 -1
  28. package/lib/Tooltip/Tooltip.native.js +6 -1
  29. package/lib/Tooltip/shared.js +5 -0
  30. package/lib/index.js +17 -13
  31. package/lib/utils/useOverlaidPosition.js +6 -4
  32. package/lib-module/Autocomplete/Autocomplete.js +448 -0
  33. package/lib-module/Autocomplete/Loading.js +36 -0
  34. package/lib-module/Autocomplete/Suggestions.js +66 -0
  35. package/lib-module/Autocomplete/constants.js +4 -0
  36. package/lib-module/Autocomplete/dictionary.js +12 -0
  37. package/lib-module/Autocomplete/index.js +2 -0
  38. package/lib-module/Button/ButtonLink.js +4 -1
  39. package/lib-module/ExpandCollapse/Panel.js +7 -0
  40. package/lib-module/IconButton/IconButton.js +8 -0
  41. package/lib-module/Link/ChevronLink.js +10 -3
  42. package/lib-module/Link/LinkBase.js +14 -0
  43. package/lib-module/Link/TextButton.js +11 -1
  44. package/lib-module/Listbox/GroupControl.js +102 -0
  45. package/lib-module/Listbox/Listbox.js +172 -0
  46. package/lib-module/Listbox/ListboxGroup.js +117 -0
  47. package/lib-module/Listbox/ListboxItem.js +71 -0
  48. package/lib-module/Listbox/ListboxOverlay.js +80 -0
  49. package/lib-module/Listbox/PressableItem.js +0 -2
  50. package/lib-module/Listbox/index.js +2 -2
  51. package/lib-module/Pagination/dictionary.js +3 -3
  52. package/lib-module/Progress/ProgressBarBackground.js +2 -2
  53. package/lib-module/SideNav/Item.js +15 -5
  54. package/lib-module/Tags/Tags.js +6 -1
  55. package/lib-module/TextInput/TextInputBase.js +2 -0
  56. package/lib-module/Tooltip/Tooltip.js +6 -1
  57. package/lib-module/Tooltip/Tooltip.native.js +6 -1
  58. package/lib-module/Tooltip/shared.js +5 -0
  59. package/lib-module/index.js +2 -1
  60. package/lib-module/utils/useOverlaidPosition.js +5 -4
  61. package/package.json +5 -3
  62. package/src/Autocomplete/Autocomplete.jsx +411 -0
  63. package/src/Autocomplete/Loading.jsx +18 -0
  64. package/src/Autocomplete/Suggestions.jsx +54 -0
  65. package/src/Autocomplete/constants.js +4 -0
  66. package/src/Autocomplete/dictionary.js +12 -0
  67. package/src/Autocomplete/index.js +3 -0
  68. package/src/Button/ButtonLink.jsx +4 -1
  69. package/src/ExpandCollapse/Panel.jsx +11 -1
  70. package/src/IconButton/IconButton.jsx +7 -0
  71. package/src/Link/ChevronLink.jsx +10 -3
  72. package/src/Link/LinkBase.jsx +11 -0
  73. package/src/Link/TextButton.jsx +8 -2
  74. package/src/Listbox/GroupControl.jsx +93 -0
  75. package/src/Listbox/Listbox.jsx +165 -0
  76. package/src/Listbox/ListboxGroup.jsx +120 -0
  77. package/src/Listbox/ListboxItem.jsx +76 -0
  78. package/src/Listbox/ListboxOverlay.jsx +82 -0
  79. package/src/Listbox/PressableItem.jsx +0 -2
  80. package/src/Listbox/index.js +3 -2
  81. package/src/Pagination/dictionary.js +3 -3
  82. package/src/Progress/ProgressBarBackground.jsx +2 -2
  83. package/src/SideNav/Item.jsx +13 -5
  84. package/src/Tags/Tags.jsx +5 -1
  85. package/src/TextInput/TextInputBase.jsx +2 -0
  86. package/src/Tooltip/Tooltip.jsx +16 -2
  87. package/src/Tooltip/Tooltip.native.jsx +15 -2
  88. package/src/Tooltip/shared.js +4 -0
  89. package/src/index.js +2 -1
  90. package/src/utils/useOverlaidPosition.js +6 -5
@@ -2,6 +2,7 @@ import React, { forwardRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useThemeTokensCallback } from '../ThemeProvider';
4
4
  import LinkBase from './LinkBase';
5
+ import { variantProp } from '../utils';
5
6
  /**
6
7
  * `TextButton` is a button that looks like a Link. It uses the same theming and variants as
7
8
  * Link but has the accessibility role of a `Button`. It should be used for actions that
@@ -30,6 +31,15 @@ const TextButton = /*#__PURE__*/forwardRef((_ref, ref) => {
30
31
  });
31
32
  TextButton.displayName = 'TextButton';
32
33
  TextButton.propTypes = { ...LinkBase.propTypes,
33
- onPress: PropTypes.func.isRequired
34
+
35
+ /** onPress function */
36
+ onPress: PropTypes.func.isRequired,
37
+
38
+ /** Children node that can be added */
39
+ children: PropTypes.node.isRequired,
40
+ variant: variantProp.propType,
41
+
42
+ /** Accesibility role for TextButton */
43
+ accessibilityRole: PropTypes.string
34
44
  };
35
45
  export default TextButton;
@@ -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;
@@ -8,11 +8,11 @@ export default {
8
8
  nextText: 'Next'
9
9
  },
10
10
  fr: {
11
- goToLabel: 'Aller au page n°',
11
+ goToLabel: 'Aller à la page n°',
12
12
  currentLabel: '(page actuelle)',
13
- previousLabel: 'Aller au page précédent',
13
+ previousLabel: 'Aller à la page précédente',
14
14
  previousText: 'Précédent',
15
- nextLabel: 'Aller au prochain page',
15
+ nextLabel: 'Aller à la page suivante',
16
16
  nextText: 'Suivant'
17
17
  }
18
18
  };
@@ -3,8 +3,8 @@ import ImageBackground from "react-native-web/dist/exports/ImageBackground";
3
3
  import StyleSheet from "react-native-web/dist/exports/StyleSheet";
4
4
  import { variantProp } from '../utils';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
- const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='DisabledProgress7' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23B2B9BF'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='%23676E73' stroke='%23676E73' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23DisabledProgress7");'%3E%3C/path%3E%3C/svg%3E`;
7
- const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='NegativeProgress6' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23C12335'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='2' shape-rendering='auto' stroke='%23e7adb4' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23NegativeProgress6");'%3E%3C/path%3E%3C/svg%3E`;
6
+ const inactiveBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='inactive' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255, 255, 255, 0)'%3E%3C/rect%3E%3Ccircle cx='4' cy='4' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='0' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='0' cy='8' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='0' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3Ccircle cx='8' cy='8' r='2' fill='rgba(0, 0, 0, 0.4)' stroke='rgba(0, 0, 0, 0.4)' stroke-width='0'%3E%3C/circle%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23inactive");'%3E%3C/path%3E%3C/svg%3E`;
7
+ const negativeBackground = `%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='24'%3E%3Cdefs%3E%3Cpattern id='negative' patternUnits='userSpaceOnUse' width='8' height='8'%3E%3Crect width='8' height='8' fill='rgba(255, 255, 255, 0)'%3E%3C/rect%3E%3Cpath d='M 0,8 l 8,-8 M -2,2 l 4,-4 M 6,10 l 4,-4' stroke-width='1' shape-rendering='auto' stroke='rgba(255, 255, 255, 0.4)' stroke-linecap='square'%3E%3C/path%3E%3C/pattern%3E%3C/defs%3E%3Cpath d='M 0 0 L 0 140 L 2000 2000 L 2000 0 Z' style='fill: url("%23negative");'%3E%3C/path%3E%3C/svg%3E`;
8
8
  const ProgressBarBackground = /*#__PURE__*/forwardRef((_ref, ref) => {
9
9
  let {
10
10
  variant
@@ -116,13 +116,13 @@ Item.propTypes = { ...selectedSystemPropTypes,
116
116
  children: PropTypes.node.isRequired,
117
117
 
118
118
  /**
119
- * @ignore
119
+ *
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
- * @ignore
125
+ *
126
126
  * Set internally in `SideNav` render function - used to keep track of expanded items groups.
127
127
  */
128
128
  groupId: PropTypes.string,
@@ -136,17 +136,27 @@ Item.propTypes = { ...selectedSystemPropTypes,
136
136
  hrefAttrs: PropTypes.shape(hrefAttrsProp.types),
137
137
 
138
138
  /**
139
- * @ignore
139
+ *
140
140
  * Set internally in `SideNav` render function.
141
141
  */
142
142
  isActive: PropTypes.bool,
143
143
 
144
144
  /**
145
- * @ignore
145
+ *
146
146
  * Set internally in `SideNav.ItemsGroup` render function. Used to mark expanded `ItemsGroup` parent.
147
147
  */
148
148
  isExpanded: PropTypes.bool,
149
149
  tokens: getTokensPropType('SideNavItem'),
150
- variant: variantProp.propType
150
+ variant: variantProp.propType,
151
+
152
+ /**
153
+ * Accesibility Role
154
+ */
155
+ accessibilityRole: PropTypes.string,
156
+
157
+ /**
158
+ * test ID
159
+ */
160
+ testID: PropTypes.number
151
161
  };
152
162
  export default Item;
@@ -252,6 +252,11 @@ Tags.propTypes = { ...selectedSystemPropTypes,
252
252
  * managing its own selected state, a default set of selections may be provided.
253
253
  * Changing the `initialValues` does not change the user's selections.
254
254
  */
255
- initialValues: PropTypes.arrayOf(PropTypes.string)
255
+ initialValues: PropTypes.arrayOf(PropTypes.string),
256
+
257
+ /**
258
+ * AccesibilityRole for the Tags
259
+ */
260
+ accessibilityRole: PropTypes.string
256
261
  };
257
262
  export default Tags;