@itwin/itwinui-react 1.30.0 → 1.32.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 (66) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/cjs/core/Badge/Badge.js +2 -2
  3. package/cjs/core/Checkbox/Checkbox.d.ts +13 -0
  4. package/cjs/core/Checkbox/Checkbox.js +15 -22
  5. package/cjs/core/ColorPicker/ColorBuilder.js +7 -8
  6. package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
  7. package/cjs/core/ColorPicker/ColorSwatch.js +2 -2
  8. package/cjs/core/ComboBox/ComboBox.d.ts +11 -0
  9. package/cjs/core/ComboBox/ComboBox.js +93 -55
  10. package/cjs/core/ExpandableBlock/ExpandableBlock.d.ts +6 -0
  11. package/cjs/core/ExpandableBlock/ExpandableBlock.js +3 -2
  12. package/cjs/core/Menu/Menu.js +3 -3
  13. package/cjs/core/Menu/MenuItem.js +1 -1
  14. package/cjs/core/Radio/Radio.d.ts +13 -0
  15. package/cjs/core/Radio/Radio.js +7 -8
  16. package/cjs/core/Select/Select.js +23 -8
  17. package/cjs/core/Table/TablePaginator.js +7 -9
  18. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +1 -1
  19. package/cjs/core/Tile/Tile.js +4 -4
  20. package/cjs/core/Tree/Tree.d.ts +123 -0
  21. package/cjs/core/Tree/Tree.js +177 -0
  22. package/cjs/core/Tree/TreeContext.d.ts +25 -0
  23. package/cjs/core/Tree/TreeContext.js +20 -0
  24. package/cjs/core/Tree/TreeNode.d.ts +87 -0
  25. package/cjs/core/Tree/TreeNode.js +169 -0
  26. package/cjs/core/Tree/TreeNodeExpander.d.ts +8 -0
  27. package/cjs/core/Tree/TreeNodeExpander.js +46 -0
  28. package/cjs/core/Tree/index.d.ts +6 -0
  29. package/cjs/core/Tree/index.js +13 -0
  30. package/cjs/core/index.d.ts +2 -0
  31. package/cjs/core/index.js +5 -1
  32. package/cjs/core/utils/components/Popover.js +1 -1
  33. package/cjs/core/utils/functions/focusable.js +6 -2
  34. package/esm/core/Badge/Badge.js +2 -2
  35. package/esm/core/Checkbox/Checkbox.d.ts +13 -0
  36. package/esm/core/Checkbox/Checkbox.js +15 -22
  37. package/esm/core/ColorPicker/ColorBuilder.js +7 -8
  38. package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
  39. package/esm/core/ColorPicker/ColorSwatch.js +2 -2
  40. package/esm/core/ComboBox/ComboBox.d.ts +11 -0
  41. package/esm/core/ComboBox/ComboBox.js +94 -56
  42. package/esm/core/ExpandableBlock/ExpandableBlock.d.ts +6 -0
  43. package/esm/core/ExpandableBlock/ExpandableBlock.js +3 -2
  44. package/esm/core/Menu/Menu.js +3 -3
  45. package/esm/core/Menu/MenuItem.js +1 -1
  46. package/esm/core/Radio/Radio.d.ts +13 -0
  47. package/esm/core/Radio/Radio.js +7 -8
  48. package/esm/core/Select/Select.js +23 -8
  49. package/esm/core/Table/TablePaginator.js +7 -9
  50. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +1 -1
  51. package/esm/core/Tile/Tile.js +4 -4
  52. package/esm/core/Tree/Tree.d.ts +123 -0
  53. package/esm/core/Tree/Tree.js +170 -0
  54. package/esm/core/Tree/TreeContext.d.ts +25 -0
  55. package/esm/core/Tree/TreeContext.js +13 -0
  56. package/esm/core/Tree/TreeNode.d.ts +87 -0
  57. package/esm/core/Tree/TreeNode.js +162 -0
  58. package/esm/core/Tree/TreeNodeExpander.d.ts +8 -0
  59. package/esm/core/Tree/TreeNodeExpander.js +39 -0
  60. package/esm/core/Tree/index.d.ts +6 -0
  61. package/esm/core/Tree/index.js +7 -0
  62. package/esm/core/index.d.ts +2 -0
  63. package/esm/core/index.js +1 -0
  64. package/esm/core/utils/components/Popover.js +1 -1
  65. package/esm/core/utils/functions/focusable.js +6 -2
  66. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.32.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.31.0...v1.32.0) (2022-02-25)
