@progress/kendo-react-dropdowns 5.12.0-dev.202303130940 → 5.12.0-dev.202303141413

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.
@@ -52,7 +52,7 @@ var SearchBar = /** @class */ (function (_super) {
52
52
  SearchBar.prototype.render = function () {
53
53
  var _this = this;
54
54
  var _a = this.props, _b = _a.expanded, expanded = _b === void 0 ? false : _b, disabled = _a.disabled, _c = _a.role, role = _c === void 0 ? 'listbox' : _c, render = _a.render;
55
- var searchbar = (React.createElement("input", { autoComplete: "off", id: this.props.id, type: "text", key: "searchbar", size: this.props.size, placeholder: this.props.placeholder, className: "k-input-inner", tabIndex: this.props.tabIndex, accessKey: this.props.accessKey, role: role, name: this.props.name, value: this.props.value, onChange: this.props.onChange, ref: function (input) { return _this._input = input; }, onKeyDown: this.props.onKeyDown, onFocus: this.props.onFocus, onBlur: this.props.onBlur, "aria-disabled": disabled || undefined, disabled: disabled || undefined, readOnly: this.props.readOnly || undefined, "aria-haspopup": "listbox", "aria-expanded": expanded, "aria-owns": this.props.owns, "aria-activedescendant": expanded ? this.props.activedescendant : undefined, "aria-describedby": this.props.ariaDescribedBy, "aria-labelledby": this.props.ariaLabelledBy, "aria-required": this.props.ariaRequired }));
55
+ var searchbar = (React.createElement("input", { autoComplete: "off", id: this.props.id, type: "text", key: "searchbar", size: this.props.size, placeholder: this.props.placeholder, className: "k-input-inner", tabIndex: this.props.tabIndex, accessKey: this.props.accessKey, role: role, name: this.props.name, value: this.props.value, onChange: this.props.onChange, ref: function (input) { return _this._input = input; }, onKeyDown: this.props.onKeyDown, onFocus: this.props.onFocus, onBlur: this.props.onBlur, onClick: this.props.onClick, "aria-disabled": disabled || undefined, disabled: disabled || undefined, readOnly: this.props.readOnly || undefined, "aria-haspopup": "listbox", "aria-expanded": expanded, "aria-owns": this.props.owns, "aria-activedescendant": expanded ? this.props.activedescendant : undefined, "aria-describedby": this.props.ariaDescribedBy, "aria-labelledby": this.props.ariaLabelledBy, "aria-required": this.props.ariaRequired }));
56
56
  return render ? render.call(undefined, searchbar) : searchbar;
57
57
  };
58
58
  return SearchBar;
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-dropdowns',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1678699148,
8
+ publishDate: 1678802019,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -4,25 +4,21 @@ import { ComboBoxProps } from './ComboBoxProps';
4
4
  import { DropDownStateBase, InternalState } from './../common/settings';
5
5
  import DropDownBase from '../common/DropDownBase';
6
6
  import { FormComponent, FormComponentValidity } from '@progress/kendo-react-common';
7
- /**
8
- * @hidden
9
- */
7
+ /** @hidden */
10
8
  export interface ComboBoxState extends DropDownStateBase {
9
+ filterText?: string;
11
10
  suggestedText?: string;
12
11
  focusedItem?: any;
12
+ windowWidth?: number;
13
13
  }
14
- /**
15
- * @hidden
16
- */
14
+ /** @hidden */
17
15
  export interface ComboInternalState extends InternalState {
18
16
  data: ComboBoxState;
19
17
  }
20
18
  /** @hidden */
21
19
  export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProps, ComboBoxState> implements FormComponent {
22
20
  static displayName: string;
23
- /**
24
- * @hidden
25
- */
21
+ /** @hidden */
26
22
  static propTypes: {
27
23
  size: PropTypes.Requireable<"small" | "medium" | "large" | null | undefined>;
28
24
  rounded: PropTypes.Requireable<"small" | "medium" | "full" | "large" | null | undefined>;
@@ -55,13 +51,14 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
55
51
  skip: PropTypes.Validator<number>;
56
52
  total: PropTypes.Validator<number>;
57
53
  }>>;
54
+ /** @hidden */
58
55
  onFilterChange: PropTypes.Requireable<(...args: any[]) => any>;
59
56
  onPageChange: PropTypes.Requireable<(...args: any[]) => any>;
60
57
  opened: PropTypes.Requireable<boolean>;
61
58
  disabled: PropTypes.Requireable<boolean>;
62
59
  dir: PropTypes.Requireable<string>;
63
60
  tabIndex: PropTypes.Requireable<number>;
64
- accessKey: PropTypes.Requireable<string>;
61
+ accessKey: PropTypes.Requireable<string>; /** @hidden */
65
62
  data: PropTypes.Requireable<any[]>;
66
63
  textField: PropTypes.Requireable<string>;
67
64
  className: PropTypes.Requireable<string>;
@@ -81,9 +78,7 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
81
78
  onOpen: PropTypes.Requireable<(...args: any[]) => any>;
82
79
  onClose: PropTypes.Requireable<(...args: any[]) => any>;
83
80
  onFocus: PropTypes.Requireable<(...args: any[]) => any>;
84
- onBlur: PropTypes.Requireable<(...args: any[]) => any>; /**
85
- * @hidden
86
- */
81
+ onBlur: PropTypes.Requireable<(...args: any[]) => any>;
87
82
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
88
83
  itemRender: PropTypes.Requireable<(...args: any[]) => any>;
89
84
  listNoDataRender: PropTypes.Requireable<(...args: any[]) => any>;
@@ -91,9 +86,7 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
91
86
  header: PropTypes.Requireable<PropTypes.ReactNodeLike>;
92
87
  footer: PropTypes.Requireable<PropTypes.ReactNodeLike>;
93
88
  };
94
- /**
95
- * @hidden
96
- */
89
+ /** @hidden */
97
90
  static defaultProps: {
98
91
  size: "small" | "medium" | "large" | null | undefined;
99
92
  rounded: "small" | "medium" | "full" | "large" | null | undefined;
@@ -106,9 +99,7 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
106
99
  };
107
100
  validityStyles: boolean;
108
101
  };
109
- /**
110
- * @hidden
111
- */
102
+ /** @hidden */
112
103
  readonly state: ComboBoxState;
113
104
  protected readonly base: DropDownBase;
114
105
  private _element;
@@ -116,17 +107,21 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
116
107
  private _valueDuringOnChange;
117
108
  private _valueOnDidUpdate;
118
109
  private _suggested;
110
+ private _skipBlur;
119
111
  private _input;
112
+ private _adaptiveFilterInput;
120
113
  private itemHeight;
114
+ private observerResize;
115
+ private get document();
121
116
  constructor(props: ComboBoxProps);
122
- /**
123
- * @hidden
124
- */
117
+ /** @hidden */
125
118
  focus: () => void;
119
+ /** @hidden */
120
+ get element(): HTMLSpanElement | null;
126
121
  /**
127
- * @hidden
122
+ * The mobile mode of the ComboBox.
128
123
  */
129
- get element(): HTMLSpanElement | null;
124
+ get mobileMode(): boolean;
130
125
  /**
131
126
  * The value of the ComboBox.
132
127
  */
@@ -144,41 +139,36 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
144
139
  */
145
140
  get validity(): FormComponentValidity;
146
141
  protected get validityStyles(): boolean;
147
- /**
148
- * @hidden
149
- */
142
+ /** @hidden */
150
143
  protected get required(): boolean;
151
- /**
152
- * @hidden
153
- */
144
+ /** @hidden */
154
145
  componentDidUpdate(prevProps: ComboBoxProps, prevState: ComboBoxState): void;
155
- /**
156
- * @hidden
157
- */
146
+ /** @hidden */
158
147
  componentDidMount(): void;
159
- /**
160
- * @hidden
161
- */
148
+ /** @hidden */
149
+ componentWillUnmount(): void;
150
+ /** @hidden */
162
151
  render(): JSX.Element;
163
- /**
164
- * @hidden
165
- */
152
+ /** @hidden */
166
153
  handleItemSelect: (index: number, state: ComboInternalState) => void;
167
- /**
168
- * @hidden
169
- */
154
+ /** @hidden */
170
155
  onNavigate(state: InternalState, keyCode: number): void;
156
+ private onPopupOpened;
171
157
  private componentRef;
172
158
  private toggleBtnClick;
173
159
  private applyValueOnEnter;
174
160
  private applyValueOnRejectSuggestions;
175
161
  private selectFocusedItem;
162
+ private renderAdaptiveListContainer;
163
+ private renderMobileListFilter;
176
164
  private renderListContainer;
177
165
  private renderList;
166
+ private handleMobileFilterChange;
178
167
  private renderSearchBar;
179
168
  private onScroll;
180
169
  private handleItemClick;
181
170
  private handleBlur;
171
+ private onInputClick;
182
172
  private onInputKeyDown;
183
173
  private inputOnChange;
184
174
  private clearButtonClick;
@@ -187,6 +177,7 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
187
177
  private suggestValue;
188
178
  private applyState;
189
179
  private setValidity;
180
+ private calculateMedia;
190
181
  }
