@itwin/itwinui-react 3.0.0-dev.8 → 3.0.0-dev.9

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 (61) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/cjs/core/Buttons/DropdownButton/DropdownButton.js +7 -19
  3. package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +4 -4
  4. package/cjs/core/Buttons/SplitButton/SplitButton.js +53 -31
  5. package/cjs/core/ComboBox/ComboBox.d.ts +2 -2
  6. package/cjs/core/ComboBox/ComboBox.js +32 -24
  7. package/cjs/core/ComboBox/ComboBoxInput.js +29 -21
  8. package/cjs/core/ComboBox/ComboBoxMenu.js +73 -93
  9. package/cjs/core/ComboBox/helpers.d.ts +4 -1
  10. package/cjs/core/DropdownMenu/DropdownMenu.d.ts +6 -5
  11. package/cjs/core/DropdownMenu/DropdownMenu.js +59 -55
  12. package/cjs/core/Header/HeaderDropdownButton.js +1 -2
  13. package/cjs/core/Header/HeaderSplitButton.js +1 -2
  14. package/cjs/core/Menu/Menu.js +1 -1
  15. package/cjs/core/Menu/MenuItem.js +77 -55
  16. package/cjs/core/Select/Select.d.ts +5 -5
  17. package/cjs/core/Select/Select.js +74 -93
  18. package/cjs/core/Table/columns/actionColumn.js +3 -7
  19. package/cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +36 -41
  20. package/cjs/core/Table/filters/FilterToggle.js +3 -2
  21. package/cjs/core/Tile/Tile.js +21 -22
  22. package/cjs/core/index.d.ts +1 -1
  23. package/cjs/core/index.js +8 -1
  24. package/cjs/core/utils/components/InputContainer.d.ts +4 -4
  25. package/cjs/core/utils/components/InputContainer.js +7 -3
  26. package/cjs/core/utils/components/Popover.d.ts +113 -27
  27. package/cjs/core/utils/components/Popover.js +156 -118
  28. package/cjs/styles.js +2 -5
  29. package/esm/core/Buttons/DropdownButton/DropdownButton.js +8 -24
  30. package/esm/core/Buttons/SplitButton/SplitButton.d.ts +4 -4
  31. package/esm/core/Buttons/SplitButton/SplitButton.js +53 -28
  32. package/esm/core/ComboBox/ComboBox.d.ts +2 -2
  33. package/esm/core/ComboBox/ComboBox.js +33 -24
  34. package/esm/core/ComboBox/ComboBoxInput.js +22 -21
  35. package/esm/core/ComboBox/ComboBoxMenu.js +67 -87
  36. package/esm/core/ComboBox/helpers.d.ts +4 -1
  37. package/esm/core/DropdownMenu/DropdownMenu.d.ts +6 -5
  38. package/esm/core/DropdownMenu/DropdownMenu.js +64 -56
  39. package/esm/core/Header/HeaderDropdownButton.js +1 -2
  40. package/esm/core/Header/HeaderSplitButton.js +1 -2
  41. package/esm/core/Menu/Menu.js +7 -2
  42. package/esm/core/Menu/MenuItem.js +84 -52
  43. package/esm/core/Select/Select.d.ts +5 -5
  44. package/esm/core/Select/Select.js +74 -90
  45. package/esm/core/Table/columns/actionColumn.js +3 -7
  46. package/esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +36 -41
  47. package/esm/core/Table/filters/FilterToggle.js +3 -2
  48. package/esm/core/Tile/Tile.js +21 -22
  49. package/esm/core/index.d.ts +1 -1
  50. package/esm/core/index.js +1 -0
  51. package/esm/core/utils/components/InputContainer.d.ts +4 -4
  52. package/esm/core/utils/components/InputContainer.js +7 -2
  53. package/esm/core/utils/components/Popover.d.ts +113 -27
  54. package/esm/core/utils/components/Popover.js +175 -118
  55. package/esm/styles.js +2 -5
  56. package/package.json +2 -4
  57. package/styles.css +3 -3
  58. package/cjs/core/ComboBox/ComboBoxDropdown.d.ts +0 -7
  59. package/cjs/core/ComboBox/ComboBoxDropdown.js +0 -43
  60. package/esm/core/ComboBox/ComboBoxDropdown.d.ts +0 -7
  61. package/esm/core/ComboBox/ComboBoxDropdown.js +0 -37
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.0.0-dev.9
4
+
5
+ ### Major Changes
6
+
7
+ - [#1506](https://github.com/iTwin/iTwinUI/pull/1506): Replaced `tippy.js` with `floating-ui` in all popover-based components. While the basic usage is unchanged, all advanced props from tippy are no longer available.
8
+
9
+ Components affected: Select, ComboBox, DropdownMenu, DropdownButton, SplitButton.
10
+
11
+ ### Minor Changes
12
+
13
+ - [#1506](https://github.com/iTwin/iTwinUI/pull/1506): Added new `Popover` component for public use.
14
+
3
15
  ## 3.0.0-dev.8
4
16
 
5
17
  ### Major Changes
@@ -20,7 +20,7 @@ const index_js_3 = require('../../utils/index.js');
20
20
  * ];
21
21
  * <DropdownButton menuItems={menuItems}>Default</DropdownButton>
22
22
  */
23
- exports.DropdownButton = React.forwardRef((props, ref) => {
23
+ exports.DropdownButton = React.forwardRef((props, forwardedRef) => {
24
24
  const {
25
25
  menuItems,
26
26
  className,
@@ -31,28 +31,17 @@ exports.DropdownButton = React.forwardRef((props, ref) => {
31
31
  ...rest
32
32
  } = props;
33
33
  const [isMenuOpen, setIsMenuOpen] = React.useState(false);
34
- const [menuWidth, setMenuWidth] = React.useState(0);
35
- const buttonRef = React.useRef(null);
36
- const refs = (0, index_js_3.useMergedRefs)(ref, buttonRef);
37
- React.useEffect(() => {
38
- if (buttonRef.current) {
39
- setMenuWidth(buttonRef.current.offsetWidth);
40
- }
41
- }, [children, size, styleType]);
42
34
  return React.createElement(
43
35
  index_js_2.DropdownMenu,
44
36
  {
45
37
  menuItems: menuItems,
38
+ matchWidth: true,
39
+ visible: isMenuOpen,
46
40
  ...dropdownMenuProps,
47
- onShow: (i) => {
48
- setIsMenuOpen(true);
49
- dropdownMenuProps?.onShow?.(i);
41
+ onVisibleChange: (open) => {
42
+ setIsMenuOpen(open);
43
+ dropdownMenuProps?.onVisibleChange?.(open);
50
44
  },
51
- onHide: (i) => {
52
- setIsMenuOpen(false);
53
- dropdownMenuProps?.onHide?.(i);
54
- },
55
- style: { minInlineSize: menuWidth, ...dropdownMenuProps?.style },
56
45
  },
57
46
  React.createElement(
58
47
  index_js_1.Button,
@@ -67,8 +56,7 @@ exports.DropdownButton = React.forwardRef((props, ref) => {
67
56
  : React.createElement(index_js_3.SvgCaretDownSmall, {
68
57
  'aria-hidden': true,
69
58
  }),
70
- ref: refs,
71
- 'aria-label': 'Dropdown',
59
+ ref: forwardedRef,
72
60
  ...rest,
73
61
  },
74
62
  children,
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import type { ButtonProps } from '../Button/Button.js';
3
3
  import { IconButton } from '../IconButton/index.js';
4
- import type { Placement } from 'tippy.js';
5
- import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
4
+ import type { PolymorphicForwardRefComponent, PortalProps } from '../../utils/index.js';
5
+ import type { Placement } from '@floating-ui/react';
6
6
  export type SplitButtonProps = ButtonProps & {
7
7
  /**
8
8
  * Items in the dropdown menu.
@@ -26,8 +26,8 @@ export type SplitButtonProps = ButtonProps & {
26
26
  /**
27
27
  * Passes props to SplitButton menu button.
28
28
  */
29
- menuButtonProps?: React.ComponentProps<typeof IconButton>;
30
- };
29
+ menuButtonProps?: Omit<React.ComponentProps<typeof IconButton>, 'label' | 'size'>;
30
+ } & Pick<PortalProps, 'portal'>;
31
31
  /**
32
32
  * Split button component with a DropdownMenu.
33
33
  *
@@ -10,8 +10,8 @@ const classnames_1 = tslib_1.__importDefault(require('classnames'));
10
10
  const React = tslib_1.__importStar(require('react'));
11
11
  const index_js_1 = require('../Button/index.js');
12
12
  const index_js_2 = require('../IconButton/index.js');
13
- const index_js_3 = require('../../DropdownMenu/index.js');
14
- const index_js_4 = require('../../utils/index.js');
13
+ const index_js_3 = require('../../utils/index.js');
14
+ const Menu_js_1 = require('../../Menu/Menu.js');
15
15
  /**
16
16
  * Split button component with a DropdownMenu.
17
17
  *
@@ -37,21 +37,33 @@ exports.SplitButton = React.forwardRef((props, forwardedRef) => {
37
37
  children,
38
38
  wrapperProps,
39
39
  menuButtonProps,
40
+ portal = true,
40
41
  ...rest
41
42
  } = props;
42
- const [isMenuOpen, setIsMenuOpen] = React.useState(false);
43
- const [menuWidth, setMenuWidth] = React.useState(0);
44
- const wrapperRef = React.useRef(null);
45
- React.useEffect(() => {
46
- if (wrapperRef.current) {
47
- setMenuWidth(wrapperRef.current.offsetWidth);
43
+ const buttonRef = React.useRef(null);
44
+ const [visible, setVisible] = React.useState(false);
45
+ const close = React.useCallback(() => {
46
+ setVisible(false);
47
+ buttonRef.current?.focus({ preventScroll: true });
48
+ }, []);
49
+ const menuContent = React.useMemo(() => {
50
+ if (typeof menuItems === 'function') {
51
+ return menuItems(close);
48
52
  }
49
- }, [children, size]);
50
- const labelId = (0, index_js_4.useId)();
53
+ return menuItems;
54
+ }, [menuItems, close]);
55
+ const popover = (0, index_js_3.usePopover)({
56
+ visible,
57
+ onVisibleChange: (open) => (open ? setVisible(true) : close()),
58
+ placement: menuPlacement,
59
+ matchWidth: true,
60
+ });
61
+ const labelId = (0, index_js_3.useId)();
51
62
  return React.createElement(
52
- index_js_4.Box,
63
+ index_js_3.Box,
53
64
  {
54
65
  ...wrapperProps,
66
+ ref: popover.refs.setPositionReference,
55
67
  className: (0, classnames_1.default)(
56
68
  'iui-button-split',
57
69
  {
@@ -59,7 +71,6 @@ exports.SplitButton = React.forwardRef((props, forwardedRef) => {
59
71
  },
60
72
  wrapperProps?.className,
61
73
  ),
62
- ref: wrapperRef,
63
74
  },
64
75
  React.createElement(
65
76
  index_js_1.Button,
@@ -68,35 +79,46 @@ exports.SplitButton = React.forwardRef((props, forwardedRef) => {
68
79
  styleType: styleType,
69
80
  size: size,
70
81
  onClick: onClick,
71
- ref: forwardedRef,
82
+ ref: (0, index_js_3.useMergedRefs)(buttonRef, forwardedRef),
72
83
  ...rest,
73
84
  labelProps: { id: labelId, ...props.labelProps },
74
85
  },
75
86
  children,
76
87
  ),
77
88
  React.createElement(
78
- index_js_3.DropdownMenu,
89
+ index_js_2.IconButton,
79
90
  {
80
- placement: menuPlacement,
81
- menuItems: menuItems,
82
- style: { minInlineSize: menuWidth },
83
- onShow: React.useCallback(() => setIsMenuOpen(true), []),
84
- onHide: React.useCallback(() => setIsMenuOpen(false), []),
91
+ styleType: styleType,
92
+ size: size,
93
+ disabled: props.disabled,
94
+ 'aria-labelledby': props.labelProps?.id || labelId,
95
+ 'aria-expanded': popover.open,
96
+ ref: popover.refs.setReference,
97
+ ...popover.getReferenceProps(menuButtonProps),
85
98
  },
99
+ visible
100
+ ? React.createElement(index_js_3.SvgCaretUpSmall, null)
101
+ : React.createElement(index_js_3.SvgCaretDownSmall, null),
102
+ ),
103
+ popover.open &&
86
104
  React.createElement(
87
- index_js_2.IconButton,
88
- {
89
- styleType: styleType,
90
- size: size,
91
- disabled: props.disabled,
92
- 'aria-labelledby': props.labelProps?.id || labelId,
93
- ...menuButtonProps,
94
- },
95
- isMenuOpen
96
- ? React.createElement(index_js_4.SvgCaretUpSmall, null)
97
- : React.createElement(index_js_4.SvgCaretDownSmall, null),
105
+ index_js_3.Portal,
106
+ { portal: portal },
107
+ React.createElement(
108
+ Menu_js_1.Menu,
109
+ {
110
+ ...popover.getFloatingProps({
111
+ onKeyDown: ({ key }) => {
112
+ if (key === 'Tab') {
113
+ close();
114
+ }
115
+ },
116
+ }),
117
+ ref: popover.refs.setFloating,
118
+ },
119
+ menuContent,
120
+ ),
98
121
  ),
99
- ),
100
122
  );
101
123
  });
102
124
  exports.default = exports.SplitButton;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import type { SelectOption } from '../Select/index.js';
3
3
  import type { Input } from '../Input/Input.js';
4
- import type { PopoverProps, InputContainerProps, CommonProps } from '../utils/index.js';
4
+ import type { InputContainerProps, CommonProps } from '../utils/index.js';
5
5
  type ActionType = 'added' | 'removed';
6
6
  type MultipleOnChangeProps<T> = {
7
7
  value: T;
@@ -48,7 +48,7 @@ export type ComboBoxProps<T> = {
48
48
  /**
49
49
  * Props to customize dropdown menu behavior.
50
50
  */
51
- dropdownMenuProps?: PopoverProps;
51
+ dropdownMenuProps?: React.ComponentProps<'div'>;
52
52
  /**
53
53
  * Message shown when no options are available.
54
54
  * If `JSX.Element` is provided, it will be rendered as is and won't be wrapped with `MenuExtraContent`.
@@ -14,7 +14,6 @@ const SelectTag_js_1 = tslib_1.__importDefault(
14
14
  const index_js_2 = require('../Typography/index.js');
15
15
  const index_js_3 = require('../utils/index.js');
16
16
  const helpers_js_1 = require('./helpers.js');
17
- const ComboBoxDropdown_js_1 = require('./ComboBoxDropdown.js');
18
17
  const ComboBoxEndIcon_js_1 = require('./ComboBoxEndIcon.js');
19
18
  const ComboBoxInput_js_1 = require('./ComboBoxInput.js');
20
19
  const ComboBoxInputContainer_js_1 = require('./ComboBoxInputContainer.js');
@@ -57,8 +56,8 @@ const ComboBox = (props) => {
57
56
  itemRenderer,
58
57
  enableVirtualization = false,
59
58
  multiple = false,
60
- onShow,
61
- onHide,
59
+ onShow: onShowProp,
60
+ onHide: onHideProp,
62
61
  ...rest
63
62
  } = props;
64
63
  // Generate a stateful random id if not specified
@@ -116,6 +115,16 @@ const ComboBox = (props) => {
116
115
  focusedIndex: -1,
117
116
  },
118
117
  );
118
+ const onShowRef = (0, index_js_3.useLatestRef)(onShowProp);
119
+ const onHideRef = (0, index_js_3.useLatestRef)(onHideProp);
120
+ const show = React.useCallback(() => {
121
+ dispatch({ type: 'open' });
122
+ onShowRef.current?.();
123
+ }, [onShowRef]);
124
+ const hide = React.useCallback(() => {
125
+ dispatch({ type: 'close' });
126
+ onHideRef.current?.();
127
+ }, [onHideRef]);
119
128
  (0, index_js_3.useIsomorphicLayoutEffect)(() => {
120
129
  // When the dropdown opens
121
130
  if (isOpen) {
@@ -140,13 +149,6 @@ const ComboBox = (props) => {
140
149
  }
141
150
  }
142
151
  }, [isOpen, multiple, optionsRef, selected]);
143
- // Set min-width of menu to be same as input
144
- const [minWidth, setMinWidth] = React.useState(0);
145
- React.useEffect(() => {
146
- if (inputRef.current) {
147
- setMinWidth(inputRef.current.offsetWidth);
148
- }
149
- }, [isOpen]);
150
152
  // Update filtered options to the latest value options according to input value
151
153
  const [filteredOptions, setFilteredOptions] = React.useState(options);
152
154
  React.useEffect(() => {
@@ -173,7 +175,7 @@ const ComboBox = (props) => {
173
175
  (event) => {
174
176
  const { value } = event.currentTarget;
175
177
  setInputValue(value);
176
- dispatch({ type: 'open' }); // reopen when typing
178
+ show(); // reopen when typing
177
179
  setFilteredOptions(
178
180
  filterFunction?.(optionsRef.current, value) ??
179
181
  optionsRef.current.filter((option) =>
@@ -185,7 +187,7 @@ const ComboBox = (props) => {
185
187
  }
186
188
  inputProps?.onChange?.(event);
187
189
  },
188
- [filterFunction, focusedIndex, inputProps, optionsRef],
190
+ [filterFunction, focusedIndex, inputProps, optionsRef, show],
189
191
  );
190
192
  // When the value prop changes, update the selected index/indices
191
193
  React.useEffect(() => {
@@ -275,7 +277,7 @@ const ComboBox = (props) => {
275
277
  );
276
278
  } else {
277
279
  dispatch({ type: 'select', value: __originalIndex });
278
- dispatch({ type: 'close' });
280
+ hide();
279
281
  onChangeHandler(__originalIndex);
280
282
  }
281
283
  },
@@ -286,6 +288,7 @@ const ComboBox = (props) => {
286
288
  onChangeHandler,
287
289
  selected,
288
290
  optionsRef,
291
+ hide,
289
292
  ],
290
293
  );
291
294
  const getMenuItem = React.useCallback(
@@ -365,6 +368,13 @@ const ComboBox = (props) => {
365
368
  ),
366
369
  [emptyStateMessage],
367
370
  );
371
+ const popover = (0, index_js_3.usePopover)({
372
+ visible: isOpen,
373
+ onVisibleChange: (open) => (open ? show() : hide()),
374
+ matchWidth: true,
375
+ closeOnOutsideClick: true,
376
+ trigger: { focus: true },
377
+ });
368
378
  return React.createElement(
369
379
  helpers_js_1.ComboBoxRefsContext.Provider,
370
380
  { value: { inputRef, menuRef, optionsExtraInfoRef } },
@@ -376,7 +386,6 @@ const ComboBox = (props) => {
376
386
  {
377
387
  value: {
378
388
  id,
379
- minWidth,
380
389
  isOpen,
381
390
  focusedIndex,
382
391
  onClickHandler,
@@ -384,11 +393,14 @@ const ComboBox = (props) => {
384
393
  filteredOptions,
385
394
  getMenuItem,
386
395
  multiple,
396
+ popover,
397
+ show,
398
+ hide,
387
399
  },
388
400
  },
389
401
  React.createElement(
390
402
  ComboBoxInputContainer_js_1.ComboBoxInputContainer,
391
- { ...rest },
403
+ { disabled: inputProps?.disabled, ...rest },
392
404
  React.createElement(
393
405
  React.Fragment,
394
406
  null,
@@ -419,15 +431,11 @@ const ComboBox = (props) => {
419
431
  : null,
420
432
  ),
421
433
  React.createElement(
422
- ComboBoxDropdown_js_1.ComboBoxDropdown,
423
- { ...dropdownMenuProps, onShow: onShow, onHide: onHide },
424
- React.createElement(
425
- ComboBoxMenu_js_1.ComboBoxMenu,
426
- null,
427
- filteredOptions.length > 0 && !enableVirtualization
428
- ? filteredOptions.map(getMenuItem)
429
- : emptyContent,
430
- ),
434
+ ComboBoxMenu_js_1.ComboBoxMenu,
435
+ { as: 'div', ...dropdownMenuProps },
436
+ filteredOptions.length > 0 && !enableVirtualization
437
+ ? filteredOptions.map(getMenuItem)
438
+ : emptyContent,
431
439
  ),
432
440
  ),
433
441
  ),
@@ -14,9 +14,9 @@ const helpers_js_1 = require('./helpers.js');
14
14
  exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
15
15
  const {
16
16
  onKeyDown: onKeyDownProp,
17
- onFocus: onFocusProp,
18
17
  onClick: onClickProp,
19
18
  selectTags,
19
+ size,
20
20
  ...rest
21
21
  } = props;
22
22
  const {
@@ -26,13 +26,20 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
26
26
  enableVirtualization,
27
27
  multiple,
28
28
  onClickHandler,
29
+ popover,
30
+ show,
31
+ hide,
29
32
  } = (0, index_js_2.useSafeContext)(helpers_js_1.ComboBoxStateContext);
30
33
  const dispatch = (0, index_js_2.useSafeContext)(
31
34
  helpers_js_1.ComboBoxActionContext,
32
35
  );
33
36
  const { inputRef, menuRef, optionsExtraInfoRef } = (0,
34
37
  index_js_2.useSafeContext)(helpers_js_1.ComboBoxRefsContext);
35
- const refs = (0, index_js_2.useMergedRefs)(inputRef, forwardedRef);
38
+ const refs = (0, index_js_2.useMergedRefs)(
39
+ inputRef,
40
+ popover.refs.setReference,
41
+ forwardedRef,
42
+ );
36
43
  const focusedIndexRef = React.useRef(focusedIndex ?? -1);
37
44
  React.useEffect(() => {
38
45
  focusedIndexRef.current = focusedIndex ?? -1;
@@ -44,7 +51,6 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
44
51
  };
45
52
  const handleKeyDown = React.useCallback(
46
53
  (event) => {
47
- onKeyDownProp?.(event);
48
54
  const length = Object.keys(optionsExtraInfoRef.current).length ?? 0;
49
55
  if (event.altKey) {
50
56
  return;
@@ -53,7 +59,7 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
53
59
  case 'ArrowDown': {
54
60
  event.preventDefault();
55
61
  if (!isOpen) {
56
- return dispatch({ type: 'open' });
62
+ return show();
57
63
  }
58
64
  if (length === 0) {
59
65
  return;
@@ -95,7 +101,7 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
95
101
  case 'ArrowUp': {
96
102
  event.preventDefault();
97
103
  if (!isOpen) {
98
- return dispatch({ type: 'open' });
104
+ return show();
99
105
  }
100
106
  if (length === 0) {
101
107
  return;
@@ -139,17 +145,17 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
139
145
  onClickHandler?.(focusedIndexRef.current);
140
146
  }
141
147
  } else {
142
- dispatch({ type: 'open' });
148
+ show();
143
149
  }
144
150
  break;
145
151
  }
146
152
  case 'Escape': {
147
153
  event.preventDefault();
148
- dispatch({ type: 'close' });
154
+ hide();
149
155
  break;
150
156
  }
151
157
  case 'Tab':
152
- dispatch({ type: 'close' });
158
+ hide();
153
159
  break;
154
160
  }
155
161
  },
@@ -159,22 +165,18 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
159
165
  isOpen,
160
166
  menuRef,
161
167
  onClickHandler,
162
- onKeyDownProp,
163
168
  optionsExtraInfoRef,
169
+ show,
170
+ hide,
164
171
  ],
165
172
  );
166
- const handleFocus = React.useCallback(
167
- (event) => {
168
- dispatch({ type: 'open' });
169
- onFocusProp?.(event);
170
- },
171
- [dispatch, onFocusProp],
172
- );
173
173
  const handleClick = React.useCallback(() => {
174
174
  if (!isOpen) {
175
- dispatch({ type: 'open' });
175
+ show();
176
+ } else {
177
+ hide();
176
178
  }
177
- }, [dispatch, isOpen]);
179
+ }, [hide, isOpen, show]);
178
180
  const [tagContainerWidthRef, tagContainerWidth] = (0,
179
181
  index_js_2.useContainerWidth)();
180
182
  return React.createElement(
@@ -182,9 +184,8 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
182
184
  null,
183
185
  React.createElement(index_js_1.Input, {
184
186
  ref: refs,
185
- onKeyDown: handleKeyDown,
186
187
  onClick: (0, index_js_2.mergeEventHandlers)(onClickProp, handleClick),
187
- onFocus: handleFocus,
188
+ 'aria-expanded': isOpen,
188
189
  'aria-activedescendant':
189
190
  isOpen && focusedIndex != undefined && focusedIndex > -1
190
191
  ? getIdFromIndex(focusedIndex)
@@ -197,7 +198,14 @@ exports.ComboBoxInput = React.forwardRef((props, forwardedRef) => {
197
198
  autoCorrect: 'off',
198
199
  style: multiple ? { paddingInlineStart: tagContainerWidth + 18 } : {},
199
200
  'aria-describedby': multiple ? `${id}-selected-live` : undefined,
200
- ...rest,
201
+ size: size,
202
+ ...popover.getReferenceProps({
203
+ onKeyDown: (0, index_js_2.mergeEventHandlers)(
204
+ onKeyDownProp,
205
+ handleKeyDown,
206
+ ),
207
+ ...rest,
208
+ }),
201
209
  }),
202
210
  multiple && selectTags
203
211
  ? React.createElement(