@telus-uds/components-web 2.10.0 → 2.12.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 (60) hide show
  1. package/CHANGELOG.md +33 -2
  2. package/component-docs.json +76 -11
  3. package/lib/BlockQuote/BlockQuote.js +4 -1
  4. package/lib/Card/Card.js +2 -0
  5. package/lib/DatePicker/DatePicker.js +23 -12
  6. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +5 -10
  7. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +32 -7
  8. package/lib/Footnote/FootnoteLink.js +1 -2
  9. package/lib/Listbox/GroupControl.js +44 -28
  10. package/lib/Listbox/Listbox.js +54 -47
  11. package/lib/Listbox/ListboxGroup.js +36 -20
  12. package/lib/Listbox/ListboxItem.js +14 -51
  13. package/lib/Listbox/ListboxOverlay.js +1 -1
  14. package/lib/PriceLockup/PriceLockup.js +6 -1
  15. package/lib/Video/ControlBar/ControlBar.js +13 -10
  16. package/lib/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +4 -1
  17. package/lib/VideoPicker/VideoPicker.js +1 -1
  18. package/lib/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +14 -2
  19. package/lib/utils/index.js +3 -3
  20. package/lib-module/BlockQuote/BlockQuote.js +4 -1
  21. package/lib-module/Card/Card.js +2 -0
  22. package/lib-module/DatePicker/DatePicker.js +23 -12
  23. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +6 -11
  24. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +32 -7
  25. package/lib-module/Footnote/FootnoteLink.js +1 -2
  26. package/lib-module/Listbox/GroupControl.js +45 -29
  27. package/lib-module/Listbox/Listbox.js +54 -46
  28. package/lib-module/Listbox/ListboxGroup.js +37 -21
  29. package/lib-module/Listbox/ListboxItem.js +15 -51
  30. package/lib-module/Listbox/ListboxOverlay.js +1 -1
  31. package/lib-module/PriceLockup/PriceLockup.js +7 -2
  32. package/lib-module/Video/ControlBar/ControlBar.js +14 -11
  33. package/lib-module/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.js +4 -1
  34. package/lib-module/VideoPicker/VideoPicker.js +1 -1
  35. package/lib-module/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.js +14 -2
  36. package/lib-module/utils/index.js +1 -1
  37. package/package.json +3 -3
  38. package/src/BlockQuote/BlockQuote.jsx +13 -1
  39. package/src/Card/Card.jsx +12 -8
  40. package/src/DatePicker/DatePicker.jsx +22 -12
  41. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +9 -6
  42. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +21 -4
  43. package/src/Footnote/FootnoteLink.jsx +1 -2
  44. package/src/Listbox/GroupControl.jsx +50 -33
  45. package/src/Listbox/Listbox.jsx +59 -50
  46. package/src/Listbox/ListboxGroup.jsx +34 -19
  47. package/src/Listbox/ListboxItem.jsx +26 -48
  48. package/src/Listbox/ListboxOverlay.jsx +1 -1
  49. package/src/PriceLockup/PriceLockup.jsx +7 -2
  50. package/src/Video/ControlBar/ControlBar.jsx +17 -13
  51. package/src/Video/ControlBar/Controls/VideoProgressBar/VideoProgressBar.jsx +2 -1
  52. package/src/VideoPicker/VideoPicker.jsx +1 -1
  53. package/src/shared/VideoSplash/SplashButtonWithDetails/SplashButtonWithDetails.jsx +8 -1
  54. package/src/utils/index.js +1 -1
  55. package/lib/Listbox/PressableItem.js +0 -149
  56. package/lib/utils/htmlAttrs.js +0 -33
  57. package/lib-module/Listbox/PressableItem.js +0 -128
  58. package/lib-module/utils/htmlAttrs.js +0 -22
  59. package/src/Listbox/PressableItem.jsx +0 -121
  60. package/src/utils/htmlAttrs.js +0 -29