191
182
  /**
192
183
  * Represents the PropsContext of the `ComboBox` component.
@@ -36,6 +36,7 @@ var utils_1 = require("../common/utils");
36
36
  var SearchBar_1 = require("../common/SearchBar");
37
37
  var ListContainer_1 = require("../common/ListContainer");
38
38
  var List_1 = require("../common/List");
39
+ var ListFilter_1 = require("../common/ListFilter");
39
40
  var kendo_react_common_2 = require("@progress/kendo-react-common");
40
41
  var package_metadata_1 = require("../package-metadata");
41
42
  var ClearButton_1 = require("../common/ClearButton");
@@ -43,34 +44,34 @@ var kendo_react_buttons_1 = require("@progress/kendo-react-buttons");
43
44
  var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
44
45
  var messages_1 = require("./../messages");
45
46
  var kendo_react_intl_1 = require("@progress/kendo-react-intl");
47
+ var kendo_react_layout_1 = require("@progress/kendo-react-layout");
46
48
  var VALIDATION_MESSAGE = 'Please enter a valid value!';
49
+ var MOBILE_SMALL_DEVISE = 500;
50
+ var MOBILE_MEDIUM_DEVISE = 768;
47
51
  var sizeMap = kendo_react_common_1.kendoThemeMaps.sizeMap, roundedMap = kendo_react_common_1.kendoThemeMaps.roundedMap;
48
52
  /** @hidden */
