@spaced-out/ui-design-system 0.0.68 → 0.1.1

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 (34) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/components/ButtonDropdown/ButtonDropdown.js +4 -2
  3. package/lib/components/ButtonDropdown/ButtonDropdown.js.flow +8 -3
  4. package/lib/components/Checkbox/Checkbox.js +3 -2
  5. package/lib/components/Checkbox/Checkbox.js.flow +3 -1
  6. package/lib/components/Chip/Chip.module.css +1 -0
  7. package/lib/components/Dropdown/Dropdown.js +22 -28
  8. package/lib/components/Dropdown/Dropdown.js.flow +30 -47
  9. package/lib/components/Icon/ClickableIcon.js +9 -6
  10. package/lib/components/Icon/ClickableIcon.js.flow +57 -45
  11. package/lib/components/InlineDropdown/InlineDropdown.js +5 -2
  12. package/lib/components/InlineDropdown/InlineDropdown.js.flow +8 -2
  13. package/lib/components/Input/Input.js +2 -1
  14. package/lib/components/Input/Input.js.flow +1 -0
  15. package/lib/components/Input/Input.module.css +15 -2
  16. package/lib/components/Menu/Menu.js +8 -4
  17. package/lib/components/Menu/Menu.js.flow +44 -13
  18. package/lib/components/Menu/Menu.module.css +19 -2
  19. package/lib/components/Menu/MenuOptionButton.js +24 -4
  20. package/lib/components/Menu/MenuOptionButton.js.flow +38 -13
  21. package/lib/components/RadioButton/RadioButton.js +2 -1
  22. package/lib/components/RadioButton/RadioButton.js.flow +3 -1
  23. package/lib/components/SearchInput/SearchInput.js.flow +2 -22
  24. package/lib/components/Tabs/Tab/Tab.js +1 -1
  25. package/lib/components/Tabs/Tab/Tab.js.flow +1 -1
  26. package/lib/components/Tabs/TabList/TabList.js +2 -5
  27. package/lib/components/Tabs/TabList/TabList.js.flow +4 -7
  28. package/lib/components/Tooltip/Tooltip.js +1 -0
  29. package/lib/components/Tooltip/Tooltip.js.flow +1 -0
  30. package/lib/components/Typeahead/Typeahead.js +23 -18
  31. package/lib/components/Typeahead/Typeahead.js.flow +32 -33
  32. package/lib/utils/menu.js +52 -0
  33. package/lib/utils/menu.js.flow +81 -0
  34. package/package.json +1 -1
@@ -9,10 +9,14 @@ import {MenuOptionButton} from './MenuOptionButton';
9
9
  import css from './Menu.module.css';
10
10
 
11
11
 
12
- type ClassNames = $ReadOnly<{wrapper?: string, option?: string}>;
12
+ type ClassNames = $ReadOnly<{
13
+ wrapper?: string,
14
+ option?: string,
15
+ groupTitle?: string,
16
+ }>;
13
17
 
