northants-design-system 0.3.3 → 0.3.5

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 React, { cloneElement, Component, useState, useContext, useEffect, useRef } from 'react';
1
+ import React, { Component, cloneElement, useState, useContext, useEffect, useRef } from 'react';
2
2
  import styled, { css, ThemeContext, ThemeProvider, createGlobalStyle } from 'styled-components';
3
3
  import require$$0$3 from 'tty';
4
4
  import require$$2 from 'path';
@@ -298,60 +298,6 @@ const AutocompleteSuggestionTextMatch = styled.span`
298
298
  font-weight: bold;
299
299
  `;
300
300
 
301
- function _objectWithoutPropertiesLoose(source, excluded) {
302
- if (source == null) return {};
303
- var target = {};
304
- var sourceKeys = Object.keys(source);
305
- var key, i;
306
-
307
- for (i = 0; i < sourceKeys.length; i++) {
308
- key = sourceKeys[i];
309
- if (excluded.indexOf(key) >= 0) continue;
310
- target[key] = source[key];
311
- }
312
-
313
- return target;
314
- }
315
-
316
- function _extends() {
317
- _extends = Object.assign ? Object.assign.bind() : function (target) {
318
- for (var i = 1; i < arguments.length; i++) {
319
- var source = arguments[i];
320
-
321
- for (var key in source) {
322
- if (Object.prototype.hasOwnProperty.call(source, key)) {
323
- target[key] = source[key];
324
- }
325
- }
326
- }
327
-
328
- return target;
329
- };
330
- return _extends.apply(this, arguments);
331
- }
332
-
333
- function _assertThisInitialized(self) {
334
- if (self === void 0) {
335
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
336
- }
337
-
338
- return self;
339
- }
340
-
341
- function _setPrototypeOf(o, p) {
342
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
343
- o.__proto__ = p;
344
- return o;
345
- };
346
- return _setPrototypeOf(o, p);
347
- }
348
-
349
- function _inheritsLoose(subClass, superClass) {
350
- subClass.prototype = Object.create(superClass.prototype);
351
- subClass.prototype.constructor = subClass;
352
- _setPrototypeOf(subClass, superClass);
353
- }
354
-
355
301
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
356
302
 
357
303
  function getDefaultExportFromCjs (x) {
@@ -1809,7 +1755,7 @@ function requireReactIs_development () {
1809
1755
 
1810
1756
  function t(t){return "object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return (!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return !1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}function computeScrollIntoView(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p);}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else {F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)));}C.push({el:k,top:F,left:G});}return C}
1811
1757
 
1812
- var idCounter = 0;
1758
+ let idCounter = 0;
1813
1759
  /**
1814
1760
  * Accepts a parameter and returns it if it's a function
1815
1761
  * or a noop function if it's not. This allows us to
@@ -1836,15 +1782,17 @@ function scrollIntoView(node, menuNode) {
1836
1782
  return;
1837
1783
  }
1838
1784
 
1839
- var actions = computeScrollIntoView(node, {
1785
+ const actions = computeScrollIntoView(node, {
1840
1786
  boundary: menuNode,
1841
1787
  block: 'nearest',
1842
1788
  scrollMode: 'if-needed'
1843
1789
  });
1844
- actions.forEach(function (_ref) {
1845
- var el = _ref.el,
1846
- top = _ref.top,
1847
- left = _ref.left;
1790
+ actions.forEach(_ref => {
1791
+ let {
1792
+ el,
1793
+ top,
1794
+ left
1795
+ } = _ref;
1848
1796
  el.scrollTop = top;
1849
1797
  el.scrollLeft = left;
1850
1798
  });
@@ -1858,7 +1806,7 @@ function scrollIntoView(node, menuNode) {
1858
1806
 
1859
1807
 
1860
1808
  function isOrContainsNode(parent, child, environment) {
1861
- var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
1809
+ const result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
1862
1810
  return result;
1863
1811
  }
1864
1812
  /**
@@ -1872,7 +1820,7 @@ function isOrContainsNode(parent, child, environment) {
1872
1820
 
1873
1821
 
1874
1822
  function debounce(fn, time) {
1875
- var timeoutId;
1823
+ let timeoutId;
1876
1824
 
1877
1825
  function cancel() {
1878
1826
  if (timeoutId) {
@@ -1886,9 +1834,9 @@ function debounce(fn, time) {
1886
1834
  }
1887
1835
 
1888
1836
  cancel();
1889
- timeoutId = setTimeout(function () {
1837
+ timeoutId = setTimeout(() => {
1890
1838
  timeoutId = null;
1891
- fn.apply(void 0, args);
1839
+ fn(...args);
1892
1840
  }, time);
1893
1841
  }
1894
1842
 
@@ -1914,9 +1862,9 @@ function callAllEventHandlers() {
1914
1862
  args[_key3 - 1] = arguments[_key3];
1915
1863
  }
1916
1864
 
1917
- return fns.some(function (fn) {
1865
+ return fns.some(fn => {
1918
1866
  if (fn) {
1919
- fn.apply(void 0, [event].concat(args));
1867
+ fn(event, ...args);
1920
1868
  }
1921
1869
 
1922
1870
  return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;
@@ -1929,8 +1877,8 @@ function handleRefs() {
1929
1877
  refs[_key4] = arguments[_key4];
1930
1878
  }
1931
1879
 
1932
- return function (node) {
1933
- refs.forEach(function (ref) {
1880
+ return node => {
1881
+ refs.forEach(ref => {
1934
1882
  if (typeof ref === 'function') {
1935
1883
  ref(node);
1936
1884
  } else if (ref) {
@@ -1959,9 +1907,11 @@ function generateId() {
1959
1907
 
1960
1908
 
1961
1909
  function getA11yStatusMessage$1(_ref2) {
1962
- var isOpen = _ref2.isOpen,
1963
- resultCount = _ref2.resultCount,
1964
- previousResultCount = _ref2.previousResultCount;
1910
+ let {
1911
+ isOpen,
1912
+ resultCount,
1913
+ previousResultCount
1914
+ } = _ref2;
1965
1915
 
1966
1916
  if (!isOpen) {
1967
1917
  return '';
@@ -1972,7 +1922,7 @@ function getA11yStatusMessage$1(_ref2) {
1972
1922
  }
1973
1923
 
1974
1924
  if (resultCount !== previousResultCount) {
1975
- return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter key to select.";
1925
+ return `${resultCount} result${resultCount === 1 ? ' is' : 's are'} available, use up and down arrow keys to navigate. Press Enter key to select.`;
1976
1926
  }
1977
1927
 
1978
1928
  return '';
@@ -2028,10 +1978,10 @@ function getElementProps(element) {
2028
1978
 
2029
1979
  function requiredProp(fnName, propName) {
2030
1980
  // eslint-disable-next-line no-console
2031
- console.error("The property \"" + propName + "\" is required in \"" + fnName + "\"");
1981
+ console.error(`The property "${propName}" is required in "${fnName}"`);
2032
1982
  }
2033
1983
 
2034
- var stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
1984
+ const stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
2035
1985
  /**
2036
1986
  * @param {Object} state the state object
2037
1987
  * @return {Object} state that is relevant to downshift
@@ -2042,8 +1992,8 @@ function pickState(state) {
2042
1992
  state = {};
2043
1993
  }
2044
1994
 
2045
- var result = {};
2046
- stateKeys.forEach(function (k) {
1995
+ const result = {};
1996
+ stateKeys.forEach(k => {
2047
1997
  if (state.hasOwnProperty(k)) {
2048
1998
  result[k] = state[k];
2049
1999
  }
@@ -2064,7 +2014,7 @@ function pickState(state) {
2064
2014
 
2065
2015
 
2066
2016
  function getState(state, props) {
2067
- return Object.keys(state).reduce(function (prevState, key) {
2017
+ return Object.keys(state).reduce((prevState, key) => {
2068
2018
  prevState[key] = isControlledProp(props, key) ? props[key] : state[key];
2069
2019
  return prevState;
2070
2020
  }, {});
@@ -2091,12 +2041,14 @@ function isControlledProp(props, key) {
2091
2041
 
2092
2042
 
2093
2043
  function normalizeArrowKey(event) {
2094
- var key = event.key,
2095
- keyCode = event.keyCode;
2044
+ const {
2045
+ key,
2046
+ keyCode
2047
+ } = event;
2096
2048
  /* istanbul ignore next (ie) */
2097
2049
 
2098
2050
  if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
2099
- return "Arrow" + key;
2051
+ return `Arrow${key}`;
2100
2052
  }
2101
2053
 
2102
2054
  return key;
@@ -2133,13 +2085,13 @@ function getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromI
2133
2085
  return -1;
2134
2086
  }
2135
2087
 
2136
- var itemsLastIndex = itemCount - 1;
2088
+ const itemsLastIndex = itemCount - 1;
2137
2089
 
2138
2090
  if (typeof baseIndex !== 'number' || baseIndex < 0 || baseIndex >= itemCount) {
2139
2091
  baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;
2140
2092
  }
2141
2093
 
2142
- var newIndex = baseIndex + moveAmount;
2094
+ let newIndex = baseIndex + moveAmount;
2143
2095
 
2144
2096
  if (newIndex < 0) {
2145
2097
  newIndex = circular ? itemsLastIndex : 0;
@@ -2147,7 +2099,7 @@ function getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromI
2147
2099
  newIndex = circular ? 0 : itemsLastIndex;
2148
2100
  }
2149
2101
 
2150
- var nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);
2102
+ const nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);
2151
2103
 
2152
2104
  if (nonDisabledNewIndex === -1) {
2153
2105
  return baseIndex >= itemCount ? -1 : baseIndex;
@@ -2168,22 +2120,22 @@ function getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromI
2168
2120
 
2169
2121
 
2170
2122
  function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
2171
- var currentElementNode = getItemNodeFromIndex(baseIndex);
2123
+ const currentElementNode = getItemNodeFromIndex(baseIndex);
2172
2124
 
2173
2125
  if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {
2174
2126
  return baseIndex;
2175
2127
  }
2176
2128
 
2177
2129
  if (moveAmount > 0) {
2178
- for (var index = baseIndex + 1; index < itemCount; index++) {
2130
+ for (let index = baseIndex + 1; index < itemCount; index++) {
2179
2131
  if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
2180
2132
  return index;
2181
2133
  }
2182
2134
  }
2183
2135
  } else {
2184
- for (var _index = baseIndex - 1; _index >= 0; _index--) {
2185
- if (!getItemNodeFromIndex(_index).hasAttribute('disabled')) {
2186
- return _index;
2136
+ for (let index = baseIndex - 1; index >= 0; index--) {
2137
+ if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
2138
+ return index;
2187
2139
  }
2188
2140
  }
2189
2141
  }
@@ -2211,31 +2163,29 @@ function targetWithinDownshift(target, downshiftElements, environment, checkActi
2211
2163
  checkActiveElement = true;
2212
2164
  }
2213
2165
 
2214
- return downshiftElements.some(function (contextNode) {
2215
- return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));
2216
- });
2166
+ return downshiftElements.some(contextNode => contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment)));
2217
2167
  } // eslint-disable-next-line import/no-mutable-exports
2218
2168
 
2219
2169
 
2220
- var validateControlledUnchanged = noop;
2170
+ let validateControlledUnchanged = noop;
2221
2171
  /* istanbul ignore next */
2222
2172
 