49
53
  var ComboBoxWithoutContext = /** @class */ (function (_super) {
50
54
  __extends(ComboBoxWithoutContext, _super);
51
55
  function ComboBoxWithoutContext(props) {
52
56
  var _this = _super.call(this, props) || this;
53
- /**
54
- * @hidden
55
- */
57
+ /** @hidden */
56
58
  _this.state = {};
57
59
  _this.base = new DropDownBase_1.default(_this);
58
60
  _this._element = null;
59
61
  _this._inputId = (0, kendo_react_common_1.guid)();
60
62
  _this._suggested = '';
63
+ _this._skipBlur = false;
61
64
  _this._input = null;
65
+ _this._adaptiveFilterInput = null;
62
66
  _this.itemHeight = 0;
63
- /**
64
- * @hidden
65
- */
67
+ _this.observerResize = (window === null || window === void 0 ? void 0 : window.ResizeObserver) && new window.ResizeObserver(_this.calculateMedia.bind(_this));
68
+ /** @hidden */
66
69
  _this.focus = function () {
67
70
  if (_this._input) {
68
71
  _this._input.focus();
69
72
  }
70
73
  };
71
- /**
72
- * @hidden
73
- */
74
+ /** @hidden */
74
75
  _this.handleItemSelect = function (index, state) {
75
76
  var _a = _this.props, _b = _a.data, data = _b === void 0 ? [] : _b, virtual = _a.virtual, dataItemKey = _a.dataItemKey;
76
77
  var skip = virtual ? virtual.skip : 0;
@@ -84,14 +85,41 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
84
85
  _this.base.triggerPageChangeCornerItems(item, state);
85
86
  }
86
87
  };
88
+ _this.onPopupOpened = function () {
89
+ setTimeout(function () {
90
+ if (_this.mobileMode && _this._adaptiveFilterInput) {
91
+ _this._skipBlur = true;
92
+ _this._adaptiveFilterInput.focus();
93
+ _this._skipBlur = false;
94
+ }
95
+ }, 300);
96
+ };
87
97
  _this.componentRef = function (element) {
88
98
  _this._element = element;
89
99
  _this.base.wrapper = element;
90
100
  };
91
101
  _this.toggleBtnClick = function (event) {
102
+ var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
92
103
  var state = _this.base.initState();
93
104
  state.syntheticEvent = event;
94
105
  _this.base.togglePopup(state);
106
+ if (!opened && _this.mobileMode) {
107
+ var mobileText = _this.props.adaptiveFilter !== undefined ? _this.props.adaptiveFilter : _this.state.text || null;
108
+ _this.base.filterChanged(mobileText, state);
109
+ }
110
+ _this.applyState(state);
111
+ };
112
+ _this.renderMobileListFilter = function () {
113
+ var mobileText = _this.props.adaptiveFilter !== undefined ? _this.props.adaptiveFilter : _this.state.text;
114
+ var selectedItemText = (0, utils_1.getItemValue)(_this.value, _this.props.textField);
115
+ var mobileInputText = (0, utils_1.isPresent)(mobileText) ? mobileText : selectedItemText;
116
+ return (React.createElement(ListFilter_1.default, { value: mobileInputText, ref: function (filter) { return _this._adaptiveFilterInput = filter && filter.input; }, onChange: _this.handleMobileFilterChange, onKeyDown: _this.onInputKeyDown, size: _this.props.size, rounded: _this.props.rounded, fillMode: _this.props.fillMode }));
117
+ };
118
+ _this.handleMobileFilterChange = function (event) {
119
+ var state = _this.base.initState();
120
+ state.syntheticEvent = event;
121
+ state.data.text = event.target.value;
122
+ _this.base.filterChanged(event.target.value, state);
95
123
  _this.applyState(state);
96
124
  };
97
125
  _this.onScroll = function (event) {
@@ -128,7 +156,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
128
156
  _this._valueDuringOnChange = undefined;
129
157
  };
130
158
  _this.handleBlur = function (event) {
131
- if (_this.state.focused) {
159
+ if (_this.state.focused && !_this._skipBlur) {
132
160
  var state = _this.base.initState();
133
161
  state.data.focused = false;
134
162
  state.events.push({ type: 'onBlur' });
@@ -136,6 +164,17 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
136
164
  _this.applyValueOnRejectSuggestions(event.currentTarget.value, state);
137
165
  }
138
166
  };
167
+ _this.onInputClick = function (event) {
168
+ var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
169
+ var mobileText = _this.props.adaptiveFilter !== undefined ? _this.props.adaptiveFilter : _this.state.text || null;
170
+ if (!opened && _this.mobileMode) {
171
+ var state = _this.base.initState();
172
+ state.syntheticEvent = event;
173
+ _this.base.togglePopup(state);
174
+ _this.base.filterChanged(mobileText, state);
175
+ _this.applyState(state);
176
+ }
177
+ };
139
178
  _this.onInputKeyDown = function (event) {
140
179
  var keyCode = event.keyCode;
141
180
  var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
@@ -212,7 +251,8 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
212
251
  }
213
252
  _this.triggerOnChange(null, state);
214
253
  var opened = _this.props.opened !== undefined ? _this.props.opened : _this.state.opened;
215
- if (opened) {
254
+ var isAdaptive = _this.mobileMode;
255
+ if (opened && !isAdaptive) {
216
256
  _this.base.togglePopup(state);
217
257
  }
218
258
  _this.applyState(state);
@@ -227,12 +267,32 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
227
267
  (0, kendo_react_common_2.validatePackage)(package_metadata_1.packageMetadata);
228
268
  return _this;
229
269
  }
270
+ Object.defineProperty(ComboBoxWithoutContext.prototype, "document", {
271
+ get: function () {
272
+ if (!kendo_react_common_2.canUseDOM) {
273
+ return;
274
+ }
275
+ // useful only for user actions
276
+ return (this.element && this.element.ownerDocument) || document;
277
+ },
278
+ enumerable: false,
279
+ configurable: true
280
+ });
230
281
  Object.defineProperty(ComboBoxWithoutContext.prototype, "element", {
282
+ /** @hidden */
283
+ get: function () {
284
+ return this._element;
285
+ },
286
+ enumerable: false,
287
+ configurable: true
288
+ });
289
+ Object.defineProperty(ComboBoxWithoutContext.prototype, "mobileMode", {
231
290
  /**
232
- * @hidden
291
+ * The mobile mode of the ComboBox.
233
292
  */
234
293
  get: function () {
235
- return this._element;
294
+ var isAdaptive = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE && this.props.adaptive;
295
+ return !!isAdaptive;
236
296
  },
237
297
  enumerable: false,
238
298
  configurable: true
@@ -312,9 +372,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
312
372
  configurable: true
313
373
  });
314
374
  Object.defineProperty(ComboBoxWithoutContext.prototype, "required", {
315
- /**
316
- * @hidden
317
- */
375
+ /** @hidden */
318
376
  get: function () {
319
377
  return this.props.required !== undefined
320
378
  ? this.props.required
@@ -323,9 +381,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
323
381
  enumerable: false,
324
382
  configurable: true
325
383
  });
326
- /**
327
- * @hidden
328
- */
384
+ /** @hidden */
329
385
  ComboBoxWithoutContext.prototype.componentDidUpdate = function (prevProps, prevState) {
330
386
  var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, virtual = _a.virtual;
331
387
  var prevTotal = prevProps.virtual ? prevProps.virtual.total : 0;
@@ -346,6 +402,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
346
402
  this.base.scrollToVirtualItem(virtual, selectedItemIndex);
347
403
  }
348
404
  else if (opening && !virtual) {
405
+ this.onPopupOpened();
349
406
  this.base.scrollToItem(selectedItemIndex);
350
407
  }
351
408
  else if (opened && prevOpened && selectedItem && selectedItemChanged) {
@@ -357,21 +414,29 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
357
414
  }
358
415
  this.setValidity();
359
416
  };
360
- /**
361
- * @hidden
362
- */
417
+ /** @hidden */
363
418
  ComboBoxWithoutContext.prototype.componentDidMount = function () {
419
+ var _a;
364
420
  this.base.didMount();
365
421
  this.setValidity();
422
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
423
+ this.observerResize.observe(this.document.body);
424
+ }
425
+ };
426
+ /** @hidden */
427
+ ComboBoxWithoutContext.prototype.componentWillUnmount = function () {
428
+ var _a;
429
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
430
+ this.observerResize.disconnect();
431
+ }
366
432
  };
367
- /**
368
- * @hidden
369
- */
433
+ /** @hidden */
370
434
  ComboBoxWithoutContext.prototype.render = function () {
371
435
  var _a;
372
436
  var btnAriaLabelExpand = (0, kendo_react_intl_1.provideLocalizationService)(this).toLanguageString(messages_1.comboArrowBtnAriaLabelExpand, messages_1.messages[messages_1.comboArrowBtnAriaLabelExpand]);
373
437
  var btnAriaLabelCollapse = (0, kendo_react_intl_1.provideLocalizationService)(this).toLanguageString(messages_1.comboArrowBtnAriaLabelCollapse, messages_1.messages[messages_1.comboArrowBtnAriaLabelCollapse]);
374
- var _b = this.props, dir = _b.dir, disabled = _b.disabled, _c = _b.clearButton, clearButton = _c === void 0 ? ComboBoxWithoutContext.defaultProps.clearButton : _c, label = _b.label, textField = _b.textField, className = _b.className, style = _b.style, loading = _b.loading, iconClassName = _b.iconClassName, virtual = _b.virtual, size = _b.size, rounded = _b.rounded, fillMode = _b.fillMode, _d = _b.opened, opened = _d === void 0 ? this.state.opened : _d;
438
+ var _b = this.props, dir = _b.dir, disabled = _b.disabled, _c = _b.clearButton, clearButton = _c === void 0 ? ComboBoxWithoutContext.defaultProps.clearButton : _c, label = _b.label, textField = _b.textField, adaptive = _b.adaptive, className = _b.className, style = _b.style, loading = _b.loading, iconClassName = _b.iconClassName, virtual = _b.virtual, size = _b.size, rounded = _b.rounded, fillMode = _b.fillMode, _d = _b.opened, opened = _d === void 0 ? this.state.opened : _d, placeholder = _b.placeholder;
439
+ var _e = this.state.windowWidth, windowWidth = _e === void 0 ? 0 : _e;
375
440
  var isValid = !this.validityStyles || this.validity.valid;
376
441
  var text = this.props.filter !== undefined ? this.props.filter : this.state.text;
377
442
  var selectedItemText = (0, utils_1.getItemValue)(this.value, textField);
@@ -380,33 +445,34 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
380
445
  var base = this.base;
381
446
  var vs = base.vs;
382
447
  var id = this.props.id || this._inputId;
448
+ var renderAdaptive = windowWidth <= MOBILE_MEDIUM_DEVISE && adaptive;
383
449
  vs.enabled = virtual !== undefined;
384
450
  if (virtual !== undefined) {
385
451
  vs.skip = virtual.skip;
386
452
  vs.total = virtual.total;
387
453
  vs.pageSize = virtual.pageSize;
388
454
  }
389
- var combobox = (React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-combobox k-input', (_a = {},
390
- _a["k-input-".concat(sizeMap[size] || size)] = size,
391
- _a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
392
- _a["k-input-".concat(fillMode)] = fillMode,
393
- _a['k-invalid'] = !isValid,
394
- _a['k-loading'] = loading,
395
- _a['k-required'] = this.required,
396
- _a['k-disabled'] = disabled,
397
- _a), className), ref: this.componentRef, style: !label ? style : __assign(__assign({}, style), { width: undefined }), dir: dir },
398
- this.renderSearchBar(inputText || '', id),
399
- renderClearButton && !loading && React.createElement(ClearButton_1.default, { onClick: this.clearButtonClick, key: "clearbutton" }),
400
- loading && React.createElement("span", { className: "k-icon k-i-loading k-input-loading-icon", key: "loading" }),
401
- React.createElement(kendo_react_buttons_1.Button, { tabIndex: -1, type: "button", "aria-label": opened ? btnAriaLabelCollapse : btnAriaLabelExpand, icon: !iconClassName ? 'caret-alt-down' : undefined, svgIcon: !iconClassName ? kendo_svg_icons_1.caretAltDownIcon : this.props.svgIcon, iconClass: iconClassName, size: size, fillMode: fillMode, rounded: null, themeColor: 'base', className: "k-input-button", onClick: this.toggleBtnClick, onMouseDown: function (e) { return e.preventDefault(); } }),
402
- this.renderListContainer()));
455
+ var combobox = (React.createElement(React.Fragment, null,
456
+ React.createElement("span", { className: (0, kendo_react_common_1.classNames)('k-combobox k-input', (_a = {},
457
+ _a["k-input-".concat(sizeMap[size] || size)] = size,
458
+ _a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
459
+ _a["k-input-".concat(fillMode)] = fillMode,
460
+ _a['k-invalid'] = !isValid,
461
+ _a['k-loading'] = loading,
462
+ _a['k-required'] = this.required,
463
+ _a['k-disabled'] = disabled,
464
+ _a), className), ref: this.componentRef, style: !label ? style : __assign(__assign({}, style), { width: undefined }), dir: dir },
465
+ this.renderSearchBar(inputText || '', id, placeholder),
466
+ renderClearButton && !loading && React.createElement(ClearButton_1.default, { onClick: this.clearButtonClick, key: "clearbutton" }),
467
+ loading && React.createElement("span", { className: "k-icon k-i-loading k-input-loading-icon", key: "loading" }),
468
+ React.createElement(kendo_react_buttons_1.Button, { tabIndex: -1, type: "button", "aria-label": opened ? btnAriaLabelCollapse : btnAriaLabelExpand, icon: !iconClassName ? 'caret-alt-down' : undefined, svgIcon: !iconClassName ? kendo_svg_icons_1.caretAltDownIcon : this.props.svgIcon, iconClass: iconClassName, size: size, fillMode: fillMode, rounded: null, themeColor: 'base', className: "k-input-button", onClick: this.toggleBtnClick, onMouseDown: function (e) { return e.preventDefault(); } }),
469
+ !renderAdaptive && this.renderListContainer()),
470
+ renderAdaptive && this.renderAdaptiveListContainer()));
403
471
  return label
