@telus-uds/components-web 2.10.0 → 2.11.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 (45) hide show
  1. package/CHANGELOG.md +17 -2
  2. package/component-docs.json +12 -0
  3. package/lib/BlockQuote/BlockQuote.js +4 -1
  4. package/lib/DatePicker/DatePicker.js +23 -12
  5. package/lib/Listbox/GroupControl.js +44 -28
  6. package/lib/Listbox/Listbox.js +54 -47
  7. package/lib/Listbox/ListboxGroup.js +36 -20
  8. package/lib/Listbox/ListboxItem.js +14 -51
  9. package/lib/Listbox/ListboxOverlay.js +1 -1
  10. package/lib/Video/ControlBar/ControlBar.js +13 -10
  11. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +4 -1
  12. package/lib/VideoPicker/VideoPicker.js +1 -1
  13. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +14 -2
  14. package/lib/utils/index.js +3 -3
  15. package/lib-module/BlockQuote/BlockQuote.js +4 -1
  16. package/lib-module/DatePicker/DatePicker.js +23 -12
  17. package/lib-module/Listbox/GroupControl.js +45 -29
  18. package/lib-module/Listbox/Listbox.js +54 -46
  19. package/lib-module/Listbox/ListboxGroup.js +37 -21
  20. package/lib-module/Listbox/ListboxItem.js +15 -51
  21. package/lib-module/Listbox/ListboxOverlay.js +1 -1
  22. package/lib-module/Video/ControlBar/ControlBar.js +14 -11
  23. package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +4 -1
  24. package/lib-module/VideoPicker/VideoPicker.js +1 -1
  25. package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +14 -2
  26. package/lib-module/utils/index.js +1 -1
  27. package/package.json +3 -3
  28. package/src/BlockQuote/BlockQuote.jsx +13 -1
  29. package/src/DatePicker/DatePicker.jsx +22 -12
  30. package/src/Listbox/GroupControl.jsx +50 -33
  31. package/src/Listbox/Listbox.jsx +59 -50
  32. package/src/Listbox/ListboxGroup.jsx +34 -19
  33. package/src/Listbox/ListboxItem.jsx +26 -48
  34. package/src/Listbox/ListboxOverlay.jsx +1 -1
  35. package/src/Video/ControlBar/ControlBar.jsx +17 -13
  36. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +2 -1
  37. package/src/VideoPicker/VideoPicker.jsx +1 -1
  38. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +8 -1
  39. package/src/utils/index.js +1 -1
  40. package/lib/Listbox/PressableItem.js +0 -149
  41. package/lib/utils/htmlAttrs.js +0 -33
  42. package/lib-module/Listbox/PressableItem.js +0 -128
  43. package/lib-module/utils/htmlAttrs.js +0 -22
  44. package/src/Listbox/PressableItem.jsx +0 -121
  45. package/src/utils/htmlAttrs.js +0 -29
@@ -140,6 +140,7 @@ const VideoProgressBar = _ref5 => {
140
140
  videoLength,
141
141
  videoCurrentTime,
142
142
  videoBufferEnd,
143
+ playing,
143
144
  setSeek,
144
145
  resetInactivityTimer,
145
146
  tokens,
@@ -155,7 +156,9 @@ const VideoProgressBar = _ref5 => {
155
156
  trackGradientStart,
156
157
  trackGradientEnd,
157
158
  rangeBackground
158
- } = (0, _componentsBase.useThemeTokens)('VideoProgressBar', tokens, variant);
159
+ } = (0, _componentsBase.useThemeTokens)('VideoProgressBar', tokens, variant, {
160
+ playing
161
+ });
159
162
 
160
163
  const videoProgressBar = /*#__PURE__*/_react.default.createRef();
161
164
 
@@ -112,7 +112,7 @@ const VideoPicker = _ref6 => {
112
112
  setCurrentVideoId(selectedVideo);
113
113
  }, [selectedVideo]); // `frame` variant should only work on larger screens
