@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.
Files changed (88) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/component-docs.json +854 -421
  3. package/lib/Badge/Badge.js +2 -2
  4. package/lib/BlockQuote/BlockQuote.js +9 -0
  5. package/lib/Callout/Callout.js +5 -0
  6. package/lib/DatePicker/DatePicker.js +24 -4
  7. package/lib/Disclaimer/Disclaimer.js +4 -0
  8. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +7 -1
  9. package/lib/NavigationBar/NavigationBar.js +8 -2
  10. package/lib/NavigationBar/NavigationSubMenu.js +2 -4
  11. package/lib/OrderedList/OrderedList.js +4 -2
  12. package/lib/Ribbon/Ribbon.js +2 -1
  13. package/lib/Toast/Toast.js +2 -1
  14. package/lib/Video/Video.js +3 -1
  15. package/lib/WaffleGrid/WaffleGrid.js +20 -20
  16. package/lib/baseExports.js +12 -0
  17. package/lib/index.js +0 -18
  18. package/lib/utils/useOverlaidPosition.js +2 -2
  19. package/lib-module/Badge/Badge.js +1 -1
  20. package/lib-module/BlockQuote/BlockQuote.js +10 -1
  21. package/lib-module/Callout/Callout.js +6 -1
  22. package/lib-module/DatePicker/DatePicker.js +24 -4
  23. package/lib-module/Disclaimer/Disclaimer.js +4 -0
  24. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +8 -2
  25. package/lib-module/NavigationBar/NavigationBar.js +8 -2
  26. package/lib-module/NavigationBar/NavigationSubMenu.js +1 -2
  27. package/lib-module/OrderedList/OrderedList.js +5 -3
  28. package/lib-module/Ribbon/Ribbon.js +3 -2
  29. package/lib-module/Toast/Toast.js +3 -2
  30. package/lib-module/Video/Video.js +4 -2
  31. package/lib-module/WaffleGrid/WaffleGrid.js +21 -21
  32. package/lib-module/baseExports.js +1 -1
  33. package/lib-module/index.js +0 -2
  34. package/lib-module/utils/useOverlaidPosition.js +2 -2
  35. package/package.json +3 -3
  36. package/src/Badge/Badge.jsx +1 -1
  37. package/src/BlockQuote/BlockQuote.jsx +10 -1
  38. package/src/Callout/Callout.jsx +11 -1
  39. package/src/DatePicker/DatePicker.jsx +20 -2
  40. package/src/Disclaimer/Disclaimer.jsx +3 -0
  41. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +7 -2
  42. package/src/NavigationBar/NavigationBar.jsx +7 -2
  43. package/src/NavigationBar/NavigationSubMenu.jsx +1 -2
  44. package/src/OrderedList/OrderedList.jsx +4 -3
  45. package/src/Ribbon/Ribbon.jsx +8 -2
  46. package/src/Toast/Toast.jsx +4 -2
  47. package/src/Video/Video.jsx +9 -2
  48. package/src/WaffleGrid/WaffleGrid.jsx +21 -15
  49. package/src/baseExports.js +2 -0
  50. package/src/index.js +0 -2
  51. package/src/utils/useOverlaidPosition.js +2 -2
  52. package/types/Callout.d.ts +1 -0
  53. package/lib/Autocomplete/Autocomplete.js +0 -407
  54. package/lib/Autocomplete/Loading.js +0 -46
  55. package/lib/Autocomplete/Suggestions.js +0 -81
  56. package/lib/Autocomplete/constants.js +0 -19
  57. package/lib/Autocomplete/dictionary.js +0 -19
  58. package/lib/Autocomplete/index.js +0 -13
  59. package/lib/Listbox/GroupControl.js +0 -110
  60. package/lib/Listbox/Listbox.js +0 -179
  61. package/lib/Listbox/ListboxGroup.js +0 -145
  62. package/lib/Listbox/ListboxItem.js +0 -101
  63. package/lib/Listbox/ListboxOverlay.js +0 -91
  64. package/lib/Listbox/index.js +0 -13
  65. package/lib-module/Autocomplete/Autocomplete.js +0 -383
  66. package/lib-module/Autocomplete/Loading.js +0 -32
  67. package/lib-module/Autocomplete/Suggestions.js +0 -64
  68. package/lib-module/Autocomplete/constants.js +0 -5
  69. package/lib-module/Autocomplete/dictionary.js +0 -12
  70. package/lib-module/Autocomplete/index.js +0 -2
  71. package/lib-module/Listbox/GroupControl.js +0 -96
  72. package/lib-module/Listbox/Listbox.js +0 -158
  73. package/lib-module/Listbox/ListboxGroup.js +0 -122
  74. package/lib-module/Listbox/ListboxItem.js +0 -77
  75. package/lib-module/Listbox/ListboxOverlay.js +0 -69
  76. package/lib-module/Listbox/index.js +0 -2
  77. package/src/Autocomplete/Autocomplete.jsx +0 -357
  78. package/src/Autocomplete/Loading.jsx +0 -15
  79. package/src/Autocomplete/Suggestions.jsx +0 -52
  80. package/src/Autocomplete/constants.js +0 -6
  81. package/src/Autocomplete/dictionary.js +0 -12
  82. package/src/Autocomplete/index.js +0 -3
  83. package/src/Listbox/GroupControl.jsx +0 -82
  84. package/src/Listbox/Listbox.jsx +0 -163
  85. package/src/Listbox/ListboxGroup.jsx +0 -125
  86. package/src/Listbox/ListboxItem.jsx +0 -80
  87. package/src/Listbox/ListboxOverlay.jsx +0 -72
  88. package/src/Listbox/index.js +0 -3