4
+
5
+ ### What's new
6
+
7
+ * **Popover:** Append to `body` by default and increase z-index ([#562](https://www.github.com/iTwin/iTwinUI-react/issues/562)) ([66df49f](https://www.github.com/iTwin/iTwinUI-react/commit/66df49fec85ec13707cc73bb3fdf84ca3a4c7655))
8
+ - This will fix many clipping and positioning issues in tooltips and dropdowns, without the need for any workarounds.
9
+ - If a popover is nested within another popover which is already appended to document.body, then it should use `appendTo='parent'`.
10
+ * **Tree:** Add new Tree Component ([#468](https://www.github.com/iTwin/iTwinUI-react/issues/468)) ([1d5083c](https://www.github.com/iTwin/iTwinUI-react/commit/1d5083c612cd1f1b1cbec0e5ea82b8b573d72b86))
11
+ * **ComboBox:** Add new `itemRenderer` prop for customizing the look of menu items ([#547](https://www.github.com/iTwin/iTwinUI-react/issues/547)) ([d866d32](https://www.github.com/iTwin/iTwinUI-react/commit/d866d32a719dea6e359519ae40bc66dc7df209e1))
12
+ * **ExpandableBlock:** Add borderless variant via new `styleType` prop ([#557](https://www.github.com/iTwin/iTwinUI-react/issues/557)) ([9e8c8ab](https://www.github.com/iTwin/iTwinUI-react/commit/9e8c8ab76a7c6d24c51d5eea9e4424417c0e2fad))
13
+ * **Checkbox** and **Radio**: Render without `<label>` wrapper if `label` prop is not passed ([#556](https://www.github.com/iTwin/iTwinUI-react/issues/556)) ([a436cbf](https://www.github.com/iTwin/iTwinUI-react/commit/a436cbf333629b2603bf160f9a8ffe2592093805))
14
+
15
+ ### Fixes
16
+
17
+ * **Menu:** Fix lost item focus in edge cases ([#563](https://www.github.com/iTwin/iTwinUI-react/issues/563)) ([3ccb5ed](https://www.github.com/iTwin/iTwinUI-react/commit/3ccb5ed98ac4f60479e0450abb31cbb659d902b9))
18
+
19
+ ## [1.31.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.30.0...v1.31.0) (2022-02-15)
20
+
21
+ ### What's new
22
+
23
+ * **Select:** Now uses an svg for the arrow to match ComboBox ([#540](https://www.github.com/iTwin/iTwinUI-react/issues/540)) ([c0ad092](https://www.github.com/iTwin/iTwinUI-react/commit/c0ad0921f859130f4cc866999ba2d31187b192ac))
24
+
25
+ ### Fixes
26
+
27
+ * **ButtonGroup:** Fixed z-index handling through base CSS package.
28
+ * **Popover:** Fixed popover not hiding when target is scrolled off screen.
29
+
3
30
  ## [1.30.0](https://www.github.com/iTwin/iTwinUI-react/compare/v1.29.3...v1.30.0) (2022-02-08)
4
31
 
5
32
  ### What's new
@@ -66,8 +66,8 @@ var Badge = function (props) {
66
66
  var backgroundColor = props.backgroundColor, style = props.style, className = props.className, children = props.children, rest = __rest(props, ["backgroundColor", "style", "className", "children"]);
67
67
  (0, utils_1.useTheme)();
68
68
  var _style = backgroundColor &&
69
- ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--badge-color: " + backgroundColor))
70
- ? __assign({ '--badge-color': getBadgeColorValue(backgroundColor) }, style) : __assign({ backgroundColor: getBadgeColorValue(backgroundColor) }, style);
69
+ ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-badge-background-color: " + backgroundColor))
70
+ ? __assign({ '--iui-badge-background-color': getBadgeColorValue(backgroundColor) }, style) : __assign({ backgroundColor: getBadgeColorValue(backgroundColor) }, style);
71
71
  return (react_1.default.createElement("span", __assign({ className: (0, classnames_1.default)('iui-badge', className), style: _style }, rest), children));
72
72
  };
73
73
  exports.Badge = Badge;
@@ -30,16 +30,23 @@ export declare type CheckboxProps = {
30
30
  isLoading?: boolean;
31
31
  /**
32
32
  * Custom CSS class name for the checkmark element.
33
+ *
34
+ * @deprecated As of 1.32.0, this is applied on the actual checkbox `<input>` element.
35
+ * The checkmark has been moved into a pseudo-element.
33
36
  */
34
37
  checkmarkClassName?: string;
35
38
  /**
36
39
  * Custom CSS Style for the checkmark element.
40
+ *
41
+ * @deprecated As of 1.32.0, this is applied on the actual checkbox `<input>` element.
42
+ * The checkmark has been moved into a pseudo-element.
37
43
  */
38
44
  checkmarkStyle?: React.CSSProperties;
39
45
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'>;
40
46
  /**
41
47
  * Simple input checkbox
42
48
  * @example
49
+ * <Checkbox />
43
50
  * <Checkbox label='Basic Checkbox' />
44
51
  * <Checkbox label='Disabled Checkbox' disabled />
45
52
  * <Checkbox label='Checked' checked />
@@ -78,10 +85,16 @@ export declare const Checkbox: React.ForwardRefExoticComponent<{
78
85
  isLoading?: boolean | undefined;
79
86
  /**
80
87
  * Custom CSS class name for the checkmark element.
88
+ *
89
+ * @deprecated As of 1.32.0, this is applied on the actual checkbox `<input>` element.
90
+ * The checkmark has been moved into a pseudo-element.
81
91
  */
82
92
  checkmarkClassName?: string | undefined;
83
93
  /**
84
94
  * Custom CSS Style for the checkmark element.
95
+ *
96
+ * @deprecated As of 1.32.0, this is applied on the actual checkbox `<input>` element.
97
+ * The checkmark has been moved into a pseudo-element.
85
98
  */
86
99
  checkmarkStyle?: React.CSSProperties | undefined;
87
100
  } & Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> & React.RefAttributes<HTMLInputElement>>;
@@ -38,6 +38,7 @@ require("@itwin/itwinui-css/css/inputs.css");
38
38
  /**
39
39
  * Simple input checkbox
40
40
  * @example
41
+ * <Checkbox />
41
42
  * <Checkbox label='Basic Checkbox' />
42
43
  * <Checkbox label='Disabled Checkbox' disabled />
43
44
  * <Checkbox label='Checked' checked />
@@ -47,8 +48,8 @@ require("@itwin/itwinui-css/css/inputs.css");
47
48
  * <Checkbox label='Visibility Checkbox' variant='eyeball' />
48
49
  */
49
50
  exports.Checkbox = react_1.default.forwardRef(function (props, ref) {
50
- var _a;
51
- var className = props.className, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.indeterminate, indeterminate = _c === void 0 ? false : _c, label = props.label, status = props.status, _d = props.variant, variant = _d === void 0 ? 'default' : _d, setFocus = props.setFocus, _e = props.isLoading, isLoading = _e === void 0 ? false : _e, style = props.style, checkmarkClassName = props.checkmarkClassName, checkmarkStyle = props.checkmarkStyle, rest = __rest(props, ["className", "disabled", "indeterminate", "label", "status", "variant", "setFocus", "isLoading", "style", "checkmarkClassName", "checkmarkStyle"]);
51
+ var _a, _b;
52
+ var className = props.className, _c = props.disabled, disabled = _c === void 0 ? false : _c, _d = props.indeterminate, indeterminate = _d === void 0 ? false : _d, label = props.label, status = props.status, _e = props.variant, variant = _e === void 0 ? 'default' : _e, setFocus = props.setFocus, _f = props.isLoading, isLoading = _f === void 0 ? false : _f, style = props.style, checkmarkClassName = props.checkmarkClassName, checkmarkStyle = props.checkmarkStyle, rest = __rest(props, ["className", "disabled", "indeterminate", "label", "status", "variant", "setFocus", "isLoading", "style", "checkmarkClassName", "checkmarkStyle"]);
52
53
  (0, utils_1.useTheme)();
53
54
  var inputElementRef = react_1.default.useRef(null);
54
55
  var refs = (0, utils_1.useMergedRefs)(inputElementRef, ref);
@@ -65,27 +66,19 @@ exports.Checkbox = react_1.default.forwardRef(function (props, ref) {
65
66
  : inputElementRef.current.checked;
66
67
  }
67
68
  });
68
- var defaultCheckbox = (react_1.default.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
69
- react_1.default.createElement("path", { className: 'iui-check', d: 'm6.5 12.5-4.5-4.5 1.5-1.5 3 3 6-6 1.5 1.5z' }),
70
- react_1.default.createElement("path", { className: 'iui-check-partial', d: 'm2.75 6.875h10.5v2.25h-10.5z' })));
71
- var visibilityCheckbox = (react_1.default.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
72
- react_1.default.createElement("path", { className: 'iui-check', d: 'm8 2.99051a8.81883 8.81883 0 0 0 -8 4.95062 8.74664 8.74664 0 0 0 8 5.06836 8.63266 8.63266 0 0 0 8-5.06836 8.83631 8.83631 0 0 0 -8-4.95062zm-1.31445 1.86981a1.47663 1.47663 0 1 1 -1.47663 1.47668 1.47665 1.47665 0 0 1 1.47663-1.47668zm1.31445 6.64917a7.17486 7.17486 0 0 1 -6.30475-3.55237 7.4952 7.4952 0 0 1 2.81475-2.6336 3.83956 3.83956 0 1 0 6.98126.00244 7.522 7.522 0 0 1 2.81774 2.63916 7.09785 7.09785 0 0 1 -6.309 3.54437z' }),
73
- react_1.default.createElement("g", { className: 'iui-check-partial' },
74
- react_1.default.createElement("path", { d: 'm8 3v7.9a4.01179 4.01179 0 0 0 4-4 6.7509 6.7509 0 0 0 -.2-1.4l.1.1a6.89429 6.89429 0 0 1 2.4 2.4 8.39088 8.39088 0 0 1 -2.3 2.3 6.89412 6.89412 0 0 1 -3.9 1.2c-.03345 0-.06653-.00677-.1-.0072v1.5072a8.90686 8.90686 0 0 0 8-5 8.90686 8.90686 0 0 0 -8-5z', opacity: '.33' }),
75
- react_1.default.createElement("path", { d: 'm8 0a1 1 0 0 0 -1 1v2.07135a8.91637 8.91637 0 0 0 -7 4.92865 8.91637 8.91637 0 0 0 7 4.92865v2.07135a1 1 0 0 0 2 0v-14a1 1 0 0 0 -1-1zm-1.5 4.9a1.55426 1.55426 0 0 1 .5.087v2.81451a1.40746 1.40746 0 0 1 -.5.09849 1.538 1.538 0 0 1 -1.5-1.5 1.53794 1.53794 0 0 1 1.5-1.5zm-2.3 5.4a6.97279 6.97279 0 0 1 -2.5-2.3 6.89429 6.89429 0 0 1 2.4-2.4c.1 0 .1-.1.2-.1a3.194 3.194 0 0 0 -.3 1.4 4.0047 4.0047 0 0 0 3 3.857v.65289a6.37491 6.37491 0 0 1 -2.8-1.10989z' })),
76
- react_1.default.createElement("path", { className: 'iui-uncheck', d: 'm1.70671 12.879 11.17218-11.17219 1.4142 1.4142-11.17218 11.17218zm.99329-1.679 1.1-1.1a5.06317 5.06317 0 0 1 -2-2.1 7.48268 7.48268 0 0 1 6.2-3.5 4.86877 4.86877 0 0 1 1.2.1l1.3-1.3a10.07431 10.07431 0 0 0 -2.5-.3 8.84129 8.84129 0 0 0 -8 5 8.42455 8.42455 0 0 0 2.7 3.2zm10.7-6.4-1.1 1.1a7.08625 7.08625 0 0 1 2 2.1 7.50323 7.50323 0 0 1 -6.2 3.5 8.31665 8.31665 0 0 1 -1.3-.2l-1.3 1.3a8.909 8.909 0 0 0 6.4-.5 9.04344 9.04344 0 0 0 4.1-4.1 9.168 9.168 0 0 0 -2.6-3.2z' })));
77
- return (react_1.default.createElement("label", { className: (0, classnames_1.default)('iui-checkbox', (_a = {
69
+ var checkbox = (react_1.default.createElement(react_1.default.Fragment, null,
70
+ react_1.default.createElement("input", __assign({ className: (0, classnames_1.default)('iui-checkbox', {
71
+ 'iui-checkbox-visibility': variant === 'eyeball',
72
+ 'iui-loading': isLoading,
73
+ }, className && (_a = {}, _a[className] = !label, _a), checkmarkClassName), style: __assign(__assign({}, (!label && style)), checkmarkStyle), disabled: disabled || isLoading, type: 'checkbox', ref: refs }, rest)),
74
+ isLoading && react_1.default.createElement(ProgressIndicators_1.ProgressRadial, { size: 'x-small', indeterminate: true })));
75
+ return !label ? (checkbox) : (react_1.default.createElement("label", { className: (0, classnames_1.default)('iui-checkbox-wrapper', (_b = {
78
76
  'iui-disabled': disabled
79
77
  },
80
- _a["iui-" + status] = !!status,
81
- _a['iui-loading'] = isLoading,
82
- _a['iui-checkbox-visibility'] = variant === 'eyeball',
83
- _a), className), style: style },
84
- react_1.default.createElement("input", __assign({ disabled: disabled || isLoading, type: 'checkbox', ref: refs }, rest)),
85
- react_1.default.createElement("span", { className: (0, classnames_1.default)('iui-checkbox-checkmark', checkmarkClassName), style: checkmarkStyle },
86
- isLoading && react_1.default.createElement(ProgressIndicators_1.ProgressRadial, { indeterminate: true }),
87
- !isLoading &&
88
- (variant === 'default' ? defaultCheckbox : visibilityCheckbox)),
89
- label && react_1.default.createElement("span", { className: 'iui-label' }, label)));
78
+ _b["iui-" + status] = !!status,
79
+ _b['iui-loading'] = isLoading,
80
+ _b), className), style: style },
81
+ checkbox,
82
+ label && react_1.default.createElement("span", { className: 'iui-checkbox-label' }, label)));
90
83
  });
91
84
  exports.default = exports.Checkbox;
@@ -69,21 +69,20 @@ exports.ColorBuilder = react_1.default.forwardRef(function (props, ref) {
69
69
  ]);
70
70
  var _p = react_1.default.useState(false), colorDotActive = _p[0], setColorDotActive = _p[1];
71
71
  var hueColorString = hueSliderColor.toHexString();
72
- var colorSquareStyle = ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--hue:\u00A0" + hueColorString))
72
+ var colorSquareStyle = ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-field-hue: " + hueColorString))
73
73
  ? {
74
- '--hue': hueColorString,
75
- '--selected-color': dotColorString,
74
+ '--iui-color-field-hue': hueColorString,
75
+ '--iui-color-picker-selected-color': dotColorString,
76
76
  }
77
77
  : { backgroundColor: hueColorString };
78
- var opacitySliderStyle = ((_f = (_e = (_d = (0, utils_1.getWindow)()) === null || _d === void 0 ? void 0 : _d.CSS) === null || _e === void 0 ? void 0 : _e.supports) === null || _f === void 0 ? void 0 : _f.call(_e, "--selected-color:\u00A0" + hueColorString))
79
- ? { '--selected-color': hueColorString }
78
+ var opacitySliderStyle = ((_f = (_e = (_d = (0, utils_1.getWindow)()) === null || _d === void 0 ? void 0 : _d.CSS) === null || _e === void 0 ? void 0 : _e.supports) === null || _f === void 0 ? void 0 : _f.call(_e, "--iui-color-picker-selected-color: " + hueColorString))
79
+ ? { '--iui-color-picker-selected-color': hueColorString }
80
80
  : { backgroundColor: hueColorString };
81
81
  var squareTop = 100 - hsvColor.v;
82
82
  var squareLeft = hsvColor.s;
83
- var colorDotStyle = ((_j = (_h = (_g = (0, utils_1.getWindow)()) === null || _g === void 0 ? void 0 : _g.CSS) === null || _h === void 0 ? void 0 : _h.supports) === null || _j === void 0 ? void 0 : _j.call(_h, "--top:\u00A0" + squareTop.toString() + "%"))
83
+ var colorDotStyle = ((_j = (_h = (_g = (0, utils_1.getWindow)()) === null || _g === void 0 ? void 0 : _g.CSS) === null || _h === void 0 ? void 0 : _h.supports) === null || _j === void 0 ? void 0 : _j.call(_h, "--iui-color-dot-inset: 0"))
84
84
  ? {
85
- '--top': squareTop.toString() + '%',
86
- '--left': squareLeft.toString() + '%',
85
+ '--iui-color-dot-inset': squareTop.toString() + "% auto auto " + squareLeft.toString() + "%",
87
86
  }
88
87
  : {
89
88
  backgroundColor: dotColorString,
@@ -17,5 +17,5 @@ export declare type ColorSwatchProps = {
17
17
  * <ColorSwatch color='#23450b' onClick={onClick}/>
18
18
  * <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
19
19
  */
20
- export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
20
+ export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "aria-disabled" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
21
21
  export default ColorSwatch;
@@ -51,8 +51,8 @@ exports.ColorSwatch = react_1.default.forwardRef(function (props, ref) {
51
51
  }, [color]);
52
52
  var _style = react_1.default.useMemo(function () {
53
53
  var _a, _b, _c;
54
- return ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--swatch-color: " + colorString))
55
- ? __assign({ '--swatch-color': colorString }, style) : __assign({ backgroundColor: colorString }, style);
54
+ return ((_c = (_b = (_a = (0, utils_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, "--iui-color-swatch-background: " + colorString))
55
+ ? __assign({ '--iui-color-swatch-background': colorString }, style) : __assign({ backgroundColor: colorString }, style);
56
56
  }, [colorString, style]);
57
57
  return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-color-swatch', { 'iui-active': isActive }, className), style: _style, onClick: onClick, tabIndex: isActive ? 0 : -1, "aria-selected": isActive, ref: ref }, rest)));
58
58
  });
@@ -33,6 +33,17 @@ export declare type ComboBoxProps<T> = {
33
33
  * @default 'No options found'
34
34
  */
35
35
  emptyStateMessage?: string;
36
+ /**
37
+ * A custom item renderer can be specified to control the rendering.
38
+ * This function should ideally return a customized version of `MenuItem`,
39
+ * otherwise you will need to make sure to provide styling for the `isFocused` state.
40
+ */
41
+ itemRenderer?: (option: SelectOption<T>, states: {
42
+ isSelected: boolean;
43
+ isFocused: boolean;
44
+ id: string;
45
+ index: number;
46
+ }) => JSX.Element;
36
47
  } & Pick<InputContainerProps, 'status'> & Omit<CommonProps, 'title'>;
37
48
  /**
38
49
  * ComboBox component that allows typing a value to filter the options in dropdown list.
@@ -52,7 +52,7 @@ require("tippy.js/animations/shift-away.css");
52
52
  * />
53
53
  */
54
54
  var ComboBox = function (props) {
55
- var options = props.options, value = props.value, onChange = props.onChange, filterFunction = props.filterFunction, className = props.className, inputProps = props.inputProps, dropdownMenuProps = props.dropdownMenuProps, _a = props.emptyStateMessage, emptyStateMessage = _a === void 0 ? 'No options found' : _a, rest = __rest(props, ["options", "value", "onChange", "filterFunction", "className", "inputProps", "dropdownMenuProps", "emptyStateMessage"]);
55
+ var options = props.options, value = props.value, onChange = props.onChange, filterFunction = props.filterFunction, className = props.className, inputProps = props.inputProps, dropdownMenuProps = props.dropdownMenuProps, _a = props.emptyStateMessage, emptyStateMessage = _a === void 0 ? 'No options found' : _a, itemRenderer = props.itemRenderer, rest = __rest(props, ["options", "value", "onChange", "filterFunction", "className", "inputProps", "dropdownMenuProps", "emptyStateMessage", "itemRenderer"]);
56
56
  // Generate a stateful random id if not specified
57
57
  var id = react_1.default.useState(function () {
58
58
  var _a, _b;
@@ -67,16 +67,31 @@ var ComboBox = function (props) {
67
67
  return value === options[index].value;
68
68
  });
69
69
  }, [options, id]);
70
+ var userOnChange = react_1.default.useRef(onChange);
70
71
  var memoizedItems = react_1.default.useMemo(function () {
71
- return options.map(function (_a, index) {
72
- var label = _a.label, value = _a.value, rest = __rest(_a, ["label", "value"]);
73
- return (react_1.default.createElement(Menu_1.MenuItem, __assign({ id: getOptionId(index), key: getOptionId(index), value: value, role: 'option', onClick: function (value) {
72
+ return options.map(function (option, index) {
73
+ var label = option.label, value = option.value, rest = __rest(option, ["label", "value"]);
74
+ var additionalProps = {
75
+ value: value,
76
+ role: 'option',
77
+ onClick: function () {
78
+ var _a;
74
79
  setSelectedValue(value);
75
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
80
+ (_a = userOnChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnChange, value);
76
81
  setIsOpen(false);
77
- } }, rest), label));
82
+ },
83
+ };
84
+ if (itemRenderer) {
85
+ return react_1.default.cloneElement(itemRenderer(option, {
86
+ id: getOptionId(index),
87
+ index: index,
88
+ isSelected: false,
89
+ isFocused: false,
90
+ }), additionalProps);
91
+ }
92
+ return (react_1.default.createElement(Menu_1.MenuItem, __assign({ id: getOptionId(index), key: getOptionId(index) }, additionalProps, rest), label));
78
93
  });
79
- }, [options, getOptionId, onChange]);
94
+ }, [options, getOptionId, itemRenderer]);
80
95
  var inputRef = react_1.default.useRef(null);
81
96
  var menuRef = react_1.default.useRef(null);
82
97
  var toggleButtonRef = react_1.default.useRef(null);
@@ -155,6 +170,7 @@ var ComboBox = function (props) {
155
170
  });
156
171
  }, [inputValue, options, selectedValue, isOpen, filterFunction]);
157
172
  var onKeyDown = react_1.default.useCallback(function (event) {
173
+ var _a;
158
174
  var focusableOptions = (0, utils_1.getFocusableElements)(menuRef.current);
159
175
  var focusedIndexInFilteredList = focusableOptions.findIndex(function (_a) {
160
176
  var _b;
@@ -188,7 +204,7 @@ var ComboBox = function (props) {
188
204
  case 'Enter':
189
205
  if (isOpen) {
190
206
  setSelectedValue(options[focusedIndex].value);
191
- onChange === null || onChange === void 0 ? void 0 : onChange(options[focusedIndex].value);
207
+ (_a = userOnChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnChange, options[focusedIndex].value);
192
208
  }
193
209
  setIsOpen(function (open) { return !open; });
194
210
  event.preventDefault();
@@ -208,26 +224,41 @@ var ComboBox = function (props) {
208
224
  }
209
225
  break;
210
226
  }
211
- }, [focusedIndex, isOpen, options, getOptionId, onChange]);
227
+ }, [focusedIndex, isOpen, options, getOptionId]);
212
228
  var menuItems = react_1.default.useMemo(function () {
213
229
  if (filteredOptions.length === 0) {
214
- return (react_1.default.createElement(Menu_1.MenuExtraContent, null,
215
- react_1.default.createElement(Typography_1.Text, { isMuted: true }, emptyStateMessage)));
230
+ return [
231
+ react_1.default.createElement(Menu_1.MenuExtraContent, { key: 0 },
232
+ react_1.default.createElement(Typography_1.Text, { isMuted: true }, emptyStateMessage)),
233
+ ];
216
234
  }
217
235
  return filteredOptions.map(function (option) {
236
+ var _a;
218
237
  var index = options.findIndex(function (_a) {
219
238
  var value = _a.value;
220
239
  return option.value === value;
221
240
  });
222
241
  if (index < 0) {
223
- return;
242
+ return react_1.default.createElement(react_1.default.Fragment, null);
224
243
  }
225
- if (selectedValue === option.value || focusedIndex === index) {
226
- return react_1.default.cloneElement(memoizedItems[index], {
227
- isSelected: selectedValue === option.value,
228
- className: (0, classnames_1.default)({ 'iui-focused': focusedIndex === index }),
229
- ref: function (el) {
230
- return focusedIndex === index && (el === null || el === void 0 ? void 0 : el.scrollIntoView(false));
244
+ var id = getOptionId(index);
245
+ var isSelected = selectedValue === option.value;
246
+ var isFocused = focusedIndex === index;
247
+ var focusScrollRef = function (el) {
248
+ return isFocused && (el === null || el === void 0 ? void 0 : el.scrollIntoView({ block: 'nearest' }));
249
+ };
250
+ if (isSelected || isFocused) {
251
+ var item = (_a = itemRenderer === null || itemRenderer === void 0 ? void 0 : itemRenderer(option, { index: index, id: id, isSelected: isSelected, isFocused: isFocused })) !== null && _a !== void 0 ? _a : react_1.default.cloneElement(memoizedItems[index], { isSelected: isSelected });
252
+ return react_1.default.cloneElement(item, {
253
+ className: (0, classnames_1.default)({ 'iui-focused': isFocused }, item.props.className),
254
+ ref: (0, utils_1.mergeRefs)(focusScrollRef, item.props.ref),
255
+ value: option.value,
256
+ role: 'option',
257
+ onClick: function () {
258
+ var _a;
259
+ setSelectedValue(option.value);
260
+ (_a = userOnChange.current) === null || _a === void 0 ? void 0 : _a.call(userOnChange, option.value);
261
+ setIsOpen(false);
231
262
  },
232
263
  });
233
264
  }
@@ -237,46 +268,53 @@ var ComboBox = function (props) {
237
268
  filteredOptions,
238
269
  emptyStateMessage,
239
270
  options,
240
- focusedIndex,
271
+ getOptionId,
241
272
  selectedValue,
273
+ focusedIndex,
274
+ itemRenderer,
242
275
  memoizedItems,
243
276
  ]);
244
- return (react_1.default.createElement(utils_1.InputContainer, __assign({ className: className, isIconInline: true, icon: react_1.default.useMemo(function () { return (react_1.default.createElement("span", { ref: toggleButtonRef, className: (0, classnames_1.default)({
245
- 'iui-actionable': !(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled),
246
- 'iui-open': isOpen,
247
- }), onClick: function () {
248
- var _a;
249
- if (isOpen) {
250
- setIsOpen(false);
251
- }
252
- else {
253
- (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
254
- }
255
- } },
256
- react_1.default.createElement(CaretDownSmall_1.default, { "aria-hidden": true }))); }, [inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled, isOpen]) }, rest, { id: id }),
257
- react_1.default.createElement(utils_1.Popover, __assign({ placement: 'bottom-start', visible: isOpen, onClickOutside: function (_, _a) {
258
- var _b;
259
- var target = _a.target;
260
- if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
261
- setIsOpen(false);
262
- }
263
- }, animation: 'shift-away', duration: 200 }, dropdownMenuProps, { content: react_1.default.createElement(Menu_1.Menu, { id: id + "-list", className: 'iui-scroll', style: {
264
- minWidth: minWidth,
265
- maxWidth: "min(" + minWidth * 2 + "px, 90vw)",
266
- maxHeight: 300,
267
- }, setFocus: false, role: 'listbox', ref: menuRef }, menuItems), onHide: function (instance) {
268
- var _a;
269
- var selectedIndex = options.findIndex(function (_a) {
270
- var value = _a.value;
271
- return value === selectedValue;
272
- });
273
- setFocusedIndex(selectedIndex);
274
- if (selectedIndex > -1) {
275
- setInputValue(options[selectedIndex].label); // update input value to be same as selected value
276
- }
277
- (_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, instance);
278
- } }),
279
- react_1.default.createElement(Input_1.Input, __assign({ ref: inputRef, onKeyDown: onKeyDown, onFocus: function () { return setIsOpen(true); }, onChange: onInput, value: inputValue, "aria-activedescendant": isOpen && focusedIndex > -1 ? getOptionId(focusedIndex) : undefined, role: 'combobox', "aria-controls": isOpen ? id + "-list" : undefined, "aria-autocomplete": 'list', spellCheck: false, autoCapitalize: 'none', autoCorrect: 'off' }, inputProps)))));
277
+ return (react_1.default.createElement(utils_1.InputContainer, __assign({ className: className, isIconInline: true }, rest, { id: id }),
278
+ react_1.default.createElement("div", { className: 'iui-input-with-icon' },
279
+ react_1.default.createElement(utils_1.Popover, __assign({ placement: 'bottom-start', visible: isOpen, onClickOutside: function (_, _a) {
280
+ var _b;
281
+ var target = _a.target;
282
+ if (!((_b = toggleButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(target))) {
283
+ setIsOpen(false);
284
+ }
285
+ }, animation: 'shift-away', duration: 200 }, dropdownMenuProps, { content: react_1.default.createElement(Menu_1.Menu, { id: id + "-list", className: 'iui-scroll', style: {
286
+ minWidth: minWidth,
287
+ maxWidth: "min(" + minWidth * 2 + "px, 90vw)",
288
+ maxHeight: 300,
289
+ }, setFocus: false, role: 'listbox', ref: menuRef }, menuItems), onHide: function (instance) {
290
+ var _a;
291
+ var selectedIndex = options.findIndex(function (_a) {
292
+ var value = _a.value;
293
+ return value === selectedValue;
294
+ });
295
+ setFocusedIndex(selectedIndex);
296
+ if (selectedIndex > -1) {
297
+ setInputValue(options[selectedIndex].label); // update input value to be same as selected value
298
+ }
299
+ (_a = dropdownMenuProps === null || dropdownMenuProps === void 0 ? void 0 : dropdownMenuProps.onHide) === null || _a === void 0 ? void 0 : _a.call(dropdownMenuProps, instance);
300
+ } }),
301
+ react_1.default.createElement(Input_1.Input, __assign({ ref: inputRef, onKeyDown: onKeyDown, onFocus: function () { return setIsOpen(true); }, onChange: onInput, value: inputValue, "aria-activedescendant": isOpen && focusedIndex > -1
302
+ ? getOptionId(focusedIndex)
303
+ : undefined, role: 'combobox', "aria-controls": isOpen ? id + "-list" : undefined, "aria-autocomplete": 'list', spellCheck: false, autoCapitalize: 'none', autoCorrect: 'off' }, inputProps))),
304
+ react_1.default.createElement("span", { ref: toggleButtonRef, className: (0, classnames_1.default)('iui-end-icon', {
305
+ 'iui-actionable': !(inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled),
306
+ 'iui-disabled': inputProps === null || inputProps === void 0 ? void 0 : inputProps.disabled,
307
+ 'iui-open': isOpen,
308
+ }), onClick: function () {
309
+ var _a;
310
+ if (isOpen) {
311
+ setIsOpen(false);
312
+ }
313
+ else {
314
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
315
+ }
316
+ } },
317
+ react_1.default.createElement(CaretDownSmall_1.default, { "aria-hidden": true })))));
280
318
  };
281
319
  exports.ComboBox = ComboBox;
282
320
  exports.default = exports.ComboBox;
@@ -38,6 +38,12 @@ export declare type ExpandableBlockProps = {
38
38
  * @default 'default'
39
39
  */
40
40
  size?: 'default' | 'small';
41
+ /**
42
+ * Style of the ExpandableBlock.
43
+ * Use 'borderless' to hide outline.
44
+ * @default 'default'
45
+ */
46
+ styleType?: 'default' | 'borderless';
41
47
  } & Omit<CommonProps, 'title'>;
42
48
  /**
43
49
  * Container that allows content to be hidden behind a brief title and a caption.
@@ -46,10 +46,10 @@ require("@itwin/itwinui-css/css/expandable-block.css");
46
46
  */
47
47
  var ExpandableBlock = function (props) {
48
48
  var _a;
49
- var caption = props.caption, children = props.children, className = props.className, title = props.title, onToggle = props.onToggle, style = props.style, _b = props.isExpanded, isExpanded = _b === void 0 ? false : _b, endIcon = props.endIcon, status = props.status, _c = props.size, size = _c === void 0 ? 'default' : _c, rest = __rest(props, ["caption", "children", "className", "title", "onToggle", "style", "isExpanded", "endIcon", "status", "size"]);
49
+ var caption = props.caption, children = props.children, className = props.className, title = props.title, onToggle = props.onToggle, style = props.style, _b = props.isExpanded, isExpanded = _b === void 0 ? false : _b, endIcon = props.endIcon, status = props.status, _c = props.size, size = _c === void 0 ? 'default' : _c, _d = props.styleType, styleType = _d === void 0 ? 'default' : _d, rest = __rest(props, ["caption", "children", "className", "title", "onToggle", "style", "isExpanded", "endIcon", "status", "size", "styleType"]);
50
50
  (0, utils_1.useTheme)();
51
51
  var icon = endIcon !== null && endIcon !== void 0 ? endIcon : (status && utils_1.StatusIconMap[status]());
52
- var _d = react_1.default.useState(isExpanded), expanded = _d[0], setExpanded = _d[1];
52
+ var _e = react_1.default.useState(isExpanded), expanded = _e[0], setExpanded = _e[1];
53
53
  react_1.default.useEffect(function () {
54
54
  setExpanded(isExpanded);
55
55
  }, [isExpanded]);
@@ -68,6 +68,7 @@ var ExpandableBlock = function (props) {
68
68
  'iui-with-caption': !!caption,
69
69
  'iui-expanded': expanded,
70
70
  'iui-small': size === 'small',
71
+ 'iui-borderless': styleType === 'borderless',
71
72
  }, className), style: style }, rest),
72
73
  react_1.default.createElement("div", { "aria-expanded": expanded, className: 'iui-header', tabIndex: 0, onClick: handleToggle, onKeyDown: onKeyDown },
73
74
  react_1.default.createElement(ChevronRight_1.default, { className: 'iui-icon', "aria-hidden": true }),
@@ -43,6 +43,9 @@ exports.Menu = react_1.default.forwardRef(function (props, ref) {
43
43
  var _c = react_1.default.useState(), focusedIndex = _c[0], setFocusedIndex = _c[1];
44
44
  var menuRef = react_1.default.useRef(null);
45
45
  var refs = (0, utils_1.useMergedRefs)(menuRef, ref);
46
+ react_1.default.useEffect(function () {
47
+ setFocusedIndex(null);
48
+ }, [children]);
46
49
  react_1.default.useEffect(function () {
47
50
  var _a;
48
51
  var items = (0, utils_1.getFocusableElements)(menuRef.current);
@@ -55,9 +58,6 @@ exports.Menu = react_1.default.forwardRef(function (props, ref) {
55
58
  setFocusedIndex(selectedIndex > -1 ? selectedIndex : 0);
56
59
  }
57
60
  }, [setFocus, focusedIndex]);
58
- react_1.default.useEffect(function () {
59
- setFocusedIndex(null);
60
- }, [children]);
61
61
  var onKeyDown = function (event) {
62
62
  var items = (0, utils_1.getFocusableElements)(menuRef.current);
63
63
  if (!(items === null || items === void 0 ? void 0 : items.length)) {
@@ -106,7 +106,7 @@ exports.MenuItem = react_1.default.forwardRef(function (props, ref) {
106
106
  className: (0, classnames_1.default)(badge.props.className, 'iui-icon'),
107
107
  })));
108
108
  return subMenuItems.length === 0 ? (listItem) : (react_1.default.createElement(MenuItemContext.Provider, { value: { ref: menuItemRef } },
109
- react_1.default.createElement(utils_1.Popover, { placement: 'right-start', visible: isSubmenuVisible, content: react_1.default.createElement("div", { onMouseLeave: function () { return setIsSubmenuVisible(false); }, onBlur: function (e) {
109
+ react_1.default.createElement(utils_1.Popover, { placement: 'right-start', visible: isSubmenuVisible, appendTo: 'parent', content: react_1.default.createElement("div", { onMouseLeave: function () { return setIsSubmenuVisible(false); }, onBlur: function (e) {
110
110
  var _a, _b;
111
111
  !!(e.relatedTarget instanceof Node) &&
112
112
  !((_a = subMenuRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.relatedTarget)) &&
@@ -11,10 +11,16 @@ export declare type RadioProps = {
11
11
  status?: 'positive' | 'warning' | 'negative';
12
12
  /**
13
13
  * Custom CSS class name for the checkmark element.
14
+ *
15
+ * @deprecated As of 1.32.0, this is applied on the actual radio `<input>` element.
16
+ * The checkmark has been moved into a pseudo-element.
14
17
  */
15
18
  checkmarkClassName?: string;
16
19
  /**
17
20
  * Custom CSS Style for the checkmark element.
21
+ *
22
+ * @deprecated As of 1.32.0, this is applied on the actual radio `<input>` element.
23
+ * The checkmark has been moved into a pseudo-element.
18
24
  */
19
25
  checkmarkStyle?: React.CSSProperties;
20
26
  /**
@@ -26,6 +32,7 @@ export declare type RadioProps = {
26
32
  /**
27
33
  * Basic radio input component
28
34
  * @example
35
+ * <Radio />
29
36
  * <Radio label='Radio' />
30
37
  * <Radio disabled={true} label='Radio' />
31
38
  * <Radio status='positive' label='Positive' />
@@ -43,10 +50,16 @@ export declare const Radio: React.ForwardRefExoticComponent<{
43
50
  status?: "positive" | "warning" | "negative" | undefined;
44
51
  /**
45
52
  * Custom CSS class name for the checkmark element.
53
+ *
54
+ * @deprecated As of 1.32.0, this is applied on the actual radio `<input>` element.
55
+ * The checkmark has been moved into a pseudo-element.
46
56
  */
47
57
  checkmarkClassName?: string | undefined;
48
58
  /**
49
59
  * Custom CSS Style for the checkmark element.
60
+ *
61
+ * @deprecated As of 1.32.0, this is applied on the actual radio `<input>` element.
62
+ * The checkmark has been moved into a pseudo-element.
50
63
  */
51
64
  checkmarkStyle?: React.CSSProperties | undefined;
52
65
  /**