114
114
 
115
- const isFramed = frame && [_systemConstants.viewports.md, _systemConstants.viewports.lg, _systemConstants.viewports.xl].includes(viewport);
115
+ const isFramed = frame && [_systemConstants.viewports.lg, _systemConstants.viewports.xl].includes(viewport);
116
116
  const hasSlider = !frame && [_systemConstants.viewports.md, _systemConstants.viewports.lg, _systemConstants.viewports.xl].includes(viewport);
117
117
  const listElements = videoList.map((video, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_VideoPickerThumbnail.default, {
118
118
  video: video,
@@ -174,14 +174,25 @@ const selectButtonContentTokens = _ref14 => {
174
174
  };
175
175
  };
176
176
 
177
- const SplashButtonWithDetails = _ref15 => {
177
+ const getLabelTokens = _ref15 => {
178
+ let {
179
+ labelFontName: fontName,
180
+ labelFontWeight: fontWeight
181
+ } = _ref15;
182
+ return {
183
+ fontName,
184
+ fontWeight
185
+ };
186
+ };
187
+
188
+ const SplashButtonWithDetails = _ref16 => {
178
189
  let {
179
190
  label,
180
191
  tokens,
181
192
  variant,
182
193
  copy,
183
194
  videoLength
184
- } = _ref15;
195
+ } = _ref16;
185
196
  const {
186
197
  buttonContentChildrenBackground
187
198
  } = (0, _componentsBase.useThemeTokens)('SplashButtonWithDetails', tokens, variant, {
@@ -208,6 +219,7 @@ const SplashButtonWithDetails = _ref15 => {
208
219
  variant: {
209
220
  bold: true
210
221
  },
222
+ tokens: getLabelTokens(themeTokens),
211
223
  children: label
212
224
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
213
225
  variant: {
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "deprecate", {
12
12
  Object.defineProperty(exports, "htmlAttrs", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _htmlAttrs.default;
15
+ return _componentsBase.htmlAttrs;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "media", {
@@ -58,14 +58,14 @@ Object.defineProperty(exports, "warn", {
58
58
  }
59
59
  });
60
60
 
61
+ var _componentsBase = require("@telus-uds/components-base");
62
+
61
63
  var _logger = require("./logger");
62
64
 
63
65
  var _transforms = require("./transforms");
64
66
 
65
67
  var _useTypographyTheme = _interopRequireDefault(require("./useTypographyTheme"));
66
68
 
67
- var _htmlAttrs = _interopRequireDefault(require("./htmlAttrs"));
68
-
69
69
  var _media = _interopRequireDefault(require("./media"));
70
70
 
71
71
  var _ssr = _interopRequireDefault(require("./ssr"));
@@ -124,7 +124,10 @@ const BlockQuote = _ref8 => {
124
124
  return /*#__PURE__*/_jsx(Typography, {
125
125
  tokens: {
126
126
  color,
127
- fontWeight: '500'
127
+ fontName: linkFontName,
128
+ fontSize: linkFontSize,
129
+ fontWeight: linkFontWeight,
130
+ lineHeight: linkLineHeight
128
131
  },
129
132
  children: link
130
133
  });
@@ -99,6 +99,7 @@ const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
99
99
  tokens,
100
100
  variant = {},
101
101
  validation,
102
+ disabled,
102
103
  ...rest
103
104
  } = _ref;
104
105
  const [inputDate, setInputDate] = useState(date instanceof moment ? date : undefined);
@@ -123,21 +124,23 @@ const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
123
124
  };
124
125
 
125
126
  const handleFocus = event => {
126
- if (event.target.tagName === 'INPUT') {
127
+ if (event.target.tagName === 'INPUT' && !disabled) {
127
128
  setIsFocused(true);
128
129
  }
129
130
  };
130
131
 
131
132
  const handleMouseDown = event => {
132
- if (event.target.tagName === 'INPUT') {
133
- setIsClickedInside(true);
134
- setIsFocused(true);
135
- } else if (event.target.tagName === 'path') {
136
- // needed to handle the case where the user clicks on the tooltip icon
137
- setIsClickedInside(true);
138
- event.stopPropagation();
139
- } else {
140
- event.stopPropagation();
133
+ if (!disabled) {
134
+ if (event.target.tagName === 'INPUT') {
135
+ setIsClickedInside(true);
136
+ setIsFocused(true);
137
+ } else if (event.target.tagName === 'path') {
138
+ // needed to handle the case where the user clicks on the tooltip icon
139
+ setIsClickedInside(true);
140
+ event.stopPropagation();
141
+ } else {
142
+ event.stopPropagation();
143
+ }
141
144
  }
142
145
  };
143
146
 
@@ -280,8 +283,10 @@ const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
280
283
  label: ((_dictionary$copy = dictionary[copy]) === null || _dictionary$copy === void 0 ? void 0 : _dictionary$copy.roleDescription) ?? label,
281
284
  value: inputText,
282
285
  validation: validation,
286
+ inactive: disabled,
283
287
  children: /*#__PURE__*/_jsx(SingleDatePicker, {
284
288
  date: inputDate,
289
+ disabled: disabled,
285
290
  onDateChange: onChange,
286
291
  focused: isFocused,
287
292
  onFocusChange: onFocusChange,
@@ -378,7 +383,12 @@ DatePicker.propTypes = { ...selectedSystemPropTypes,
378
383
  /**
379
384
  * Use to visually mark an input as valid or invalid.
380
385
  */
381
- validation: PropTypes.oneOf(['error', 'success'])
386
+ validation: PropTypes.oneOf(['error', 'success']),
387
+
388
+ /**
389
+ * Disable the input which will not open the calendar picker
390
+ */
391
+ disabled: PropTypes.bool
382
392
  };
383
393
  DatePicker.defaultProps = {
384
394
  copy: 'en',
@@ -391,6 +401,7 @@ DatePicker.defaultProps = {
391
401
  hintPosition: 'inline',
392
402
  tooltip: undefined,
393
403
  onDateChange: () => {},
394
- validation: undefined
404
+ validation: undefined,
405
+ disabled: false
395
406
  };
396
407
  export default DatePicker;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import styled from 'styled-components';
3
3
  import PropTypes from 'prop-types';
4
- import { Icon, Spacer, useThemeTokens } from '@telus-uds/components-base';
4
+ import { Icon, Spacer, useThemeTokens, useListboxContext } from '@telus-uds/components-base';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import { jsxs as _jsxs } from "react/jsx-runtime";
7
7
  const StyledControlWrapper = /*#__PURE__*/styled.div.withConfig({
@@ -9,32 +9,41 @@ const StyledControlWrapper = /*#__PURE__*/styled.div.withConfig({
9
9
  componentId: "components-web__sc-1r7ts3q-0"
10
10
  })(_ref => {
11
11
  let {
12
- focus,
13
- tokens
12
+ groupFontName,
13
+ groupFontWeight,
14
+ groupFontSize,
15
+ groupColor,
16
+ groupBackgroundColor,
17
+ groupBorderColor,
18
+ groupBorderWidth,
19
+ groupBorderRadius,
20
+ groupPaddingLeft,
21
+ groupPaddingRight,
22
+ groupPaddingTop,
23
+ groupPaddingBottom,
24
+ itemTextDecoration,
25
+ itemOutline,
26
+ groupHeight
14
27
  } = _ref;
15
28
  return {
16
- fontFamily: `${tokens.groupFontName}${tokens.groupFontWeight}normal`,
17
- fontSize: tokens.groupFontSize,
18
- color: tokens.groupColor,
19
- textDecoration: tokens.itemTextDecoration,
20
- backgroundColor: tokens.groupBackgroundColor,
21
- outline: tokens.itemOutline,
29
+ fontFamily: `${groupFontName}${groupFontWeight}normal`,
30
+ fontSize: groupFontSize,
31
+ color: groupColor,
32
+ textDecoration: itemTextDecoration,
33
+ backgroundColor: groupBackgroundColor,
34
+ outline: itemOutline,
22
35
  width: '100%',
36
+ height: groupHeight,
23
37
  display: 'flex',
38
+ alignItems: 'center',
24
39
  justifyContent: 'space-between',
25
- ...(focus ? {
26
- border: `${tokens.groupBorderWidth} solid ${tokens.groupBorderColor}`,
27
- borderRadius: tokens.groupBorderRadius,
28
- paddingLeft: `calc(${tokens.groupPaddingLeft}px - ${tokens.groupBorderWidth}px)`,
29
- paddingRight: `calc(${tokens.groupPaddingRight}px - ${tokens.groupBorderWidth}px)`,
30
- paddingTop: `calc(${tokens.groupPaddingTop}px - ${tokens.groupBorderWidth}px)`,
31
- paddingBottom: `calc(${tokens.groupPaddingBottom}px - ${tokens.groupBorderWidth}px)`
32
- } : {
33
- paddingLeft: tokens.groupPaddingLeft,
34
- paddingRight: tokens.groupPaddingRight,
35
- paddingTop: tokens.groupPaddingTop,
36
- paddingBottom: tokens.groupPaddingBottom
37
- })
40
+ boxSizing: 'border-box',
41
+ border: `${groupBorderWidth}px solid ${groupBorderColor}`,
42
+ borderRadius: groupBorderRadius,
43
+ paddingLeft: groupPaddingLeft - groupBorderWidth,
44
+ paddingRight: groupPaddingRight - groupBorderWidth,
45
+ paddingTop: groupPaddingTop - groupBorderWidth,
46
+ paddingBottom: groupPaddingBottom - groupBorderWidth
38
47
  };
39
48
  });
40
49
 
@@ -44,24 +53,31 @@ const GroupControl = _ref2 => {
44
53
  pressed,
45
54
  hover,
46
55
  focus,
47
- current,
48
- label
56
+ label,
57
+ id
49
58
  } = _ref2;
50
- const tokens = useThemeTokens('ListBox', {}, {}, {
59
+ const {
60
+ selectedId,
61
+ setSelectedId
62
+ } = useListboxContext();
63
+ const tokens = useThemeTokens('Listbox', {}, {}, {
51
64
  expanded,
52
65
  pressed,
53
66
  hover,
54
- current,
67
+ current: selectedId === id && id !== undefined,
55
68
  focus
56
69
  });
57
70
  return /*#__PURE__*/_jsxs(StyledControlWrapper, {
58
- focus,
59
- tokens,
71
+ onClick: () => setSelectedId(id),
72
+ ...tokens,
60
73
  children: [label, /*#__PURE__*/_jsx(Spacer, {
61
74
  space: 1,
62
75
  direction: "row"
63
76
  }), /*#__PURE__*/_jsx(Icon, {
64
77
  icon: tokens.groupIcon,
78
+ tokens: {
79
+ color: tokens.groupColor
80
+ },
65
81
  variant: {
66
82
  size: 'micro'
67
83
  }
@@ -70,11 +86,11 @@ const GroupControl = _ref2 => {
70
86
  };
71
87
 
72
88
  GroupControl.propTypes = {
89
+ id: PropTypes.string,
73
90
  expanded: PropTypes.bool,
74
91
  pressed: PropTypes.bool,
75
92
  hover: PropTypes.bool,
76
93
  focus: PropTypes.bool,
77
- current: PropTypes.bool,
78
94
  label: PropTypes.string
79
95
  };
80
96
  export default GroupControl;
@@ -1,11 +1,10 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import styled from 'styled-components';
4
- import { ExpandCollapse, withLinkRouter } from '@telus-uds/components-base';
4
+ import { ExpandCollapse, useThemeTokens, withLinkRouter, ListboxContext } from '@telus-uds/components-base';
5
5
  import ListboxGroup from './ListboxGroup';
6
6
  import ListboxItem from './ListboxItem';
7
7
  import DropdownOverlay from './ListboxOverlay';
8
- import resolveItemSelection from '../NavigationBar/resolveItemSelection';
9
8
  import { createElement as _createElement } from "react";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
11
10
  const StyledList = /*#__PURE__*/styled.ul.withConfig({
@@ -26,12 +25,19 @@ const Listbox = _ref => {
26
25
  // focus will be moved to this one once within the menu
27
26
  parentRef = null,
28
27
  // to return focus to after leaving the last menu item
29
- selectedId,
28
+ selectedId: defaultSelectedId,
30
29
  LinkRouter,
31
30
  itemRouterProps,
32
- onClose
31
+ onClose,
32
+ variant,
33
+ tokens
33
34
  } = _ref;
34
- const initialOpen = getInitialOpen(items, selectedId); // We need to keep track of each item's ref in order to be able to
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
35
41
  // focus on a specific item via keyboard navigation
36
42
 
37
43
  const itemRefs = useRef([]);
@@ -76,48 +82,50 @@ const Listbox = _ref => {
76
82
  window.removeEventListener('touchstart', onClose);
77
83
  };
78
84
  }, [onClose, handleKeydown]);
79
- return /*#__PURE__*/_jsx(ExpandCollapse, {
80
- initialOpen: initialOpen,
81
- maxOpen: 1,
82
- children: expandProps => /*#__PURE__*/_jsx(StyledList, {
83
- role: "listbox",
84
- children: items.map((item, index) => {
85
- const {
86
- id,
87
- label,
88
- items: nestedItems
89
- } = item;
90
- const {
91
- itemId,
92
- selected
93
- } = resolveItemSelection({
94
- id,
95
- label,
96
- items: nestedItems
97
- }, selectedId); // Give `firstItemRef` to the first focusable item
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
98
106
 
99
- const itemRef = index === 0 && !itemId !== selectedId || index === 1 && items[0].id === selectedId ? firstItemRef : ref => {
100
- itemRefs.current[index] = ref;
101
- return ref;
102
- };
103
- return nestedItems ? /*#__PURE__*/_createElement(ListboxGroup, { ...item,
104
- selectedId: selectedId,
105
- key: itemId,
106
- expandProps: expandProps,
107
- LinkRouter: LinkRouter,
108
- itemRouterProps: itemRouterProps,
109
- prevItemRef: itemRefs.current[index - 1] ?? null,
110
- nextItemRef: itemRefs.current[index + 1] ?? null,
111
- ref: itemRef
112
- }) : /*#__PURE__*/_createElement(ListboxItem, { ...item,
113
- selected: selected,
114
- key: itemId,
115
- LinkRouter: LinkRouter,
116
- itemRouterProps: itemRouterProps,
117
- prevItemRef: itemRefs.current[index - 1] ?? null,
118
- nextItemRef: itemRefs.current[index + 1] ?? null,
119
- ref: itemRef
120
- });
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
+ })
121
129
  })
122
130
  })
123
131
  });
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable react/require-default-props */
2
2
  import React, { forwardRef } from 'react';
3
3
  import PropTypes from 'prop-types';
4
- import { ExpandCollapse, withLinkRouter } from '@telus-uds/components-base';
4
+ import { ExpandCollapse, withLinkRouter, useListboxContext } from '@telus-uds/components-base';
5
5
  import styled from 'styled-components';
6
6
  import ListboxItem from './ListboxItem';
7
7
  import GroupControl from './GroupControl';
@@ -33,7 +33,6 @@ const ListboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
33
33
  id,
34
34
  label,
35
35
  items,
36
- selectedId,
37
36
  LinkRouter,
38
37
  linkRouterProps,
39
38
  expandProps,
@@ -41,7 +40,10 @@ const ListboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
41
40
  nextItemRef,
42
41
  prevItemRef
43
42
  } = _ref;
44
- // TODO: implement keyboard navigation via refs for grouped items separately here
43
+ const {
44
+ selectedId
45
+ } = useListboxContext(); // TODO: implement keyboard navigation via refs for grouped items separately here
46
+
45
47
  return /*#__PURE__*/_jsx(StyledGroupWrapper, {
46
48
  role: "option",
47
49
  children: /*#__PURE__*/_jsx(ExpandCollapse.Panel, {
@@ -51,11 +53,17 @@ const ListboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
51
53
  paddingLeft: 'none',
52
54
  paddingRight: 'none',
53
55
  paddingTop: 'none',
54
- paddingBottom: 'none'
56
+ paddingBottom: 'none',
57
+ backgroundColor: 'transparent',
58
+ borderColor: 'transparent',
59
+ textLine: 'none',
60
+ borderWidth: 0
55
61
  } // TODO refactor
56
62
  // eslint-disable-next-line react/no-unstable-nested-components
57
63
  ,
58
- control: controlProps => /*#__PURE__*/_jsx(GroupControl, { ...controlProps,
64
+ control: controlProps => /*#__PURE__*/_jsx(GroupControl, {
65
+ id: id ?? label,
66
+ ...controlProps,
59
67
  label: label
60
68
  }),
61
69
  ...expandProps,
@@ -63,25 +71,33 @@ const ListboxGroup = /*#__PURE__*/forwardRef((_ref, ref) => {
63
71
  contentPaddingLeft: 'none',
64
72
  contentPaddingRight: 'none',
65
73
  contentPaddingTop: 'none',
66
- contentPaddingBottom: 'none'
74
+ contentPaddingBottom: 'none',
75
+ borderColor: 'transparent',
76
+ borderRadius: 0,
77
+ borderWidth: 0,
78
+ marginBottom: 0
67
79
  },
68
80
  controlRef: ref,
69
81
  children: /*#__PURE__*/_jsx(StyledList, {
70
- children: items.map((item, index) => /*#__PURE__*/_jsx(ListboxItem, { ...item,
71
- selected: item.id === selectedId,
72
- isChild: true,
73
- LinkRouter: LinkRouter,
74
- linkRouterProps: linkRouterProps,
75
- ...(index === 0 && {
76
- prevItemRef
77
- }),
78
- ...(index === items.length - 1 && {
79
- nextItemRef
80
- }),
81
- ...(index === items.length - 1 && {
82
- onBlur: onLastItemBlur
83
- })
84
- }, item.label))
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
+ })
85
101
  })
86
102
  })
87
103
  });
@@ -2,9 +2,8 @@
2
2
  import React, { forwardRef } from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import styled from 'styled-components';
5
- import { selectSystemProps, withLinkRouter, useThemeTokens } from '@telus-uds/components-base';
5
+ import { selectSystemProps, withLinkRouter, useThemeTokensCallback, PressableItem } from '@telus-uds/components-base';
6
6
  import { htmlAttrs } from '../utils';
7
- import PressableItem from './PressableItem';
8
7
  import { jsx as _jsx } from "react/jsx-runtime";
9
8
  const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
10
9
  const StyledItemContainer = /*#__PURE__*/styled.li.withConfig({
@@ -23,48 +22,10 @@ const StyledItemContainer = /*#__PURE__*/styled.li.withConfig({
23
22
  margin: 0
24
23
  }
25
24
  });
26
-
27
- const getSelectedItemStyles = _ref2 => {
28
- let {
29
- tokens
30
- } = _ref2;
31
- return {
32
- display: tokens.itemDisplay,
33
- fontFamily: `${tokens.itemFontName}${tokens.itemFontWeight}normal`,
34
- fontSize: tokens.itemFontSize,
35
- paddingTop: tokens.itemPaddingTop,
36
- paddingBottom: tokens.itemPaddingBottom,
37
- paddingLeft: tokens.itemPaddingLeft,
38
- paddingRight: tokens.itemPaddingRight,
39
- color: tokens.itemColor,
40
- textDecoration: tokens.itemTextDecoration,
41
- backgroundColor: tokens.itemBackgroundColor,
42
- outline: tokens.itemOutline,
43
- borderWidth: tokens.itemBorderWidth,
44
- width: '100%'
45
- };
46
- };
47
-
48
- const SelectedItem = /*#__PURE__*/styled.div.withConfig({
49
- displayName: "ListboxItem__SelectedItem",
50
- componentId: "components-web__sc-tlroet-1"
51
- })(_ref3 => {
52
- let {
53
- isChild,
54
- tokens
55
- } = _ref3;
56
- return { ...getSelectedItemStyles({
57
- tokens
58
- }),
59
- borderLeft: isChild ? `${tokens.itemBorderLeftWidth}px solid ${tokens.itemBorderLeftColor}` : 'none'
60
- };
61
- });
62
- const ListboxItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
25
+ const ListboxItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
63
26
  let {
64
27
  href,
65
28
  label,
66
- onPress,
67
- selected = false,
68
29
  isChild = false,
69
30
  onBlur,
70
31
  nextItemRef,
@@ -73,21 +34,22 @@ const ListboxItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
73
34
  variant = {},
74
35
  LinkRouter,
75
36
  linkRouterProps,
37
+ id,
38
+ onPress = () => {},
76
39
  ...rest
77
- } = _ref4;
78
- const selectedProps = selectProps(rest);
79
- const systemTokens = useThemeTokens('ListBox', tokens, variant, {
40
+ } = _ref2;
41
+ const selectedProps = selectProps({
42
+ href,
43
+ ...rest
44
+ });
45
+ const getTokens = useThemeTokensCallback('Listbox', tokens, variant, {
80
46
  isChild
81
47
  });
82
48
  return /*#__PURE__*/_jsx(StyledItemContainer, {
83
49
  isChild: isChild,
84
50
  ...selectedProps,
85
51
  role: "option",
86
- children: selected ? /*#__PURE__*/_jsx(SelectedItem, {
87
- isChild: isChild,
88
- tokens: systemTokens,
89
- children: label
90
- }) : /*#__PURE__*/_jsx(PressableItem, {
52
+ children: /*#__PURE__*/_jsx(PressableItem, {
91
53
  href: href,
92
54
  isChild: isChild,
93
55
  onPress: onPress,
@@ -95,6 +57,9 @@ const ListboxItem = /*#__PURE__*/forwardRef((_ref4, ref) => {
95
57
  nextItemRef: nextItemRef,
96
58
  prevItemRef: prevItemRef,
97
59
  ref: ref,
60
+ tokens: getTokens,
61
+ selectedProps: selectedProps,
62
+ id: id,
98
63
  children: label
99
64
  })
100
65
  });
@@ -107,7 +72,6 @@ ListboxItem.propTypes = { ...selectedSystemPropTypes,
107
72
  label: PropTypes.node.isRequired,
108
73
  nextItemRef: PropTypes.object,
109
74
  prevItemRef: PropTypes.object,
110
- onPress: PropTypes.func,
111
- selected: PropTypes.bool
75
+ onPress: PropTypes.func
112
76
  };
113
77
  export default withLinkRouter(ListboxItem);
@@ -31,7 +31,7 @@ const DropdownOverlay = /*#__PURE__*/forwardRef((_ref, ref) => {
31
31
  minWidth,
32
32
  onLayout
33
33
  } = _ref;
34
- const systemTokens = useThemeTokens('ListBox', {}, {});
34
+ const systemTokens = useThemeTokens('Listbox', {}, {});
35
35
  return /*#__PURE__*/_jsx(WebPortal, {
36
36
  children: /*#__PURE__*/_jsx(View, {
37
37
  ref: ref,