@@ -1,110 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _styledComponents = _interopRequireDefault(require("styled-components"));
11
-
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
- var _componentsBase = require("@telus-uds/components-base");
15
-
16
- var _jsxRuntime = require("react/jsx-runtime");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- const StyledControlWrapper = /*#__PURE__*/_styledComponents.default.div.withConfig({
21
- displayName: "GroupControl__StyledControlWrapper",
22
- componentId: "components-web__sc-1r7ts3q-0"
23
- })(_ref => {
24
- let {
25
- groupFontName,
26
- groupFontWeight,
27
- groupFontSize,
28
- groupColor,
29
- groupBackgroundColor,
30
- groupBorderColor,
31
- groupBorderWidth,
32
- groupBorderRadius,
33
- groupPaddingLeft,
34
- groupPaddingRight,
35
- groupPaddingTop,
36
- groupPaddingBottom,
37
- itemTextDecoration,
38
- itemOutline,
39
- groupHeight
40
- } = _ref;
41
- return {
42
- fontFamily: `${groupFontName}${groupFontWeight}normal`,
43
- fontSize: groupFontSize,
44
- color: groupColor,
45
- textDecoration: itemTextDecoration,
46
- backgroundColor: groupBackgroundColor,
47
- outline: itemOutline,
48
- width: '100%',
49
- height: groupHeight,
50
- display: 'flex',
51
- alignItems: 'center',
52
- justifyContent: 'space-between',
53
- boxSizing: 'border-box',
54
- border: `${groupBorderWidth}px solid ${groupBorderColor}`,
55
- borderRadius: groupBorderRadius,
56
- paddingLeft: groupPaddingLeft - groupBorderWidth,
57
- paddingRight: groupPaddingRight - groupBorderWidth,
58
- paddingTop: groupPaddingTop - groupBorderWidth,
59
- paddingBottom: groupPaddingBottom - groupBorderWidth
60
- };
61
- });
62
-
63
- const GroupControl = _ref2 => {
64
- let {
65
- expanded,
66
- pressed,
67
- hover,
68
- focus,
69
- label,
70
- id
71
- } = _ref2;
72
- const {
73
- selectedId,
74
- setSelectedId
75
- } = (0, _componentsBase.useListboxContext)();
76
- const tokens = (0, _componentsBase.useThemeTokens)('Listbox', {}, {}, {
77
- expanded,
78
- pressed,
79
- hover,
80
- current: selectedId === id && id !== undefined,
81
- focus
82
- });
83
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledControlWrapper, {
84
- onClick: () => setSelectedId(id),
85
- ...tokens,
86
- children: [label, /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
87
- space: 1,
88
- direction: "row"
89
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
90
- icon: tokens.groupIcon,
91
- tokens: {
92
- color: tokens.groupColor
93
- },
94
- variant: {
95
- size: 'micro'
96
- }
97
- })]
98
- });
99
- };
100
-
101
- GroupControl.propTypes = {
102
- id: _propTypes.default.string,
103
- expanded: _propTypes.default.bool,
104
- pressed: _propTypes.default.bool,
105
- hover: _propTypes.default.bool,
106
- focus: _propTypes.default.bool,
107
- label: _propTypes.default.string
108
- };
109
- var _default = GroupControl;
110
- exports.default = _default;
@@ -1,179 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
- var _componentsBase = require("@telus-uds/components-base");
15
-
16
- var _ListboxGroup = _interopRequireDefault(require("./ListboxGroup"));
17
-
18
- var _ListboxItem = _interopRequireDefault(require("./ListboxItem"));
19
-
20
- var _ListboxOverlay = _interopRequireDefault(require("./ListboxOverlay"));
21
-
22
- var _jsxRuntime = require("react/jsx-runtime");
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
-
28
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
-
30
- const StyledList = /*#__PURE__*/_styledComponents.default.ul.withConfig({
31
- displayName: "Listbox__StyledList",
32
- componentId: "components-web__sc-1564thh-0"
33
- })({
34
- margin: 0,
35
- padding: 0,
36
- listStyle: 'none'
37
- });
38
-
39
- const getInitialOpen = (items, selectedId) => items.filter(item => item.items && item.items.some(nestedItem => (nestedItem.id ?? nestedItem.label) === selectedId)).map(item => item.id ?? item.label);
40
-
41
- const Listbox = _ref => {
42
- let {
43
- items = [],
44
- firstItemRef = null,
45
- // focus will be moved to this one once within the menu
46
- parentRef = null,
47
- // to return focus to after leaving the last menu item
48
- selectedId: defaultSelectedId,
49
- LinkRouter,
50
- itemRouterProps,
51
- onClose,
52
- variant,
53
- tokens
54
- } = _ref;
55
- const initialOpen = getInitialOpen(items, defaultSelectedId);
56
- const [selectedId, setSelectedId] = (0, _react.useState)(defaultSelectedId);
57
- const {
58
- minHeight,
59
- minWidth
60
- } = (0, _componentsBase.useThemeTokens)('Listbox', variant, tokens); // We need to keep track of each item's ref in order to be able to
61
- // focus on a specific item via keyboard navigation
62
-
63
- const itemRefs = (0, _react.useRef)([]);
64
- if (firstItemRef !== null && firstItemRef !== void 0 && firstItemRef.current) itemRefs.current[0] = firstItemRef.current;
65
- const [focusedIndex, setFocusedIndex] = (0, _react.useState)(0);
66
- const handleKeydown = (0, _react.useCallback)(event => {
67
- const nextItemRef = itemRefs.current[focusedIndex + 1];
68
- const prevItemRef = itemRefs.current[focusedIndex - 1];
69
-
70
- if (event.key === 'ArrowUp' || event.shiftKey && event.key === 'Tab') {
71
- var _parentRef$current;
72
-
73
- // Move the focus to the previous item or to the parent one if on the first
74
- if (prevItemRef) {
75
- event.preventDefault();
76
- prevItemRef.focus();
77
- } else if (parentRef) (_parentRef$current = parentRef.current) === null || _parentRef$current === void 0 ? void 0 : _parentRef$current.focus();
78
-
79
- setFocusedIndex(focusedIndex - 1);
80
- } else if ((event.key === 'ArrowDown' || event.key === 'Tab') && nextItemRef) {
81
- event.preventDefault();
82
- setFocusedIndex(focusedIndex + 1);
83
- nextItemRef.focus();
84
- } else if (event.key === 'Escape') {
85
- var _parentRef$current2, _parentRef$current3;
86
-
87
- // Close the dropdown
88
- 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
89
-
90
- parentRef === null || parentRef === void 0 ? void 0 : (_parentRef$current3 = parentRef.current) === null || _parentRef$current3 === void 0 ? void 0 : _parentRef$current3.focus();
91
- if (onClose) onClose(event);
92
- }
93
- }, [focusedIndex, onClose, parentRef]); // Add listeners for mouse clicks outside and for key presses
94
-
95
- (0, _react.useEffect)(() => {
96
- window.addEventListener('click', onClose);
97
- window.addEventListener('keydown', handleKeydown);
98
- window.addEventListener('touchstart', onClose);
99
- return () => {
100
- window.removeEventListener('click', onClose);
101
- window.removeEventListener('keydown', handleKeydown);
102
- window.removeEventListener('touchstart', onClose);
103
- };
104
- }, [onClose, handleKeydown]);
105
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ListboxContext.Provider, {
106
- value: {
107
- selectedId,
108
- setSelectedId
109
- },
110
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ExpandCollapse, {
111
- initialOpen: initialOpen,
112
- maxOpen: 1,
113
- children: expandProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledList, {
114
- role: "listbox",
115
- style: {
116
- minHeight,
117
- minWidth
118
- },
119
- children: items.map((item, index) => {
120
- const {
121
- id,
122
- label,
123
- items: nestedItems
124
- } = item;
125
- const itemId = id ?? label; // Give `firstItemRef` to the first focusable item
126
-
127
- const itemRef = index === 0 && !itemId !== selectedId || index === 1 && items[0].id === selectedId ? firstItemRef : ref => {
128
- itemRefs.current[index] = ref;
129
- return ref;
130
- };
131
- return nestedItems ? /*#__PURE__*/(0, _react.createElement)(_ListboxGroup.default, { ...item,
132
- expandProps: expandProps,
133
- LinkRouter: LinkRouter,
134
- itemRouterProps: itemRouterProps,
135
- prevItemRef: itemRefs.current[index - 1] ?? null,
136
- nextItemRef: itemRefs.current[index + 1] ?? null,
137
- ref: itemRef,
138
- key: itemId
139
- }) : /*#__PURE__*/(0, _react.createElement)(_ListboxItem.default, { ...item,
140
- key: itemId,
141
- id: itemId,
142
- LinkRouter: LinkRouter,
143
- itemRouterProps: itemRouterProps,
144
- prevItemRef: itemRefs.current[index - 1] ?? null,
145
- nextItemRef: itemRefs.current[index + 1] ?? null,
146
- ref: itemRef
147
- });
148
- })
149
- })
150
- })
151
- });
152
- };
153
-
154
- Listbox.propTypes = { ..._componentsBase.withLinkRouter.propTypes,
155
-
156
- /**
157
- * Focus will be moved to the item with this ref once within the menu.
158
- */
159
- firstItemRef: _propTypes.default.object,
160
-
161
- /**
162
- * Focus will be returned to the dropdown control with this ref after leaving
163
- * the last menu item.
164
- */
165
- parentRef: _propTypes.default.object,
166
-
167
- /**
168
- * `Listbox` items
169
- */
170
- items: _propTypes.default.array,
171
-
172
- /**
173
- * To select an item by default
174
- */
175
- selectedId: _propTypes.default.string
176
- };
177
- Listbox.Overlay = _ListboxOverlay.default;
178
- var _default = Listbox;
179
- exports.default = _default;
@@ -1,145 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _componentsBase = require("@telus-uds/components-base");
13
-
14
- var _styledComponents = _interopRequireDefault(require("styled-components"));
15
-
16
- var _ListboxItem = _interopRequireDefault(require("./ListboxItem"));
17
-
18
- var _GroupControl = _interopRequireDefault(require("./GroupControl"));
19
-
20
- var _jsxRuntime = require("react/jsx-runtime");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
-
26
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
-
28
- /* eslint-disable react/require-default-props */
29
- const StyledGroupWrapper = /*#__PURE__*/_styledComponents.default.li.withConfig({
30
- displayName: "ListboxGroup__StyledGroupWrapper",
31
- componentId: "components-web__sc-3jlyy7-0"
32
- })({
33
- margin: 'none',
34
- padding: 'none',
35
- display: 'block',
36
- overflowY: 'hidden',
37
- // Currently the default expand collapse control does not have a focus state and so the browser default is applied.
38
- // This hides the outline so that it does not clash with the custom control we provide.
39
- '& div[role=button]': {
40
- outline: 'none'
41
- }
42
- });
43
-
44
- const StyledList = /*#__PURE__*/_styledComponents.default.ul.withConfig({
45
- displayName: "ListboxGroup__StyledList",
46
- componentId: "components-web__sc-3jlyy7-1"
47
- })({
48
- margin: 0,
49
- padding: 0,
50
- listStyle: 'none'
51
- });
52
-
53
- const ListboxGroup = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
54
- let {
55
- id,
56
- label,
57
- items,
58
- LinkRouter,
59
- linkRouterProps,
60
- expandProps,
61
- onLastItemBlur,
62
- nextItemRef,
63
- prevItemRef
64
- } = _ref;
65
- const {
66
- selectedId
67
- } = (0, _componentsBase.useListboxContext)(); // TODO: implement keyboard navigation via refs for grouped items separately here
68
-
69
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledGroupWrapper, {
70
- role: "option",
71
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ExpandCollapse.Panel, {
72
- panelId: id ?? label,
73
- controlTokens: {
74
- icon: null,
75
- paddingLeft: 'none',
76
- paddingRight: 'none',
77
- paddingTop: 'none',
78
- paddingBottom: 'none',
79
- backgroundColor: 'transparent',
80
- borderColor: 'transparent',
81
- textLine: 'none',
82
- borderWidth: 0
83
- } // TODO refactor
84
- // eslint-disable-next-line react/no-unstable-nested-components
85
- ,
86
- control: controlProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupControl.default, {
87
- id: id ?? label,
88
- ...controlProps,
89
- label: label
90
- }),
91
- ...expandProps,
92
- tokens: {
93
- contentPaddingLeft: 'none',
94
- contentPaddingRight: 'none',
95
- contentPaddingTop: 'none',
96
- contentPaddingBottom: 'none',
97
- borderColor: 'transparent',
98
- borderRadius: 0,
99
- borderWidth: 0,
100
- marginBottom: 0
101
- },
102
- controlRef: ref,
103
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledList, {
104
- children: items.map((item, index) => {
105
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListboxItem.default, {
106
- id: item.id ?? item.label,
107
- ...item,
108
- selected: item.id && item.id === selectedId || item.label && item.label === selectedId,
109
- isChild: true,
110
- LinkRouter: LinkRouter,
111
- linkRouterProps: linkRouterProps,
112
- ...(index === 0 && {
113
- prevItemRef
114
- }),
115
- ...(index === items.length - 1 && {
116
- nextItemRef
117
- }),
118
- ...(index === items.length - 1 && {
119
- onBlur: onLastItemBlur
120
- })
121
- }, item.label);
122
- })
123
- })
124
- })
125
- });
126
- });
127
- ListboxGroup.displayName = 'ListboxGroup';
128
- ListboxGroup.propTypes = { ..._componentsBase.withLinkRouter.propTypes,
129
- label: _propTypes.default.string,
130
- items: _propTypes.default.arrayOf(_propTypes.default.shape({
131
- href: _propTypes.default.string,
132
- label: _propTypes.default.string,
133
- current: _propTypes.default.bool
134
- })),
135
- expandProps: _propTypes.default.object,
136
- nextItemRef: _propTypes.default.object,
137
- prevItemRef: _propTypes.default.object,
138
-
139
- /**
140
- * Use this callback to redirect the focus after it leaves the last item of the group.
141
- */
142
- onLastItemBlur: _propTypes.default.func
143
- };
144
- var _default = ListboxGroup;
145
- exports.default = _default;
@@ -1,101 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
- var _componentsBase = require("@telus-uds/components-base");
15
-
16
- var _utils = require("../utils");
17
-
18
- var _jsxRuntime = require("react/jsx-runtime");
19
-
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- /* eslint-disable react/require-default-props */
27
- const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
28
-
29
- const StyledItemContainer = /*#__PURE__*/_styledComponents.default.li.withConfig({
30
- displayName: "ListboxItem__StyledItemContainer",
31
- componentId: "components-web__sc-tlroet-0"
32
- })({
33
- display: 'flex',
34
- paddingLeft: _ref => {
35
- let {
36
- isChild
37
- } = _ref;
38
- return isChild ? '16px' : '0px';
39
- },
40
- '&&&': {
41
- // Docusaurus applies aggressively high-specificity margin on `li`
42
- margin: 0
43
- }
44
- });
45
-
46
- const ListboxItem = /*#__PURE__*/(0, _react.forwardRef)((_ref2, ref) => {
47
- let {
48
- href,
49
- label,
50
- isChild = false,
51
- onBlur,
52
- nextItemRef,
53
- prevItemRef,
54
- tokens,
55
- variant = {},
56
- LinkRouter,
57
- linkRouterProps,
58
- id,
59
- onPress = () => {},
60
- ...rest
61
- } = _ref2;
62
- const selectedProps = selectProps({
63
- href,
64
- ...rest
65
- });
66
- const getTokens = (0, _componentsBase.useThemeTokensCallback)('Listbox', tokens, variant, {
67
- isChild
68
- });
69
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledItemContainer, {
70
- isChild: isChild,
71
- ...selectedProps,
72
- role: "option",
73
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.PressableItem, {
74
- href: href,
75
- isChild: isChild,
76
- onPress: onPress,
77
- onBlur: onBlur,
78
- nextItemRef: nextItemRef,
79
- prevItemRef: prevItemRef,
80
- ref: ref,
81
- tokens: getTokens,
82
- selectedProps: selectedProps,
83
- id: id,
84
- children: label
85
- })
86
- });
87
- });
88
- ListboxItem.displayName = 'ListboxItem';
89
- ListboxItem.propTypes = { ...selectedSystemPropTypes,
90
- ..._componentsBase.withLinkRouter.propTypes,
91
- href: _propTypes.default.string,
92
- isChild: _propTypes.default.bool,
93
- label: _propTypes.default.node.isRequired,
94
- nextItemRef: _propTypes.default.object,
95
- prevItemRef: _propTypes.default.object,
96
- onPress: _propTypes.default.func
97
- };
98
-
99
- var _default = (0, _componentsBase.withLinkRouter)(ListboxItem);
100
-
101
- exports.default = _default;
@@ -1,91 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _componentsBase = require("@telus-uds/components-base");
11
-
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
- var _View = _interopRequireDefault(require("react-native-web/dist/cjs/exports/View"));
15
-
16
- var _StyleSheet = _interopRequireDefault(require("react-native-web/dist/cjs/exports/StyleSheet"));
17
-
18
- var _WebPortal = _interopRequireDefault(require("../WebPortal"));
19
-
20
- var _jsxRuntime = require("react/jsx-runtime");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
-
26
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
-
28
- /* eslint-disable react/require-default-props */
29
- const staticStyles = _StyleSheet.default.create({
30
- positioner: {
31
- flex: 1,
32
- // Grow to maxWidth when possible, shrink when not possible
33
- position: 'absolute',
34
- zIndex: 10000 // Position on top of all the other overlays, including backdrops and modals
35
-
36
- },
37
- hidden: {
38
- // Use opacity not visibility to hide the dropdown during positioning
39
- // so on web, children may be focused from the first render
40
- opacity: 0
41
- }
42
- });
43
-
44
- const paddingVertical = 0;
45
- const paddingHorizontal = 0;
46
- const DropdownOverlay = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
47
- let {
48
- children,
49
- isReady = false,
50
- overlaidPosition,
51
- maxWidth,
52
- minWidth,
53
- onLayout
54
- } = _ref;
55
- const systemTokens = (0, _componentsBase.useThemeTokens)('Listbox', {}, {});
56
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_WebPortal.default, {
57
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_View.default, {
58
- ref: ref,
59
- onLayout: onLayout,
60
- style: [overlaidPosition, {
61
- maxWidth,
62
- minWidth
63
- }, staticStyles.positioner, !isReady && staticStyles.hidden],
64
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Card, {
65
- tokens: {
66
- shadow: systemTokens.shadow,
67
- paddingBottom: paddingVertical,
68
- paddingTop: paddingVertical,
69
- paddingLeft: paddingHorizontal,
70
- paddingRight: paddingHorizontal
71
- },
72
- children: children
73
- })
74
- })
75
- });
76
- });
77
- DropdownOverlay.displayName = 'DropdownOverlay';
78
- DropdownOverlay.propTypes = {
79
- children: _propTypes.default.node.isRequired,
80
- isReady: _propTypes.default.bool,
81
- overlaidPosition: _propTypes.default.shape({
82
- top: _propTypes.default.number,
83
- left: _propTypes.default.number,
84
- width: _propTypes.default.number
85
- }),
86
- maxWidth: _propTypes.default.number,
87
- minWidth: _propTypes.default.number,
88
- onLayout: _propTypes.default.func
89
- };
90
- var _default = DropdownOverlay;
91
- exports.default = _default;
@@ -1,13 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _Listbox = _interopRequireDefault(require("./Listbox"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- var _default = _Listbox.default;
13
- exports.default = _default;