package/CHANGELOG.md CHANGED
@@ -1,12 +1,43 @@
1
1
  # Change Log - @telus-uds/components-web
2
2
 
3
- This log was last generated on Tue, 20 Jun 2023 16:00:54 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 28 Jun 2023 23:16:56 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 2.12.0
8
+
9
+ Wed, 28 Jun 2023 23:16:56 GMT
10
+
11
+ ### Minor changes
12
+
13
+ - Fixed an issue where FootnoteLink had a default property value which was being applied as 'smallerpx' instead of the intended 'smaller' (kyle.king2@telus.com)
14
+ - Gradient token added to Card component (35577399+JoshHC@users.noreply.github.com)
15
+ - added function to select link tokens from themeTokens (kyle.king2@telus.com)
16
+ - Bump @telus-uds/components-base to v1.53.0
17
+ - Bump @telus-uds/system-theme-tokens to v2.36.0
18
+
19
+ ### Patches
20
+
21
+ - May not be able to focus `ChevronLink` for `theme-allium` (shahzaibkhalidmalik@outlook.com)
22
+
23
+ ## 2.11.0
24
+
25
+ Wed, 21 Jun 2023 20:40:42 GMT
26
+
27
+ ### Minor changes
28
+
29
+ - Adjusted component implementations for 'Video' components to allow for custom height, playing appearance state and custom fontWeight for SplashButtonWithDetails (kyle.king2@telus.com)
30
+ - Standardized Listbox (wlsdud194@hotmail.com)
31
+ - Bump @telus-uds/components-base to v1.52.0
32
+ - Bump @telus-uds/system-theme-tokens to v2.35.0
33
+
34
+ ### Patches
35
+
36
+ - Fixes where `frame` mode in `VideoPicker` is used, render short video titles for `md` viewport. (shahzaibkhalidmalik@outlook.com)
37
+
7
38
  ## 2.10.0
8
39
 
9
- Tue, 20 Jun 2023 16:00:54 GMT
40
+ Tue, 20 Jun 2023 16:09:24 GMT
10
41
 
11
42
  ### Minor changes
12
43
 
@@ -522,6 +522,7 @@
522
522
  "flex": "integer",
523
523
  "backgroundColor": "color",
524
524
  "borderColor": "color",
525
+ "gradient": "gradient",
525
526
  "borderRadius": "radius",
526
527
  "borderWidth": "border",
527
528
  "paddingBottom": "size",
@@ -793,6 +794,17 @@
793
794
  "required": false,
794
795
  "description": "Use to visually mark an input as valid or invalid."
795
796
  },
797
+ "disabled": {
798
+ "defaultValue": {
799
+ "value": "false",
800
+ "computed": false
801
+ },
802
+ "type": {
803
+ "name": "bool"
804
+ },
805
+ "required": false,
806
+ "description": "Disable the input which will not open the calendar picker"
807
+ },
796
808
  "id": {
797
809
  "type": {
798
810
  "name": "string"
@@ -1056,11 +1068,14 @@
1056
1068
  },
1057
1069
  "required": false
1058
1070
  },
