@danielgindi/selectbox 2.0.56 → 2.0.57

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.
package/dist/lib.es6.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.56
2
+ * @danielgindi/selectbox 2.0.57
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  import { closestUntil, createElement, next, prev, setElementAttrs } from "@danielgindi/dom-utils/lib/Dom";
@@ -86,6 +86,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
86
86
  * @property {boolean} [isHeaderVisible=false] show header element
87
87
  * @property {boolean} [isFooterVisible=false] show footer element
88
88
  * @property {boolean} [searchable=false] include inline search box
89
+ * @property {string} [searchPlaceholder=''] placeholder text for the inline search box
89
90
  * @property {string} [noResultsText='No matching results'] text for no results (empty for none)
90
91
  * @property {number} [filterThrottleWindow=300] throttle time (milliseconds) for filtering
91
92
  * @property {boolean} [filterOnEmptyTerm=false] call the filter function on empty search term too
@@ -150,6 +151,7 @@ var DefaultOptions = {
150
151
  isHeaderVisible: false,
151
152
  isFooterVisible: false,
152
153
  searchable: false,
154
+ searchPlaceholder: "",
153
155
  noResultsText: "No matching results",
154
156
  filterThrottleWindow: 300,
155
157
  filterOnEmptyTerm: false,
@@ -194,6 +196,7 @@ var DropList = class DropList {
194
196
  on: o.on || null,
195
197
  positionOptionsProvider: o.positionOptionsProvider ?? null,
196
198
  searchable: o.searchable,
199
+ searchPlaceholder: o.searchPlaceholder,
197
200
  isHeaderVisible: o.isHeaderVisible,
198
201
  isFooterVisible: o.isFooterVisible,
199
202
  silenceEvents: true,
@@ -1372,7 +1375,8 @@ var DropList = class DropList {
1372
1375
  autocomplete: "off",
1373
1376
  autocapitalize: "off",
1374
1377
  spellcheck: "false",
1375
- "aria-autocomplete": "list"
1378
+ "aria-autocomplete": "list",
1379
+ placeholder: p.searchPlaceholder || ""
1376
1380
  });
1377
1381
  p.headerEl.appendChild(p.searchInput);
1378
1382
  } else {
@@ -1381,6 +1385,15 @@ var DropList = class DropList {
1381
1385
  }
1382
1386
  this.setHeaderVisible(searchable);
1383
1387
  }
1388
+ /**
1389
+ * Set the placeholder text of the inline search box
1390
+ * @param {string} placeholder
1391
+ */
1392
+ setSearchPlaceholder(placeholder) {
1393
+ const p = this._p;
1394
+ p.searchPlaceholder = placeholder || "";
1395
+ if (p.searchInput) p.searchInput.placeholder = p.searchPlaceholder;
1396
+ }
1384
1397
  hasFocusedItem() {
1385
1398
  return this._p.focusItemIndex > -1 && this._p.focusItemIndex < this._p.items.length;
1386
1399
  }