14
18
  export type MenuOption = {
15
- key?: string,
19
+ key: string,
16
20
  label?: string,
17
21
  secondaryLabel?: string,
18
22
  customComponent?: React.Node,
@@ -22,38 +26,48 @@ export type MenuOption = {
22
26
  iconRightType?: IconType,
23
27
  disabled?: boolean,
24
28
  optionSize?: MenuSizeTypes,
29
+ optionVariant?: MenuOptionsVariant,
25
30
  };
26
31
 
27
32
  // Render first available option set
28
33
 
29
- export type MenuProps = {
34
+ export type BaseMenuProps = {
30
35
  onSelect?: (option: MenuOption) => mixed,
31
- selectedOption?: MenuOption,
36
+ selectedOption?: ?MenuOption,
37
+ optionsVariant?: MenuOptionsVariant,
38
+ selectedKeys?: Array<string>,
32
39
  classNames?: ClassNames,
33
40
  size?: MenuSizeTypes,
34
41
  width?: string,
35
42
  menuDisabled?: boolean,
36
43
  isFluid?: boolean,
37
- ...MenuOptionTypes,
44
+ };
45
+
46
+ export type MenuOptionTypes = {
47
+ options?: Array<MenuOption>,
48
+ composeOptions?: Array<Array<MenuOption>>,
49
+ groupTitleOptions?: Array<MenuGroupTitleOption>,
38
50
  };
39
51
 
40
52
  export type MenuSizeTypes = 'medium' | 'small';
53
+ export type MenuOptionsVariant = 'checkbox' | 'radio' | 'normal';
41
54
 
42
55
  export type MenuGroupTitleOption = {
43
56
  groupTitle?: React.Node,
44
57
  options?: Array<MenuOption>,
58
+ showLineDivider?: boolean,
45
59
  };
46
60
 
47
- export type MenuOptionTypes = {
48
- options?: Array<MenuOption>,
49
- composeOptions?: Array<Array<MenuOption>>,
50
- groupTitleOptions?: Array<MenuGroupTitleOption>,
61
+ export type MenuProps = {
62
+ ...BaseMenuProps,
63
+ ...MenuOptionTypes,
51
64
  };
52
65
 
53
66
  const RenderOption = ({
54
67
  options,
55
68
  composeOptions,
56
69
  groupTitleOptions,
70
+ classNames,
57
71
  ...restProps
58
72
  }: MenuProps): React.Node => {
59
73
  if (options && Array.isArray(options) && options.length) {
@@ -61,7 +75,11 @@ const RenderOption = ({
61
75
  <>
62
76
  {options.map((option) => (
63
77
  <React.Fragment key={option.key}>
64
- <MenuOptionButton option={option} {...restProps} />
78
+ <MenuOptionButton
79
+ option={option}
80
+ classNames={classNames}
81
+ {...restProps}
82
+ />
65
83
  </React.Fragment>
66
84
  ))}
67
85
  </>
@@ -79,7 +97,11 @@ const RenderOption = ({
79
97
  <span className={css.menuDivider} key={index}>
80
98
  {composeMenuOptions.map((option) => (
81
99
  <React.Fragment key={option.key}>
82
- <MenuOptionButton option={option} {...restProps} />
100
+ <MenuOptionButton
101
+ option={option}
102
+ classNames={classNames}
103
+ {...restProps}
104
+ />
83
105
  </React.Fragment>
84
106
  ))}
85
107
  </span>
@@ -98,14 +120,23 @@ const RenderOption = ({
98
120
  // eslint-disable-next-line react/no-array-index-key
99
121
  <React.Fragment key={index}>
100
122
  {!!optionsGroup.groupTitle && (
101
- <div className={css.groupTitleWrapper}>
123
+ <div
124
+ className={classify(
125
+ css.groupTitleWrapper,
126
+ classNames?.groupTitle,
127
+ )}
128
+ >
102
129
  {optionsGroup.groupTitle}
103
130
  </div>
104
131
  )}
105
132
 
106
133
  {optionsGroup.options?.map((option) => (
107
134
  <React.Fragment key={option.key}>
108
- <MenuOptionButton option={option} {...restProps} />
135
+ <MenuOptionButton
136
+ option={option}
137
+ classNames={classNames}
138
+ {...restProps}
139
+ />
109
140
  </React.Fragment>
110
141
  ))}
111
142
  </React.Fragment>
@@ -155,6 +155,18 @@
155
155
  color: colorTextPrimary;
156
156
  }
157
157
 
158
+ .option:focus-within {
159
+ background: colorFillSecondary;
160
+ outline: none;
161
+ color: colorTextPrimary;
162
+ }
163
+
164
+ .option.selected {
165
+ background: colorFillSecondary;
166
+ outline: none;
167
+ color: colorTextPrimary;
168
+ }
169
+
158
170
  .option:focus .optionTextSecondaryLabel {
159
171
  color: colorTextSecondary;
160
172
  }
@@ -187,12 +199,17 @@
187
199
  padding-bottom: spaceNone;
188
200
  }
189
201
 
202
+ .optionsWrapper {
203
+ display: flex;
204
+ flex-flow: column;
205
+ }
206
+
190
207
  .groupTitleWrapper {
191
208
  composes: formLabelSmall from '../../styles/typography.module.css';
192
209
  display: flex;
193
- margin-bottom: spaceXSmall;
210
+ padding-bottom: spaceXSmall;
194
211
  padding-left: spaceSmall;
195
212
  padding-right: calc(spaceXSmall / 2);
196
213
  color: colorTextTertiary;
197
- margin-top: spaceSmall;
214
+ padding-top: spaceSmall;
198
215
  }
@@ -7,7 +7,9 @@ exports.MenuOptionButton = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _classify = require("../../utils/classify");
9
9
  var _Button = require("../Button");
10
+ var _Checkbox = require("../Checkbox");
10
11
  var _Icon = require("../Icon");
12
+ var _RadioButton = require("../RadioButton");
11
13
  var _Truncate = require("../Truncate");
12
14
  var _MenuModule = _interopRequireDefault(require("./Menu.module.css"));
13
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -21,7 +23,9 @@ const MenuOptionButton = props => {
21
23
  onSelect,
22
24
  selectedOption,
23
25
  menuDisabled,
24
- classNames
26
+ classNames,
27
+ optionsVariant = 'normal',
28
+ selectedKeys
25
29
  } = props;
26
30
  const {
27
31
  key,
@@ -33,15 +37,22 @@ const MenuOptionButton = props => {
33
37
  iconRight,
34
38
  iconRightType,
35
39
  disabled,
36
- optionSize
40
+ optionSize,
41
+ optionVariant = optionsVariant
37
42
  } = option;
38
43
  const [buttonSize, setButtonSize] = React.useState(optionSize || size);
44
+ const isSelected = () => {
45
+ if (!selectedKeys || !Array.isArray(selectedKeys) || !selectedKeys.length) {
46
+ return false;
47
+ }
48
+ return selectedKeys.includes(option.key);
49
+ };
39
50
  React.useEffect(() => {
40
51
  setButtonSize(optionSize || size);
41
52
  }, [optionSize, size]);
42
53
  return /*#__PURE__*/React.createElement(_Button.UnstyledButton, {
43
54
  className: (0, _classify.classify)(_MenuModule.default.option, {
44
- [_MenuModule.default.selected]: key === selectedOption?.key,
55
+ [_MenuModule.default.selected]: isSelected() || key === selectedOption?.key,
45
56
  [_MenuModule.default.optionSmall]: buttonSize === 'small',
46
57
  [_MenuModule.default.optionMedium]: buttonSize === 'medium',
47
58
  [_MenuModule.default.disabled]: menuDisabled || disabled,
@@ -51,7 +62,16 @@ const MenuOptionButton = props => {
51
62
  disabled: menuDisabled || disabled,
52
63
  onClick: () => onSelect && onSelect(option),
53
64
  autoFocus: selectedOption?.key === key
54
- }, !!iconLeft && /*#__PURE__*/React.createElement(_Icon.Icon, {
65
+ }, optionVariant === 'checkbox' && /*#__PURE__*/React.createElement(_Checkbox.Checkbox, {
66
+ tabIndex: -1,
67
+ disabled: menuDisabled || disabled,
68
+ checked: isSelected()
69
+ }), optionVariant === 'radio' && /*#__PURE__*/React.createElement(_RadioButton.RadioButton, {
70
+ disabled: menuDisabled || disabled,
71
+ value: option.key,
72
+ selectedValue: selectedKeys?.[0],
73
+ tabIndex: -1
74
+ }), !!iconLeft && /*#__PURE__*/React.createElement(_Icon.Icon, {
55
75
  name: iconLeft,
56
76
  type: iconLeftType,
57
77
  size: "small",
@@ -3,30 +3,32 @@ import * as React from 'react';
3
3
 
4
4
  import {classify} from '../../utils/classify';
5
5
  import {UnstyledButton} from '../Button';
6
+ import {Checkbox} from '../Checkbox';
6
7
  import {Icon} from '../Icon';
8
+ import {RadioButton} from '../RadioButton';
7
9
  import {Truncate} from '../Truncate';
8
10
 
9
- import type {MenuOption} from './Menu';
11
+ import type {BaseMenuProps, MenuOption} from './Menu';
10
12
 
11
13
  import css from './Menu.module.css';
12
14
 
13
15
 
14
- type ClassNames = $ReadOnly<{wrapper?: string, option?: string}>;
15
-
16
16
  export type MenuOptionProps = {
17
+ ...BaseMenuProps,
17
18
  option: MenuOption,
18
- onSelect?: (option: MenuOption) => mixed,
19
- selectedOption?: MenuOption,
20
- classNames?: ClassNames,
21
- size?: 'medium' | 'small',
22
- width?: string,
23
- menuDisabled?: boolean,
24
- isFluid?: boolean,
25
19
  };
26
20
 
27
21
  export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
28
- const {option, size, onSelect, selectedOption, menuDisabled, classNames} =
29
- props;
22
+ const {
23
+ option,
24
+ size,
25
+ onSelect,
26
+ selectedOption,
27
+ menuDisabled,
28
+ classNames,
29
+ optionsVariant = 'normal',
30
+ selectedKeys,
31
+ } = props;
30
32
  const {
31
33
  key,
32
34
  label,
@@ -38,8 +40,16 @@ export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
38
40
  iconRightType,
39
41
  disabled,
40
42
  optionSize,
43
+ optionVariant = optionsVariant,
41
44
  } = option;
42
45
  const [buttonSize, setButtonSize] = React.useState(optionSize || size);
46
+ const isSelected = () => {
47
+ if (!selectedKeys || !Array.isArray(selectedKeys) || !selectedKeys.length) {
48
+ return false;
49
+ }
50
+
51
+ return selectedKeys.includes(option.key);
52
+ };
43
53
 
44
54
  React.useEffect(() => {
45
55
  setButtonSize(optionSize || size);
@@ -50,7 +60,7 @@ export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
50
60
  className={classify(
51
61
  css.option,
52
62
  {
53
- [css.selected]: key === selectedOption?.key,
63
+ [css.selected]: isSelected() || key === selectedOption?.key,
54
64
  [css.optionSmall]: buttonSize === 'small',
55
65
  [css.optionMedium]: buttonSize === 'medium',
56
66
  [css.disabled]: menuDisabled || disabled,
@@ -63,6 +73,21 @@ export const MenuOptionButton = (props: MenuOptionProps): React.Node => {
63
73
  onClick={() => onSelect && onSelect(option)}
64
74
  autoFocus={selectedOption?.key === key}
65
75
  >
76
+ {optionVariant === 'checkbox' && (
77
+ <Checkbox
78
+ tabIndex={-1}
79
+ disabled={menuDisabled || disabled}
80
+ checked={isSelected()}
81
+ />
82
+ )}
83
+ {optionVariant === 'radio' && (
84
+ <RadioButton
85
+ disabled={menuDisabled || disabled}
86
+ value={option.key}
87
+ selectedValue={selectedKeys?.[0]}
88
+ tabIndex={-1}
89
+ />
90
+ )}
66
91
  {!!iconLeft && (
67
92
  <Icon
68
93
  name={iconLeft}
@@ -24,6 +24,7 @@ const RadioButton = _ref => {
24
24
  align = 'vertical',
25
25
  className,
26
26
  error = false,
27
+ tabIndex = 0,
27
28
  ...props
28
29
  } = _ref;
29
30
  const radioInput = /*#__PURE__*/React.createRef();
@@ -61,7 +62,7 @@ const RadioButton = _ref => {
61
62
  ref: radioInput,
62
63
  onChange: onChangeHandler,
63
64
  onKeyDown: onKeyDownHandler,
64
- tabIndex: disabled ? '-1' : 0,
65
+ tabIndex: disabled ? -1 : tabIndex,
65
66
  name: name,
66
67
  value: value || ''
67
68
  }, props)), React.Children.count(children) > 0 && /*#__PURE__*/React.createElement(_Text.FormLabelMedium, {
@@ -26,6 +26,7 @@ export type RadioButtonProps = {
26
26
  className?: string,
27
27
  error?: boolean,
28
28
  onChange?: (newValue: string) => mixed,
29
+ tabIndex?: number,
29
30
  };
30
31
 
31
32
  export const RadioButton = ({
@@ -39,6 +40,7 @@ export const RadioButton = ({
39
40
  align = 'vertical',
40
41
  className,
41
42
  error = false,
43
+ tabIndex = 0,
42
44
  ...props
43
45
  }: RadioButtonProps): React.Node => {
44
46
  const radioInput = React.createRef<HTMLInputElement>();
@@ -87,7 +89,7 @@ export const RadioButton = ({
87
89
  ref={radioInput}
88
90
  onChange={onChangeHandler}
89
91
  onKeyDown={onKeyDownHandler}
90
- tabIndex={disabled ? '-1' : 0}
92
+ tabIndex={disabled ? -1 : tabIndex}
91
93
  name={name}
92
94
  value={value || ''}
93
95
  {...props}
@@ -2,6 +2,7 @@
2
2
 
3
3
  import * as React from 'react';
4
4
 
5
+ import type {InputProps} from '../Input';
5
6
  import {Input} from '../Input';
6
7
 
7
8
  import css from './SearchInput.module.css';
@@ -10,29 +11,8 @@ import css from './SearchInput.module.css';
10
11
  type ClassNames = $ReadOnly<{box?: string, iconLeft?: string}>;
11
12
 
12
13
  export type SearchInputProps = {
14
+ ...InputProps,
13
15
  classNames?: ClassNames,
14
- name?: string,
15
- placeholder?: string,
16
- disabled?: boolean,
17
- locked?: boolean,
18
- value?: string,
19
- error?: boolean,
20
- errorText?: string,
21
- label?: string | React.Node,
22
- helperText?: string | React.Node,
23
- size?: 'medium' | 'small',
24
- required?: boolean,
25
- boxRef?: (?HTMLElement) => mixed,
26
- onChange?: (
27
- evt: SyntheticInputEvent<HTMLInputElement>,
28
- isEnter?: boolean,
29
- ) => mixed,
30
- onFocus?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
31
- onBlur?: (e: SyntheticInputEvent<HTMLInputElement>) => mixed,
32
- onKeyDown?: (e: SyntheticKeyboardEvent<HTMLInputElement>) => mixed,
33
- onPaste?: (e: ClipboardEvent) => mixed,
34
- onPaste?: (e: ClipboardEvent) => mixed,
35
- onContainerClick?: ?(SyntheticEvent<HTMLElement>) => mixed,
36
16
  onClear?: () => void,
37
17
  };
38
18
 
@@ -63,7 +63,7 @@ const Tab = /*#__PURE__*/React.forwardRef((_ref, forwardRef) => {
63
63
  style: {
64
64
  width
65
65
  },
66
- tabIndex: disabled ? '-1' : 0,
66
+ tabIndex: disabled ? -1 : 0,
67
67
  ref: tabRef
68
68
  }), /*#__PURE__*/React.createElement("span", {
69
69
  className: (0, _classify.classify)(_TabModule.default.iconTextWrap, {
@@ -83,7 +83,7 @@ export const Tab: React$AbstractComponent<TabProps, HTMLButtonElement> =
83
83
  )}
84
84
  onClick={onClickHandler}
85
85
  style={{width}}
86
- tabIndex={disabled ? '-1' : 0}
86
+ tabIndex={disabled ? -1 : 0}
87
87
  ref={tabRef}
88
88
  >
89
89
  <span
@@ -74,10 +74,7 @@ const TabList = _ref => {
74
74
  label
75
75
  });
76
76
  };
77
- const selectedOption = {
78
- key: selectedTab?.tabId,
79
- label: selectedTab?.label || ''
80
- };
77
+ const selectedKeys = [selectedTab?.tabId || ''];
81
78
  const isMenuOptionSelected = (() => {
82
79
  for (let i = 0; i < menuOptions.length; i++) {
83
80
  if (menuOptions[i].key === selectedTab?.tabId) {
@@ -102,7 +99,7 @@ const TabList = _ref => {
102
99
  isFluid: false,
103
100
  menuDisabled: false,
104
101
  options: menuOptions,
105
- selectedOption,
102
+ selectedKeys,
106
103
  width: menuWidth
107
104
  }
108
105
  }
@@ -15,10 +15,10 @@ type ClassNames = $ReadOnly<{wrapper?: string}>;
15
15
 
16
16
  export type TabListProps = {
17
17
  classNames?: ClassNames,
18
- onSelect?: ({tabId?: string, label?: string}) => mixed,
18
+ onSelect?: ({tabId: string, label?: string}) => mixed,
19
19
  children?: React.Node,
20
20
  size?: 'medium',
21
- selectedTab?: {tabId?: string, label?: string},
21
+ selectedTab?: {tabId: string, label?: string},
22
22
  menuWidth?: string,
23
23
  };
24
24
 
@@ -80,10 +80,7 @@ export const TabList = ({
80
80
  const menuOnSelect = ({key, label}) => {
81
81
  onSelect && onSelect({tabId: key, label});
82
82
  };
83
- const selectedOption = {
84
- key: selectedTab?.tabId,
85
- label: selectedTab?.label || '',
86
- };
83
+ const selectedKeys = [selectedTab?.tabId || ''];
87
84
 
88
85
  const isMenuOptionSelected = (() => {
89
86
  for (let i = 0; i < menuOptions.length; i++) {
@@ -109,7 +106,7 @@ export const TabList = ({
109
106
  isFluid: false,
110
107
  menuDisabled: false,
111
108
  options: menuOptions,
112
- selectedOption,
109
+ selectedKeys,
113
110
  width: menuWidth,
114
111
  },
115
112
  }}
@@ -47,6 +47,7 @@ const Tooltip = _ref => {
47
47
  strategy,
48
48
  context
49
49
  } = (0, _reactDomInteractions.useFloating)({
50
+ strategy: 'fixed',
50
51
  placement,
51
52
  open,
52
53
  onOpenChange: setOpen,
@@ -85,6 +85,7 @@ export const Tooltip = ({
85
85
  }: TooltipProps): React.Node => {
86
86
  const [open, setOpen] = React.useState(false);
87
87
  const {x, y, reference, floating, strategy, context} = useFloating({
88
+ strategy: 'fixed',
88
89
  placement,
89
90
  open,
90
91
  onOpenChange: setOpen,
@@ -20,20 +20,21 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
20
20
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
21
  const Typeahead = _ref => {
22
22
  let {
23
- options,
24
- size,
23
+ size = 'medium',
25
24
  classNames,
26
25
  placeholder = 'Select...',
27
26
  onSelect,
28
27
  onSearch,
29
- selectedOption,
30
- menuSize,
31
28
  onClear,
29
+ menu,
30
+ onMenuOpen,
31
+ onMenuClose,
32
+ typeaheadInputText,
32
33
  ...inputProps
33
34
  } = _ref;
34
35
  const typeaheadRef = React.useRef();
35
- const [inputValue, setInputValue] = React.useState(selectedOption?.label);
36
- const [filteredOptions, setFilteredOptions] = React.useState(options);
36
+ const [inputValue, setInputValue] = React.useState(typeaheadInputText || '');
37
+ const [filteredOptions, setFilteredOptions] = React.useState(menu?.options);
37
38
  const {
38
39
  x,
39
40
  y,
@@ -53,12 +54,13 @@ const Typeahead = _ref => {
53
54
  }
54
55
  };
55
56
  React.useEffect(() => {
56
- if (selectedOption?.key) {
57
- setInputValue(selectedOption.label);
58
- }
59
- }, [selectedOption]);
57
+ setInputValue(typeaheadInputText || '');
58
+ }, [typeaheadInputText]);
59
+ const onMenuToggle = isOpen => {
60
+ isOpen ? onMenuOpen && onMenuOpen() : onMenuClose && onMenuClose();
61
+ };
60
62
  React.useEffect(() => {
61
- const optionsFiltered = options && options.filter(option => {
63
+ const optionsFiltered = menu?.options && menu.options.filter(option => {
62
64
  if (!option.label || !inputValue) {
63
65
  return true;
64
66
  } else {
@@ -67,7 +69,9 @@ const Typeahead = _ref => {
67
69
  });
68
70
  setFilteredOptions(optionsFiltered || []);
69
71
  }, [inputValue]);
70
- return /*#__PURE__*/React.createElement(_clickAway.ClickAway, null, _ref2 => {
72
+ return /*#__PURE__*/React.createElement(_clickAway.ClickAway, {
73
+ onChange: onMenuToggle
74
+ }, _ref2 => {
71
75
  let {
72
76
  isOpen,
73
77
  onOpen,
@@ -101,7 +105,7 @@ const Typeahead = _ref => {
101
105
  setInputValue('');
102
106
  onClear?.();
103
107
  }
104
- })), isOpen && filteredOptions && !!filteredOptions.length && /*#__PURE__*/React.createElement("div", {
108
+ })), isOpen && menu && filteredOptions && !!filteredOptions.length && /*#__PURE__*/React.createElement("div", {
105
109
  onClickCapture: cancelNext,
106
110
  ref: floating,
107
111
  style: {
@@ -111,15 +115,16 @@ const Typeahead = _ref => {
111
115
  width: _size.sizeFluid,
112
116
  backgroundColor: _color.colorBackgroundTertiary
113
117
  }
114
- }, /*#__PURE__*/React.createElement(_Menu.Menu, {
115
- isFluid: true,
118
+ }, /*#__PURE__*/React.createElement(_Menu.Menu, _extends({}, menu, {
116
119
  options: filteredOptions,
117
120
  onSelect: option => {
118
121
  handleSelect(option);
119
- clickAway();
122
+ if (!menu.optionsVariant || menu.optionsVariant === 'normal') {
123
+ clickAway();
124
+ }
120
125
  },
121
- size: menuSize || size
122
- })));
126
+ size: menu.size || size
127
+ }))));
123
128
  });
124
129
  };
125
130
  exports.Typeahead = Typeahead;