1059
- "fontSize": {
1060
- "defaultValue": {
1061
- "value": "'smaller'",
1062
- "computed": false
1071
+ "onClick": {
1072
+ "type": {
1073
+ "name": "func"
1063
1074
  },
1075
+ "required": true,
1076
+ "description": "A callback function to handle the click of a FootnoteLink."
1077
+ },
1078
+ "fontSize": {
1064
1079
  "type": {
1065
1080
  "name": "union",
1066
1081
  "value": [
@@ -1074,13 +1089,6 @@
1074
1089
  },
1075
1090
  "required": false,
1076
1091
  "description": "Override default `fontSize` to set specific font size value"
1077
- },
1078
- "onClick": {
1079
- "type": {
1080
- "name": "func"
1081
- },
1082
- "required": true,
1083
- "description": "A callback function to handle the click of a FootnoteLink."
1084
1092
  }
1085
1093
  },
1086
1094
  "attributes": {}
@@ -2351,6 +2359,55 @@
2351
2359
  },
2352
2360
  "required": false,
2353
2361
  "description": "To provide a11y text for `PriceLockup` component\n\n**Note:** a11yText will override strikethrough price, so it must include price (ie. \"was 50 dollars per month\")"
2362
+ },
2363
+ "tokens": {
2364
+ "type": {
2365
+ "name": "custom",
2366
+ "raw": {
2367
+ "fontName": "fontName",
2368
+ "fontWeight": "fontWeight",
2369
+ "footnoteMarginTop": "size",
2370
+ "footnoteGap": "size",
2371
+ "bottomTextMarginTop": "size",
2372
+ "priceMarginBottom": "size",
2373
+ "bottomLinksMarginLeft": "size",
2374
+ "topTextMarginBottom": "size",
2375
+ "strikeThroughHeight": "size",
2376
+ "strikeThroughColor": "color",
2377
+ "fontColor": "color",
2378
+ "dividerColor": "color",
2379
+ "topTextFontSize": "fontSize",
2380
+ "strikeThroughPosition": "size",
2381
+ "topTextLineHeight": "lineHeight",
2382
+ "currencySymbolFontSize": "fontSize",
2383
+ "currencySymbolLineHeight": "lineHeight",
2384
+ "currencySymbolFontName": "fontName",
2385
+ "currencySymbolFontWeight": "fontWeight",
2386
+ "amountFontSize": "fontSize",
2387
+ "amountLineHeight": "lineHeight",
2388
+ "amountLetterSpacing": "letterSpacing",
2389
+ "amountFontWeight": "fontWeight",
2390
+ "amountFontName": "fontName",
2391
+ "centsFontSize": "fontSize",
2392
+ "centsLineHeight": "lineHeight",
2393
+ "centsFontName": "fontName",
2394
+ "centsFontWeight": "fontWeight",
2395
+ "topTextFontName": "fontName",
2396
+ "topTextFontWeight": "fontWeight",
2397
+ "rateFontSize": "fontSize",
2398
+ "rateLineHeight": "lineHeight",
2399
+ "rateFontName": "fontName",
2400
+ "rateFontWeight": "fontWeight",
2401
+ "bottomTextFontSize": "fontSize",
2402
+ "bottomTextLineHeight": "lineHeight",
2403
+ "footnoteLinkColor": "color",
2404
+ "footnoteLinkFontName": "fontName",
2405
+ "footnoteLinkFontWeight": "fontWeight",
2406
+ "footnoteLinkFontSize": "fontSize"
2407
+ }
2408
+ },
2409
+ "required": false,
2410
+ "description": "`PriceLockup` tokens"
2354
2411
  }
2355
2412
  },
2356
2413
  "attributes": {}
@@ -9107,6 +9164,7 @@
9107
9164
  "flex": "integer",
9108
9165
  "backgroundColor": "color",
9109
9166
  "borderColor": "color",
9167
+ "gradient": "gradient",
9110
9168
  "borderRadius": "radius",
9111
9169
  "borderWidth": "border",
9112
9170
  "paddingBottom": "size",
@@ -12632,6 +12690,7 @@
12632
12690
  "dotWidth": "size",
12633
12691
  "dotBorderWidth": "border",
12634
12692
  "timelineContainerDirection": "direction",
12693
+ "timelineConnectorColor": "color",
12635
12694
  "timelineColor": "color",
12636
12695
  "connectorWidth": "size",
12637
12696
  "connectorHeight": "size",
@@ -12730,7 +12789,10 @@
12730
12789
  "paddingBottom": "size",
12731
12790
  "shadow": "shadow",
12732
12791
  "alignSelf": "flexAlign",
12792
+ "space": "integer",
12733
12793
  "icon": "icon",
12794
+ "trackHeight": "size",
12795
+ "outerBorderGapButton": "size",
12734
12796
  "width": "size",