404
472
  ? (React.createElement(kendo_react_labels_1.FloatingLabel, { label: label, editorId: id, editorValue: inputText, editorValid: isValid, editorDisabled: disabled, style: { width: style ? style.width : undefined }, children: combobox }))
405
473
  : combobox;
406
474
  };
407
- /**
408
- * @hidden
409
- */
475
+ /** @hidden */
410
476
  ComboBoxWithoutContext.prototype.onNavigate = function (state, keyCode) {
411
477
  var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c;
412
478
  var text = this.props.filter ? this.props.filter : this.state.text;
@@ -433,6 +499,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
433
499
  }
434
500
  }
435
501
  };
502
+ ;
436
503
  ComboBoxWithoutContext.prototype.applyValueOnEnter = function (value, state) {
437
504
  var _a;
438
505
  var _b = this.props, _c = _b.data, data = _c === void 0 ? [] : _c, textField = _b.textField, allowCustom = _b.allowCustom;
@@ -468,9 +535,10 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
468
535
  var _b = this.props, _c = _b.data, data = _c === void 0 ? [] : _c, textField = _b.textField, allowCustom = _b.allowCustom;
469
536
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
470
537
  var valueItemText = (0, utils_1.getItemValue)(this.value, textField);
538
+ var isMobileDevice = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE;
471
539
  this._suggested = '';
472
540
  if (text === valueItemText || (text === '' && !(0, utils_1.isPresent)(valueItemText))) {
473
- if (opened) {
541
+ if (opened && !isMobileDevice) {
474
542
  this.base.togglePopup(state);
475
543
  }
476
544
  return this.applyState(state);
@@ -489,7 +557,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
489
557
  state.data.text = undefined;
490
558
  this.base.filterChanged('', state);
491
559
  }
492
- if (opened) {
560
+ if (opened && !isMobileDevice) {
493
561
  this.base.togglePopup(state);
494
562
  }
495
563
  this.applyState(state);
@@ -514,6 +582,51 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
514
582
  }
515
583
  return this.applyState(state);
516
584
  };
585
+ ComboBoxWithoutContext.prototype.renderAdaptiveListContainer = function () {
586
+ var _a;
587
+ var _this = this;
588
+ var _b = this.state.windowWidth, windowWidth = _b === void 0 ? 0 : _b;
589
+ var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, _d = _c.data, data = _d === void 0 ? [] : _d, groupField = _c.groupField, list = _c.list, virtual = _c.virtual, adaptiveTitle = _c.adaptiveTitle;
590
+ var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
591
+ var group = this.state.group;
592
+ if (group === undefined && groupField !== undefined) {
593
+ group = (0, utils_1.getItemValue)(data[0], groupField);
594
+ }
595
+ var actionSheetProps = {
596
+ navigatable: false,
597
+ navigatableElements: [],
598
+ expand: opened,
599
+ animation: true,
600
+ onClose: function (event) { return _this.toggleBtnClick(event); },
601
+ animationStyles: windowWidth <= MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
602
+ className: windowWidth <= MOBILE_SMALL_DEVISE
603
+ ? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
604
+ : 'k-adaptive-actionsheet k-actionsheet-bottom'
605
+ };
606
+ return (React.createElement(React.Fragment, null,
607
+ React.createElement(kendo_react_layout_1.ActionSheet, __assign({}, actionSheetProps),
608
+ React.createElement(kendo_react_layout_1.ActionSheetHeader, { className: 'k-text-center' },
609
+ React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
610
+ React.createElement("div", { className: "k-actionsheet-title" },
611
+ React.createElement("div", null, adaptiveTitle)),
612
+ React.createElement("div", { className: "k-actionsheet-actions" },
613
+ React.createElement(kendo_react_buttons_1.Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", onClick: this.toggleBtnClick },
614
+ React.createElement("span", { className: "k-button-icon k-icon k-i-x" })))),
615
+ React.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderMobileListFilter())),
616
+ React.createElement(kendo_react_layout_1.ActionSheetContent, { className: '!k-overflow-hidden' },
617
+ React.createElement("div", { className: 'k-list-container' },
618
+ React.createElement("div", { className: (0, kendo_react_common_1.classNames)((_a = {},
619
+ _a['k-list'] = !list,
620
+ _a['k-list-lg'] = true,
621
+ _a['k-virtual-list'] = virtual,
622
+ _a['k-data-table'] = list,
623
+ _a["k-table-".concat(sizeMap[size] || size)] = list && size,
624
+ _a)) },
625
+ header && React.createElement("div", { className: "k-table-header" }, header),
626
+ !list && group && React.createElement("div", { className: "k-list-group-sticky-header" }, group),
627
+ this.renderList(),
628
+ footer && React.createElement("div", { className: "k-list-footer" }, footer)))))));
629
+ };
517
630
  ComboBoxWithoutContext.prototype.renderListContainer = function () {
518
631
  var _a;
519
632
  var base = this.base;
@@ -560,20 +673,22 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
560
673
  var selectedItemText = (0, utils_1.getItemValue)(this.value, textField);
561
674
  var value = (0, utils_1.isPresent)(text) && text !== selectedItemText ? null : this.value;
562
675
  var ListComponent = this.props.list || List_1.default;
563
- return (React.createElement(ListComponent, { id: base.listBoxId, virtual: Boolean(virtual), show: opened, data: data, focusedIndex: focusedIndex, value: value, textField: textField, valueField: dataItemKey, groupField: this.props.groupField, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle: { maxHeight: popupSettings.height }, wrapperCssClass: (0, kendo_react_common_1.classNames)('k-list-content', (_a = {},
676
+ return (React.createElement(ListComponent, { id: base.listBoxId, virtual: Boolean(virtual), show: opened, data: data, focusedIndex: focusedIndex, value: value, textField: textField, valueField: dataItemKey, groupField: this.props.groupField, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle: (this.state.windowWidth && this.state.windowWidth > MOBILE_MEDIUM_DEVISE)
677
+ ? { maxHeight: popupSettings.height }
678
+ : {}, wrapperCssClass: (0, kendo_react_common_1.classNames)('k-list-content', (_a = {},
564
679
  _a['k-list-scroller'] = !virtual,
565
680
  _a)), listStyle: vs.enabled ? { transform: translate } : undefined, key: "listkey", skip: skip, onClick: this.handleItemClick, itemRender: itemRender, noDataRender: listNoDataRender, onMouseDown: function (e) { return e.preventDefault(); }, onScroll: this.onScroll, wrapperRef: vs.scrollerRef, scroller: this.base.renderScrollElement() }));
566
681
  };
567
- ComboBoxWithoutContext.prototype.renderSearchBar = function (text, id) {
682
+ ComboBoxWithoutContext.prototype.renderSearchBar = function (text, id, placeholder) {
568
683
  var _this = this;
569
- var _a = this.props, placeholder = _a.placeholder, tabIndex = _a.tabIndex, disabled = _a.disabled, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c;
684
+ var _a = this.props, tabIndex = _a.tabIndex, disabled = _a.disabled, _b = _a.data, data = _b === void 0 ? [] : _b, dataItemKey = _a.dataItemKey, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c;
570
685
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
571
686
  var value = this.value;
572
687
  var selectedIndex = Math.max(0, data.findIndex(function (i) { return (0, utils_1.areSame)(i, value, dataItemKey); }));
573
688
  if (this._suggested && !(0, utils_1.areSame)(this._valueOnDidUpdate, value, dataItemKey)) {
574
689
  this._suggested = '';
575
690
  }
576
- return (React.createElement(SearchBar_1.default, { id: id, placeholder: placeholder, tabIndex: tabIndex, accessKey: this.props.accessKey, value: text + this._suggested, suggestedText: this._suggested, ref: function (el) { return _this._input = el && el.input; }, onKeyDown: this.onInputKeyDown, onChange: this.inputOnChange, onFocus: this.base.handleFocus, onBlur: this.handleBlur, disabled: disabled, expanded: opened, owns: this.base.listBoxId, activedescendant: "option-".concat(this.base.guid, "-").concat(selectedIndex + virtual.skip), role: "combobox", ariaLabelledBy: this.props.ariaLabelledBy, ariaDescribedBy: this.props.ariaDescribedBy, ariaRequired: this.required, render: this.props.valueRender }));
691
+ return (React.createElement(SearchBar_1.default, { id: id, readOnly: (opened && this.mobileMode), placeholder: placeholder, tabIndex: tabIndex, accessKey: this.props.accessKey, value: text + this._suggested, suggestedText: this._suggested, ref: function (el) { return _this._input = el && el.input; }, onClick: this.onInputClick, onKeyDown: this.onInputKeyDown, onChange: this.inputOnChange, onFocus: this.base.handleFocus, onBlur: this.handleBlur, disabled: disabled, expanded: opened, owns: this.base.listBoxId, activedescendant: "option-".concat(this.base.guid, "-").concat(selectedIndex + virtual.skip), role: "combobox", ariaLabelledBy: this.props.ariaLabelledBy, ariaDescribedBy: this.props.ariaDescribedBy, ariaRequired: this.required, render: this.props.valueRender }));
577
692
  };
578
693
  ComboBoxWithoutContext.prototype.triggerOnChange = function (item, state) {
579
694
  var value = this.value;
@@ -608,14 +723,18 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
608
723
  this.base.applyState(state);
609
724
  this._valueDuringOnChange = undefined;
610
725
  };
726
+ ComboBoxWithoutContext.prototype.calculateMedia = function (entries) {
727
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
728
+ var entry = entries_1[_i];
729
+ this.setState({ windowWidth: entry.target.clientWidth });
730
+ }
731
+ ;
732
+ };
733
+ ;
611
734
  ComboBoxWithoutContext.displayName = 'ComboBox';
612
- /**
613
- * @hidden
614
- */
735
+ /** @hidden */
615
736
  ComboBoxWithoutContext.propTypes = __assign(__assign({}, DropDownBase_1.default.propTypes), { size: PropTypes.oneOf([null, 'small', 'medium', 'large']), rounded: PropTypes.oneOf([null, 'small', 'medium', 'large', 'full']), fillMode: PropTypes.oneOf([null, 'solid', 'flat', 'outline']), dataItemKey: PropTypes.string, groupField: PropTypes.string, suggest: PropTypes.bool, placeholder: PropTypes.string, allowCustom: PropTypes.bool, clearButton: PropTypes.bool, iconClassName: PropTypes.string, svgIcon: kendo_react_common_1.svgIconPropType, validationMessage: PropTypes.string, required: PropTypes.bool, id: PropTypes.string, ariaLabelledBy: PropTypes.string, ariaDescribedBy: PropTypes.string, list: PropTypes.any, valueRender: PropTypes.func });
616
- /**
617
- * @hidden
618
- */
737
+ /** @hidden */
619
738
  ComboBoxWithoutContext.defaultProps = __assign(__assign({}, DropDownBase_1.default.defaultProps), { size: 'medium', rounded: 'medium', fillMode: 'solid', allowCustom: false, clearButton: true, required: false });
620
739
  return ComboBoxWithoutContext;
621
740
  }(React.Component));
@@ -107,6 +107,10 @@ export interface ComboBoxProps extends FormComponentProps {
107
107
  * Sets the value of ComboBox input. Useful for making the ComboBox input a [controlled component](https://reactjs.org/docs/forms.html#controlled-components).
108
108
  */
109
109
  filter?: string | null;
110
+ /**
111
+ * Sets the value of the adaptive filtering input of the of ComboBox.
112
+ */
113
+ adaptiveFilter?: string;
110
114
  /**
111
115
  * Sets the loading state of the ComboBox ([see example]({% slug filtering_combobox %}#toc-basic-configuration)).
112
116
  */
@@ -268,4 +272,12 @@ export interface ComboBoxProps extends FormComponentProps {
268
272
  * @default `solid`
269
273
  */
270
274
  fillMode?: null | 'solid' | 'flat' | 'outline';
275
+ /**
276
+ * Providing different rendering of the popup element based on the screen dimensions.
277
+ */
278
+ adaptive?: boolean;
279
+ /**
280
+ * Specifies the text that is rendered as title in the adaptive popup.
281
+ */
282
+ adaptiveTitle?: string;
271
283
  }
@@ -147,7 +147,7 @@ export default class DropDownBase {
147
147
  didMount(): void;
148
148
  calculateDir(): void;
149
149
  calculatePopupWidth(): void;
150
- scrollToItem(itemIndex: number, vsEnabled?: boolean): void;
150
+ scrollToItem(itemIndex: number, vsEnabled?: boolean, once?: boolean): void;
151
151
  handleItemClick: (index: number, event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLInputElement>) => void;
152
152
  handleFocus: React.FocusEventHandler<HTMLSpanElement>;
153
153
  filterChanged: (text: string | null, state: InternalState) => void;