@telus-uds/components-web 2.17.2 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -2
- package/component-docs.json +854 -421
- package/lib/Badge/Badge.js +2 -2
- package/lib/BlockQuote/BlockQuote.js +9 -0
- package/lib/Callout/Callout.js +5 -0
- package/lib/DatePicker/DatePicker.js +24 -4
- package/lib/Disclaimer/Disclaimer.js +4 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +7 -1
- package/lib/NavigationBar/NavigationBar.js +8 -2
- package/lib/NavigationBar/NavigationSubMenu.js +2 -4
- package/lib/OrderedList/OrderedList.js +4 -2
- package/lib/Ribbon/Ribbon.js +2 -1
- package/lib/Toast/Toast.js +2 -1
- package/lib/Video/Video.js +3 -1
- package/lib/WaffleGrid/WaffleGrid.js +20 -20
- package/lib/baseExports.js +12 -0
- package/lib/index.js +0 -18
- package/lib/utils/useOverlaidPosition.js +2 -2
- package/lib-module/Badge/Badge.js +1 -1
- package/lib-module/BlockQuote/BlockQuote.js +10 -1
- package/lib-module/Callout/Callout.js +6 -1
- package/lib-module/DatePicker/DatePicker.js +24 -4
- package/lib-module/Disclaimer/Disclaimer.js +4 -0
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +8 -2
- package/lib-module/NavigationBar/NavigationBar.js +8 -2
- package/lib-module/NavigationBar/NavigationSubMenu.js +1 -2
- package/lib-module/OrderedList/OrderedList.js +5 -3
- package/lib-module/Ribbon/Ribbon.js +3 -2
- package/lib-module/Toast/Toast.js +3 -2
- package/lib-module/Video/Video.js +4 -2
- package/lib-module/WaffleGrid/WaffleGrid.js +21 -21
- package/lib-module/baseExports.js +1 -1
- package/lib-module/index.js +0 -2
- package/lib-module/utils/useOverlaidPosition.js +2 -2
- package/package.json +3 -3
- package/src/Badge/Badge.jsx +1 -1
- package/src/BlockQuote/BlockQuote.jsx +10 -1
- package/src/Callout/Callout.jsx +11 -1
- package/src/DatePicker/DatePicker.jsx +20 -2
- package/src/Disclaimer/Disclaimer.jsx +3 -0
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +7 -2
- package/src/NavigationBar/NavigationBar.jsx +7 -2
- package/src/NavigationBar/NavigationSubMenu.jsx +1 -2
- package/src/OrderedList/OrderedList.jsx +4 -3
- package/src/Ribbon/Ribbon.jsx +8 -2
- package/src/Toast/Toast.jsx +4 -2
- package/src/Video/Video.jsx +9 -2
- package/src/WaffleGrid/WaffleGrid.jsx +21 -15
- package/src/baseExports.js +2 -0
- package/src/index.js +0 -2
- package/src/utils/useOverlaidPosition.js +2 -2
- package/types/Callout.d.ts +1 -0
- package/lib/Autocomplete/Autocomplete.js +0 -407
- package/lib/Autocomplete/Loading.js +0 -46
- package/lib/Autocomplete/Suggestions.js +0 -81
- package/lib/Autocomplete/constants.js +0 -19
- package/lib/Autocomplete/dictionary.js +0 -19
- package/lib/Autocomplete/index.js +0 -13
- package/lib/Listbox/GroupControl.js +0 -110
- package/lib/Listbox/Listbox.js +0 -179
- package/lib/Listbox/ListboxGroup.js +0 -145
- package/lib/Listbox/ListboxItem.js +0 -101
- package/lib/Listbox/ListboxOverlay.js +0 -91
- package/lib/Listbox/index.js +0 -13
- package/lib-module/Autocomplete/Autocomplete.js +0 -383
- package/lib-module/Autocomplete/Loading.js +0 -32
- package/lib-module/Autocomplete/Suggestions.js +0 -64
- package/lib-module/Autocomplete/constants.js +0 -5
- package/lib-module/Autocomplete/dictionary.js +0 -12
- package/lib-module/Autocomplete/index.js +0 -2
- package/lib-module/Listbox/GroupControl.js +0 -96
- package/lib-module/Listbox/Listbox.js +0 -158
- package/lib-module/Listbox/ListboxGroup.js +0 -122
- package/lib-module/Listbox/ListboxItem.js +0 -77
- package/lib-module/Listbox/ListboxOverlay.js +0 -69
- package/lib-module/Listbox/index.js +0 -2
- package/src/Autocomplete/Autocomplete.jsx +0 -357
- package/src/Autocomplete/Loading.jsx +0 -15
- package/src/Autocomplete/Suggestions.jsx +0 -52
- package/src/Autocomplete/constants.js +0 -6
- package/src/Autocomplete/dictionary.js +0 -12
- package/src/Autocomplete/index.js +0 -3
- package/src/Listbox/GroupControl.jsx +0 -82
- package/src/Listbox/Listbox.jsx +0 -163
- package/src/Listbox/ListboxGroup.jsx +0 -125
- package/src/Listbox/ListboxItem.jsx +0 -80
- package/src/Listbox/ListboxOverlay.jsx +0 -72
- package/src/Listbox/index.js +0 -3
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { ExpandCollapse, useThemeTokens, withLinkRouter, ListboxContext } from '@telus-uds/components-base';
|
|
5
|
-
import ListboxGroup from './ListboxGroup';
|
|
6
|
-
import ListboxItem from './ListboxItem';
|
|
7
|
-
import DropdownOverlay from './ListboxOverlay';
|
|
8
|
-
import { createElement as _createElement } from "react";
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
const StyledList = /*#__PURE__*/styled.ul.withConfig({
|
|
11
|
-
displayName: "Listbox__StyledList",
|
|
12
|
-
componentId: "components-web__sc-1564thh-0"
|
|
13
|
-
})({
|
|
14
|
-
margin: 0,
|
|
15
|
-
padding: 0,
|
|
16
|
-
listStyle: 'none'
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const getInitialOpen = (items, selectedId) => items.filter(item => item.items && item.items.some(nestedItem => (nestedItem.id ?? nestedItem.label) === selectedId)).map(item => item.id ?? item.label);
|
|
20
|
-
|
|
21
|
-
const Listbox = _ref => {
|
|
22
|
-
let {
|
|
23
|
-
items = [],
|
|
24
|
-
firstItemRef = null,
|
|
25
|
-
// focus will be moved to this one once within the menu
|
|
26
|
-
parentRef = null,
|
|
27
|
-
// to return focus to after leaving the last menu item
|
|
28
|
-
selectedId: defaultSelectedId,
|
|
29
|
-
LinkRouter,
|
|
30
|
-
itemRouterProps,
|
|
31
|
-
onClose,
|
|
32
|
-
variant,
|
|
33
|
-
tokens
|
|
34
|
-
} = _ref;
|
|
35
|
-
const initialOpen = getInitialOpen(items, defaultSelectedId);
|
|
36
|
-
const [selectedId, setSelectedId] = useState(defaultSelectedId);
|
|
37
|
-
const {
|
|
38
|
-
minHeight,
|
|
39
|
-
minWidth
|
|
40
|
-
} = useThemeTokens('Listbox', variant, tokens); // We need to keep track of each item's ref in order to be able to
|
|
41
|
-
// focus on a specific item via keyboard navigation
|
|
42
|
-
|
|
43
|
-
const itemRefs = useRef([]);
|
|
44
|
-
if (firstItemRef !== null && firstItemRef !== void 0 && firstItemRef.current) itemRefs.current[0] = firstItemRef.current;
|
|
45
|
-
const [focusedIndex, setFocusedIndex] = useState(0);
|
|
46
|
-
const handleKeydown = useCallback(event => {
|
|
47
|
-
const nextItemRef = itemRefs.current[focusedIndex + 1];
|
|
48
|
-
const prevItemRef = itemRefs.current[focusedIndex - 1];
|
|
49
|
-
|
|
50
|
-
if (event.key === 'ArrowUp' || event.shiftKey && event.key === 'Tab') {
|
|
51
|
-
var _parentRef$current;
|
|
52
|
-
|
|
53
|
-
// Move the focus to the previous item or to the parent one if on the first
|
|
54
|
-
if (prevItemRef) {
|
|
55
|
-
event.preventDefault();
|
|
56
|
-
prevItemRef.focus();
|
|
57
|
-
} else if (parentRef) (_parentRef$current = parentRef.current) === null || _parentRef$current === void 0 ? void 0 : _parentRef$current.focus();
|
|
58
|
-
|
|
59
|
-
setFocusedIndex(focusedIndex - 1);
|
|
60
|
-
} else if ((event.key === 'ArrowDown' || event.key === 'Tab') && nextItemRef) {
|
|
61
|
-
event.preventDefault();
|
|
62
|
-
setFocusedIndex(focusedIndex + 1);
|
|
63
|
-
nextItemRef.focus();
|
|
64
|
-
} else if (event.key === 'Escape') {
|
|
65
|
-
var _parentRef$current2, _parentRef$current3;
|
|
66
|
-
|
|
67
|
-
// Close the dropdown
|
|
68
|
-
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
|
|
69
|
-
|
|
70
|
-
parentRef === null || parentRef === void 0 ? void 0 : (_parentRef$current3 = parentRef.current) === null || _parentRef$current3 === void 0 ? void 0 : _parentRef$current3.focus();
|
|
71
|
-
if (onClose) onClose(event);
|
|
72
|
-
}
|
|
73
|
-
}, [focusedIndex, onClose, parentRef]); // Add listeners for mouse clicks outside and for key presses
|
|
74
|
-
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
window.addEventListener('click', onClose);
|
|
77
|
-
window.addEventListener('keydown', handleKeydown);
|
|
78
|
-
window.addEventListener('touchstart', onClose);
|
|
79
|
-
return () => {
|
|
80
|
-
window.removeEventListener('click', onClose);
|
|
81
|
-
window.removeEventListener('keydown', handleKeydown);
|
|
82
|
-
window.removeEventListener('touchstart', onClose);
|
|
83
|
-
};
|
|
84
|
-
}, [onClose, handleKeydown]);
|
|
85
|
-
return /*#__PURE__*/_jsx(ListboxContext.Provider, {
|
|
86
|
-
value: {
|
|
87
|
-
selectedId,
|
|
88
|
-
setSelectedId
|
|
89
|
-
},
|
|
90
|
-
children: /*#__PURE__*/_jsx(ExpandCollapse, {
|
|
91
|
-
initialOpen: initialOpen,
|
|
92
|
-
maxOpen: 1,
|
|
93
|
-
children: expandProps => /*#__PURE__*/_jsx(StyledList, {
|
|
94
|
-
role: "listbox",
|
|
95
|
-
style: {
|
|
96
|
-
minHeight,
|
|
97
|
-
minWidth
|
|
98
|
-
},
|
|
99
|
-
children: items.map((item, index) => {
|
|
100
|
-
const {
|
|
101
|
-
id,
|
|
102
|
-
label,
|
|
103
|
-
items: nestedItems
|
|
104
|
-
} = item;
|
|
105
|
-
const itemId = id ?? label; // Give `firstItemRef` to the first focusable item
|
|
106
|
-
|
|
107
|
-
const itemRef = index === 0 && !itemId !== selectedId || index === 1 && items[0].id === selectedId ? firstItemRef : ref => {
|
|
108
|
-
itemRefs.current[index] = ref;
|
|
109
|
-
return ref;
|
|
110
|
-
};
|
|
111
|
-
return nestedItems ? /*#__PURE__*/_createElement(ListboxGroup, { ...item,
|
|
112
|
-
expandProps: expandProps,
|
|
113
|
-
LinkRouter: LinkRouter,
|
|
114
|
-
itemRouterProps: itemRouterProps,
|
|
115
|
-
prevItemRef: itemRefs.current[index - 1] ?? null,
|
|
116
|
-
nextItemRef: itemRefs.current[index + 1] ?? null,
|
|
117
|
-
ref: itemRef,
|
|
118
|
-
key: itemId
|
|
119
|
-
}) : /*#__PURE__*/_createElement(ListboxItem, { ...item,
|
|
120
|
-
key: itemId,
|
|
121
|
-
id: itemId,
|
|
122
|
-
LinkRouter: LinkRouter,
|
|
123
|
-
itemRouterProps: itemRouterProps,
|
|
124
|
-
prevItemRef: itemRefs.current[index - 1] ?? null,
|
|
125
|
-
nextItemRef: itemRefs.current[index + 1] ?? null,
|
|
126
|
-
ref: itemRef
|
|
127
|
-
});
|
|
128
|
-
})
|
|
129
|
-
})
|
|
130
|
-
})
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
Listbox.propTypes = { ...withLinkRouter.propTypes,
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Focus will be moved to the item with this ref once within the menu.
|
|
138
|
-
*/
|
|
139
|
-
firstItemRef: PropTypes.object,
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Focus will be returned to the dropdown control with this ref after leaving
|
|
143
|
-
* the last menu item.
|
|
144
|
-
*/
|
|
145
|
-
parentRef: PropTypes.object,
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* `Listbox` items
|
|
149
|
-
*/
|
|
150
|
-
items: PropTypes.array,
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* To select an item by default
|
|
154
|
-
*/
|
|
155
|
-
selectedId: PropTypes.string
|
|
156
|
-
};
|
|
157
|
-
Listbox.Overlay = DropdownOverlay;
|
|
158
|
-
export default Listbox;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/require-default-props */
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import { ExpandCollapse, withLinkRouter, useListboxContext } from '@telus-uds/components-base';
|
|
5
|
-
import styled from 'styled-components';
|
|
6
|
-
import ListboxItem from './ListboxItem';
|
|
7
|
-
import GroupControl from './GroupControl';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const StyledGroupWrapper = /*#__PURE__*/styled.li.withConfig({
|
|
10
|
-
displayName: "ListboxGroup__StyledGroupWrapper",
|
|
11
|
-
componentId: "components-web__sc-3jlyy7-0"
|
|
12
|
-
})({
|
|
13
|
-
margin: 'none',
|
|
14
|
-
padding: 'none',
|
|
15
|
-
display: 'block',
|
|
16
|
-
overflowY: 'hidden',
|
|
17
|
-
// Currently the default expand collapse control does not have a focus state and so the browser default is applied.
|
|
18
|
-
// This hides the outline so that it does not clash with the custom control we provide.
|
|
19
|
-
'& div[role=button]': {
|
|
20
|
-
outline: 'none'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const StyledList = /*#__PURE__*/styled.ul.withConfig({
|
|
24
|
-
displayName: "ListboxGroup__StyledList",
|
|
25
|
-
componentId: "components-web__sc-3jlyy7-1"
|
|
26
|
-
})({
|
|
27
|
-
margin: 0,
|
|
28
|
-
padding: 0,
|
|
29
|
-
listStyle: 'none'
|
|
30
|
-
});
|
|
31
|
-
const ListboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
32
|
-
let {
|
|
33
|
-
id,
|
|
34
|
-
label,
|
|
35
|
-
items,
|
|
36
|
-
LinkRouter,
|
|
37
|
-
linkRouterProps,
|
|
38
|
-
expandProps,
|
|
39
|
-
onLastItemBlur,
|
|
40
|
-
nextItemRef,
|
|
41
|
-
prevItemRef
|
|
42
|
-
} = _ref;
|
|
43
|
-
const {
|
|
44
|
-
selectedId
|
|
45
|
-
} = useListboxContext(); // TODO: implement keyboard navigation via refs for grouped items separately here
|
|
46
|
-
|
|
47
|
-
return /*#__PURE__*/_jsx(StyledGroupWrapper, {
|
|
48
|
-
role: "option",
|
|
49
|
-
children: /*#__PURE__*/_jsx(ExpandCollapse.Panel, {
|
|
50
|
-
panelId: id ?? label,
|
|
51
|
-
controlTokens: {
|
|
52
|
-
icon: null,
|
|
53
|
-
paddingLeft: 'none',
|
|
54
|
-
paddingRight: 'none',
|
|
55
|
-
paddingTop: 'none',
|
|
56
|
-
paddingBottom: 'none',
|
|
57
|
-
backgroundColor: 'transparent',
|
|
58
|
-
borderColor: 'transparent',
|
|
59
|
-
textLine: 'none',
|
|
60
|
-
borderWidth: 0
|
|
61
|
-
} // TODO refactor
|
|
62
|
-
// eslint-disable-next-line react/no-unstable-nested-components
|
|
63
|
-
,
|
|
64
|
-
control: controlProps => /*#__PURE__*/_jsx(GroupControl, {
|
|
65
|
-
id: id ?? label,
|
|
66
|
-
...controlProps,
|
|
67
|
-
label: label
|
|
68
|
-
}),
|
|
69
|
-
...expandProps,
|
|
70
|
-
tokens: {
|
|
71
|
-
contentPaddingLeft: 'none',
|
|
72
|
-
contentPaddingRight: 'none',
|
|
73
|
-
contentPaddingTop: 'none',
|
|
74
|
-
contentPaddingBottom: 'none',
|
|
75
|
-
borderColor: 'transparent',
|
|
76
|
-
borderRadius: 0,
|
|
77
|
-
borderWidth: 0,
|
|
78
|
-
marginBottom: 0
|
|
79
|
-
},
|
|
80
|
-
controlRef: ref,
|
|
81
|
-
children: /*#__PURE__*/_jsx(StyledList, {
|
|
82
|
-
children: items.map((item, index) => {
|
|
83
|
-
return /*#__PURE__*/_jsx(ListboxItem, {
|
|
84
|
-
id: item.id ?? item.label,
|
|
85
|
-
...item,
|
|
86
|
-
selected: item.id && item.id === selectedId || item.label && item.label === selectedId,
|
|
87
|
-
isChild: true,
|
|
88
|
-
LinkRouter: LinkRouter,
|
|
89
|
-
linkRouterProps: linkRouterProps,
|
|
90
|
-
...(index === 0 && {
|
|
91
|
-
prevItemRef
|
|
92
|
-
}),
|
|
93
|
-
...(index === items.length - 1 && {
|
|
94
|
-
nextItemRef
|
|
95
|
-
}),
|
|
96
|
-
...(index === items.length - 1 && {
|
|
97
|
-
onBlur: onLastItemBlur
|
|
98
|
-
})
|
|
99
|
-
}, item.label);
|
|
100
|
-
})
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
ListboxGroup.displayName = 'ListboxGroup';
|
|
106
|
-
ListboxGroup.propTypes = { ...withLinkRouter.propTypes,
|
|
107
|
-
label: PropTypes.string,
|
|
108
|
-
items: PropTypes.arrayOf(PropTypes.shape({
|
|
109
|
-
href: PropTypes.string,
|
|
110
|
-
label: PropTypes.string,
|
|
111
|
-
current: PropTypes.bool
|
|
112
|
-
})),
|
|
113
|
-
expandProps: PropTypes.object,
|
|
114
|
-
nextItemRef: PropTypes.object,
|
|
115
|
-
prevItemRef: PropTypes.object,
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Use this callback to redirect the focus after it leaves the last item of the group.
|
|
119
|
-
*/
|
|
120
|
-
onLastItemBlur: PropTypes.func
|
|
121
|
-
};
|
|
122
|
-
export default ListboxGroup;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/require-default-props */
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
|
-
import { selectSystemProps, withLinkRouter, useThemeTokensCallback, PressableItem } from '@telus-uds/components-base';
|
|
6
|
-
import { htmlAttrs } from '../utils';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
9
|
-
const StyledItemContainer = /*#__PURE__*/styled.li.withConfig({
|
|
10
|
-
displayName: "ListboxItem__StyledItemContainer",
|
|
11
|
-
componentId: "components-web__sc-tlroet-0"
|
|
12
|
-
})({
|
|
13
|
-
display: 'flex',
|
|
14
|
-
paddingLeft: _ref => {
|
|
15
|
-
let {
|
|
16
|
-
isChild
|
|
17
|
-
} = _ref;
|
|
18
|
-
return isChild ? '16px' : '0px';
|
|
19
|
-
},
|
|
20
|
-
'&&&': {
|
|
21
|
-
// Docusaurus applies aggressively high-specificity margin on `li`
|
|
22
|
-
margin: 0
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
const ListboxItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
26
|
-
let {
|
|
27
|
-
href,
|
|
28
|
-
label,
|
|
29
|
-
isChild = false,
|
|
30
|
-
onBlur,
|
|
31
|
-
nextItemRef,
|
|
32
|
-
prevItemRef,
|
|
33
|
-
tokens,
|
|
34
|
-
variant = {},
|
|
35
|
-
LinkRouter,
|
|
36
|
-
linkRouterProps,
|
|
37
|
-
id,
|
|
38
|
-
onPress = () => {},
|
|
39
|
-
...rest
|
|
40
|
-
} = _ref2;
|
|
41
|
-
const selectedProps = selectProps({
|
|
42
|
-
href,
|
|
43
|
-
...rest
|
|
44
|
-
});
|
|
45
|
-
const getTokens = useThemeTokensCallback('Listbox', tokens, variant, {
|
|
46
|
-
isChild
|
|
47
|
-
});
|
|
48
|
-
return /*#__PURE__*/_jsx(StyledItemContainer, {
|
|
49
|
-
isChild: isChild,
|
|
50
|
-
...selectedProps,
|
|
51
|
-
role: "option",
|
|
52
|
-
children: /*#__PURE__*/_jsx(PressableItem, {
|
|
53
|
-
href: href,
|
|
54
|
-
isChild: isChild,
|
|
55
|
-
onPress: onPress,
|
|
56
|
-
onBlur: onBlur,
|
|
57
|
-
nextItemRef: nextItemRef,
|
|
58
|
-
prevItemRef: prevItemRef,
|
|
59
|
-
ref: ref,
|
|
60
|
-
tokens: getTokens,
|
|
61
|
-
selectedProps: selectedProps,
|
|
62
|
-
id: id,
|
|
63
|
-
children: label
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
ListboxItem.displayName = 'ListboxItem';
|
|
68
|
-
ListboxItem.propTypes = { ...selectedSystemPropTypes,
|
|
69
|
-
...withLinkRouter.propTypes,
|
|
70
|
-
href: PropTypes.string,
|
|
71
|
-
isChild: PropTypes.bool,
|
|
72
|
-
label: PropTypes.node.isRequired,
|
|
73
|
-
nextItemRef: PropTypes.object,
|
|
74
|
-
prevItemRef: PropTypes.object,
|
|
75
|
-
onPress: PropTypes.func
|
|
76
|
-
};
|
|
77
|
-
export default withLinkRouter(ListboxItem);
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/* eslint-disable react/require-default-props */
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
3
|
-
import { Card, useThemeTokens } from '@telus-uds/components-base';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import View from "react-native-web/dist/exports/View";
|
|
6
|
-
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
7
|
-
import WebPortal from '../WebPortal';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
const staticStyles = StyleSheet.create({
|
|
10
|
-
positioner: {
|
|
11
|
-
flex: 1,
|
|
12
|
-
// Grow to maxWidth when possible, shrink when not possible
|
|
13
|
-
position: 'absolute',
|
|
14
|
-
zIndex: 10000 // Position on top of all the other overlays, including backdrops and modals
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
hidden: {
|
|
18
|
-
// Use opacity not visibility to hide the dropdown during positioning
|
|
19
|
-
// so on web, children may be focused from the first render
|
|
20
|
-
opacity: 0
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
const paddingVertical = 0;
|
|
24
|
-
const paddingHorizontal = 0;
|
|
25
|
-
const DropdownOverlay = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
26
|
-
let {
|
|
27
|
-
children,
|
|
28
|
-
isReady = false,
|
|
29
|
-
overlaidPosition,
|
|
30
|
-
maxWidth,
|
|
31
|
-
minWidth,
|
|
32
|
-
onLayout
|
|
33
|
-
} = _ref;
|
|
34
|
-
const systemTokens = useThemeTokens('Listbox', {}, {});
|
|
35
|
-
return /*#__PURE__*/_jsx(WebPortal, {
|
|
36
|
-
children: /*#__PURE__*/_jsx(View, {
|
|
37
|
-
ref: ref,
|
|
38
|
-
onLayout: onLayout,
|
|
39
|
-
style: [overlaidPosition, {
|
|
40
|
-
maxWidth,
|
|
41
|
-
minWidth
|
|
42
|
-
}, staticStyles.positioner, !isReady && staticStyles.hidden],
|
|
43
|
-
children: /*#__PURE__*/_jsx(Card, {
|
|
44
|
-
tokens: {
|
|
45
|
-
shadow: systemTokens.shadow,
|
|
46
|
-
paddingBottom: paddingVertical,
|
|
47
|
-
paddingTop: paddingVertical,
|
|
48
|
-
paddingLeft: paddingHorizontal,
|
|
49
|
-
paddingRight: paddingHorizontal
|
|
50
|
-
},
|
|
51
|
-
children: children
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
DropdownOverlay.displayName = 'DropdownOverlay';
|
|
57
|
-
DropdownOverlay.propTypes = {
|
|
58
|
-
children: PropTypes.node.isRequired,
|
|
59
|
-
isReady: PropTypes.bool,
|
|
60
|
-
overlaidPosition: PropTypes.shape({
|
|
61
|
-
top: PropTypes.number,
|
|
62
|
-
left: PropTypes.number,
|
|
63
|
-
width: PropTypes.number
|
|
64
|
-
}),
|
|
65
|
-
maxWidth: PropTypes.number,
|
|
66
|
-
minWidth: PropTypes.number,
|
|
67
|
-
onLayout: PropTypes.func
|
|
68
|
-
};
|
|
69
|
-
export default DropdownOverlay;
|