12735
12797
  "trackBorderWidth": "border",
12736
12798
  "trackBorderColor": "color",
@@ -13056,7 +13118,10 @@
13056
13118
  "paddingBottom": "size",
13057
13119
  "shadow": "shadow",
13058
13120
  "alignSelf": "flexAlign",
13121
+ "space": "integer",
13059
13122
  "icon": "icon",
13123
+ "trackHeight": "size",
13124
+ "outerBorderGapButton": "size",
13060
13125
  "width": "size",
13061
13126
  "trackBorderWidth": "border",
13062
13127
  "trackBorderColor": "color",
@@ -140,7 +140,10 @@ const BlockQuote = _ref8 => {
140
140
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
141
141
  tokens: {
142
142
  color,
143
- fontWeight: '500'
143
+ fontName: linkFontName,
144
+ fontSize: linkFontSize,
145
+ fontWeight: linkFontWeight,
146
+ lineHeight: linkLineHeight
144
147
  },
145
148
  children: link
146
149
  });
package/lib/Card/Card.js CHANGED
@@ -30,6 +30,7 @@ const selectCardBaseTokens = _ref => {
30
30
  let {
31
31
  backgroundColor,
32
32
  borderColor,
33
+ gradient,
33
34
  borderWidth,
34
35
  borderRadius,
35
36
  shadow,
@@ -38,6 +39,7 @@ const selectCardBaseTokens = _ref => {
38
39
  return {
39
40
  backgroundColor,
40
41
  borderColor,
42
+ gradient,
41
43
  borderWidth,
42
44
  borderRadius,
43
45
  shadow,
@@ -125,6 +125,7 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
125
125
  tokens,
126
126
  variant = {},
127
127
  validation,
128
+ disabled,
128
129
  ...rest
129
130
  } = _ref;
130
131
  const [inputDate, setInputDate] = (0, _react.useState)(date instanceof _moment.default ? date : undefined);
@@ -149,21 +150,23 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
149
150
  };
150
151
 
151
152
  const handleFocus = event => {
152
- if (event.target.tagName === 'INPUT') {
153
+ if (event.target.tagName === 'INPUT' && !disabled) {
153
154
  setIsFocused(true);
154
155
  }
155
156
  };
156
157
 
157
158
  const handleMouseDown = event => {
158
- if (event.target.tagName === 'INPUT') {
159
- setIsClickedInside(true);
160
- setIsFocused(true);
161
- } else if (event.target.tagName === 'path') {
162
- // needed to handle the case where the user clicks on the tooltip icon
163
- setIsClickedInside(true);
164
- event.stopPropagation();
165
- } else {
166
- event.stopPropagation();
159
+ if (!disabled) {
160
+ if (event.target.tagName === 'INPUT') {
161
+ setIsClickedInside(true);
162
+ setIsFocused(true);
163
+ } else if (event.target.tagName === 'path') {
164
+ // needed to handle the case where the user clicks on the tooltip icon
165
+ setIsClickedInside(true);
166
+ event.stopPropagation();
167
+ } else {
168
+ event.stopPropagation();
169
+ }
167
170
  }
168
171
  };
169
172
 
@@ -308,8 +311,10 @@ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
308
311
  label: ((_dictionary$copy = _dictionary.default[copy]) === null || _dictionary$copy === void 0 ? void 0 : _dictionary$copy.roleDescription) ?? label,
309
312
  value: inputText,
310
313
  validation: validation,
314
+ inactive: disabled,
311
315
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SingleDatePicker.default, {
312
316
  date: inputDate,
317
+ disabled: disabled,
313
318
  onDateChange: onChange,
314
319
  focused: isFocused,
315
320
  onFocusChange: onFocusChange,
@@ -406,7 +411,12 @@ DatePicker.propTypes = { ...selectedSystemPropTypes,
406
411
  /**
407
412
  * Use to visually mark an input as valid or invalid.
408
413
  */
409
- validation: _propTypes.default.oneOf(['error', 'success'])
414
+ validation: _propTypes.default.oneOf(['error', 'success']),
415
+
416
+ /**
417
+ * Disable the input which will not open the calendar picker
418
+ */
419
+ disabled: _propTypes.default.bool
410
420
  };
411
421
  DatePicker.defaultProps = {
412
422
  copy: 'en',
@@ -419,7 +429,8 @@ DatePicker.defaultProps = {
419
429
  hintPosition: 'inline',
420
430
  tooltip: undefined,
421
431
  onDateChange: () => {},
422
- validation: undefined
432
+ validation: undefined,
433
+ disabled: false
423
434
  };
424
435
  var _default = DatePicker;
425
436
  exports.default = _default;
@@ -28,12 +28,6 @@ const ExpandCollapseMini = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
28
28
  tokens,
29
29
  ...rest
30
30
  } = _ref;
31
- const {
32
- variant
33
- } = rest;
34
- const {
35
- borderWidth
36
- } = (0, _componentsBase.useThemeTokens)('ExpandCollapseMini', tokens, variant);
37
31
 
38
32
  const handleChange = (openPanels, event) => {
39
33
  if (typeof onToggle === 'function') {
@@ -43,9 +37,6 @@ const ExpandCollapseMini = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
43
37
  };
44
38
 
45
39
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ExpandCollapse, {
46
- tokens: {
47
- borderWidth
48
- },
49
40
  onChange: handleChange,
50
41
  children: expandProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ExpandCollapse.Panel, { ...expandProps,
51
42
  panelId: "ExpandCollapseMiniPanel",
@@ -53,7 +44,11 @@ const ExpandCollapseMini = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
53
44
  mini: true
54
45
  },
55
46
  controlTokens: {
56
- icon: null
47
+ // Remove unwanted look and feel from ExpandCollapse(background pressed, focus border and text underline)
48
+ icon: null,
49
+ borderColor: 'transparent',
50
+ textLine: 'none',
51
+ backgroundColor: 'transparent'
57
52
  } // TODO refactor
58
53
  // eslint-disable-next-line react/no-unstable-nested-components
59
54
  ,
@@ -29,7 +29,22 @@ const presentationOnly = {
29
29
 
30
30
  };
31
31
 
32
- const ExpandCollapseMiniControl = _ref => {
32
+ const selectLinkTokens = _ref => {
33
+ let {
34
+ color,
35
+ textLine,
36
+ lineHeight,
37
+ fontSize
38
+ } = _ref;
39
+ return {
40
+ color,
41
+ textLine,
42
+ blockLineHeight: lineHeight,
43
+ blockFontSize: fontSize
44
+ };
45
+ };
46
+
47
+ const ExpandCollapseMiniControl = _ref2 => {
33
48
  let {
34
49
  pressableState,
35
50
  collapseTitle,
@@ -38,16 +53,25 @@ const ExpandCollapseMiniControl = _ref => {
38
53
  tokens,
39
54
  variant = {},
40
55
  ...rest
41
- } = _ref;
56
+ } = _ref2;
42
57
  const {
43
58
  expanded,
44
- hover
45
- } = pressableState || {};
59
+ hover,
60
+ focus
61
+ } = pressableState || {}; // we only want focus outline when focusing, if user is pressing we don't want the border.
62
+
63
+ const {
64
+ outerBorderColor
65
+ } = (0, _componentsBase.useThemeTokens)('Link', {}, {}, {
66
+ focus
67
+ });
46
68
  const {
47
69
  size,
48
- icon
70
+ icon,
71
+ ...themeTokens
49
72
  } = (0, _componentsBase.useThemeTokens)('ExpandCollapseMiniControl', tokens, variant, {
50
- expanded
73
+ expanded,
74
+ focus
51
75
  }); // Choose hover styles when any part of Control is hoverred
52
76
 
53
77
  const appearance = { ...variant,
@@ -75,7 +99,8 @@ const ExpandCollapseMiniControl = _ref => {
75
99
  icon: icon,
76
100
  iconPosition: iconPosition,
77
101
  tokens: linkState => ({ ...getTokens(linkState),
78
- outerBorderWidth: 0
102
+ ...selectLinkTokens(themeTokens),
103
+ outerBorderColor
79
104
  }),
80
105
  ...presentationOnly,
81
106
  ...selectProps(rest),
@@ -140,8 +140,7 @@ FootnoteLink.propTypes = { ...selectedSystemPropTypes,
140
140
  fontSize: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
141
141
  };
142
142
  FootnoteLink.defaultProps = {
143
- copy: 'en',
144
- fontSize: 'smaller'
143
+ copy: 'en'
145
144
  };
146
145
  var _default = FootnoteLink;
147
146
  exports.default = _default;
@@ -22,32 +22,41 @@ const StyledControlWrapper = /*#__PURE__*/_styledComponents.default.div.withConf
22
22
  componentId: "components-web__sc-1r7ts3q-0"
23
23
  })(_ref => {
24
24
  let {
25
- focus,
26
- tokens
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
27
40
  } = _ref;
28
41
  return {
29
- fontFamily: `${tokens.groupFontName}${tokens.groupFontWeight}normal`,
30
- fontSize: tokens.groupFontSize,
31
- color: tokens.groupColor,
32
- textDecoration: tokens.itemTextDecoration,
33
- backgroundColor: tokens.groupBackgroundColor,
34
- outline: tokens.itemOutline,
42
+ fontFamily: `${groupFontName}${groupFontWeight}normal`,
43
+ fontSize: groupFontSize,
44
+ color: groupColor,
45
+ textDecoration: itemTextDecoration,
46
+ backgroundColor: groupBackgroundColor,
47
+ outline: itemOutline,
35
48
  width: '100%',
49
+ height: groupHeight,
36
50
  display: 'flex',
51
+ alignItems: 'center',
37
52
  justifyContent: 'space-between',
38
- ...(focus ? {
39
- border: `${tokens.groupBorderWidth} solid ${tokens.groupBorderColor}`,
40
- borderRadius: tokens.groupBorderRadius,
41
- paddingLeft: `calc(${tokens.groupPaddingLeft}px - ${tokens.groupBorderWidth}px)`,
42
- paddingRight: `calc(${tokens.groupPaddingRight}px - ${tokens.groupBorderWidth}px)`,
43
- paddingTop: `calc(${tokens.groupPaddingTop}px - ${tokens.groupBorderWidth}px)`,
44
- paddingBottom: `calc(${tokens.groupPaddingBottom}px - ${tokens.groupBorderWidth}px)`
45
- } : {
46
- paddingLeft: tokens.groupPaddingLeft,
47
- paddingRight: tokens.groupPaddingRight,
48
- paddingTop: tokens.groupPaddingTop,
49
- paddingBottom: tokens.groupPaddingBottom
50
- })
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
51
60
  };
52
61
  });
53
62
 
@@ -57,24 +66,31 @@ const GroupControl = _ref2 => {
57
66
  pressed,
58
67
  hover,
59
68
  focus,
60
- current,
61
- label
69
+ label,
70
+ id
62
71
  } = _ref2;
63
- const tokens = (0, _componentsBase.useThemeTokens)('ListBox', {}, {}, {
72
+ const {
73
+ selectedId,
74
+ setSelectedId
75
+ } = (0, _componentsBase.useListboxContext)();
76
+ const tokens = (0, _componentsBase.useThemeTokens)('Listbox', {}, {}, {
64
77
  expanded,
65
78
  pressed,
66
79
  hover,
67
- current,
80
+ current: selectedId === id && id !== undefined,
68
81
  focus
69
82
  });
70
83
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledControlWrapper, {
71
- focus,
72
- tokens,
84
+ onClick: () => setSelectedId(id),
85
+ ...tokens,
73
86
  children: [label, /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Spacer, {
74
87
  space: 1,
75
88
  direction: "row"
76
89
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
77
90
  icon: tokens.groupIcon,
91
+ tokens: {
92
+ color: tokens.groupColor
93
+ },
78
94
  variant: {
79
95
  size: 'micro'
80
96
  }
@@ -83,11 +99,11 @@ const GroupControl = _ref2 => {
83
99
  };
84
100
 
85
101
  GroupControl.propTypes = {
102
+ id: _propTypes.default.string,
86
103
  expanded: _propTypes.default.bool,
87
104
  pressed: _propTypes.default.bool,
88
105
  hover: _propTypes.default.bool,
89
106
  focus: _propTypes.default.bool,
90
- current: _propTypes.default.bool,
91
107
  label: _propTypes.default.string
92
108
  };
93
109
  var _default = GroupControl;
@@ -19,8 +19,6 @@ var _ListboxItem = _interopRequireDefault(require("./ListboxItem"));
19
19
 
20
20
  var _ListboxOverlay = _interopRequireDefault(require("./ListboxOverlay"));
21
21
 
22
- var _resolveItemSelection = _interopRequireDefault(require("../NavigationBar/resolveItemSelection"));
23
-
24
22
  var _jsxRuntime = require("react/jsx-runtime");
25
23
 
26
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -47,12 +45,19 @@ const Listbox = _ref => {
47
45
  // focus will be moved to this one once within the menu
48
46
  parentRef = null,
49
47
  // to return focus to after leaving the last menu item
50
- selectedId,
48
+ selectedId: defaultSelectedId,
51
49
  LinkRouter,
52
50
  itemRouterProps,
53
- onClose
51
+ onClose,
52
+ variant,
53
+ tokens
54
54
  } = _ref;
55
- const initialOpen = getInitialOpen(items, selectedId); // We need to keep track of each item's ref in order to be able to
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
56
61
  // focus on a specific item via keyboard navigation
57
62
 
58
63
  const itemRefs = (0, _react.useRef)([]);
@@ -97,48 +102,50 @@ const Listbox = _ref => {
97
102
  window.removeEventListener('touchstart', onClose);
98
103
  };
99
104
  }, [onClose, handleKeydown]);
100
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.ExpandCollapse, {
101
- initialOpen: initialOpen,
102
- maxOpen: 1,
103
- children: expandProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledList, {
104
- role: "listbox",
105
- children: items.map((item, index) => {
106
- const {
107
- id,
108
- label,
109
- items: nestedItems
110
- } = item;
111
- const {
112
- itemId,
113
- selected
114
- } = (0, _resolveItemSelection.default)({
115
- id,
116
- label,
117
- items: nestedItems
118
- }, selectedId); // Give `firstItemRef` to the first focusable item
119
-
120
- const itemRef = index === 0 && !itemId !== selectedId || index === 1 && items[0].id === selectedId ? firstItemRef : ref => {
121
- itemRefs.current[index] = ref;
122
- return ref;
123
- };
124
- return nestedItems ? /*#__PURE__*/(0, _react.createElement)(_ListboxGroup.default, { ...item,
125
- selectedId: selectedId,
126
- key: itemId,
127
- expandProps: expandProps,
128
- LinkRouter: LinkRouter,
129
- itemRouterProps: itemRouterProps,
130
- prevItemRef: itemRefs.current[index - 1] ?? null,
131
- nextItemRef: itemRefs.current[index + 1] ?? null,
132
- ref: itemRef
133
- }) : /*#__PURE__*/(0, _react.createElement)(_ListboxItem.default, { ...item,
134
- selected: selected,
135
- key: itemId,
136
- LinkRouter: LinkRouter,
137
- itemRouterProps: itemRouterProps,
138
- prevItemRef: itemRefs.current[index - 1] ?? null,
139
- nextItemRef: itemRefs.current[index + 1] ?? null,
140
- ref: itemRef
141
- });
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
+ })
142
149
  })
143
150
  })
144
151
  });