2223
2173
  if (process.env.NODE_ENV !== 'production') {
2224
- validateControlledUnchanged = function validateControlledUnchanged(state, prevProps, nextProps) {
2225
- var warningDescription = "This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";
2226
- Object.keys(state).forEach(function (propKey) {
2174
+ validateControlledUnchanged = (state, prevProps, nextProps) => {
2175
+ const warningDescription = `This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props`;
2176
+ Object.keys(state).forEach(propKey => {
2227
2177
  if (prevProps[propKey] !== undefined && nextProps[propKey] === undefined) {
2228
2178
  // eslint-disable-next-line no-console
2229
- console.error("downshift: A component has changed the controlled prop \"" + propKey + "\" to be uncontrolled. " + warningDescription);
2179
+ console.error(`downshift: A component has changed the controlled prop "${propKey}" to be uncontrolled. ${warningDescription}`);
2230
2180
  } else if (prevProps[propKey] === undefined && nextProps[propKey] !== undefined) {
2231
2181
  // eslint-disable-next-line no-console
2232
- console.error("downshift: A component has changed the uncontrolled prop \"" + propKey + "\" to be controlled. " + warningDescription);
2182
+ console.error(`downshift: A component has changed the uncontrolled prop "${propKey}" to be controlled. ${warningDescription}`);
2233
2183
  }
2234
2184
  });
2235
2185
  };
2236
2186
  }
2237
2187
 
2238
- var cleanupStatus = debounce(function (documentProp) {
2188
+ const cleanupStatus = debounce(documentProp => {
2239
2189
  getStatusDiv(documentProp).textContent = '';
2240
2190
  }, 500);
2241
2191
  /**
@@ -2244,7 +2194,7 @@ var cleanupStatus = debounce(function (documentProp) {
2244
2194
  */
2245
2195
 
2246
2196
  function setStatus(status, documentProp) {
2247
- var div = getStatusDiv(documentProp);
2197
+ const div = getStatusDiv(documentProp);
2248
2198
 
2249
2199
  if (!status) {
2250
2200
  return;
@@ -2265,7 +2215,7 @@ function getStatusDiv(documentProp) {
2265
2215
  documentProp = document;
2266
2216
  }
2267
2217
 
2268
- var statusDiv = documentProp.getElementById('a11y-status-message');
2218
+ let statusDiv = documentProp.getElementById('a11y-status-message');
2269
2219
 
2270
2220
  if (statusDiv) {
2271
2221
  return statusDiv;
@@ -2290,23 +2240,23 @@ function getStatusDiv(documentProp) {
2290
2240
  return statusDiv;
2291
2241
  }
2292
2242
 
2293
- var unknown = process.env.NODE_ENV !== "production" ? '__autocomplete_unknown__' : 0;
2294
- var mouseUp = process.env.NODE_ENV !== "production" ? '__autocomplete_mouseup__' : 1;
2295
- var itemMouseEnter = process.env.NODE_ENV !== "production" ? '__autocomplete_item_mouseenter__' : 2;
2296
- var keyDownArrowUp = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_arrow_up__' : 3;
2297
- var keyDownArrowDown = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_arrow_down__' : 4;
2298
- var keyDownEscape = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_escape__' : 5;
2299
- var keyDownEnter = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_enter__' : 6;
2300
- var keyDownHome = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_home__' : 7;
2301
- var keyDownEnd = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_end__' : 8;
2302
- var clickItem = process.env.NODE_ENV !== "production" ? '__autocomplete_click_item__' : 9;
2303
- var blurInput = process.env.NODE_ENV !== "production" ? '__autocomplete_blur_input__' : 10;
2304
- var changeInput = process.env.NODE_ENV !== "production" ? '__autocomplete_change_input__' : 11;
2305
- var keyDownSpaceButton = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_space_button__' : 12;
2306
- var clickButton = process.env.NODE_ENV !== "production" ? '__autocomplete_click_button__' : 13;
2307
- var blurButton = process.env.NODE_ENV !== "production" ? '__autocomplete_blur_button__' : 14;
2308
- var controlledPropUpdatedSelectedItem = process.env.NODE_ENV !== "production" ? '__autocomplete_controlled_prop_updated_selected_item__' : 15;
2309
- var touchEnd = process.env.NODE_ENV !== "production" ? '__autocomplete_touchend__' : 16;
2243
+ const unknown = process.env.NODE_ENV !== "production" ? '__autocomplete_unknown__' : 0;
2244
+ const mouseUp = process.env.NODE_ENV !== "production" ? '__autocomplete_mouseup__' : 1;
2245
+ const itemMouseEnter = process.env.NODE_ENV !== "production" ? '__autocomplete_item_mouseenter__' : 2;
2246
+ const keyDownArrowUp = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_arrow_up__' : 3;
2247
+ const keyDownArrowDown = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_arrow_down__' : 4;
2248
+ const keyDownEscape = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_escape__' : 5;
2249
+ const keyDownEnter = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_enter__' : 6;
2250
+ const keyDownHome = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_home__' : 7;
2251
+ const keyDownEnd = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_end__' : 8;
2252
+ const clickItem = process.env.NODE_ENV !== "production" ? '__autocomplete_click_item__' : 9;
2253
+ const blurInput = process.env.NODE_ENV !== "production" ? '__autocomplete_blur_input__' : 10;
2254
+ const changeInput = process.env.NODE_ENV !== "production" ? '__autocomplete_change_input__' : 11;
2255
+ const keyDownSpaceButton = process.env.NODE_ENV !== "production" ? '__autocomplete_keydown_space_button__' : 12;
2256
+ const clickButton = process.env.NODE_ENV !== "production" ? '__autocomplete_click_button__' : 13;
2257
+ const blurButton = process.env.NODE_ENV !== "production" ? '__autocomplete_blur_button__' : 14;
2258
+ const controlledPropUpdatedSelectedItem = process.env.NODE_ENV !== "production" ? '__autocomplete_controlled_prop_updated_selected_item__' : 15;
2259
+ const touchEnd = process.env.NODE_ENV !== "production" ? '__autocomplete_touchend__' : 16;
2310
2260
 
2311
2261
  var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
2312
2262
  __proto__: null,
@@ -2329,58 +2279,45 @@ var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
2329
2279
  touchEnd: touchEnd
2330
2280
  });
2331
2281
 
2332
- var _excluded$4 = ["refKey", "ref"],
2333
- _excluded2$3 = ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"],
2334
- _excluded3$2 = ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"],
2335
- _excluded4$1 = ["refKey", "ref"],
2336
- _excluded5$1 = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"];
2282
+ /* eslint camelcase:0 */
2337
2283
 
2338
- var Downshift = /*#__PURE__*/function () {
2339
- var Downshift = /*#__PURE__*/function (_Component) {
2340
- _inheritsLoose(Downshift, _Component);
2341
-
2342
- function Downshift(_props) {
2284
+ const Downshift = /*#__PURE__*/(() => {
2285
+ class Downshift extends Component {
2286
+ constructor(_props) {
2343
2287
  var _this;
2344
2288
 
2345
- _this = _Component.call(this, _props) || this; // fancy destructuring + defaults + aliases
2346
- // this basically says each value of state should either be set to
2347
- // the initial value or the default value if the initial value is not provided
2289
+ super(_props);
2290
+ _this = this;
2291
+ this.id = this.props.id || `downshift-${generateId()}`;
2292
+ this.menuId = this.props.menuId || `${this.id}-menu`;
2293
+ this.labelId = this.props.labelId || `${this.id}-label`;
2294
+ this.inputId = this.props.inputId || `${this.id}-input`;
2348
2295
 
2349
- _this.id = _this.props.id || "downshift-" + generateId();
2350
- _this.menuId = _this.props.menuId || _this.id + "-menu";
2351
- _this.labelId = _this.props.labelId || _this.id + "-label";
2352
- _this.inputId = _this.props.inputId || _this.id + "-input";
2353
-
2354
- _this.getItemId = _this.props.getItemId || function (index) {
2355
- return _this.id + "-item-" + index;
2356
- };
2296
+ this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
2357
2297
 
2358
- _this.input = null;
2359
- _this.items = [];
2360
- _this.itemCount = null;
2361
- _this.previousResultCount = 0;
2362
- _this.timeoutIds = [];
2298
+ this.input = null;
2299
+ this.items = [];
2300
+ this.itemCount = null;
2301
+ this.previousResultCount = 0;
2302
+ this.timeoutIds = [];
2363
2303
 
2364
- _this.internalSetTimeout = function (fn, time) {
2365
- var id = setTimeout(function () {
2366
- _this.timeoutIds = _this.timeoutIds.filter(function (i) {
2367
- return i !== id;
2368
- });
2304
+ this.internalSetTimeout = (fn, time) => {
2305
+ const id = setTimeout(() => {
2306
+ this.timeoutIds = this.timeoutIds.filter(i => i !== id);
2369
2307
  fn();
2370
2308
  }, time);
2371
-
2372
- _this.timeoutIds.push(id);
2309
+ this.timeoutIds.push(id);
2373
2310
  };
2374
2311
 
2375
- _this.setItemCount = function (count) {
2376
- _this.itemCount = count;
2312
+ this.setItemCount = count => {
2313
+ this.itemCount = count;
2377
2314
  };
2378
2315
 
2379
- _this.unsetItemCount = function () {
2380
- _this.itemCount = null;
2316
+ this.unsetItemCount = () => {
2317
+ this.itemCount = null;
2381
2318
  };
2382
2319
 
2383
- _this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {
2320
+ this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {
2384
2321
  if (highlightedIndex === void 0) {
2385
2322
  highlightedIndex = _this.props.defaultHighlightedIndex;
2386
2323
  }
@@ -2391,69 +2328,72 @@ var Downshift = /*#__PURE__*/function () {
2391
2328
 
2392
2329
  otherStateToSet = pickState(otherStateToSet);
2393
2330
 
2394
- _this.internalSetState(_extends({
2395
- highlightedIndex: highlightedIndex
2396
- }, otherStateToSet));
2331
+ _this.internalSetState({
2332
+ highlightedIndex,
2333
+ ...otherStateToSet
2334
+ });
2397
2335
  };
2398
2336
 
2399
- _this.clearSelection = function (cb) {
2400
- _this.internalSetState({
2337
+ this.clearSelection = cb => {
2338
+ this.internalSetState({
2401
2339
  selectedItem: null,
2402
2340
  inputValue: '',
2403
- highlightedIndex: _this.props.defaultHighlightedIndex,
2404
- isOpen: _this.props.defaultIsOpen
2341
+ highlightedIndex: this.props.defaultHighlightedIndex,
2342
+ isOpen: this.props.defaultIsOpen
2405
2343
  }, cb);
2406
2344
  };
2407
2345
 
2408
- _this.selectItem = function (item, otherStateToSet, cb) {
2346
+ this.selectItem = (item, otherStateToSet, cb) => {
2409
2347
  otherStateToSet = pickState(otherStateToSet);
2410
-
2411
- _this.internalSetState(_extends({
2412
- isOpen: _this.props.defaultIsOpen,
2413
- highlightedIndex: _this.props.defaultHighlightedIndex,
2348
+ this.internalSetState({
2349
+ isOpen: this.props.defaultIsOpen,
2350
+ highlightedIndex: this.props.defaultHighlightedIndex,
2414
2351
  selectedItem: item,
2415
- inputValue: _this.props.itemToString(item)
2416
- }, otherStateToSet), cb);
2352
+ inputValue: this.props.itemToString(item),
2353
+ ...otherStateToSet
2354
+ }, cb);
2417
2355
  };
2418
2356
 
2419
- _this.selectItemAtIndex = function (itemIndex, otherStateToSet, cb) {
2420
- var item = _this.items[itemIndex];
2357
+ this.selectItemAtIndex = (itemIndex, otherStateToSet, cb) => {
2358
+ const item = this.items[itemIndex];
2421
2359
 
2422
2360
  if (item == null) {
2423
2361
  return;
2424
2362
  }
2425
2363
 
2426
- _this.selectItem(item, otherStateToSet, cb);
2364
+ this.selectItem(item, otherStateToSet, cb);
2427
2365
  };
2428
2366
 
2429
- _this.selectHighlightedItem = function (otherStateToSet, cb) {
2430
- return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);
2367
+ this.selectHighlightedItem = (otherStateToSet, cb) => {
2368
+ return this.selectItemAtIndex(this.getState().highlightedIndex, otherStateToSet, cb);
2431
2369
  };
2432
2370
 
2433
- _this.internalSetState = function (stateToSet, cb) {
2434
- var isItemSelected, onChangeArg;
2435
- var onStateChangeArg = {};
2436
- var isStateToSetFunction = typeof stateToSet === 'function'; // we want to call `onInputValueChange` before the `setState` call
2371
+ this.internalSetState = (stateToSet, cb) => {
2372
+ let isItemSelected, onChangeArg;
2373
+ const onStateChangeArg = {};
2374
+ const isStateToSetFunction = typeof stateToSet === 'function'; // we want to call `onInputValueChange` before the `setState` call
2437
2375
  // so someone controlling the `inputValue` state gets notified of
2438
2376
  // the input change as soon as possible. This avoids issues with
2439
2377
  // preserving the cursor position.
2440
2378
  // See https://github.com/downshift-js/downshift/issues/217 for more info.
2441
2379
 
2442
2380
  if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {
2443
- _this.props.onInputValueChange(stateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), stateToSet));
2381
+ this.props.onInputValueChange(stateToSet.inputValue, { ...this.getStateAndHelpers(),
2382
+ ...stateToSet
2383
+ });
2444
2384
  }
2445
2385
 
2446
- return _this.setState(function (state) {
2447
- state = _this.getState(state);
2448
- var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet; // Your own function that could modify the state that will be set.
2386
+ return this.setState(state => {
2387
+ state = this.getState(state);
2388
+ let newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet; // Your own function that could modify the state that will be set.
2449
2389
 
2450
- newStateToSet = _this.props.stateReducer(state, newStateToSet); // checks if an item is selected, regardless of if it's different from
2390
+ newStateToSet = this.props.stateReducer(state, newStateToSet); // checks if an item is selected, regardless of if it's different from
2451
2391
  // what was selected before
2452
2392
  // used to determine if onSelect and onChange callbacks should be called
2453
2393
 
2454
2394
  isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
2455
2395
 
2456
- var nextState = {}; // this is just used to tell whether the state changed
2396
+ const nextState = {}; // this is just used to tell whether the state changed
2457
2397
  // and we're trying to update that state. OR if the selection has changed and we're
2458
2398
  // trying to update the selection
2459
2399
 
@@ -2462,7 +2402,7 @@ var Downshift = /*#__PURE__*/function () {
2462
2402
  }
2463
2403
 
2464
2404
  newStateToSet.type = newStateToSet.type || unknown;
2465
- Object.keys(newStateToSet).forEach(function (key) {
2405
+ Object.keys(newStateToSet).forEach(key => {
2466
2406
  // onStateChangeArg should only have the state that is
2467
2407
  // actually changing
2468
2408
  if (state[key] !== newStateToSet[key]) {
@@ -2481,79 +2421,82 @@ var Downshift = /*#__PURE__*/function () {
2481
2421
 
2482
2422
  newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
2483
2423
 
2484
- if (!isControlledProp(_this.props, key)) {
2424
+ if (!isControlledProp(this.props, key)) {
2485
2425
  nextState[key] = newStateToSet[key];
2486
2426
  }
2487
2427
  }); // if stateToSet is a function, then we weren't able to call onInputValueChange
2488
2428
  // earlier, so we'll call it now that we know what the inputValue state will be.
2489
2429
 
2490
2430
  if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {
2491
- _this.props.onInputValueChange(newStateToSet.inputValue, _extends({}, _this.getStateAndHelpers(), newStateToSet));
2431
+ this.props.onInputValueChange(newStateToSet.inputValue, { ...this.getStateAndHelpers(),
2432
+ ...newStateToSet
2433
+ });
2492
2434
  }
2493
2435
 
2494
2436
  return nextState;
2495
- }, function () {
2437
+ }, () => {
2496
2438
  // call the provided callback if it's a function
2497
2439
  cbToCb(cb)(); // only call the onStateChange and onChange callbacks if
2498
2440
  // we have relevant information to pass them.
2499
2441
 
2500
- var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;
2442
+ const hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;
2501
2443
 
2502
2444
  if (hasMoreStateThanType) {
2503
- _this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers());
2445
+ this.props.onStateChange(onStateChangeArg, this.getStateAndHelpers());
2504
2446
  }
2505
2447
 
2506
2448
  if (isItemSelected) {
2507
- _this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers());
2449
+ this.props.onSelect(stateToSet.selectedItem, this.getStateAndHelpers());
2508
2450
  }
2509
2451
 
2510
2452
  if (onChangeArg !== undefined) {
2511
- _this.props.onChange(onChangeArg, _this.getStateAndHelpers());
2453
+ this.props.onChange(onChangeArg, this.getStateAndHelpers());
2512
2454
  } // this is currently undocumented and therefore subject to change
2513
2455
  // We'll try to not break it, but just be warned.
2514
2456
 
2515
2457
 
2516
- _this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());
2458
+ this.props.onUserAction(onStateChangeArg, this.getStateAndHelpers());
2517
2459
  });
2518
2460
  };
2519
2461
 
2520
- _this.rootRef = function (node) {
2521
- return _this._rootNode = node;
2522
- };
2523
-
2524
- _this.getRootProps = function (_temp, _temp2) {
2525
- var _extends2;
2526
-
2527
- var _ref = _temp === void 0 ? {} : _temp,
2528
- _ref$refKey = _ref.refKey,
2529
- refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
2530
- ref = _ref.ref,
2531
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$4);
2532
-
2533
- var _ref2 = _temp2 === void 0 ? {} : _temp2,
2534
- _ref2$suppressRefErro = _ref2.suppressRefError,
2535
- suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
2536
-
2462
+ this.rootRef = node => this._rootNode = node;
2463
+
2464
+ this.getRootProps = function (_temp, _temp2) {
2465
+ let {
2466
+ refKey = 'ref',
2467
+ ref,
2468
+ ...rest
2469
+ } = _temp === void 0 ? {} : _temp;
2470
+ let {
2471
+ suppressRefError = false
2472
+ } = _temp2 === void 0 ? {} : _temp2;
2537
2473
  // this is used in the render to know whether the user has called getRootProps.
2538
2474
  // It uses that to know whether to apply the props automatically
2539
2475
  _this.getRootProps.called = true;
2540
2476
  _this.getRootProps.refKey = refKey;
2541
2477
  _this.getRootProps.suppressRefError = suppressRefError;
2542
2478
 
2543
- var _this$getState = _this.getState(),
2544
- isOpen = _this$getState.isOpen;
2479
+ const {
2480
+ isOpen
2481
+ } = _this.getState();
2545
2482
 
2546
- return _extends((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);
2483
+ return {
2484
+ [refKey]: handleRefs(ref, _this.rootRef),
2485
+ role: 'combobox',
2486
+ 'aria-expanded': isOpen,
2487
+ 'aria-haspopup': 'listbox',
2488
+ 'aria-owns': isOpen ? _this.menuId : null,
2489
+ 'aria-labelledby': _this.labelId,
2490
+ ...rest
2491
+ };
2547
2492
  };
2548
2493
 
2549
- _this.keyDownHandlers = {
2550
- ArrowDown: function ArrowDown(event) {
2551
- var _this2 = this;
2552
-
2494
+ this.keyDownHandlers = {
2495
+ ArrowDown(event) {
2553
2496
  event.preventDefault();
2554
2497
 
2555
2498
  if (this.getState().isOpen) {
2556
- var amount = event.shiftKey ? 5 : 1;
2499
+ const amount = event.shiftKey ? 5 : 1;
2557
2500
  this.moveHighlightedIndex(amount, {
2558
2501
  type: keyDownArrowDown
2559
2502
  });
@@ -2561,31 +2504,27 @@ var Downshift = /*#__PURE__*/function () {
2561
2504
  this.internalSetState({
2562
2505
  isOpen: true,
2563
2506
  type: keyDownArrowDown
2564
- }, function () {
2565
- var itemCount = _this2.getItemCount();
2507
+ }, () => {
2508
+ const itemCount = this.getItemCount();
2566
2509
 
2567
2510
  if (itemCount > 0) {
2568
- var _this2$getState = _this2.getState(),
2569
- highlightedIndex = _this2$getState.highlightedIndex;
2570
-
2571
- var nextHighlightedIndex = getNextWrappingIndex(1, highlightedIndex, itemCount, function (index) {
2572
- return _this2.getItemNodeFromIndex(index);
2573
- });
2574
-
2575
- _this2.setHighlightedIndex(nextHighlightedIndex, {
2511
+ const {
2512
+ highlightedIndex
2513
+ } = this.getState();
2514
+ const nextHighlightedIndex = getNextWrappingIndex(1, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
2515
+ this.setHighlightedIndex(nextHighlightedIndex, {
2576
2516
  type: keyDownArrowDown
2577
2517
  });
2578
2518
  }
2579
2519
  });
2580
2520
  }
2581
2521
  },
2582
- ArrowUp: function ArrowUp(event) {
2583
- var _this3 = this;
2584
2522
 
2523
+ ArrowUp(event) {
2585
2524
  event.preventDefault();
2586
2525
 
2587
2526
  if (this.getState().isOpen) {
2588
- var amount = event.shiftKey ? -5 : -1;
2527
+ const amount = event.shiftKey ? -5 : -1;
2589
2528
  this.moveHighlightedIndex(amount, {
2590
2529
  type: keyDownArrowUp
2591
2530
  });
@@ -2593,37 +2532,36 @@ var Downshift = /*#__PURE__*/function () {
2593
2532
  this.internalSetState({
2594
2533
  isOpen: true,
2595
2534
  type: keyDownArrowUp
2596
- }, function () {
2597
- var itemCount = _this3.getItemCount();
2535
+ }, () => {
2536
+ const itemCount = this.getItemCount();
2598
2537
 
2599
2538
  if (itemCount > 0) {
2600
- var _this3$getState = _this3.getState(),
2601
- highlightedIndex = _this3$getState.highlightedIndex;
2602
-
2603
- var nextHighlightedIndex = getNextWrappingIndex(-1, highlightedIndex, itemCount, function (index) {
2604
- return _this3.getItemNodeFromIndex(index);
2605
- });
2606
-
2607
- _this3.setHighlightedIndex(nextHighlightedIndex, {
2539
+ const {
2540
+ highlightedIndex
2541
+ } = this.getState();
2542
+ const nextHighlightedIndex = getNextWrappingIndex(-1, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
2543
+ this.setHighlightedIndex(nextHighlightedIndex, {
2608
2544
  type: keyDownArrowUp
2609
2545
  });
2610
2546
  }
2611
2547
  });
2612
2548
  }
2613
2549
  },
2614
- Enter: function Enter(event) {
2550
+
2551
+ Enter(event) {
2615
2552
  if (event.which === 229) {
2616
2553
  return;
2617
2554
  }
2618
2555
 
2619
- var _this$getState2 = this.getState(),
2620
- isOpen = _this$getState2.isOpen,
2621
- highlightedIndex = _this$getState2.highlightedIndex;
2556
+ const {
2557
+ isOpen,
2558
+ highlightedIndex
2559
+ } = this.getState();
2622
2560
 
2623
2561
  if (isOpen && highlightedIndex != null) {
2624
2562
  event.preventDefault();
2625
- var item = this.items[highlightedIndex];
2626
- var itemNode = this.getItemNodeFromIndex(highlightedIndex);
2563
+ const item = this.items[highlightedIndex];
2564
+ const itemNode = this.getItemNodeFromIndex(highlightedIndex);
2627
2565
 
2628
2566
  if (item == null || itemNode && itemNode.hasAttribute('disabled')) {
2629
2567
  return;
@@ -2634,125 +2572,131 @@ var Downshift = /*#__PURE__*/function () {
2634
2572
  });
2635
2573
  }
2636
2574
  },
2637
- Escape: function Escape(event) {
2575
+
2576
+ Escape(event) {
2638
2577
  event.preventDefault();
2639
- this.reset(_extends({
2640
- type: keyDownEscape
2641
- }, !this.state.isOpen && {
2642
- selectedItem: null,
2643
- inputValue: ''
2644
- }));
2578
+ this.reset({
2579
+ type: keyDownEscape,
2580
+ ...(!this.state.isOpen && {
2581
+ selectedItem: null,
2582
+ inputValue: ''
2583
+ })
2584
+ });
2645
2585
  }
2586
+
2646
2587
  };
2647
- _this.buttonKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
2648
- ' ': function _(event) {
2588
+ this.buttonKeyDownHandlers = { ...this.keyDownHandlers,
2589
+
2590
+ ' '(event) {
2649
2591
  event.preventDefault();
2650
2592
  this.toggleMenu({
2651
2593
  type: keyDownSpaceButton
2652
2594
  });
2653
2595
  }
2654
- });
2655
- _this.inputKeyDownHandlers = _extends({}, _this.keyDownHandlers, {
2656
- Home: function Home(event) {
2657
- var _this4 = this;
2658
2596
 
2659
- var _this$getState3 = this.getState(),
2660
- isOpen = _this$getState3.isOpen;
2597
+ };
2598
+ this.inputKeyDownHandlers = { ...this.keyDownHandlers,
2599
+
2600
+ Home(event) {
2601
+ const {
2602
+ isOpen
2603
+ } = this.getState();
2661
2604
 
2662
2605
  if (!isOpen) {
2663
2606
  return;
2664
2607
  }
2665
2608
 
2666
2609
  event.preventDefault();
2667
- var itemCount = this.getItemCount();
2610
+ const itemCount = this.getItemCount();
2668
2611
 
2669
2612
  if (itemCount <= 0 || !isOpen) {
2670
2613
  return;
2671
2614
  } // get next non-disabled starting downwards from 0 if that's disabled.
2672
2615
 
2673
2616
 
2674
- var newHighlightedIndex = getNextNonDisabledIndex(1, 0, itemCount, function (index) {
2675
- return _this4.getItemNodeFromIndex(index);
2676
- }, false);
2617
+ const newHighlightedIndex = getNextNonDisabledIndex(1, 0, itemCount, index => this.getItemNodeFromIndex(index), false);
2677
2618
  this.setHighlightedIndex(newHighlightedIndex, {
2678
2619
  type: keyDownHome
2679
2620
  });
2680
2621
  },
2681
- End: function End(event) {
2682
- var _this5 = this;
2683
2622
 
2684
- var _this$getState4 = this.getState(),
2685
- isOpen = _this$getState4.isOpen;
2623
+ End(event) {
2624
+ const {
2625
+ isOpen
2626
+ } = this.getState();
2686
2627
 
2687
2628
  if (!isOpen) {
2688
2629
  return;
2689
2630
  }
2690
2631
 
2691
2632
  event.preventDefault();
2692
- var itemCount = this.getItemCount();
2633
+ const itemCount = this.getItemCount();
2693
2634
 
2694
2635
  if (itemCount <= 0 || !isOpen) {
2695
2636
  return;
2696
2637
  } // get next non-disabled starting upwards from last index if that's disabled.
2697
2638
 
2698
2639
 
2699
- var newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, function (index) {
2700
- return _this5.getItemNodeFromIndex(index);
2701
- }, false);
2640
+ const newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, index => this.getItemNodeFromIndex(index), false);
2702
2641
  this.setHighlightedIndex(newHighlightedIndex, {
2703
2642
  type: keyDownEnd
2704
2643
  });
2705
2644
  }
2706
- });
2707
-
2708
- _this.getToggleButtonProps = function (_temp3) {
2709
- var _ref3 = _temp3 === void 0 ? {} : _temp3,
2710
- onClick = _ref3.onClick;
2711
- _ref3.onPress;
2712
- var onKeyDown = _ref3.onKeyDown,
2713
- onKeyUp = _ref3.onKeyUp,
2714
- onBlur = _ref3.onBlur,
2715
- rest = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);
2716
2645
 
2717
- var _this$getState5 = _this.getState(),
2718
- isOpen = _this$getState5.isOpen;
2646
+ };
2719
2647
 
2720
- var enabledEventHandlers = {
2648
+ this.getToggleButtonProps = function (_temp3) {
2649
+ let {
2650
+ onClick,
2651
+ onPress,
2652
+ onKeyDown,
2653
+ onKeyUp,
2654
+ onBlur,
2655
+ ...rest
2656
+ } = _temp3 === void 0 ? {} : _temp3;
2657
+
2658
+ const {
2659
+ isOpen
2660
+ } = _this.getState();
2661
+
2662
+ const enabledEventHandlers = {
2721
2663
  onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
2722
2664
  onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
2723
2665
  onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
2724
2666
  onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)
2725
2667
  };
2726
- var eventHandlers = rest.disabled ? {} : enabledEventHandlers;
2727
- return _extends({
2668
+ const eventHandlers = rest.disabled ? {} : enabledEventHandlers;
2669
+ return {
2728
2670
  type: 'button',
2729
2671
  role: 'button',
2730
2672
  'aria-label': isOpen ? 'close menu' : 'open menu',
2731
2673
  'aria-haspopup': true,
2732
- 'data-toggle': true
2733
- }, eventHandlers, rest);
2674
+ 'data-toggle': true,
2675
+ ...eventHandlers,
2676
+ ...rest
2677
+ };
2734
2678
  };
2735
2679
 
2736
- _this.buttonHandleKeyUp = function (event) {
2680
+ this.buttonHandleKeyUp = event => {
2737
2681
  // Prevent click event from emitting in Firefox
2738
2682
  event.preventDefault();
2739
2683
  };
2740
2684
 
2741
- _this.buttonHandleKeyDown = function (event) {
2742
- var key = normalizeArrowKey(event);
2685
+ this.buttonHandleKeyDown = event => {
2686
+ const key = normalizeArrowKey(event);
2743
2687
 
2744
- if (_this.buttonKeyDownHandlers[key]) {
2745
- _this.buttonKeyDownHandlers[key].call(_assertThisInitialized(_this), event);
2688
+ if (this.buttonKeyDownHandlers[key]) {
2689
+ this.buttonKeyDownHandlers[key].call(this, event);
2746
2690
  }
2747
2691
  };
2748
2692
 
2749
- _this.buttonHandleClick = function (event) {
2693
+ this.buttonHandleClick = event => {
2750
2694
  event.preventDefault(); // handle odd case for Safari and Firefox which
2751
2695
  // don't give the button the focus properly.
2752
2696
 
2753
2697
  /* istanbul ignore if (can't reasonably test this) */
2754
2698
 
2755
- if (_this.props.environment.document.activeElement === _this.props.environment.document.body) {
2699
+ if (this.props.environment.document.activeElement === this.props.environment.document.body) {
2756
2700
  event.target.focus();
2757
2701
  } // to simplify testing components that use downshift, we'll not wrap this in a setTimeout
2758
2702
  // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
@@ -2760,69 +2704,71 @@ var Downshift = /*#__PURE__*/function () {
2760
2704
 
2761
2705
 
2762
2706
  if (process.env.NODE_ENV === 'test') {
2763
- _this.toggleMenu({
2707
+ this.toggleMenu({
2764
2708
  type: clickButton
2765
2709
  });
2766
2710
  } else {
2767
2711
  // Ensure that toggle of menu occurs after the potential blur event in iOS
2768
- _this.internalSetTimeout(function () {
2769
- return _this.toggleMenu({
2770
- type: clickButton
2771
- });
2772
- });
2712
+ this.internalSetTimeout(() => this.toggleMenu({
2713
+ type: clickButton
2714
+ }));
2773
2715
  }
2774
2716
  };
2775
2717
 
2776
- _this.buttonHandleBlur = function (event) {
2777
- var blurTarget = event.target; // Save blur target for comparison with activeElement later
2718
+ this.buttonHandleBlur = event => {
2719
+ const blurTarget = event.target; // Save blur target for comparison with activeElement later
2778
2720
  // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
2779
2721
 
2780
- _this.internalSetTimeout(function () {
2781
- if (!_this.isMouseDown && (_this.props.environment.document.activeElement == null || _this.props.environment.document.activeElement.id !== _this.inputId) && _this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
2722
+ this.internalSetTimeout(() => {
2723
+ if (!this.isMouseDown && (this.props.environment.document.activeElement == null || this.props.environment.document.activeElement.id !== this.inputId) && this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
2782
2724
  ) {
2783
- _this.reset({
2725
+ this.reset({
2784
2726
  type: blurButton
2785
2727
  });
2786
2728
  }
2787
2729
  });
2788
2730
  };
2789
2731
 
2790
- _this.getLabelProps = function (props) {
2791
- return _extends({
2792
- htmlFor: _this.inputId,
2793
- id: _this.labelId
2794
- }, props);
2732
+ this.getLabelProps = props => {
2733
+ return {
2734
+ htmlFor: this.inputId,
2735
+ id: this.labelId,
2736
+ ...props
2737
+ };
2795
2738
  };
2796
2739
 
2797
- _this.getInputProps = function (_temp4) {
2798
- var _ref4 = _temp4 === void 0 ? {} : _temp4,
2799
- onKeyDown = _ref4.onKeyDown,
2800
- onBlur = _ref4.onBlur,
2801
- onChange = _ref4.onChange,
2802
- onInput = _ref4.onInput;
2803
- _ref4.onChangeText;
2804
- var rest = _objectWithoutPropertiesLoose(_ref4, _excluded3$2);
2805
-
2806
- var onChangeKey;
2807
- var eventHandlers = {};
2740
+ this.getInputProps = function (_temp4) {
2741
+ let {
2742
+ onKeyDown,
2743
+ onBlur,
2744
+ onChange,
2745
+ onInput,
2746
+ onChangeText,
2747
+ ...rest
2748
+ } = _temp4 === void 0 ? {} : _temp4;
2749
+ let onChangeKey;
2750
+ let eventHandlers = {};
2808
2751
  /* istanbul ignore next (preact) */
2809
2752
 
2810
2753
  {
2811
2754
  onChangeKey = 'onChange';
2812
2755
  }
2813
2756
 
2814
- var _this$getState6 = _this.getState(),
2815
- inputValue = _this$getState6.inputValue,
2816
- isOpen = _this$getState6.isOpen,
2817
- highlightedIndex = _this$getState6.highlightedIndex;
2757
+ const {
2758
+ inputValue,
2759
+ isOpen,
2760
+ highlightedIndex
2761
+ } = _this.getState();
2818
2762
 
2819
2763
  if (!rest.disabled) {
2820
- var _eventHandlers;
2821
-
2822
- eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);
2764
+ eventHandlers = {
2765
+ [onChangeKey]: callAllEventHandlers(onChange, onInput, _this.inputHandleChange),
2766
+ onKeyDown: callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown),
2767
+ onBlur: callAllEventHandlers(onBlur, _this.inputHandleBlur)
2768
+ };
2823
2769
  }
2824
2770
 
2825
- return _extends({
2771
+ return {
2826
2772
  'aria-autocomplete': 'list',
2827
2773
  'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : null,
2828
2774
  'aria-controls': isOpen ? _this.menuId : null,
@@ -2831,77 +2777,79 @@ var Downshift = /*#__PURE__*/function () {
2831
2777
  // revert back since autocomplete="nope" is ignored on latest Chrome and Opera
2832
2778
  autoComplete: 'off',
2833
2779
  value: inputValue,
2834
- id: _this.inputId
2835
- }, eventHandlers, rest);
2780
+ id: _this.inputId,
2781
+ ...eventHandlers,
2782
+ ...rest
2783
+ };
2836
2784
  };
2837
2785
 
2838
- _this.inputHandleKeyDown = function (event) {
2839
- var key = normalizeArrowKey(event);
2786
+ this.inputHandleKeyDown = event => {
2787
+ const key = normalizeArrowKey(event);
2840
2788
 
2841
- if (key && _this.inputKeyDownHandlers[key]) {
2842
- _this.inputKeyDownHandlers[key].call(_assertThisInitialized(_this), event);
2789
+ if (key && this.inputKeyDownHandlers[key]) {
2790
+ this.inputKeyDownHandlers[key].call(this, event);
2843
2791
  }
2844
2792
  };
2845
2793
 
2846
- _this.inputHandleChange = function (event) {
2847
- _this.internalSetState({
2794
+ this.inputHandleChange = event => {
2795
+ this.internalSetState({
2848
2796
  type: changeInput,
2849
2797
  isOpen: true,
2850
2798
  inputValue: event.target.value,
2851
- highlightedIndex: _this.props.defaultHighlightedIndex
2799
+ highlightedIndex: this.props.defaultHighlightedIndex
2852
2800
  });
2853
2801
  };
2854
2802
 
2855
- _this.inputHandleBlur = function () {
2803
+ this.inputHandleBlur = () => {
2856
2804
  // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element
2857
- _this.internalSetTimeout(function () {
2858
- var downshiftButtonIsActive = _this.props.environment.document && !!_this.props.environment.document.activeElement && !!_this.props.environment.document.activeElement.dataset && _this.props.environment.document.activeElement.dataset.toggle && _this._rootNode && _this._rootNode.contains(_this.props.environment.document.activeElement);
2805
+ this.internalSetTimeout(() => {
2806
+ const downshiftButtonIsActive = this.props.environment.document && !!this.props.environment.document.activeElement && !!this.props.environment.document.activeElement.dataset && this.props.environment.document.activeElement.dataset.toggle && this._rootNode && this._rootNode.contains(this.props.environment.document.activeElement);
2859
2807
 
2860
- if (!_this.isMouseDown && !downshiftButtonIsActive) {
2861
- _this.reset({
2808
+ if (!this.isMouseDown && !downshiftButtonIsActive) {
2809
+ this.reset({
2862
2810
  type: blurInput
2863
2811
  });
2864
2812
  }
2865
2813
  });
2866
2814
  };
2867
2815
 
2868
- _this.menuRef = function (node) {
2869
- _this._menuNode = node;
2816
+ this.menuRef = node => {
2817
+ this._menuNode = node;
2870
2818
  };
2871
2819
 
2872
- _this.getMenuProps = function (_temp5, _temp6) {
2873
- var _extends3;
2874
-
2875
- var _ref5 = _temp5 === void 0 ? {} : _temp5,
2876
- _ref5$refKey = _ref5.refKey,
2877
- refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
2878
- ref = _ref5.ref,
2879
- props = _objectWithoutPropertiesLoose(_ref5, _excluded4$1);
2880
-
2881
- var _ref6 = _temp6 === void 0 ? {} : _temp6,
2882
- _ref6$suppressRefErro = _ref6.suppressRefError,
2883
- suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;
2884
-
2820
+ this.getMenuProps = function (_temp5, _temp6) {
2821
+ let {
2822
+ refKey = 'ref',
2823
+ ref,
2824
+ ...props
2825
+ } = _temp5 === void 0 ? {} : _temp5;
2826
+ let {
2827
+ suppressRefError = false
2828
+ } = _temp6 === void 0 ? {} : _temp6;
2885
2829
  _this.getMenuProps.called = true;
2886
2830
  _this.getMenuProps.refKey = refKey;
2887
2831
  _this.getMenuProps.suppressRefError = suppressRefError;
2888
- return _extends((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
2832
+ return {
2833
+ [refKey]: handleRefs(ref, _this.menuRef),
2834
+ role: 'listbox',
2835
+ 'aria-labelledby': props && props['aria-label'] ? null : _this.labelId,
2836
+ id: _this.menuId,
2837
+ ...props
2838
+ };
2889
2839
  };
2890
2840
 
2891
- _this.getItemProps = function (_temp7) {
2892
- var _enabledEventHandlers;
2893
-
2894
- var _ref7 = _temp7 === void 0 ? {} : _temp7,
2895
- onMouseMove = _ref7.onMouseMove,
2896
- onMouseDown = _ref7.onMouseDown,
2897
- onClick = _ref7.onClick;
2898
- _ref7.onPress;
2899
- var index = _ref7.index,
2900
- _ref7$item = _ref7.item,
2901
- item = _ref7$item === void 0 ? process.env.NODE_ENV === 'production' ?
2902
- /* istanbul ignore next */
2903
- undefined : requiredProp('getItemProps', 'item') : _ref7$item,
2904
- rest = _objectWithoutPropertiesLoose(_ref7, _excluded5$1);
2841
+ this.getItemProps = function (_temp7) {
2842
+ let {
2843
+ onMouseMove,
2844
+ onMouseDown,
2845
+ onClick,
2846
+ onPress,
2847
+ index,
2848
+ item = process.env.NODE_ENV === 'production' ?
2849
+ /* istanbul ignore next */
2850
+ undefined : requiredProp('getItemProps', 'item'),
2851
+ ...rest
2852
+ } = _temp7 === void 0 ? {} : _temp7;
2905
2853
 
2906
2854
  if (index === undefined) {
2907
2855
  _this.items.push(item);
@@ -2911,13 +2859,13 @@ var Downshift = /*#__PURE__*/function () {
2911
2859
  _this.items[index] = item;
2912
2860
  }
2913
2861
 
2914
- var onSelectKey = 'onClick';
2915
- var customClickHandler = onClick;
2916
- var enabledEventHandlers = (_enabledEventHandlers = {
2862
+ const onSelectKey = 'onClick';
2863
+ const customClickHandler = onClick;
2864
+ const enabledEventHandlers = {
2917
2865
  // onMouseMove is used over onMouseEnter here. onMouseMove
2918
2866
  // is only triggered on actual mouse movement while onMouseEnter
2919
2867
  // can fire on DOM changes, interrupting keyboard navigation
2920
- onMouseMove: callAllEventHandlers(onMouseMove, function () {
2868
+ onMouseMove: callAllEventHandlers(onMouseMove, () => {
2921
2869
  if (index === _this.getState().highlightedIndex) {
2922
2870
  return;
2923
2871
  }
@@ -2932,72 +2880,81 @@ var Downshift = /*#__PURE__*/function () {
2932
2880
 
2933
2881
  _this.avoidScrolling = true;
2934
2882
 
2935
- _this.internalSetTimeout(function () {
2936
- return _this.avoidScrolling = false;
2937
- }, 250);
2883
+ _this.internalSetTimeout(() => _this.avoidScrolling = false, 250);
2938
2884
  }),
2939
- onMouseDown: callAllEventHandlers(onMouseDown, function (event) {
2885
+ onMouseDown: callAllEventHandlers(onMouseDown, event => {
2940
2886
  // This prevents the activeElement from being changed
2941
2887
  // to the item so it can remain with the current activeElement
2942
2888
  // which is a more common use case.
2943
2889
  event.preventDefault();
2890
+ }),
2891
+ [onSelectKey]: callAllEventHandlers(customClickHandler, () => {
2892
+ _this.selectItemAtIndex(index, {
2893
+ type: clickItem
2894
+ });
2944
2895
  })
2945
- }, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function () {
2946
- _this.selectItemAtIndex(index, {
2947
- type: clickItem
2948
- });
2949
- }), _enabledEventHandlers); // Passing down the onMouseDown handler to prevent redirect
2896
+ }; // Passing down the onMouseDown handler to prevent redirect
2950
2897
  // of the activeElement if clicking on disabled items
2951
2898
 
2952
- var eventHandlers = rest.disabled ? {
2899
+ const eventHandlers = rest.disabled ? {
2953
2900
  onMouseDown: enabledEventHandlers.onMouseDown
2954
2901
  } : enabledEventHandlers;
2955
- return _extends({
2902
+ return {
2956
2903
  id: _this.getItemId(index),
2957
2904
  role: 'option',
2958
- 'aria-selected': _this.getState().highlightedIndex === index
2959
- }, eventHandlers, rest);
2905
+ 'aria-selected': _this.getState().highlightedIndex === index,
2906
+ ...eventHandlers,
2907
+ ...rest
2908
+ };
2960
2909
  };
2961
2910
 
2962
- _this.clearItems = function () {
2963
- _this.items = [];
2911
+ this.clearItems = () => {
2912
+ this.items = [];
2964
2913
  };
2965
2914
 
2966
- _this.reset = function (otherStateToSet, cb) {
2915
+ this.reset = function (otherStateToSet, cb) {
2967
2916
  if (otherStateToSet === void 0) {
2968
2917
  otherStateToSet = {};
2969
2918
  }
2970
2919
 
2971
2920
  otherStateToSet = pickState(otherStateToSet);
2972
2921
 
2973
- _this.internalSetState(function (_ref8) {
2974
- var selectedItem = _ref8.selectedItem;
2975
- return _extends({
2922
+ _this.internalSetState(_ref => {
2923
+ let {
2924
+ selectedItem
2925
+ } = _ref;
2926
+ return {
2976
2927
  isOpen: _this.props.defaultIsOpen,
2977
2928
  highlightedIndex: _this.props.defaultHighlightedIndex,
2978
- inputValue: _this.props.itemToString(selectedItem)
2979
- }, otherStateToSet);
2929
+ inputValue: _this.props.itemToString(selectedItem),
2930
+ ...otherStateToSet
2931
+ };
2980
2932
  }, cb);
2981
2933
  };
2982
2934
 
2983
- _this.toggleMenu = function (otherStateToSet, cb) {
2935
+ this.toggleMenu = function (otherStateToSet, cb) {
2984
2936
  if (otherStateToSet === void 0) {
2985
2937
  otherStateToSet = {};
2986
2938
  }
2987
2939
 
2988
2940
  otherStateToSet = pickState(otherStateToSet);
2989
2941
 
2990
- _this.internalSetState(function (_ref9) {
2991
- var isOpen = _ref9.isOpen;
2992
- return _extends({
2993
- isOpen: !isOpen
2994
- }, isOpen && {
2995
- highlightedIndex: _this.props.defaultHighlightedIndex
2996
- }, otherStateToSet);
2997
- }, function () {
2998
- var _this$getState7 = _this.getState(),
2999
- isOpen = _this$getState7.isOpen,
3000
- highlightedIndex = _this$getState7.highlightedIndex;
2942
+ _this.internalSetState(_ref2 => {
2943
+ let {
2944
+ isOpen
2945
+ } = _ref2;
2946
+ return {
2947
+ isOpen: !isOpen,
2948
+ ...(isOpen && {
2949
+ highlightedIndex: _this.props.defaultHighlightedIndex
2950
+ }),
2951
+ ...otherStateToSet
2952
+ };
2953
+ }, () => {
2954
+ const {
2955
+ isOpen,
2956
+ highlightedIndex
2957
+ } = _this.getState();
3001
2958
 
3002
2959
  if (isOpen) {
3003
2960
  if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {
@@ -3009,70 +2966,63 @@ var Downshift = /*#__PURE__*/function () {
3009
2966
  });
3010
2967
  };
3011
2968
 
3012
- _this.openMenu = function (cb) {
3013
- _this.internalSetState({
2969
+ this.openMenu = cb => {
2970
+ this.internalSetState({
3014
2971
  isOpen: true
3015
2972
  }, cb);
3016
2973
  };
3017
2974
 
3018
- _this.closeMenu = function (cb) {
3019
- _this.internalSetState({
2975
+ this.closeMenu = cb => {
2976
+ this.internalSetState({
3020
2977
  isOpen: false
3021
2978
  }, cb);
3022
2979
  };
3023
2980
 
3024
- _this.updateStatus = debounce(function () {
3025
- var state = _this.getState();
3026
-
3027
- var item = _this.items[state.highlightedIndex];
3028
-
3029
- var resultCount = _this.getItemCount();
3030
-
3031
- var status = _this.props.getA11yStatusMessage(_extends({
3032
- itemToString: _this.props.itemToString,
3033
- previousResultCount: _this.previousResultCount,
3034
- resultCount: resultCount,
3035
- highlightedItem: item
3036
- }, state));
3037
-
3038
- _this.previousResultCount = resultCount;
3039
- setStatus(status, _this.props.environment.document);
2981
+ this.updateStatus = debounce(() => {
2982
+ const state = this.getState();
2983
+ const item = this.items[state.highlightedIndex];
2984
+ const resultCount = this.getItemCount();
2985
+ const status = this.props.getA11yStatusMessage({
2986
+ itemToString: this.props.itemToString,
2987
+ previousResultCount: this.previousResultCount,
2988
+ resultCount,
2989
+ highlightedItem: item,
2990
+ ...state
2991
+ });
2992
+ this.previousResultCount = resultCount;
2993
+ setStatus(status, this.props.environment.document);
3040
2994
  }, 200);
3041
-
3042
- var _this$props = _this.props,
3043
- defaultHighlightedIndex = _this$props.defaultHighlightedIndex,
3044
- _this$props$initialHi = _this$props.initialHighlightedIndex,
3045
- _highlightedIndex = _this$props$initialHi === void 0 ? defaultHighlightedIndex : _this$props$initialHi,
3046
- defaultIsOpen = _this$props.defaultIsOpen,
3047
- _this$props$initialIs = _this$props.initialIsOpen,
3048
- _isOpen = _this$props$initialIs === void 0 ? defaultIsOpen : _this$props$initialIs,
3049
- _this$props$initialIn = _this$props.initialInputValue,
3050
- _inputValue = _this$props$initialIn === void 0 ? '' : _this$props$initialIn,
3051
- _this$props$initialSe = _this$props.initialSelectedItem,
3052
- _selectedItem = _this$props$initialSe === void 0 ? null : _this$props$initialSe;
3053
-
3054
- var _state = _this.getState({
2995
+ // fancy destructuring + defaults + aliases
2996
+ // this basically says each value of state should either be set to
2997
+ // the initial value or the default value if the initial value is not provided
2998
+ const {
2999
+ defaultHighlightedIndex,
3000
+ initialHighlightedIndex: _highlightedIndex = defaultHighlightedIndex,
3001
+ defaultIsOpen,
3002
+ initialIsOpen: _isOpen = defaultIsOpen,
3003
+ initialInputValue: _inputValue = '',
3004
+ initialSelectedItem: _selectedItem = null
3005
+ } = this.props;
3006
+
3007
+ const _state = this.getState({
3055
3008
  highlightedIndex: _highlightedIndex,
3056
3009
  isOpen: _isOpen,
3057
3010
  inputValue: _inputValue,
3058
3011
  selectedItem: _selectedItem
3059
3012
  });
3060
3013
 
3061
- if (_state.selectedItem != null && _this.props.initialInputValue === undefined) {
3062
- _state.inputValue = _this.props.itemToString(_state.selectedItem);
3014
+ if (_state.selectedItem != null && this.props.initialInputValue === undefined) {
3015
+ _state.inputValue = this.props.itemToString(_state.selectedItem);
3063
3016
  }
3064
3017
 
3065
- _this.state = _state;
3066
- return _this;
3018
+ this.state = _state;
3067
3019
  }
3068
3020
 
3069
- var _proto = Downshift.prototype;
3070
-
3071
3021
  /**
3072
3022
  * Clear all running timeouts
3073
3023
  */
3074
- _proto.internalClearTimeouts = function internalClearTimeouts() {
3075
- this.timeoutIds.forEach(function (id) {
3024
+ internalClearTimeouts() {
3025
+ this.timeoutIds.forEach(id => {
3076
3026
  clearTimeout(id);
3077
3027
  });
3078
3028
  this.timeoutIds = [];
@@ -3086,22 +3036,22 @@ var Downshift = /*#__PURE__*/function () {
3086
3036
  * @param {Object} stateToMerge defaults to this.state
3087
3037
  * @return {Object} the state
3088
3038
  */
3089
- ;
3090
3039
 
3091
- _proto.getState = function getState$1(stateToMerge) {
3040
+
3041
+ getState(stateToMerge) {
3092
3042
  if (stateToMerge === void 0) {
3093
3043
  stateToMerge = this.state;
3094
3044
  }
3095
3045
 
3096
3046
  return getState(stateToMerge, this.props);
3097
- };
3047
+ }
3098
3048
 
3099
- _proto.getItemCount = function getItemCount() {
3049
+ getItemCount() {
3100
3050
  // things read better this way. They're in priority order:
3101
3051
  // 1. `this.itemCount`
3102
3052
  // 2. `this.props.itemCount`
3103
3053
  // 3. `this.items.length`
3104
- var itemCount = this.items.length;
3054
+ let itemCount = this.items.length;
3105
3055
 
3106
3056
  if (this.itemCount != null) {
3107
3057
  itemCount = this.itemCount;
@@ -3110,102 +3060,102 @@ var Downshift = /*#__PURE__*/function () {
3110
3060
  }
3111
3061
 
3112
3062
  return itemCount;
3113
- };
3063
+ }
3114
3064
 
3115
- _proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {
3065
+ getItemNodeFromIndex(index) {
3116
3066
  return this.props.environment.document.getElementById(this.getItemId(index));
3117
- };
3067
+ }
3118
3068
 
3119
- _proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {
3069
+ scrollHighlightedItemIntoView() {
3120
3070
  /* istanbul ignore else (react-native) */
3121
3071
  {
3122
- var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
3072
+ const node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
3123
3073
  this.props.scrollIntoView(node, this._menuNode);
3124
3074
  }
3125
- };
3126
-
3127
- _proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {
3128
- var _this6 = this;
3129
-
3130
- var itemCount = this.getItemCount();
3075
+ }
3131
3076
 
3132
- var _this$getState8 = this.getState(),
3133
- highlightedIndex = _this$getState8.highlightedIndex;
3077
+ moveHighlightedIndex(amount, otherStateToSet) {
3078
+ const itemCount = this.getItemCount();
3079
+ const {
3080
+ highlightedIndex
3081
+ } = this.getState();
3134
3082
 
3135
3083
  if (itemCount > 0) {
3136
- var nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, function (index) {
3137
- return _this6.getItemNodeFromIndex(index);
3138
- });
3084
+ const nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
3139
3085
  this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);
3140
3086
  }
3141
- };
3087
+ }
3142
3088
 
3143
- _proto.getStateAndHelpers = function getStateAndHelpers() {
3144
- var _this$getState9 = this.getState(),
3145
- highlightedIndex = _this$getState9.highlightedIndex,
3146
- inputValue = _this$getState9.inputValue,
3147
- selectedItem = _this$getState9.selectedItem,
3148
- isOpen = _this$getState9.isOpen;
3149
-
3150
- var itemToString = this.props.itemToString;
3151
- var id = this.id;
3152
- var getRootProps = this.getRootProps,
3153
- getToggleButtonProps = this.getToggleButtonProps,
3154
- getLabelProps = this.getLabelProps,
3155
- getMenuProps = this.getMenuProps,
3156
- getInputProps = this.getInputProps,
3157
- getItemProps = this.getItemProps,
3158
- openMenu = this.openMenu,
3159
- closeMenu = this.closeMenu,
3160
- toggleMenu = this.toggleMenu,
3161
- selectItem = this.selectItem,
3162
- selectItemAtIndex = this.selectItemAtIndex,
3163
- selectHighlightedItem = this.selectHighlightedItem,
3164
- setHighlightedIndex = this.setHighlightedIndex,
3165
- clearSelection = this.clearSelection,
3166
- clearItems = this.clearItems,
3167
- reset = this.reset,
3168
- setItemCount = this.setItemCount,
3169
- unsetItemCount = this.unsetItemCount,
3170
- setState = this.internalSetState;
3089
+ getStateAndHelpers() {
3090
+ const {
3091
+ highlightedIndex,
3092
+ inputValue,
3093
+ selectedItem,
3094
+ isOpen
3095
+ } = this.getState();
3096
+ const {
3097
+ itemToString
3098
+ } = this.props;
3099
+ const {
3100
+ id
3101
+ } = this;
3102
+ const {
3103
+ getRootProps,
3104
+ getToggleButtonProps,
3105
+ getLabelProps,
3106
+ getMenuProps,
3107
+ getInputProps,
3108
+ getItemProps,
3109
+ openMenu,
3110
+ closeMenu,
3111
+ toggleMenu,
3112
+ selectItem,
3113
+ selectItemAtIndex,
3114
+ selectHighlightedItem,
3115
+ setHighlightedIndex,
3116
+ clearSelection,
3117
+ clearItems,
3118
+ reset,
3119
+ setItemCount,
3120
+ unsetItemCount,
3121
+ internalSetState: setState
3122
+ } = this;
3171
3123
  return {
3172
3124
  // prop getters
3173
- getRootProps: getRootProps,
3174
- getToggleButtonProps: getToggleButtonProps,
3175
- getLabelProps: getLabelProps,
3176
- getMenuProps: getMenuProps,
3177
- getInputProps: getInputProps,
3178
- getItemProps: getItemProps,
3125
+ getRootProps,
3126
+ getToggleButtonProps,
3127
+ getLabelProps,
3128
+ getMenuProps,
3129
+ getInputProps,
3130
+ getItemProps,
3179
3131
  // actions
3180
- reset: reset,
3181
- openMenu: openMenu,
3182
- closeMenu: closeMenu,
3183
- toggleMenu: toggleMenu,
3184
- selectItem: selectItem,
3185
- selectItemAtIndex: selectItemAtIndex,
3186
- selectHighlightedItem: selectHighlightedItem,
3187
- setHighlightedIndex: setHighlightedIndex,
3188
- clearSelection: clearSelection,
3189
- clearItems: clearItems,
3190
- setItemCount: setItemCount,
3191
- unsetItemCount: unsetItemCount,
3192
- setState: setState,
3132
+ reset,
3133
+ openMenu,
3134
+ closeMenu,
3135
+ toggleMenu,
3136
+ selectItem,
3137
+ selectItemAtIndex,
3138
+ selectHighlightedItem,
3139
+ setHighlightedIndex,
3140
+ clearSelection,
3141
+ clearItems,
3142
+ setItemCount,
3143
+ unsetItemCount,
3144
+ setState,
3193
3145
  // props
3194
- itemToString: itemToString,
3146
+ itemToString,
3195
3147
  // derived
3196
- id: id,
3148
+ id,
3197
3149
  // state
3198
- highlightedIndex: highlightedIndex,
3199
- inputValue: inputValue,
3200
- isOpen: isOpen,
3201
- selectedItem: selectedItem
3150
+ highlightedIndex,
3151
+ inputValue,
3152
+ isOpen,
3153
+ selectedItem
3202
3154
  };
3203
3155
  } //////////////////////////// ROOT
3204
- ;
3205
3156
 
3206
- _proto.componentDidMount = function componentDidMount() {
3207
- var _this7 = this;
3208
3157
 
3158
+ componentDidMount() {
3209
3159
  /* istanbul ignore if (react-native) */
3210
3160
  if (process.env.NODE_ENV !== 'production' && !false && this.getMenuProps.called && !this.getMenuProps.suppressRefError) {
3211
3161
  validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps);
@@ -3219,22 +3169,20 @@ var Downshift = /*#__PURE__*/function () {
3219
3169
  // down long enough for the list to disappear (because the blur event fires on the input)
3220
3170
  // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should
3221
3171
  // trigger hiding the menu.
3222
- var onMouseDown = function onMouseDown() {
3223
- _this7.isMouseDown = true;
3172
+ const onMouseDown = () => {
3173
+ this.isMouseDown = true;
3224
3174
  };
3225
3175
 
3226
- var onMouseUp = function onMouseUp(event) {
3227
- _this7.isMouseDown = false; // if the target element or the activeElement is within a downshift node
3176
+ const onMouseUp = event => {
3177
+ this.isMouseDown = false; // if the target element or the activeElement is within a downshift node
3228
3178
  // then we don't want to reset downshift
3229
3179
 
3230
- var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment);
3180
+ const contextWithinDownshift = targetWithinDownshift(event.target, [this._rootNode, this._menuNode], this.props.environment);
3231
3181
 
3232
- if (!contextWithinDownshift && _this7.getState().isOpen) {
3233
- _this7.reset({
3182
+ if (!contextWithinDownshift && this.getState().isOpen) {
3183
+ this.reset({
3234
3184
  type: mouseUp
3235
- }, function () {
3236
- return _this7.props.onOuterClick(_this7.getStateAndHelpers());
3237
- });
3185
+ }, () => this.props.onOuterClick(this.getStateAndHelpers()));
3238
3186
  }
3239
3187
  }; // Touching an element in iOS gives focus and hover states, but touching out of
3240
3188
  // the element will remove hover, and persist the focus state, resulting in the
@@ -3244,38 +3192,36 @@ var Downshift = /*#__PURE__*/function () {
3244
3192
  // but not if the user is swiping
3245
3193
 
3246
3194
 
3247
- var onTouchStart = function onTouchStart() {
3248
- _this7.isTouchMove = false;
3195
+ const onTouchStart = () => {
3196
+ this.isTouchMove = false;
3249
3197
  };
3250
3198
 
3251
- var onTouchMove = function onTouchMove() {
3252
- _this7.isTouchMove = true;
3199
+ const onTouchMove = () => {
3200
+ this.isTouchMove = true;
3253
3201
  };
3254
3202
 
3255
- var onTouchEnd = function onTouchEnd(event) {
3256
- var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment, false);
3203
+ const onTouchEnd = event => {
3204
+ const contextWithinDownshift = targetWithinDownshift(event.target, [this._rootNode, this._menuNode], this.props.environment, false);
3257
3205
 
3258
- if (!_this7.isTouchMove && !contextWithinDownshift && _this7.getState().isOpen) {
3259
- _this7.reset({
3206
+ if (!this.isTouchMove && !contextWithinDownshift && this.getState().isOpen) {
3207
+ this.reset({
3260
3208
  type: touchEnd
3261
- }, function () {
3262
- return _this7.props.onOuterClick(_this7.getStateAndHelpers());
3263
- });
3209
+ }, () => this.props.onOuterClick(this.getStateAndHelpers()));
3264
3210
  }
3265
3211
  };
3266
3212
 
3267
- var environment = this.props.environment;
3213
+ const {
3214
+ environment
3215
+ } = this.props;
3268
3216
  environment.addEventListener('mousedown', onMouseDown);
3269
3217
  environment.addEventListener('mouseup', onMouseUp);
3270
3218
  environment.addEventListener('touchstart', onTouchStart);
3271
3219
  environment.addEventListener('touchmove', onTouchMove);
3272
3220
  environment.addEventListener('touchend', onTouchEnd);
3273
3221
 
3274
- this.cleanup = function () {
3275
- _this7.internalClearTimeouts();
3276
-
3277
- _this7.updateStatus.cancel();
3278
-
3222
+ this.cleanup = () => {
3223
+ this.internalClearTimeouts();
3224
+ this.updateStatus.cancel();
3279
3225
  environment.removeEventListener('mousedown', onMouseDown);
3280
3226
  environment.removeEventListener('mouseup', onMouseUp);
3281
3227
  environment.removeEventListener('touchstart', onTouchStart);
@@ -3283,21 +3229,21 @@ var Downshift = /*#__PURE__*/function () {
3283
3229
  environment.removeEventListener('touchend', onTouchEnd);
3284
3230
  };
3285
3231
  }
3286
- };
3287
-
3288
- _proto.shouldScroll = function shouldScroll(prevState, prevProps) {
3289
- var _ref10 = this.props.highlightedIndex === undefined ? this.getState() : this.props,
3290
- currentHighlightedIndex = _ref10.highlightedIndex;
3291
-
3292
- var _ref11 = prevProps.highlightedIndex === undefined ? prevState : prevProps,
3293
- prevHighlightedIndex = _ref11.highlightedIndex;
3232
+ }
3294
3233
 
3295
- var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
3296
- var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
3234
+ shouldScroll(prevState, prevProps) {
3235
+ const {
3236
+ highlightedIndex: currentHighlightedIndex
3237
+ } = this.props.highlightedIndex === undefined ? this.getState() : this.props;
3238
+ const {
3239
+ highlightedIndex: prevHighlightedIndex
3240
+ } = prevProps.highlightedIndex === undefined ? prevState : prevProps;
3241
+ const scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
3242
+ const scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
3297
3243
  return scrollWhenOpen || scrollWhenNavigating;
3298
- };
3244
+ }
3299
3245
 
3300
- _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
3246
+ componentDidUpdate(prevProps, prevState) {
3301
3247
  if (process.env.NODE_ENV !== 'production') {
3302
3248
  validateControlledUnchanged(this.state, prevProps, this.props);
3303
3249
  /* istanbul ignore if (react-native) */
@@ -3323,14 +3269,14 @@ var Downshift = /*#__PURE__*/function () {
3323
3269
  {
3324
3270
  this.updateStatus();
3325
3271
  }
3326
- };
3272
+ }
3327
3273
 
3328
- _proto.componentWillUnmount = function componentWillUnmount() {
3274
+ componentWillUnmount() {
3329
3275
  this.cleanup(); // avoids memory leak
3330
- };
3276
+ }
3331
3277
 
3332
- _proto.render = function render() {
3333
- var children = unwrapArray(this.props.children, noop); // because the items are rerendered every time we call the children
3278
+ render() {
3279
+ const children = unwrapArray(this.props.children, noop); // because the items are rerendered every time we call the children
3334
3280
  // we clear this out each render and it will be populated again as
3335
3281
  // getItemProps is called.
3336
3282
 
@@ -3350,7 +3296,7 @@ var Downshift = /*#__PURE__*/function () {
3350
3296
  this.getLabelProps.called = false; // and something similar for getInputProps
3351
3297
 
3352
3298
  this.getInputProps.called = false;
3353
- var element = unwrapArray(children(this.getStateAndHelpers()));
3299
+ const element = unwrapArray(children(this.getStateAndHelpers()));
3354
3300
 
3355
3301
  if (!element) {
3356
3302
  return null;
@@ -3379,16 +3325,15 @@ var Downshift = /*#__PURE__*/function () {
3379
3325
 
3380
3326
 
3381
3327
  return undefined;
3382
- };
3328
+ }
3383
3329
 
3384
- return Downshift;
3385
- }(Component);
3330
+ }
3386
3331
 
3387
3332
  Downshift.defaultProps = {
3388
3333
  defaultHighlightedIndex: null,
3389
3334
  defaultIsOpen: false,
3390
3335
  getA11yStatusMessage: getA11yStatusMessage$1,
3391
- itemToString: function itemToString(i) {
3336
+ itemToString: i => {
3392
3337
  if (i == null) {
3393
3338
  return '';
3394
3339
  }
@@ -3406,21 +3351,17 @@ var Downshift = /*#__PURE__*/function () {
3406
3351
  onChange: noop,
3407
3352
  onSelect: noop,
3408
3353
  onOuterClick: noop,
3409
- selectedItemChanged: function selectedItemChanged(prevItem, item) {
3410
- return prevItem !== item;
3411
- },
3354
+ selectedItemChanged: (prevItem, item) => prevItem !== item,
3412
3355
  environment:
3413
3356
  /* istanbul ignore next (ssr) */
3414
3357
  typeof window === 'undefined' ? {} : window,
3415
- stateReducer: function stateReducer(state, stateToSet) {
3416
- return stateToSet;
3417
- },
3358
+ stateReducer: (state, stateToSet) => stateToSet,
3418
3359
  suppressRefError: false,
3419
- scrollIntoView: scrollIntoView
3360
+ scrollIntoView
3420
3361
  };
3421
3362
  Downshift.stateChangeTypes = stateChangeTypes$3;
3422
3363
  return Downshift;
3423
- }();
3364
+ })();
3424
3365
 
3425
3366
  process.env.NODE_ENV !== "production" ? Downshift.propTypes = {
3426
3367
  children: propTypes.exports.func,
@@ -3470,31 +3411,35 @@ process.env.NODE_ENV !== "production" ? Downshift.propTypes = {
3470
3411
  } : void 0;
3471
3412
  var Downshift$1 = Downshift;
3472
3413
 
3473
- function validateGetMenuPropsCalledCorrectly(node, _ref12) {
3474
- var refKey = _ref12.refKey;
3414
+ function validateGetMenuPropsCalledCorrectly(node, _ref3) {
3415
+ let {
3416
+ refKey
3417
+ } = _ref3;
3475
3418
 
3476
3419
  if (!node) {
3477
3420
  // eslint-disable-next-line no-console
3478
- console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
3421
+ console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
3479
3422
  }
3480
3423
  }
3481
3424
 
3482
- function validateGetRootPropsCalledCorrectly(element, _ref13) {
3483
- var refKey = _ref13.refKey;
3484
- var refKeySpecified = refKey !== 'ref';
3485
- var isComposite = !isDOMElement(element);
3425
+ function validateGetRootPropsCalledCorrectly(element, _ref4) {
3426
+ let {
3427
+ refKey
3428
+ } = _ref4;
3429
+ const refKeySpecified = refKey !== 'ref';
3430
+ const isComposite = !isDOMElement(element);
3486
3431
 
3487
3432
  if (isComposite && !refKeySpecified && !reactIs.exports.isForwardRef(element)) {
3488
3433
  // eslint-disable-next-line no-console
3489
3434
  console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
3490
3435
  } else if (!isComposite && refKeySpecified) {
3491
3436
  // eslint-disable-next-line no-console
3492
- console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"" + refKey + "\"");
3437
+ console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
3493
3438
  }
3494
3439
 
3495
3440
  if (!reactIs.exports.isForwardRef(element) && !getElementProps(element)[refKey]) {
3496
3441
  // eslint-disable-next-line no-console
3497
- console.error("downshift: You must apply the ref prop \"" + refKey + "\" from getRootProps onto your root element.");
3442
+ console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
3498
3443
  }
3499
3444
  }
3500
3445
  /**
@@ -3518,16 +3463,18 @@ function stateReducer(s, a) {
3518
3463
 
3519
3464
 
3520
3465
  function getA11ySelectionMessage(selectionParameters) {
3521
- var selectedItem = selectionParameters.selectedItem,
3522
- itemToStringLocal = selectionParameters.itemToString;
3523
- return selectedItem ? itemToStringLocal(selectedItem) + " has been selected." : '';
3466
+ const {
3467
+ selectedItem,
3468
+ itemToString: itemToStringLocal
3469
+ } = selectionParameters;
3470
+ return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
3524
3471
  }
3525
3472
  /**
3526
3473
  * Debounced call for updating the a11y message.
3527
3474
  */
3528
3475
 
3529
3476
 
3530
- debounce(function (getA11yMessage, document) {
3477
+ debounce((getA11yMessage, document) => {
3531
3478
  setStatus(getA11yMessage(), document);
3532
3479
  }, 200); // istanbul ignore next
3533
3480
 
@@ -3535,11 +3482,11 @@ function itemToString(item) {
3535
3482
  return item ? String(item) : '';
3536
3483
  }
3537
3484
 
3538
- var defaultProps$3 = {
3539
- itemToString: itemToString,
3540
- stateReducer: stateReducer,
3541
- getA11ySelectionMessage: getA11ySelectionMessage,
3542
- scrollIntoView: scrollIntoView,
3485
+ const defaultProps$3 = {
3486
+ itemToString,
3487
+ stateReducer,
3488
+ getA11ySelectionMessage,
3489
+ scrollIntoView,
3543
3490
  circularNavigation: false,
3544
3491
  environment:
3545
3492
  /* istanbul ignore next (ssr) */
@@ -3611,7 +3558,7 @@ function getA11yStatusMessage(_a) {
3611
3558
  return 'No results are available.';
3612
3559
  }
3613
3560
  if (resultCount !== previousResultCount) {
3614
- return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.";
3561
+ return "".concat(resultCount, " result").concat(resultCount === 1 ? ' is' : 's are', " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.");
3615
3562
  }
3616
3563
  return '';
3617
3564
  }
@@ -3708,7 +3655,7 @@ process.env.NODE_ENV !== "production" ? '__controlled_prop_updated_selected_item
3708
3655
 
3709
3656
  if (process.env.NODE_ENV !== 'production') ;
3710
3657
 
3711
- _extends({}, defaultProps$3, {
3658
+ ({ ...defaultProps$3,
3712
3659
  getA11yStatusMessage: getA11yStatusMessage$1,
3713
3660
  circularNavigation: true
3714
3661
  });
@@ -3721,9 +3668,11 @@ _extends({}, defaultProps$3, {
3721
3668
 
3722
3669
 
3723
3670
  function getA11yRemovalMessage(selectionParameters) {
3724
- var removedSelectedItem = selectionParameters.removedSelectedItem,
3725
- itemToStringLocal = selectionParameters.itemToString;
3726
- return itemToStringLocal(removedSelectedItem) + " has been removed.";
3671
+ const {
3672
+ removedSelectedItem,
3673
+ itemToString: itemToStringLocal
3674
+ } = selectionParameters;
3675
+ return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
3727
3676
  }
3728
3677
 
3729
3678
  ({
@@ -3754,7 +3703,7 @@ function getA11yRemovalMessage(selectionParameters) {
3754
3703
  itemToString: defaultProps$3.itemToString,
3755
3704
  stateReducer: defaultProps$3.stateReducer,
3756
3705
  environment: defaultProps$3.environment,
3757
- getA11yRemovalMessage: getA11yRemovalMessage,
3706
+ getA11yRemovalMessage,
3758
3707
  keyNavigationNext: 'ArrowRight',
3759
3708
  keyNavigationPrevious: 'ArrowLeft'
3760
3709
  }); // eslint-disable-next-line import/no-mutable-exports
@@ -6750,7 +6699,7 @@ const PromotedLink$1 = styled.a`
6750
6699
  0px 4px 15px rgba(0, 0, 0, 0.11);
6751
6700
 
6752
6701
  padding: 20px 15px;
6753
- width: calc(100% - 30px);
6702
+ width: 100%;
6754
6703
  margin-bottom: 15px;
6755
6704
 
6756
6705
  span {
@@ -17252,7 +17201,7 @@ let Declaration$3 = declaration;
17252
17201
  let Comment$3 = comment;
17253
17202
  let Node$1 = node_1;
17254
17203
 
17255
- let parse$4, Rule$4, AtRule$4;
17204
+ let parse$4, Rule$4, AtRule$4, Root$6;
17256
17205
 
17257
17206
  function cleanSource(nodes) {
17258
17207
  return nodes.map(i => {
@@ -17654,6 +17603,10 @@ Container$K.registerAtRule = dependant => {
17654
17603
  AtRule$4 = dependant;
17655
17604
  };
17656
17605
 
17606
+ Container$K.registerRoot = dependant => {
17607
+ Root$6 = dependant;
17608
+ };
17609
+
17657
17610
  var container = Container$K;
17658
17611
  Container$K.default = Container$K;
17659
17612
 
@@ -17667,6 +17620,8 @@ Container$K.rebuild = node => {
17667
17620
  Object.setPrototypeOf(node, Declaration$3.prototype);
17668
17621
  } else if (node.type === 'comment') {
17669
17622
  Object.setPrototypeOf(node, Comment$3.prototype);
17623
+ } else if (node.type === 'root') {
17624
+ Object.setPrototypeOf(node, Root$6.prototype);
17670
17625
  }
17671
17626
 
17672
17627
  node[my$1] = true;
@@ -17882,6 +17837,8 @@ Root$5.registerProcessor = dependant => {
17882
17837
  var root = Root$5;
17883
17838
  Root$5.default = Root$5;
17884
17839
 
17840
+ Container$H.registerRoot(Root$5);
17841
+
17885
17842
  let list$2 = {
17886
17843
  split(string, separators, last) {
17887
17844
  let array = [];
@@ -17889,7 +17846,8 @@ let list$2 = {
17889
17846
  let split = false;
17890
17847
 
17891
17848
  let func = 0;
17892
- let quote = false;
17849
+ let inQuote = false;
17850
+ let prevQuote = '';
17893
17851
  let escape = false;
17894
17852
 
17895
17853
  for (let letter of string) {
@@ -17897,12 +17855,13 @@ let list$2 = {
17897
17855
  escape = false;
17898
17856
  } else if (letter === '\\') {
17899
17857
  escape = true;
17900
- } else if (quote) {
17901
- if (letter === quote) {
17902
- quote = false;
17858
+ } else if (inQuote) {
17859
+ if (letter === prevQuote) {
17860
+ inQuote = false;
17903
17861
  }
17904
17862
  } else if (letter === '"' || letter === "'") {
17905
- quote = letter;
17863
+ inQuote = true;
17864
+ prevQuote = letter;
17906
17865
  } else if (letter === '(') {
17907
17866
  func += 1;
17908
17867
  } else if (letter === ')') {
@@ -19296,7 +19255,7 @@ let Root$2 = root;
19296
19255
 
19297
19256
  class Processor$1 {
19298
19257
  constructor(plugins = []) {
19299
- this.version = '8.4.14';
19258
+ this.version = '8.4.16';
19300
19259
  this.plugins = this.normalize(plugins);
19301
19260
  }
19302
19261
 
@@ -20031,6 +19990,14 @@ function sanitizeHtml(html, options, _recursing) {
20031
19990
  // Do not crash on bad markup
20032
19991
  return;
20033
19992
  }
19993
+
19994
+ if (frame.tag !== name) {
19995
+ // Another case of bad markup.
19996
+ // Push to stack, so that it will be used in future closing tags.
19997
+ stack.push(frame);
19998
+ return;
19999
+ }
20000
+
20034
20001
  skipText = options.enforceHtmlBoundary ? name === 'html' : false;
20035
20002
  depth--;
20036
20003
  const skip = skipMap[depth];
@@ -28730,6 +28697,11 @@ function requireFollowRedirects () {
28730
28697
  };
28731
28698
  });
28732
28699
 
28700
+ var InvalidUrlError = createErrorType(
28701
+ "ERR_INVALID_URL",
28702
+ "Invalid URL",
28703
+ TypeError
28704
+ );
28733
28705
  // Error types with codes
28734
28706
  var RedirectionError = createErrorType(
28735
28707
  "ERR_FR_REDIRECTION_FAILURE",
@@ -28790,10 +28762,10 @@ function requireFollowRedirects () {
28790
28762
  }
28791
28763
 
28792
28764
  // Validate input and shift parameters if necessary
28793
- if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) {
28765
+ if (!isString(data) && !isBuffer(data)) {
28794
28766
  throw new TypeError("data should be a string, Buffer or Uint8Array");
28795
28767
  }
28796
- if (typeof encoding === "function") {
28768
+ if (isFunction(encoding)) {
28797
28769
  callback = encoding;
28798
28770
  encoding = null;
28799
28771
  }
@@ -28822,11 +28794,11 @@ function requireFollowRedirects () {
28822
28794
  // Ends the current native request
28823
28795
  RedirectableRequest.prototype.end = function (data, encoding, callback) {
28824
28796
  // Shift parameters if necessary
28825
- if (typeof data === "function") {
28797
+ if (isFunction(data)) {
28826
28798
  callback = data;
28827
28799
  data = encoding = null;
28828
28800
  }
28829
- else if (typeof encoding === "function") {
28801
+ else if (isFunction(encoding)) {
28830
28802
  callback = encoding;
28831
28803
  encoding = null;
28832
28804
  }
@@ -29003,7 +28975,7 @@ function requireFollowRedirects () {
29003
28975
  url.format(this._options) :
29004
28976
  // When making a request to a proxy, […]
29005
28977
  // a client MUST send the target URI in absolute-form […].
29006
- this._currentUrl = this._options.path;
28978
+ this._options.path;
29007
28979
 
29008
28980
  // End a redirected request
29009
28981
  // (The first request must be ended explicitly with RedirectableRequest#end)
@@ -29124,7 +29096,7 @@ function requireFollowRedirects () {
29124
29096
  redirectUrl = url.resolve(currentUrl, location);
29125
29097
  }
29126
29098
  catch (cause) {
29127
- this.emit("error", new RedirectionError(cause));
29099
+ this.emit("error", new RedirectionError({ cause: cause }));
29128
29100
  return;
29129
29101
  }
29130
29102
 
@@ -29144,7 +29116,7 @@ function requireFollowRedirects () {
29144
29116
  }
29145
29117
 
29146
29118
  // Evaluate the beforeRedirect callback
29147
- if (typeof beforeRedirect === "function") {
29119
+ if (isFunction(beforeRedirect)) {
29148
29120
  var responseDetails = {
29149
29121
  headers: response.headers,
29150
29122
  statusCode: statusCode,
@@ -29169,7 +29141,7 @@ function requireFollowRedirects () {
29169
29141
  this._performRequest();
29170
29142
  }
29171
29143
  catch (cause) {
29172
- this.emit("error", new RedirectionError(cause));
29144
+ this.emit("error", new RedirectionError({ cause: cause }));
29173
29145
  }
29174
29146
  };
29175
29147
 
@@ -29191,15 +29163,19 @@ function requireFollowRedirects () {
29191
29163
  // Executes a request, following redirects
29192
29164
  function request(input, options, callback) {
29193
29165
  // Parse parameters
29194
- if (typeof input === "string") {
29195
- var urlStr = input;
29166
+ if (isString(input)) {
29167
+ var parsed;
29196
29168
  try {
29197
- input = urlToOptions(new URL(urlStr));
29169
+ parsed = urlToOptions(new URL(input));
29198
29170
  }
29199
29171
  catch (err) {
29200
29172
  /* istanbul ignore next */
29201
- input = url.parse(urlStr);
29173
+ parsed = url.parse(input);
29202
29174
  }
29175
+ if (!isString(parsed.protocol)) {
29176
+ throw new InvalidUrlError({ input });
29177
+ }
29178
+ input = parsed;
29203
29179
  }
29204
29180
  else if (URL && (input instanceof URL)) {
29205
29181
  input = urlToOptions(input);
@@ -29209,7 +29185,7 @@ function requireFollowRedirects () {
29209
29185
  options = input;
29210
29186
  input = { protocol: protocol };
29211
29187
  }
29212
- if (typeof options === "function") {
29188
+ if (isFunction(options)) {
29213
29189
  callback = options;
29214
29190
  options = null;
29215
29191
  }
@@ -29220,6 +29196,9 @@ function requireFollowRedirects () {
29220
29196
  maxBodyLength: exports.maxBodyLength,
29221
29197
  }, input, options);
29222
29198
  options.nativeProtocols = nativeProtocols;
29199
+ if (!isString(options.host) && !isString(options.hostname)) {
29200
+ options.hostname = "::1";
29201
+ }
29223
29202
 
29224
29203
  assert.equal(options.protocol, protocol, "protocol mismatch");
29225
29204
  debug("options", options);
@@ -29277,21 +29256,19 @@ function requireFollowRedirects () {
29277
29256
  undefined : String(lastValue).trim();
29278
29257
  }
29279
29258
 
29280
- function createErrorType(code, defaultMessage) {
29281
- function CustomError(cause) {
29259
+ function createErrorType(code, message, baseClass) {
29260
+ // Create constructor
29261
+ function CustomError(properties) {
29282
29262
  Error.captureStackTrace(this, this.constructor);
29283
- if (!cause) {
29284
- this.message = defaultMessage;
29285
- }
29286
- else {
29287
- this.message = defaultMessage + ": " + cause.message;
29288
- this.cause = cause;
29289
- }
29263
+ Object.assign(this, properties || {});
29264
+ this.code = code;
29265
+ this.message = this.cause ? message + ": " + this.cause.message : message;
29290
29266
  }
29291
- CustomError.prototype = new Error();
29267
+
29268
+ // Attach constructor and set default properties
29269
+ CustomError.prototype = new (baseClass || Error)();
29292
29270
  CustomError.prototype.constructor = CustomError;
29293
29271
  CustomError.prototype.name = "Error [" + code + "]";
29294
- CustomError.prototype.code = code;
29295
29272
  return CustomError;
29296
29273
  }
29297
29274
 
@@ -29304,10 +29281,23 @@ function requireFollowRedirects () {
29304
29281
  }
29305
29282
 
29306
29283
  function isSubdomain(subdomain, domain) {
29307
- const dot = subdomain.length - domain.length - 1;
29284
+ assert(isString(subdomain) && isString(domain));
29285
+ var dot = subdomain.length - domain.length - 1;
29308
29286
  return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
29309
29287
  }
29310
29288
 
29289
+ function isString(value) {
29290
+ return typeof value === "string" || value instanceof String;
29291
+ }
29292
+
29293
+ function isFunction(value) {
29294
+ return typeof value === "function";
29295
+ }
29296
+
29297
+ function isBuffer(value) {
29298
+ return typeof value === "object" && ("length" in value);
29299
+ }
29300
+
29311
29301
  // Exports
29312
29302
  followRedirects.exports = wrap({ http: http, https: https });
29313
29303
  followRedirects.exports.wrap = wrap;
@@ -32838,7 +32828,7 @@ const north_vars = {
32838
32828
  twitter_link: 'https://twitter.com/NNorthantsC',
32839
32829
  linkedin_link: 'https://www.linkedin.com/company/north-northamptonshire-council',
32840
32830
  facebook_link: 'https://www.facebook.com/NorthNorthants',
32841
- instagram_link: 'https://www.instagram.com/northnorthantscouncil',
32831
+ instagram_link: 'https://www.instagram.com/northnorthantscouncil/',
32842
32832
  youtube_link: 'https://www.youtube.com/channel/UCnng5JhKCm4lUbvuzZM07sA',
32843
32833
 
32844
32834
  breakpointsVals: {
@@ -32952,7 +32942,7 @@ const west_vars = {
32952
32942
  twitter_link: 'https://twitter.com/WestNorthants',
32953
32943
  linkedin_link: 'https://www.linkedin.com/company/west-northamptonshire-council',
32954
32944
  facebook_link: 'https://www.facebook.com/WestNorthants',
32955
- instagram_link: 'https://www.instagram.com/westnorthants',
32945
+ instagram_link: 'https://www.instagram.com/westnorthants/',
32956
32946
  youtube_link: 'https://www.youtube.com/channel/UCDyc2cNcl19OvcGOCuZDTBQ',
32957
32947
 
32958
32948
  breakpointsVals: {
@@ -33066,7 +33056,7 @@ const lb_vars_north = {
33066
33056
  twitter_link: 'https://twitter.com/NNorthantsC',
33067
33057
  linkedin_link: 'https://www.linkedin.com/company/north-northamptonshire-council',
33068
33058
  facebook_link: 'https://www.facebook.com/NorthNorthants',
33069
- instagram_link: 'https://www.instagram.com/northnorthantscouncil',
33059
+ instagram_link: 'https://www.instagram.com/northnorthantscouncil/',
33070
33060
  youtube_link: 'https://www.youtube.com/channel/UCnng5JhKCm4lUbvuzZM07sA',
33071
33061
 
33072
33062
  breakpointsVals: {
@@ -33179,7 +33169,7 @@ const lb_vars_west = {
33179
33169
  twitter_link: 'https://twitter.com/WestNorthants',
33180
33170
  linkedin_link: 'https://www.linkedin.com/company/west-northamptonshire-council',
33181
33171
  facebook_link: 'https://www.facebook.com/WestNorthants',
33182
- instagram_link: 'https://www.instagram.com/westnorthants',
33172
+ instagram_link: 'https://www.instagram.com/westnorthants/',
33183
33173
  youtube_link: 'https://www.youtube.com/channel/UCDyc2cNcl19OvcGOCuZDTBQ',
33184
33174
 
33185
33175
  breakpointsVals: {