@evergis/uilib-gl 1.0.79 → 1.0.81

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.
@@ -1,4 +1,4 @@
1
- import { CSSProperties, KeyboardEvent, MouseEvent, ReactNode } from "react";
1
+ import { CSSProperties, KeyboardEvent, MouseEvent, PropsWithChildren } from "react";
2
2
  import Autosuggest from "react-autosuggest";
3
3
  import { IOption } from "../Menu";
4
4
  import { InputProps } from "../../molecules/Input";
@@ -56,17 +56,17 @@ export interface IOptionProps {
56
56
  onClick?: (e: MouseEvent) => void;
57
57
  onMouseDown?: (e: MouseEvent) => void;
58
58
  }
59
- export interface IPopup {
59
+ export interface IPopup extends PropsWithChildren {
60
60
  anchor: HTMLElement;
61
61
  zIndex?: number;
62
62
  suggestions: IOption[];
63
63
  bottomBind?: boolean;
64
64
  menuHeight?: string;
65
65
  width?: string;
66
+ minWidth?: string;
66
67
  containerRef?: (ref: HTMLDivElement | null) => void;
67
68
  root?: HTMLElement | null;
68
69
  onRequestClose?: VoidFunction;
69
- children?: ReactNode | ReactNode[];
70
70
  }
71
71
  export interface IText {
72
72
  highlight?: boolean;
@@ -0,0 +1,45 @@
1
+ import { ChangeEvent, Component, FormEvent } from "react";
2
+ import Autosuggest from "react-autosuggest";
3
+ import { IOption } from "../../Menu";
4
+ import { IAutoCompleteProps, IAutoCompleteState } from "./types";
5
+ export declare class AutoComplete extends Component<IAutoCompleteProps, IAutoCompleteState> {
6
+ static defaultProps: {
7
+ width: string;
8
+ bottomBind: boolean;
9
+ valueLengthThrottled: number;
10
+ valueLengthFilter: number;
11
+ options: never[];
12
+ valueLengthAsync: number;
13
+ filterOptions: (value: string, options: IOption<string>[]) => IOption<string>[];
14
+ };
15
+ static getDerivedStateFromProps(nextProps: IAutoCompleteProps, prevState: IAutoCompleteState): {
16
+ selectedSuggestion: never[];
17
+ value?: undefined;
18
+ suggestions?: undefined;
19
+ } | {
20
+ value: string | undefined;
21
+ selectedSuggestion: IOption<string>;
22
+ suggestions?: undefined;
23
+ } | {
24
+ suggestions: never[];
25
+ selectedSuggestion?: undefined;
26
+ value?: undefined;
27
+ } | null;
28
+ state: IAutoCompleteState;
29
+ input: HTMLElement | null;
30
+ loadSuggestionsDebounced: (value: string) => void;
31
+ loadSuggestionsThrottled: (value: string) => void;
32
+ constructor(props: IAutoCompleteProps);
33
+ loadSuggestions: (value: string) => void;
34
+ onSuggestionsFetchRequested: ({ value }: Autosuggest.SuggestionsFetchRequestedParams) => void;
35
+ getSuggestions: (value: string, options: IOption[]) => IOption<string>[];
36
+ onChangeInput: (_event: ChangeEvent<HTMLInputElement>, { newValue }: {
37
+ newValue: string;
38
+ }) => void;
39
+ onSuggestionsClearRequested: () => void;
40
+ getSuggestionValue: (suggestion: IOption) => string;
41
+ onSuggestionSelected: (_event: FormEvent<HTMLInputElement>, data: Autosuggest.SuggestionSelectedEventData<IOption>) => void;
42
+ onRefInput: (ref: HTMLInputElement | null, onAutosuggestRef: (ref: HTMLElement) => void) => void;
43
+ shouldRenderSuggestions: (value: string) => boolean;
44
+ render(): import("react").JSX.Element;
45
+ }
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { IInput } from "./types";
3
+ export declare const InputComponent: FC<IInput>;
4
+ export declare const Input: FC<IInput>;
@@ -0,0 +1,5 @@
1
+ import { IMenu } from "./types";
2
+ export declare const classNames: {
3
+ suggestionsList: string;
4
+ };
5
+ export declare const Menu: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, import("../../../atoms/Blank").IBlankProps & IMenu, never>;
@@ -0,0 +1,3 @@
1
+ import { FC } from "react";
2
+ import { IOptionProps } from "./types";
3
+ export declare const Option: FC<IOptionProps>;
@@ -0,0 +1,4 @@
1
+ import { FC } from "react";
2
+ import { IPopup } from "./types";
3
+ export declare const PopupComponent: FC<IPopup>;
4
+ export declare const Popup: FC<IPopup>;
@@ -0,0 +1,2 @@
1
+ import { IText } from "./types";
2
+ export declare const Text: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, IText, never>;
@@ -0,0 +1,2 @@
1
+ export * from "./AutoComplete";
2
+ export * from "./types";
@@ -0,0 +1 @@
1
+ export declare const ProgressContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
@@ -0,0 +1,60 @@
1
+ import { KeyboardEvent, CSSProperties, PropsWithChildren } from "react";
2
+ import Autosuggest from "react-autosuggest";
3
+ import { IOption } from "../../Menu";
4
+ import { InputProps } from "../../../molecules/Input";
5
+ import { IBlankProps } from "../../../atoms/Blank";
6
+ export interface IAutoCompleteProps extends Omit<InputProps, "value" | "onChange" | "onSelect" | "onKeyDown"> {
7
+ options?: IOption[];
8
+ value: string;
9
+ width?: string;
10
+ menuWidth?: string;
11
+ menuHeight?: string;
12
+ onSelect?: (option: IOption) => void;
13
+ onChange: (value: string) => void;
14
+ autosuggestProps?: Autosuggest.AutosuggestProps<any, any>;
15
+ asyncCallback?: (value: string) => Promise<IOption[]>;
16
+ bottomBind?: boolean;
17
+ zIndex?: number;
18
+ id?: string;
19
+ valueLengthThrottled?: number;
20
+ valueLengthFilter?: number;
21
+ valueLengthAsync?: number;
22
+ filterOptions?: FilterOptions;
23
+ onKeyDown?: (e: KeyboardEvent<HTMLInputElement>) => void;
24
+ onGetInnerRef?: (input: HTMLElement) => void;
25
+ optionStyle?: CSSProperties;
26
+ root?: HTMLElement | null;
27
+ loading?: boolean;
28
+ }
29
+ export interface IAutoCompleteState {
30
+ suggestions: IOption[];
31
+ selectedSuggestion: IOption | undefined;
32
+ }
33
+ export declare type FilterOptions = (value: string, options: IOption[]) => IOption[];
34
+ export interface IInput {
35
+ selectedSuggestion?: IOption;
36
+ innerRef?: RefType<HTMLInputElement | null>;
37
+ }
38
+ export interface IMenu extends IBlankProps {
39
+ minWidth?: string;
40
+ maxHeight?: string;
41
+ }
42
+ export interface IOptionProps {
43
+ query: string;
44
+ suggestion: IOption;
45
+ isHighlighted: boolean;
46
+ optionStyle?: CSSProperties;
47
+ }
48
+ export interface IPopup extends PropsWithChildren {
49
+ anchor: HTMLElement;
50
+ zIndex?: number;
51
+ suggestions: IOption[];
52
+ bottomBind?: boolean;
53
+ menuHeight?: string;
54
+ width?: string;
55
+ containerRef?: (ref: HTMLDivElement | null) => void;
56
+ root?: HTMLElement | null;
57
+ }
58
+ export interface IText {
59
+ highlight?: boolean;
60
+ }
@@ -56,7 +56,7 @@ export interface FilterInputProps {
56
56
  selectedOption?: FilterTypeOption | null;
57
57
  onShown?: VoidFunction;
58
58
  onChange?: (filterType: FilterTypeOption | null, value: FilterValue) => void;
59
- asyncCallback?: (value: string) => Promise<void>;
59
+ asyncCallback?: (value: string) => Promise<IOption[]>;
60
60
  zIndex?: number;
61
61
  menuTitle?: string;
62
62
  clearTitle?: string;
@@ -40,6 +40,7 @@ import addDays from 'date-fns/addDays';
40
40
  import getDaysInMonth from 'date-fns/getDaysInMonth';
41
41
  import getDay from 'date-fns/getDay';
42
42
  import { returnFound, removeObject, changeProps, insertObjectAfter } from 'find-and';
43
+ import isNil$1 from 'lodash-es/isNil';
43
44
  import { parse } from 'date-fns';
44
45
  import { DateRange } from 'react-date-range';
45
46
  import PropTypes from 'prop-types';
@@ -13709,7 +13710,7 @@ const Box = styled.span`
13709
13710
  borderRadius
13710
13711
  }
13711
13712
  } = _ref3;
13712
- return borderRadius.medium;
13713
+ return borderRadius.xSmall;
13713
13714
  }};
13714
13715
  box-sizing: border-box;
13715
13716
  overflow: hidden;
@@ -18783,7 +18784,7 @@ const OptionContainer = styled.div`
18783
18784
  justify-content: flex-start;
18784
18785
  align-items: center;
18785
18786
  min-height: 1.25em;
18786
- padding: 0.75rem 1rem;
18787
+ padding: 0.625rem 1rem;
18787
18788
  color: ${_ref => {
18788
18789
  let {
18789
18790
  theme: {
@@ -18856,7 +18857,6 @@ const OptionContainer = styled.div`
18856
18857
  }};
18857
18858
  `;
18858
18859
  const OptionIcon = styled.span`
18859
- margin-right: 0.5rem;
18860
18860
  min-width: 1.5rem;
18861
18861
  text-overflow: unset !important;
18862
18862
  `;
@@ -21086,16 +21086,22 @@ const classNames = {
21086
21086
  };
21087
21087
  const Menu$1 = /*#__PURE__*/styled(Blank)`
21088
21088
  position: relative;
21089
- min-width: ${_ref => {
21089
+ width: ${_ref => {
21090
21090
  let {
21091
- minWidth
21091
+ width
21092
21092
  } = _ref;
21093
+ return width ?? "auto";
21094
+ }};
21095
+ min-width: ${_ref2 => {
21096
+ let {
21097
+ minWidth
21098
+ } = _ref2;
21093
21099
  return minWidth;
21094
21100
  }};
21095
- max-height: ${_ref2 => {
21101
+ max-height: ${_ref3 => {
21096
21102
  let {
21097
21103
  maxHeight
21098
- } = _ref2;
21104
+ } = _ref3;
21099
21105
  return maxHeight;
21100
21106
  }};
21101
21107
  padding: 0.625rem 0;
@@ -21114,6 +21120,7 @@ const PopupComponent = _ref => {
21114
21120
  bottomBind,
21115
21121
  menuHeight,
21116
21122
  width,
21123
+ minWidth,
21117
21124
  anchor,
21118
21125
  children,
21119
21126
  containerRef,
@@ -21132,7 +21139,8 @@ const PopupComponent = _ref => {
21132
21139
  root: root,
21133
21140
  onRequestClose: onRequestClose
21134
21141
  }, React.createElement(Menu$1, Object.assign({
21135
- minWidth: width,
21142
+ width: width,
21143
+ minWidth: minWidth,
21136
21144
  maxHeight: menuHeight,
21137
21145
  ref: containerRef
21138
21146
  }, props), children));
@@ -24122,6 +24130,392 @@ const DraggableTree = _ref => {
24122
24130
  return React.createElement(DraggableTreeContainer, null, renderNodes(nodesClone, 0));
24123
24131
  };
24124
24132
 
24133
+ const classNames$1 = {
24134
+ suggestionsList: "react-autosuggest__suggestions-list"
24135
+ };
24136
+ const Menu$2 = /*#__PURE__*/styled(Blank)`
24137
+ position: relative;
24138
+ min-width: ${_ref => {
24139
+ let {
24140
+ minWidth
24141
+ } = _ref;
24142
+ return minWidth;
24143
+ }};
24144
+ max-height: ${_ref2 => {
24145
+ let {
24146
+ maxHeight
24147
+ } = _ref2;
24148
+ return maxHeight;
24149
+ }};
24150
+ padding: 0.625rem 0;
24151
+
24152
+ .${classNames$1.suggestionsList} {
24153
+ list-style: none;
24154
+ margin: 0;
24155
+ padding: 0;
24156
+ }
24157
+ `;
24158
+
24159
+ const PopupComponent$2 = _ref => {
24160
+ let {
24161
+ zIndex,
24162
+ suggestions,
24163
+ bottomBind,
24164
+ menuHeight,
24165
+ width,
24166
+ anchor,
24167
+ children,
24168
+ containerRef,
24169
+ root,
24170
+ ...props
24171
+ } = _ref;
24172
+ return React.createElement(Popover, {
24173
+ open: suggestions.length > 0 && !!children,
24174
+ anchorOrigin: bottomBind ? "bottom-left" : "top-left",
24175
+ targetOrigin: bottomBind ? "top-left" : "bottom-left",
24176
+ animateX: false,
24177
+ zIndex: zIndex || 1,
24178
+ anchor: anchor,
24179
+ root: root
24180
+ }, React.createElement(Menu$2, Object.assign({
24181
+ minWidth: width,
24182
+ maxHeight: menuHeight,
24183
+ ref: containerRef
24184
+ }, props), children));
24185
+ };
24186
+ const Popup$2 = /*#__PURE__*/memo(PopupComponent$2);
24187
+
24188
+ const Text$2 = styled.span`
24189
+ font-weight: ${_ref => {
24190
+ let {
24191
+ highlight
24192
+ } = _ref;
24193
+ return highlight ? "bold" : "normal";
24194
+ }};
24195
+ `;
24196
+
24197
+ const OptionComponent$2 = _ref => {
24198
+ let {
24199
+ query,
24200
+ suggestion,
24201
+ isHighlighted,
24202
+ optionStyle
24203
+ } = _ref;
24204
+ const {
24205
+ text: optionText,
24206
+ icon,
24207
+ value,
24208
+ prefix,
24209
+ style
24210
+ } = suggestion;
24211
+ const parts = getHighlightParts(optionText || "", query);
24212
+ return React.createElement(OptionContainer, {
24213
+ nullable: value === null,
24214
+ selected: isHighlighted,
24215
+ onMouseDown: e => e.preventDefault(),
24216
+ style: optionStyle || style
24217
+ }, prefix, icon && React.createElement(OptionIcon, null, React.createElement(Icon, {
24218
+ kind: icon
24219
+ })), React.createElement("span", null, parts.map((_ref2, index) => {
24220
+ let {
24221
+ text,
24222
+ highlight
24223
+ } = _ref2;
24224
+ return React.createElement(Text$2, {
24225
+ highlight: highlight,
24226
+ key: `text-${index}`
24227
+ }, text);
24228
+ })));
24229
+ };
24230
+
24231
+ const Option$2 = /*#__PURE__*/memo(OptionComponent$2);
24232
+
24233
+ const InputComponent$2 = _ref => {
24234
+ let {
24235
+ selectedSuggestion,
24236
+ ...props
24237
+ } = _ref;
24238
+ const icon = (selectedSuggestion == null ? void 0 : selectedSuggestion.icon) && React.createElement(Icon, {
24239
+ kind: selectedSuggestion.icon
24240
+ });
24241
+ const prefix = selectedSuggestion != null && selectedSuggestion.prefix ? React.createElement("div", {
24242
+ style: {
24243
+ marginLeft: "0.5rem"
24244
+ }
24245
+ }, selectedSuggestion == null ? void 0 : selectedSuggestion.prefix) : null;
24246
+ return React.createElement(Input$1, Object.assign({
24247
+ iconBefore: icon || prefix
24248
+ }, props));
24249
+ };
24250
+ const Input$4 = /*#__PURE__*/memo(InputComponent$2);
24251
+
24252
+ const ProgressContainer$2 = styled.div`
24253
+ display: flex;
24254
+ flex-direction: column;
24255
+ align-items: center;
24256
+ justify-content: center;
24257
+ `;
24258
+
24259
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
24260
+
24261
+ const filterOptions$1 = (value, options) => options.filter(item => {
24262
+ var _item$text;
24263
+
24264
+ return (_item$text = item.text) == null ? void 0 : _item$text.trim().toLowerCase().includes(value || "");
24265
+ }).sort((_a, b) => {
24266
+ var _b$text;
24267
+
24268
+ return ((_b$text = b.text) == null ? void 0 : _b$text.toLowerCase().indexOf(value || "")) === 0 ? 1 : -1;
24269
+ });
24270
+
24271
+ class AutoComplete$1 extends Component {
24272
+ constructor(props) {
24273
+ super(props);
24274
+ this.state = {
24275
+ suggestions: [],
24276
+ selectedSuggestion: undefined
24277
+ };
24278
+ this.input = null;
24279
+
24280
+ this.loadSuggestions = value => {
24281
+ const {
24282
+ asyncCallback,
24283
+ valueLengthAsync
24284
+ } = this.props;
24285
+ const inputValue = value.trim();
24286
+
24287
+ if (asyncCallback && inputValue.length >= valueLengthAsync) {
24288
+ asyncCallback(value).then(suggestions => {
24289
+ this.setState({
24290
+ suggestions: this.getSuggestions(value, suggestions)
24291
+ });
24292
+ });
24293
+ }
24294
+ };
24295
+
24296
+ this.onSuggestionsFetchRequested = _ref => {
24297
+ let {
24298
+ value
24299
+ } = _ref;
24300
+ const {
24301
+ options,
24302
+ asyncCallback,
24303
+ valueLengthThrottled
24304
+ } = this.props;
24305
+
24306
+ if (asyncCallback) {
24307
+ if (value.length < valueLengthThrottled) {
24308
+ this.loadSuggestionsThrottled(value);
24309
+ } else {
24310
+ this.loadSuggestionsDebounced(value);
24311
+ }
24312
+ } else {
24313
+ this.setState({
24314
+ suggestions: this.getSuggestions(value, options)
24315
+ });
24316
+ }
24317
+ };
24318
+
24319
+ this.getSuggestions = (value, options) => {
24320
+ const inputValue = value.trim().toLowerCase();
24321
+
24322
+ if (!Array.isArray(options)) {
24323
+ return [];
24324
+ }
24325
+
24326
+ if (!inputValue) {
24327
+ return options;
24328
+ }
24329
+
24330
+ if (this.props.filterOptions) {
24331
+ return this.props.filterOptions(inputValue, options);
24332
+ }
24333
+
24334
+ return [];
24335
+ };
24336
+
24337
+ this.onChangeInput = (_event, _ref2) => {
24338
+ let {
24339
+ newValue
24340
+ } = _ref2;
24341
+ return this.props.onChange(newValue);
24342
+ };
24343
+
24344
+ this.onSuggestionsClearRequested = () => {
24345
+ this.setState({
24346
+ suggestions: []
24347
+ });
24348
+ };
24349
+
24350
+ this.getSuggestionValue = suggestion => {
24351
+ return suggestion.text || "";
24352
+ };
24353
+
24354
+ this.onSuggestionSelected = (_event, data) => {
24355
+ const {
24356
+ onSelect
24357
+ } = this.props;
24358
+ const {
24359
+ suggestion
24360
+ } = data;
24361
+ this.setState({
24362
+ selectedSuggestion: suggestion
24363
+ }, () => {
24364
+ onSelect && onSelect(suggestion);
24365
+ });
24366
+ };
24367
+
24368
+ this.onRefInput = (ref, onAutosuggestRef) => {
24369
+ if (ref) {
24370
+ this.input = ref;
24371
+ onAutosuggestRef(ref);
24372
+
24373
+ if (this.props.onGetInnerRef) {
24374
+ this.props.onGetInnerRef(ref);
24375
+ }
24376
+ }
24377
+ };
24378
+
24379
+ this.shouldRenderSuggestions = value => {
24380
+ const {
24381
+ valueLengthFilter
24382
+ } = this.props;
24383
+ return value.trim().length >= valueLengthFilter;
24384
+ };
24385
+
24386
+ this.loadSuggestionsDebounced = debounce$1(this.loadSuggestions, 500);
24387
+ this.loadSuggestionsThrottled = throttle(this.loadSuggestions, 500);
24388
+ }
24389
+
24390
+ static getDerivedStateFromProps(nextProps, prevState) {
24391
+ const {
24392
+ value,
24393
+ options,
24394
+ valueLengthFilter
24395
+ } = nextProps;
24396
+ const {
24397
+ selectedSuggestion
24398
+ } = prevState;
24399
+ const suggestion = options == null ? void 0 : options.find(option => option.value === value);
24400
+
24401
+ if (!value) {
24402
+ return {
24403
+ selectedSuggestion: []
24404
+ };
24405
+ }
24406
+
24407
+ if (selectedSuggestion && value !== selectedSuggestion.value && suggestion) {
24408
+ return {
24409
+ value: suggestion.text,
24410
+ selectedSuggestion: suggestion
24411
+ };
24412
+ }
24413
+
24414
+ if (!value && valueLengthFilter && valueLengthFilter > 0) {
24415
+ return {
24416
+ suggestions: []
24417
+ };
24418
+ }
24419
+
24420
+ return null;
24421
+ }
24422
+
24423
+ render() {
24424
+ const {
24425
+ suggestions,
24426
+ selectedSuggestion
24427
+ } = this.state;
24428
+ const {
24429
+ value,
24430
+ onChange,
24431
+ onSelect,
24432
+ width,
24433
+ autosuggestProps,
24434
+ zIndex,
24435
+ menuHeight,
24436
+ bottomBind,
24437
+ id,
24438
+ menuWidth,
24439
+ onGetInnerRef,
24440
+ optionStyle,
24441
+ root,
24442
+ loading,
24443
+ ...props
24444
+ } = this.props;
24445
+ const inputProps = {
24446
+ value,
24447
+ onChange: this.onChangeInput,
24448
+ width,
24449
+ id,
24450
+ ...props
24451
+ };
24452
+ return React.createElement(Autosuggest, Object.assign({
24453
+ suggestions: suggestions,
24454
+ shouldRenderSuggestions: this.shouldRenderSuggestions,
24455
+ onSuggestionsFetchRequested: this.onSuggestionsFetchRequested,
24456
+ onSuggestionsClearRequested: this.onSuggestionsClearRequested,
24457
+ getSuggestionValue: this.getSuggestionValue,
24458
+ renderSuggestion: (suggestion, _ref3) => {
24459
+ let {
24460
+ query,
24461
+ isHighlighted
24462
+ } = _ref3;
24463
+ return React.createElement(Option$2, {
24464
+ suggestion: suggestion,
24465
+ query: query,
24466
+ isHighlighted: isHighlighted,
24467
+ optionStyle: optionStyle
24468
+ });
24469
+ },
24470
+ renderSuggestionsContainer: _ref4 => {
24471
+ let {
24472
+ containerProps: {
24473
+ ref,
24474
+ ...containerProps
24475
+ },
24476
+ children
24477
+ } = _ref4;
24478
+ return React.createElement(Popup$2, Object.assign({
24479
+ anchor: this.input,
24480
+ zIndex: zIndex,
24481
+ width: menuWidth || width,
24482
+ menuHeight: menuHeight,
24483
+ bottomBind: bottomBind,
24484
+ suggestions: suggestions,
24485
+ containerRef: ref,
24486
+ root: root
24487
+ }, containerProps), loading && React.createElement(ProgressContainer$2, null, React.createElement(CircularProgress, {
24488
+ diameter: 1.25
24489
+ })), !loading && children);
24490
+ },
24491
+ id: id,
24492
+ onSuggestionSelected: this.onSuggestionSelected,
24493
+ inputProps: inputProps,
24494
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24495
+ renderInputComponent: _ref5 => {
24496
+ let {
24497
+ ref,
24498
+ ...renderProps
24499
+ } = _ref5;
24500
+ return React.createElement(Input$4, Object.assign({
24501
+ selectedSuggestion: selectedSuggestion,
24502
+ innerRef: input => this.onRefInput(input, ref)
24503
+ }, renderProps));
24504
+ }
24505
+ }, autosuggestProps));
24506
+ }
24507
+
24508
+ }
24509
+ AutoComplete$1.defaultProps = {
24510
+ width: "14rem",
24511
+ bottomBind: true,
24512
+ valueLengthThrottled: 5,
24513
+ valueLengthFilter: 0,
24514
+ options: [],
24515
+ valueLengthAsync: 0,
24516
+ filterOptions: filterOptions$1
24517
+ };
24518
+
24125
24519
  const Spacer = styled.div`
24126
24520
  * {
24127
24521
  margin-right: 1rem;
@@ -25290,7 +25684,7 @@ _ref => {
25290
25684
  [defaultFilterType, isMenuOpened, toggleMenu, selectedOption == null ? void 0 : selectedOption.icon, menuTitle, menuMaxHeight, onFilterTypeSelect]);
25291
25685
  const renderClearButton = useMemo(() => {
25292
25686
  const isArray = Array.isArray(filterValue);
25293
- return isArray && (filterValue == null ? void 0 : filterValue[0]) !== undefined || !isArray && !isNil(filterValue) ? React.createElement(IconButton, {
25687
+ return isArray && (filterValue == null ? void 0 : filterValue[0]) !== undefined || !isArray && !isNil$1(filterValue) ? React.createElement(IconButton, {
25294
25688
  kind: "close",
25295
25689
  onClick: () => {
25296
25690
  setFilterValue(null);
@@ -25382,7 +25776,7 @@ _ref => {
25382
25776
  });
25383
25777
  }
25384
25778
 
25385
- return selectedOption != null && selectedOption.autocomplete ? React.createElement(AutoComplete, {
25779
+ return selectedOption != null && selectedOption.autocomplete ? React.createElement(AutoComplete$1, {
25386
25780
  label: label,
25387
25781
  asyncCallback: asyncCallback,
25388
25782
  zIndex: zIndex,
@@ -25393,10 +25787,11 @@ _ref => {
25393
25787
  disableInputOnly: isDisabled,
25394
25788
  onKeyDown: onKeyDown,
25395
25789
  onChange: setFilterValue,
25396
- onSelect: items => {
25397
- var _items;
25398
-
25399
- return onFilterChange(selectedOption, ((_items = items[items.length - 1]) == null ? void 0 : _items.text) || "");
25790
+ onSelect: _ref2 => {
25791
+ let {
25792
+ text
25793
+ } = _ref2;
25794
+ return onFilterChange(selectedOption, text);
25400
25795
  },
25401
25796
  onBlur: () => onFilterChange(selectedOption, filterValue !== "" ? filterValue : null),
25402
25797
  active: active