Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blueprintjs/select

Package Overview
Dependencies
Maintainers
1
Versions
227
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blueprintjs/select - npm Package Compare versions

Comparing version 3.15.0 to 3.15.1

2

dist/select.bundle.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames")):"function"==typeof define&&define.amd?define(["@blueprintjs/core","tslib","react","classnames"],t):"object"==typeof exports?exports.Select=t(require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames")):(e.Blueprint=e.Blueprint||{},e.Blueprint.Select=t(e.Blueprint.Core,e.window,e.React,e.classNames))}(window,(function(e,t,n,r){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r},,,function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t),n.d(t,"Classes",(function(){return r})),n.d(t,"renderFilteredItems",(function(){return v})),n.d(t,"executeItemsEqual",(function(){return m})),n.d(t,"getCreateNewItem",(function(){return f})),n.d(t,"isCreateNewItem",(function(){return h})),n.d(t,"getActiveItem",(function(){return y})),n.d(t,"Omnibar",(function(){return L})),n.d(t,"QueryList",(function(){return C})),n.d(t,"getFirstEnabledItem",(function(){return T})),n.d(t,"MultiSelect",(function(){return A})),n.d(t,"Select",(function(){return S})),n.d(t,"Suggest",(function(){return K}));var r={};n.r(r),n.d(r,"MULTISELECT",(function(){return s})),n.d(r,"MULTISELECT_POPOVER",(function(){return l})),n.d(r,"MULTISELECT_TAG_INPUT_INPUT",(function(){return p})),n.d(r,"OMNIBAR",(function(){return u})),n.d(r,"OMNIBAR_OVERLAY",(function(){return a})),n.d(r,"SELECT",(function(){return c})),n.d(r,"SELECT_POPOVER",(function(){return d}));var i=n(0),o=i.Classes.getClassNamespace(),s=o+"-multi-select",l=s+"-popover",p=s+"-tag-input-input",u=o+"-omnibar",a=u+"-overlay",c=o+"-select",d=c+"-popover";function v(e,t,n){if(0===e.query.length&&void 0!==n)return n;var r=e.filteredItems.map(e.renderItem).filter((function(e){return null!=e}));return r.length>0?r:t}function m(e,t,n){return void 0===e||null==t||null==n?t===n:i.Utils.isFunction(e)?e(t,n):t[e]===n[e]}function f(){return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"}}function h(e){if(null==e)return!1;var t=Object.keys(e);return 1===t.length&&"__blueprintCreateNewItemBrand"===t[0]&&"blueprint-create-new-item"===e.__blueprintCreateNewItemBrand}function y(e){return null==e||h(e)?null:e}var I=n(1),O=n(3),P=n.n(O),g=n(2),C=function(e){function t(t,n){var r,o,s=e.call(this,t,n)||this;s.refHandlers={itemsParent:function(e){return s.itemsParentRef=e}},s.shouldCheckActiveItemInViewport=!1,s.expectedNextActiveItem=null,s.isEnterKeyPressed=!1,s.renderItemList=function(e){var t=s.props,n=t.initialContent,r=t.noResults,o=e.renderCreateItem(),l=v(e,null!=o?null:r,n);if(null==l&&null==o)return null;var p=s.isCreateItemFirst();return g.createElement(i.Menu,{ulRef:e.itemsParentRef},p&&o,l,!p&&o)},s.renderItem=function(e,t){if(!0!==s.props.disabled){var n=s.state,r=n.activeItem,i=n.query,o=s.state.filteredItems.indexOf(e)>=0,l={active:m(s.props.itemsEqual,y(r),e),disabled:R(e,t,s.props.itemDisabled),matchesPredicate:o};return s.props.itemRenderer(e,{handleClick:function(t){return s.handleItemSelect(e,t)},index:t,modifiers:l,query:i})}return null},s.renderCreateItemMenuItem=function(){if(s.isCreateItemRendered()){var e=s.state,t=e.activeItem,n=e.query.trim(),r=h(t);return s.props.createNewItemRenderer(n,r,(function(e){s.handleItemCreate(n,e)}))}return null},s.handleItemCreate=function(e,t){var n,r,i,o,l=null===(r=(n=s.props).createNewItemFromQuery)||void 0===r?void 0:r.call(n,e);null!=l&&(null===(o=(i=s.props).onItemSelect)||void 0===o||o.call(i,l,t),s.maybeResetQuery())},s.handleItemSelect=function(e,t){var n,r;s.setActiveItem(e),null===(r=(n=s.props).onItemSelect)||void 0===r||r.call(n,e,t),s.maybeResetQuery()},s.handlePaste=function(e){for(var t,n=s.props,r=n.createNewItemFromQuery,i=n.onItemsPaste,o=[],l=[],p=0,u=e;p<u.length;p++){var a=u[p],c=_(a,s.props);if(void 0!==c)t=c,l.push(c);else if(s.canCreateItems()){var d=null==r?void 0:r(a);void 0!==d&&l.push(d)}else o.push(a)}s.setQuery(o.join(", "),!1),void 0!==t&&s.setActiveItem(t),null==i||i(l)},s.handleKeyDown=function(e){var t,n,r=e.keyCode;if(r===i.Keys.ARROW_UP||r===i.Keys.ARROW_DOWN){e.preventDefault();var o=s.getNextActiveItem(r===i.Keys.ARROW_UP?-1:1);null!=o&&s.setActiveItem(o)}else r===i.Keys.ENTER&&(s.isEnterKeyPressed=!0);null===(n=(t=s.props).onKeyDown)||void 0===n||n.call(t,e)},s.handleKeyUp=function(e){var t=s.props.onKeyUp,n=s.state.activeItem;e.keyCode===i.Keys.ENTER&&s.isEnterKeyPressed&&(e.preventDefault(),null==n||h(n)?s.handleItemCreate(s.state.query,e):s.handleItemSelect(n,e),s.isEnterKeyPressed=!1),null==t||t(e)},s.handleInputQueryChange=function(e){var t,n,r=null==e?"":e.target.value;s.setQuery(r),null===(n=(t=s.props).onQueryChange)||void 0===n||n.call(t,r,e)};var l=t.query,p=void 0===l?"":l,u=null===(r=t.createNewItemFromQuery)||void 0===r?void 0:r.call(t,p),a=b(p,t);return s.state={activeItem:void 0!==t.activeItem?t.activeItem:null!==(o=t.initialActiveItem)&&void 0!==o?o:T(a,t.itemDisabled),createNewItem:u,filteredItems:a,query:p},s}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=e.className,n=e.items,r=e.renderer,i=e.itemListRenderer,o=void 0===i?this.renderItemList:i,s=this.state,l=(s.createNewItem,Object(I.__rest)(s,["createNewItem"]));return r(Object(I.__assign)(Object(I.__assign)({},l),{className:t,handleItemSelect:this.handleItemSelect,handleKeyDown:this.handleKeyDown,handleKeyUp:this.handleKeyUp,handlePaste:this.handlePaste,handleQueryChange:this.handleInputQueryChange,itemList:o(Object(I.__assign)(Object(I.__assign)({},l),{items:n,itemsParentRef:this.refHandlers.itemsParent,renderCreateItem:this.renderCreateItemMenuItem,renderItem:this.renderItem}))}))},t.prototype.componentDidUpdate=function(e){var t=this;void 0!==this.props.activeItem&&this.props.activeItem!==this.state.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:this.props.activeItem})),null!=this.props.query&&this.props.query!==e.query?this.setQuery(this.props.query,this.props.resetOnQuery,this.props):i.Utils.shallowCompareKeys(this.props,e,{include:["items","itemListPredicate","itemPredicate"]})||this.setQuery(this.state.query),this.shouldCheckActiveItemInViewport&&(this.requestAnimationFrame((function(){return t.scrollActiveItemIntoView()})),this.shouldCheckActiveItemInViewport=!1)},t.prototype.scrollActiveItemIntoView=function(){var e=!1!==this.props.scrollToActiveItem,t=!m(this.props.itemsEqual,y(this.expectedNextActiveItem),y(this.props.activeItem));if(this.expectedNextActiveItem=null,e||!t){var n=this.getActiveElement();if(null!=this.itemsParentRef&&null!=n){var r=n.offsetTop,i=n.offsetHeight,o=this.itemsParentRef,s=o.offsetTop,l=o.scrollTop,p=o.clientHeight,u=this.getItemsParentPadding(),a=u.paddingTop,c=r+i+u.paddingBottom-s,d=r-a-s;c>=l+p?this.itemsParentRef.scrollTop=c+i-p:d<=l&&(this.itemsParentRef.scrollTop=d-i)}}},t.prototype.setQuery=function(e,t,n){var r;void 0===t&&(t=this.props.resetOnQuery),void 0===n&&(n=this.props);var i=n.createNewItemFromQuery;this.shouldCheckActiveItemInViewport=!0,e!==this.state.query&&(null===(r=n.onQueryChange)||void 0===r||r.call(n,e));var o=e.trim(),s=b(o,n),l=null!=i&&""!==o?i(o):void 0;this.setState({createNewItem:l,filteredItems:s,query:e});var p=this.getActiveIndex(s);(t||p<0||R(y(this.state.activeItem),p,n.itemDisabled))&&(this.isCreateItemRendered()&&this.isCreateItemFirst()?this.setActiveItem({__blueprintCreateNewItemBrand:"blueprint-create-new-item"}):this.setActiveItem(T(s,n.itemDisabled)))},t.prototype.setActiveItem=function(e){var t,n,r,i;this.expectedNextActiveItem=e,void 0===this.props.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:e})),h(e)?null===(n=(t=this.props).onActiveItemChange)||void 0===n||n.call(t,null,!0):null===(i=(r=this.props).onActiveItemChange)||void 0===i||i.call(r,e,!1)},t.prototype.getActiveElement=function(){var e=this.state.activeItem;if(null!=this.itemsParentRef){if(h(e)){var t=this.isCreateItemFirst()?0:this.state.filteredItems.length;return this.itemsParentRef.children.item(t)}var n=this.getActiveIndex();return this.itemsParentRef.children.item(n)}},t.prototype.getActiveIndex=function(e){void 0===e&&(e=this.state.filteredItems);var t=this.state.activeItem;if(null==t||h(t))return-1;for(var n=0;n<e.length;++n)if(m(this.props.itemsEqual,e[n],t))return n;return-1},t.prototype.getItemsParentPadding=function(){var e=getComputedStyle(this.itemsParentRef),t=e.paddingTop;return{paddingBottom:E(e.paddingBottom),paddingTop:E(t)}},t.prototype.getNextActiveItem=function(e,t){if((void 0===t&&(t=this.getActiveIndex()),this.isCreateItemRendered())&&(0===t&&-1===e||t===this.state.filteredItems.length-1&&1===e))return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"};return T(this.state.filteredItems,this.props.itemDisabled,e,t)},t.prototype.isCreateItemRendered=function(){return this.canCreateItems()&&""!==this.state.query&&!this.wouldCreatedItemMatchSomeExistingItem()},t.prototype.isCreateItemFirst=function(){return"first"===this.props.createNewItemPosition},t.prototype.canCreateItems=function(){return null!=this.props.createNewItemFromQuery&&null!=this.props.createNewItemRenderer},t.prototype.wouldCreatedItemMatchSomeExistingItem=function(){var e=this;return this.state.filteredItems.some((function(t){return m(e.props.itemsEqual,t,e.state.createNewItem)}))},t.prototype.maybeResetQuery=function(){this.props.resetOnSelect&&this.setQuery("",!0)},t.displayName=i.DISPLAYNAME_PREFIX+".QueryList",t.defaultProps={disabled:!1,resetOnQuery:!0},t}(i.AbstractComponent2);function E(e){return null==e?0:parseInt(e.slice(0,-2),10)}function _(e,t){var n=t.items,r=t.itemPredicate;if(i.Utils.isFunction(r))for(var o=0;o<n.length;o++){var s=n[o];if(r(e,s,o,!0))return s}}function b(e,t){var n=t.items,r=t.itemPredicate,o=t.itemListPredicate;return i.Utils.isFunction(o)?o(e,n):i.Utils.isFunction(r)?n.filter((function(t,n){return r(e,t,n)})):n}function R(e,t,n){return null!=n&&null!=e&&(i.Utils.isFunction(n)?n(e,t):!!e[n])}function T(e,t,n,r){if(void 0===n&&(n=1),void 0===r&&(r=e.length-1),0===e.length)return null;var i,o,s,l=r,p=e.length-1;do{if(s=p,!R(e[l=(i=l+n)<(o=0)?s:i>s?o:i],l,t))return e[l]}while(l!==r&&-1!==r);return null}var L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TypedQueryList=C.ofType(),t.renderQueryList=function(e){var n=t.props,o=n.inputProps,s=void 0===o?{}:o,l=n.isOpen,p=n.overlayProps,u=void 0===p?{}:p,a=e.handleKeyDown,c=e.handleKeyUp,d=l?{onKeyDown:a,onKeyUp:c}:{};return g.createElement(i.Overlay,Object(I.__assign)({hasBackdrop:!0},u,{isOpen:l,className:P()(r.OMNIBAR_OVERLAY,u.className),onClose:t.handleOverlayClose}),g.createElement("div",Object(I.__assign)({className:P()(r.OMNIBAR,e.className)},d),g.createElement(i.InputGroup,Object(I.__assign)({autoFocus:!0,large:!0,leftIcon:"search",placeholder:"Search..."},s,{onChange:e.handleQueryChange,value:e.query})),e.itemList))},t.handleOverlayClose=function(e){var n,r,i,o;null===(r=null===(n=t.props.overlayProps)||void 0===n?void 0:n.onClose)||void 0===r||r.call(n,e),null===(o=(i=t.props).onClose)||void 0===o||o.call(i,e)},t}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.isOpen,e.inputProps,e.overlayProps,Object(I.__rest)(e,["isOpen","inputProps","overlayProps"])),n="initialContent"in this.props?this.props.initialContent:null;return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{initialContent:n,renderer:this.renderQueryList}))},t.displayName=i.DISPLAYNAME_PREFIX+".Omnibar",t}(g.PureComponent),A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isOpen:t.props.popoverProps&&t.props.popoverProps.isOpen||!1},t.TypedQueryList=C.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){var n,r;t.input=e,null===(r=null===(n=t.props.tagInputProps)||void 0===n?void 0:n.inputRef)||void 0===r||r.call(n,e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n,o=t.props,s=o.fill,l=o.tagInputProps,p=void 0===l?{}:l,u=o.popoverProps,a=void 0===u?{}:u,c=o.selectedItems,d=void 0===c?[]:c,v=o.placeholder,m=e.handlePaste,f=e.handleKeyDown,h=e.handleKeyUp;s&&(a.fill=!0,p.fill=!0);var y=Object(I.__assign)(Object(I.__assign)({},p.inputProps),{className:P()(null===(n=p.inputProps)||void 0===n?void 0:n.className,r.MULTISELECT_TAG_INPUT_INPUT)});return g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,canEscapeKeyClose:!0,enforceFocus:!1,isOpen:t.state.isOpen,position:i.Position.BOTTOM_LEFT},a,{className:P()(e.className,a.className),interactionKind:i.PopoverInteractionKind.CLICK,onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.MULTISELECT_POPOVER,a.popoverClassName),onOpened:t.handlePopoverOpened}),g.createElement("div",{onKeyDown:t.getTagInputKeyDownHandler(f),onKeyUp:t.getTagInputKeyUpHandler(h)},g.createElement(i.TagInput,Object(I.__assign)({placeholder:v},p,{className:P()(r.MULTISELECT,p.className),inputRef:t.refHandlers.input,inputProps:y,inputValue:e.query,onAdd:function(e,t){"paste"===t&&m(e)},onInputChange:e.handleQueryChange,onRemove:t.handleTagRemove,values:d.map(t.props.tagRenderer)}))),g.createElement("div",{onKeyDown:f,onKeyUp:h},e.itemList))},t.handleItemSelect=function(e,n){var r,i;null!=t.input&&t.input.focus(),null===(i=(r=t.props).onItemSelect)||void 0===i||i.call(r,e,n)},t.handleQueryChange=function(e,n){var r,i;t.setState({isOpen:e.length>0||!t.props.openOnKeyDown}),null===(i=(r=t.props).onQueryChange)||void 0===i||i.call(r,e,n)},t.handlePopoverInteraction=function(e){return t.requestAnimationFrame((function(){var n,r,i=t.input===document.activeElement;null==t.input||i?t.props.openOnKeyDown||t.setState({isOpen:!0}):t.setState({isOpen:!1}),null===(r=null===(n=t.props.popoverProps)||void 0===n?void 0:n.onInteraction)||void 0===r||r.call(n,e)}))},t.handlePopoverOpened=function(e){var n,r;null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),null===(r=null===(n=t.props.popoverProps)||void 0===n?void 0:n.onOpened)||void 0===r||r.call(n,e)},t.handleTagRemove=function(e,n){var r,i=t.props,o=i.selectedItems,s=void 0===o?[]:o,l=i.onRemove,p=i.tagInputProps;null==l||l(s[n],n),null===(r=null==p?void 0:p.onRemove)||void 0===r||r.call(p,e,n)},t.getTagInputKeyDownHandler=function(e){return function(n){var r=n.which;r===i.Keys.ESCAPE||r===i.Keys.TAB?(null!=t.input&&t.input.blur(),t.setState({isOpen:!1})):r!==i.Keys.BACKSPACE&&r!==i.Keys.ARROW_LEFT&&r!==i.Keys.ARROW_RIGHT&&t.setState({isOpen:!0});var o=null!=n.target.closest("."+i.Classes.TAG_REMOVE);t.state.isOpen&&!o&&(null==e||e(n))}},t.getTagInputKeyUpHandler=function(e){return function(n){var i=n.target.classList.contains(r.MULTISELECT_TAG_INPUT_INPUT);t.state.isOpen&&i&&(null==e||e(n))}},t}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.openOnKeyDown,e.popoverProps,e.tagInputProps,Object(I.__rest)(e,["openOnKeyDown","popoverProps","tagInputProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{onItemSelect:this.handleItemSelect,onQueryChange:this.handleQueryChange,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.displayName=i.DISPLAYNAME_PREFIX+".MultiSelect",t.defaultProps={fill:!1,placeholder:"Search..."},t}(i.AbstractPureComponent2),S=function(e){function t(){var t,n=e.apply(this,arguments)||this;return n.state={isOpen:!1},n.TypedQueryList=C.ofType(),n.inputEl=null,n.queryList=null,n.refHandlers={input:Object(i.isRefObject)(null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef)?n.inputEl=n.props.inputProps.inputRef:function(e){var t,r;n.inputEl=e,null===(r=null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef)||void 0===r||r(e)},queryList:function(e){return n.queryList=e}},n.renderQueryList=function(e){var t=n.props,o=t.filterable,s=void 0===o||o,l=t.disabled,p=void 0!==l&&l,u=t.inputProps,a=void 0===u?{}:u,c=t.popoverProps,d=void 0===c?{}:c,v=g.createElement(i.InputGroup,Object(I.__assign)({leftIcon:"search",placeholder:"Filter...",rightElement:n.maybeRenderClearButton(e.query)},a,{inputRef:n.refHandlers.input,onChange:e.handleQueryChange,value:e.query})),m=e.handleKeyDown,f=e.handleKeyUp;return g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,enforceFocus:!1,isOpen:n.state.isOpen,disabled:p,position:i.Position.BOTTOM_LEFT},d,{className:P()(e.className,d.className),onInteraction:n.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,d.popoverClassName),onOpening:n.handlePopoverOpening,onOpened:n.handlePopoverOpened,onClosing:n.handlePopoverClosing}),g.createElement("div",{onKeyDown:n.state.isOpen?m:n.handleTargetKeyDown,onKeyUp:n.state.isOpen?f:void 0},n.props.children),g.createElement("div",{onKeyDown:m,onKeyUp:f},s?v:void 0,e.itemList))},n.handleTargetKeyDown=function(e){e.which!==i.Keys.ARROW_UP&&e.which!==i.Keys.ARROW_DOWN||(e.preventDefault(),n.setState({isOpen:!0}))},n.handleItemSelect=function(e,t){var r,i;n.setState({isOpen:!1}),null===(i=(r=n.props).onItemSelect)||void 0===i||i.call(r,e,t)},n.handlePopoverInteraction=function(e){var t,r;n.setState({isOpen:e}),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onInteraction)||void 0===r||r.call(t,e)},n.handlePopoverOpening=function(e){var t,r;n.previousFocusedElement=document.activeElement,n.props.resetOnClose&&n.resetQuery(),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpening)||void 0===r||r.call(t,e)},n.handlePopoverOpened=function(e){var t,r;null!=n.queryList&&n.queryList.scrollActiveItemIntoView(),n.requestAnimationFrame((function(){var e,t=n.props.inputProps;!1!==(void 0===t?{}:t).autoFocus&&(null===(e=Object(i.getRef)(n.inputEl))||void 0===e||e.focus())})),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpened)||void 0===r||r.call(t,e)},n.handlePopoverClosing=function(e){var t,r;n.requestAnimationFrame((function(){void 0!==n.previousFocusedElement&&(n.previousFocusedElement.focus(),n.previousFocusedElement=void 0)})),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onClosing)||void 0===r||r.call(t,e)},n.resetQuery=function(){return n.queryList&&n.queryList.setQuery("",!0)},n}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.filterable,e.inputProps,e.popoverProps,Object(I.__rest)(e,["filterable","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{onItemSelect:this.handleItemSelect,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.prototype.componentDidUpdate=function(e,t){this.state.isOpen&&!t.isOpen&&null!=this.queryList&&this.queryList.scrollActiveItemIntoView()},t.prototype.maybeRenderClearButton=function(e){return e.length>0?g.createElement(i.Button,{icon:"cross",minimal:!0,onClick:this.resetQuery}):void 0},t.displayName=i.DISPLAYNAME_PREFIX+".Select",t}(i.AbstractPureComponent2),K=function(e){function t(){var t,n=e.apply(this,arguments)||this;return n.state={isOpen:null!=n.props.popoverProps&&n.props.popoverProps.isOpen||!1,selectedItem:n.getInitialSelectedItem()},n.TypedQueryList=C.ofType(),n.inputEl=null,n.queryList=null,n.refHandlers={input:Object(i.isRefObject)(null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef)?n.inputEl=n.props.inputProps.inputRef:function(e){var t,r;n.inputEl=e,null===(r=null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef)||void 0===r||r(e)},queryList:function(e){return n.queryList=e}},n.renderQueryList=function(e){var t=n.props,o=t.fill,s=t.inputProps,l=void 0===s?{}:s,p=t.popoverProps,u=void 0===p?{}:p,a=n.state,c=a.isOpen,d=a.selectedItem,v=e.handleKeyDown,m=e.handleKeyUp,f=l.autoComplete,h=void 0===f?"off":f,y=l.placeholder,O=void 0===y?"Search...":y,C=d?n.props.inputValueRenderer(d):"",E=c&&C?C:O,_=c?e.query:C||(n.props.resetOnClose?"":e.query);return o&&(u.fill=!0,l.fill=!0),g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,enforceFocus:!1,isOpen:c,position:i.Position.BOTTOM_LEFT},u,{className:P()(e.className,u.className),interactionKind:i.PopoverInteractionKind.CLICK,onInteraction:n.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,u.popoverClassName),onOpening:n.handlePopoverOpening,onOpened:n.handlePopoverOpened}),g.createElement(i.InputGroup,Object(I.__assign)({autoComplete:h,disabled:n.props.disabled},l,{inputRef:n.refHandlers.input,onChange:e.handleQueryChange,onFocus:n.handleInputFocus,onKeyDown:n.getTargetKeyDownHandler(v),onKeyUp:n.getTargetKeyUpHandler(m),placeholder:E,value:_})),g.createElement("div",{onKeyDown:v,onKeyUp:m},e.itemList))},n.selectText=function(){n.requestAnimationFrame((function(){var e=Object(i.getRef)(n.inputEl);null==e||e.setSelectionRange(0,e.value.length)}))},n.handleInputFocus=function(e){var t,r;n.selectText(),n.props.openOnKeyDown||n.setState({isOpen:!0}),null===(r=null===(t=n.props.inputProps)||void 0===t?void 0:t.onFocus)||void 0===r||r.call(t,e)},n.handleItemSelect=function(e,t){var r,o,s,l,p;n.props.closeOnSelect?(null===(o=Object(i.getRef)(n.inputEl))||void 0===o||o.blur(),p=!1):(null===(r=Object(i.getRef)(n.inputEl))||void 0===r||r.focus(),n.selectText(),p=!0),void 0===n.props.selectedItem?n.setState({isOpen:p,selectedItem:e}):n.setState({isOpen:p}),null===(l=(s=n.props).onItemSelect)||void 0===l||l.call(s,e,t)},n.handlePopoverInteraction=function(e){return n.requestAnimationFrame((function(){var t,r,o=Object(i.getRef)(n.inputEl)===document.activeElement;null==n.inputEl||o||n.setState({isOpen:!1}),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onInteraction)||void 0===r||r.call(t,e)}))},n.handlePopoverOpening=function(e){var t,r;n.props.resetOnClose&&n.queryList&&n.queryList.setQuery("",!0),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpening)||void 0===r||r.call(t,e)},n.handlePopoverOpened=function(e){var t,r;null!=n.queryList&&n.queryList.scrollActiveItemIntoView(),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpened)||void 0===r||r.call(t,e)},n.getTargetKeyDownHandler=function(e){return function(t){var r,o,s,l=t.which;l===i.Keys.ESCAPE||l===i.Keys.TAB?(null===(r=Object(i.getRef)(n.inputEl))||void 0===r||r.blur(),n.setState({isOpen:!1})):n.props.openOnKeyDown&&l!==i.Keys.BACKSPACE&&l!==i.Keys.ARROW_LEFT&&l!==i.Keys.ARROW_RIGHT&&n.setState({isOpen:!0}),n.state.isOpen&&(null==e||e(t)),null===(s=null===(o=n.props.inputProps)||void 0===o?void 0:o.onKeyDown)||void 0===s||s.call(o,t)}},n.getTargetKeyUpHandler=function(e){return function(t){var r,i;n.state.isOpen&&(null==e||e(t)),null===(i=null===(r=n.props.inputProps)||void 0===r?void 0:r.onKeyUp)||void 0===i||i.call(r,t)}},n}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e,t=this.props,n=(t.disabled,t.inputProps,t.popoverProps,Object(I.__rest)(t,["disabled","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},n,{initialActiveItem:null!==(e=this.props.selectedItem)&&void 0!==e?e:void 0,onItemSelect:this.handleItemSelect,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.prototype.componentDidUpdate=function(e,t){var n,r,o=this;void 0!==this.props.selectedItem&&this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem}),!1===this.state.isOpen&&!0===t.isOpen&&setTimeout((function(){o.maybeResetActiveItemToSelectedItem()}),null!==(r=null===(n=this.props.popoverProps)||void 0===n?void 0:n.transitionDuration)&&void 0!==r?r:i.Popover.defaultProps.transitionDuration),this.state.isOpen&&!t.isOpen&&null!=this.queryList&&this.queryList.scrollActiveItemIntoView()},t.prototype.getInitialSelectedItem=function(){return void 0!==this.props.selectedItem?this.props.selectedItem:void 0!==this.props.defaultSelectedItem?this.props.defaultSelectedItem:null},t.prototype.maybeResetActiveItemToSelectedItem=function(){var e,t=void 0===this.props.activeItem&&null!==this.state.selectedItem&&!this.props.resetOnSelect;null!==this.queryList&&t&&this.queryList.setActiveItem(null!==(e=this.props.selectedItem)&&void 0!==e?e:this.state.selectedItem)},t.displayName=i.DISPLAYNAME_PREFIX+".Suggest",t.defaultProps={closeOnSelect:!0,fill:!1,openOnKeyDown:!1,resetOnClose:!1},t}(i.AbstractPureComponent2)}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames")):"function"==typeof define&&define.amd?define(["@blueprintjs/core","tslib","react","classnames"],t):"object"==typeof exports?exports.Select=t(require("@blueprintjs/core"),require("tslib"),require("react"),require("classnames")):(e.Blueprint=e.Blueprint||{},e.Blueprint.Select=t(e.Blueprint.Core,e.window,e.React,e.classNames))}(window,(function(e,t,n,r){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t){e.exports=r},,,function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";n.r(t),n.d(t,"Classes",(function(){return r})),n.d(t,"renderFilteredItems",(function(){return v})),n.d(t,"executeItemsEqual",(function(){return m})),n.d(t,"getCreateNewItem",(function(){return h})),n.d(t,"isCreateNewItem",(function(){return f})),n.d(t,"getActiveItem",(function(){return y})),n.d(t,"Omnibar",(function(){return L})),n.d(t,"QueryList",(function(){return C})),n.d(t,"getFirstEnabledItem",(function(){return T})),n.d(t,"MultiSelect",(function(){return A})),n.d(t,"Select",(function(){return S})),n.d(t,"Suggest",(function(){return K}));var r={};n.r(r),n.d(r,"MULTISELECT",(function(){return s})),n.d(r,"MULTISELECT_POPOVER",(function(){return l})),n.d(r,"MULTISELECT_TAG_INPUT_INPUT",(function(){return a})),n.d(r,"OMNIBAR",(function(){return p})),n.d(r,"OMNIBAR_OVERLAY",(function(){return u})),n.d(r,"SELECT",(function(){return c})),n.d(r,"SELECT_POPOVER",(function(){return d}));var i=n(0),o=i.Classes.getClassNamespace(),s=o+"-multi-select",l=s+"-popover",a=s+"-tag-input-input",p=o+"-omnibar",u=p+"-overlay",c=o+"-select",d=c+"-popover";function v(e,t,n){if(0===e.query.length&&void 0!==n)return n;var r=e.filteredItems.map(e.renderItem).filter((function(e){return null!=e}));return r.length>0?r:t}function m(e,t,n){return void 0===e||null==t||null==n?t===n:i.Utils.isFunction(e)?e(t,n):t[e]===n[e]}function h(){return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"}}function f(e){if(null==e)return!1;var t=Object.keys(e);return 1===t.length&&"__blueprintCreateNewItemBrand"===t[0]&&"blueprint-create-new-item"===e.__blueprintCreateNewItemBrand}function y(e){return null==e||f(e)?null:e}var I=n(1),O=n(3),P=n.n(O),g=n(2),C=function(e){function t(t,n){var r,o,s=e.call(this,t,n)||this;s.refHandlers={itemsParent:function(e){return s.itemsParentRef=e}},s.shouldCheckActiveItemInViewport=!1,s.expectedNextActiveItem=null,s.isEnterKeyPressed=!1,s.renderItemList=function(e){var t=s.props,n=t.initialContent,r=t.noResults,o=e.renderCreateItem(),l=v(e,null!=o?null:r,n);if(null==l&&null==o)return null;var a=s.isCreateItemFirst();return g.createElement(i.Menu,{ulRef:e.itemsParentRef},a&&o,l,!a&&o)},s.renderItem=function(e,t){if(!0!==s.props.disabled){var n=s.state,r=n.activeItem,i=n.query,o=s.state.filteredItems.indexOf(e)>=0,l={active:m(s.props.itemsEqual,y(r),e),disabled:R(e,t,s.props.itemDisabled),matchesPredicate:o};return s.props.itemRenderer(e,{handleClick:function(t){return s.handleItemSelect(e,t)},index:t,modifiers:l,query:i})}return null},s.renderCreateItemMenuItem=function(){if(s.isCreateItemRendered()){var e=s.state,t=e.activeItem,n=e.query.trim(),r=f(t);return s.props.createNewItemRenderer(n,r,(function(e){s.handleItemCreate(n,e)}))}return null},s.handleItemCreate=function(e,t){var n,r,i,o,l=null===(r=(n=s.props).createNewItemFromQuery)||void 0===r?void 0:r.call(n,e);null!=l&&(null===(o=(i=s.props).onItemSelect)||void 0===o||o.call(i,l,t),s.maybeResetQuery())},s.handleItemSelect=function(e,t){var n,r;s.setActiveItem(e),null===(r=(n=s.props).onItemSelect)||void 0===r||r.call(n,e,t),s.maybeResetQuery()},s.handlePaste=function(e){for(var t,n=s.props,r=n.createNewItemFromQuery,i=n.onItemsPaste,o=[],l=[],a=0,p=e;a<p.length;a++){var u=p[a],c=_(u,s.props);if(void 0!==c)t=c,l.push(c);else if(s.canCreateItems()){var d=null==r?void 0:r(u);void 0!==d&&l.push(d)}else o.push(u)}s.setQuery(o.join(", "),!1),void 0!==t&&s.setActiveItem(t),null==i||i(l)},s.handleKeyDown=function(e){var t,n,r=e.keyCode;if(r===i.Keys.ARROW_UP||r===i.Keys.ARROW_DOWN){e.preventDefault();var o=s.getNextActiveItem(r===i.Keys.ARROW_UP?-1:1);null!=o&&s.setActiveItem(o)}else r===i.Keys.ENTER&&(s.isEnterKeyPressed=!0);null===(n=(t=s.props).onKeyDown)||void 0===n||n.call(t,e)},s.handleKeyUp=function(e){var t=s.props.onKeyUp,n=s.state.activeItem;e.keyCode===i.Keys.ENTER&&s.isEnterKeyPressed&&(e.preventDefault(),null==n||f(n)?s.handleItemCreate(s.state.query,e):s.handleItemSelect(n,e),s.isEnterKeyPressed=!1),null==t||t(e)},s.handleInputQueryChange=function(e){var t,n,r=null==e?"":e.target.value;s.setQuery(r),null===(n=(t=s.props).onQueryChange)||void 0===n||n.call(t,r,e)};var l=t.query,a=void 0===l?"":l,p=null===(r=t.createNewItemFromQuery)||void 0===r?void 0:r.call(t,a),u=b(a,t);return s.state={activeItem:void 0!==t.activeItem?t.activeItem:null!==(o=t.initialActiveItem)&&void 0!==o?o:T(u,t.itemDisabled),createNewItem:p,filteredItems:u,query:a},s}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=e.className,n=e.items,r=e.renderer,i=e.itemListRenderer,o=void 0===i?this.renderItemList:i,s=this.state,l=(s.createNewItem,Object(I.__rest)(s,["createNewItem"]));return r(Object(I.__assign)(Object(I.__assign)({},l),{className:t,handleItemSelect:this.handleItemSelect,handleKeyDown:this.handleKeyDown,handleKeyUp:this.handleKeyUp,handlePaste:this.handlePaste,handleQueryChange:this.handleInputQueryChange,itemList:o(Object(I.__assign)(Object(I.__assign)({},l),{items:n,itemsParentRef:this.refHandlers.itemsParent,renderCreateItem:this.renderCreateItemMenuItem,renderItem:this.renderItem}))}))},t.prototype.componentDidUpdate=function(e){var t=this;void 0!==this.props.activeItem&&this.props.activeItem!==this.state.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:this.props.activeItem})),null!=this.props.query&&this.props.query!==e.query?this.setQuery(this.props.query,this.props.resetOnQuery,this.props):i.Utils.shallowCompareKeys(this.props,e,{include:["items","itemListPredicate","itemPredicate"]})||this.setQuery(this.state.query),this.shouldCheckActiveItemInViewport&&(this.requestAnimationFrame((function(){return t.scrollActiveItemIntoView()})),this.shouldCheckActiveItemInViewport=!1)},t.prototype.scrollActiveItemIntoView=function(){var e=!1!==this.props.scrollToActiveItem,t=!m(this.props.itemsEqual,y(this.expectedNextActiveItem),y(this.props.activeItem));if(this.expectedNextActiveItem=null,e||!t){var n=this.getActiveElement();if(null!=this.itemsParentRef&&null!=n){var r=n.offsetTop,i=n.offsetHeight,o=this.itemsParentRef,s=o.offsetTop,l=o.scrollTop,a=o.clientHeight,p=this.getItemsParentPadding(),u=p.paddingTop,c=r+i+p.paddingBottom-s,d=r-u-s;c>=l+a?this.itemsParentRef.scrollTop=c+i-a:d<=l&&(this.itemsParentRef.scrollTop=d-i)}}},t.prototype.setQuery=function(e,t,n){var r;void 0===t&&(t=this.props.resetOnQuery),void 0===n&&(n=this.props);var i=n.createNewItemFromQuery;this.shouldCheckActiveItemInViewport=!0,e!==this.state.query&&(null===(r=n.onQueryChange)||void 0===r||r.call(n,e));var o=e.trim(),s=b(o,n),l=null!=i&&""!==o?i(o):void 0;this.setState({createNewItem:l,filteredItems:s,query:e});var a=this.getActiveIndex(s);(t||a<0||R(y(this.state.activeItem),a,n.itemDisabled))&&(this.isCreateItemRendered()&&this.isCreateItemFirst()?this.setActiveItem({__blueprintCreateNewItemBrand:"blueprint-create-new-item"}):this.setActiveItem(T(s,n.itemDisabled)))},t.prototype.setActiveItem=function(e){var t,n,r,i;this.expectedNextActiveItem=e,void 0===this.props.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:e})),f(e)?null===(n=(t=this.props).onActiveItemChange)||void 0===n||n.call(t,null,!0):null===(i=(r=this.props).onActiveItemChange)||void 0===i||i.call(r,e,!1)},t.prototype.getActiveElement=function(){var e=this.state.activeItem;if(null!=this.itemsParentRef){if(f(e)){var t=this.isCreateItemFirst()?0:this.state.filteredItems.length;return this.itemsParentRef.children.item(t)}var n=this.getActiveIndex();return this.itemsParentRef.children.item(n)}},t.prototype.getActiveIndex=function(e){void 0===e&&(e=this.state.filteredItems);var t=this.state.activeItem;if(null==t||f(t))return-1;for(var n=0;n<e.length;++n)if(m(this.props.itemsEqual,e[n],t))return n;return-1},t.prototype.getItemsParentPadding=function(){var e=getComputedStyle(this.itemsParentRef),t=e.paddingTop;return{paddingBottom:E(e.paddingBottom),paddingTop:E(t)}},t.prototype.getNextActiveItem=function(e,t){if((void 0===t&&(t=this.getActiveIndex()),this.isCreateItemRendered())&&(0===t&&-1===e||t===this.state.filteredItems.length-1&&1===e))return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"};return T(this.state.filteredItems,this.props.itemDisabled,e,t)},t.prototype.isCreateItemRendered=function(){return this.canCreateItems()&&""!==this.state.query&&!this.wouldCreatedItemMatchSomeExistingItem()},t.prototype.isCreateItemFirst=function(){return"first"===this.props.createNewItemPosition},t.prototype.canCreateItems=function(){return null!=this.props.createNewItemFromQuery&&null!=this.props.createNewItemRenderer},t.prototype.wouldCreatedItemMatchSomeExistingItem=function(){var e=this;return this.state.filteredItems.some((function(t){return m(e.props.itemsEqual,t,e.state.createNewItem)}))},t.prototype.maybeResetQuery=function(){this.props.resetOnSelect&&this.setQuery("",!0)},t.displayName=i.DISPLAYNAME_PREFIX+".QueryList",t.defaultProps={disabled:!1,resetOnQuery:!0},t}(i.AbstractComponent2);function E(e){return null==e?0:parseInt(e.slice(0,-2),10)}function _(e,t){var n=t.items,r=t.itemPredicate;if(i.Utils.isFunction(r))for(var o=0;o<n.length;o++){var s=n[o];if(r(e,s,o,!0))return s}}function b(e,t){var n=t.items,r=t.itemPredicate,o=t.itemListPredicate;return i.Utils.isFunction(o)?o(e,n):i.Utils.isFunction(r)?n.filter((function(t,n){return r(e,t,n)})):n}function R(e,t,n){return null!=n&&null!=e&&(i.Utils.isFunction(n)?n(e,t):!!e[n])}function T(e,t,n,r){if(void 0===n&&(n=1),void 0===r&&(r=e.length-1),0===e.length)return null;var i,o,s,l=r,a=e.length-1;do{if(s=a,!R(e[l=(i=l+n)<(o=0)?s:i>s?o:i],l,t))return e[l]}while(l!==r&&-1!==r);return null}var L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TypedQueryList=C.ofType(),t.renderQueryList=function(e){var n=t.props,o=n.inputProps,s=void 0===o?{}:o,l=n.isOpen,a=n.overlayProps,p=void 0===a?{}:a,u=e.handleKeyDown,c=e.handleKeyUp,d=l?{onKeyDown:u,onKeyUp:c}:{};return g.createElement(i.Overlay,Object(I.__assign)({hasBackdrop:!0},p,{isOpen:l,className:P()(r.OMNIBAR_OVERLAY,p.className),onClose:t.handleOverlayClose}),g.createElement("div",Object(I.__assign)({className:P()(r.OMNIBAR,e.className)},d),g.createElement(i.InputGroup,Object(I.__assign)({autoFocus:!0,large:!0,leftIcon:"search",placeholder:"Search..."},s,{onChange:e.handleQueryChange,value:e.query})),e.itemList))},t.handleOverlayClose=function(e){var n,r,i,o;null===(r=null===(n=t.props.overlayProps)||void 0===n?void 0:n.onClose)||void 0===r||r.call(n,e),null===(o=(i=t.props).onClose)||void 0===o||o.call(i,e)},t}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.isOpen,e.inputProps,e.overlayProps,Object(I.__rest)(e,["isOpen","inputProps","overlayProps"])),n="initialContent"in this.props?this.props.initialContent:null;return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{initialContent:n,renderer:this.renderQueryList}))},t.displayName=i.DISPLAYNAME_PREFIX+".Omnibar",t}(g.PureComponent),A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isOpen:t.props.popoverProps&&t.props.popoverProps.isOpen||!1},t.TypedQueryList=C.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){var n,r;t.input=e,null===(r=null===(n=t.props.tagInputProps)||void 0===n?void 0:n.inputRef)||void 0===r||r.call(n,e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n,o=t.props,s=o.fill,l=o.tagInputProps,a=void 0===l?{}:l,p=o.popoverProps,u=void 0===p?{}:p,c=o.selectedItems,d=void 0===c?[]:c,v=o.placeholder,m=e.handlePaste,h=e.handleKeyDown,f=e.handleKeyUp;s&&(u.fill=!0,a.fill=!0);var y=Object(I.__assign)(Object(I.__assign)({},a.inputProps),{className:P()(null===(n=a.inputProps)||void 0===n?void 0:n.className,r.MULTISELECT_TAG_INPUT_INPUT)});return g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,canEscapeKeyClose:!0,enforceFocus:!1,isOpen:t.state.isOpen,position:i.Position.BOTTOM_LEFT},u,{className:P()(e.className,u.className),interactionKind:i.PopoverInteractionKind.CLICK,onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.MULTISELECT_POPOVER,u.popoverClassName),onOpened:t.handlePopoverOpened}),g.createElement("div",{onKeyDown:t.getTagInputKeyDownHandler(h),onKeyUp:t.getTagInputKeyUpHandler(f)},g.createElement(i.TagInput,Object(I.__assign)({placeholder:v},a,{className:P()(r.MULTISELECT,a.className),inputRef:t.refHandlers.input,inputProps:y,inputValue:e.query,onAdd:function(e,t){"paste"===t&&m(e)},onInputChange:e.handleQueryChange,onRemove:t.handleTagRemove,values:d.map(t.props.tagRenderer)}))),g.createElement("div",{onKeyDown:h,onKeyUp:f},e.itemList))},t.handleItemSelect=function(e,n){var r,i;null!=t.input&&t.input.focus(),null===(i=(r=t.props).onItemSelect)||void 0===i||i.call(r,e,n)},t.handleQueryChange=function(e,n){var r,i;t.setState({isOpen:e.length>0||!t.props.openOnKeyDown}),null===(i=(r=t.props).onQueryChange)||void 0===i||i.call(r,e,n)},t.handlePopoverInteraction=function(e){return t.requestAnimationFrame((function(){var n,r,i=t.input===document.activeElement;null==t.input||i?t.props.openOnKeyDown||t.setState({isOpen:!0}):t.setState({isOpen:!1}),null===(r=null===(n=t.props.popoverProps)||void 0===n?void 0:n.onInteraction)||void 0===r||r.call(n,e)}))},t.handlePopoverOpened=function(e){var n,r;null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),null===(r=null===(n=t.props.popoverProps)||void 0===n?void 0:n.onOpened)||void 0===r||r.call(n,e)},t.handleTagRemove=function(e,n){var r,i=t.props,o=i.selectedItems,s=void 0===o?[]:o,l=i.onRemove,a=i.tagInputProps;null==l||l(s[n],n),null===(r=null==a?void 0:a.onRemove)||void 0===r||r.call(a,e,n)},t.getTagInputKeyDownHandler=function(e){return function(n){var r=n.which;r===i.Keys.ESCAPE||r===i.Keys.TAB?(null!=t.input&&t.input.blur(),t.setState({isOpen:!1})):r!==i.Keys.BACKSPACE&&r!==i.Keys.ARROW_LEFT&&r!==i.Keys.ARROW_RIGHT&&t.setState({isOpen:!0});var o=null!=n.target.closest("."+i.Classes.TAG_REMOVE);t.state.isOpen&&!o&&(null==e||e(n))}},t.getTagInputKeyUpHandler=function(e){return function(n){var i=n.target.classList.contains(r.MULTISELECT_TAG_INPUT_INPUT);t.state.isOpen&&i&&(null==e||e(n))}},t}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.openOnKeyDown,e.popoverProps,e.tagInputProps,Object(I.__rest)(e,["openOnKeyDown","popoverProps","tagInputProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{onItemSelect:this.handleItemSelect,onQueryChange:this.handleQueryChange,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.displayName=i.DISPLAYNAME_PREFIX+".MultiSelect",t.defaultProps={fill:!1,placeholder:"Search..."},t}(i.AbstractPureComponent2),S=function(e){function t(){var t,n=e.apply(this,arguments)||this;return n.state={isOpen:!1},n.TypedQueryList=C.ofType(),n.inputElement=null,n.queryList=null,n.handleInputRef=Object(i.refHandler)(n,"inputElement",null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef),n.handleQueryListRef=function(e){return n.queryList=e},n.renderQueryList=function(e){var t=n.props,o=t.filterable,s=void 0===o||o,l=t.disabled,a=void 0!==l&&l,p=t.inputProps,u=void 0===p?{}:p,c=t.popoverProps,d=void 0===c?{}:c,v=g.createElement(i.InputGroup,Object(I.__assign)({leftIcon:"search",placeholder:"Filter...",rightElement:n.maybeRenderClearButton(e.query)},u,{inputRef:n.handleInputRef,onChange:e.handleQueryChange,value:e.query})),m=e.handleKeyDown,h=e.handleKeyUp;return g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,enforceFocus:!1,isOpen:n.state.isOpen,disabled:a,position:i.Position.BOTTOM_LEFT},d,{className:P()(e.className,d.className),onInteraction:n.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,d.popoverClassName),onOpening:n.handlePopoverOpening,onOpened:n.handlePopoverOpened,onClosing:n.handlePopoverClosing}),g.createElement("div",{onKeyDown:n.state.isOpen?m:n.handleTargetKeyDown,onKeyUp:n.state.isOpen?h:void 0},n.props.children),g.createElement("div",{onKeyDown:m,onKeyUp:h},s?v:void 0,e.itemList))},n.handleTargetKeyDown=function(e){e.which!==i.Keys.ARROW_UP&&e.which!==i.Keys.ARROW_DOWN||(e.preventDefault(),n.setState({isOpen:!0}))},n.handleItemSelect=function(e,t){var r,i;n.setState({isOpen:!1}),null===(i=(r=n.props).onItemSelect)||void 0===i||i.call(r,e,t)},n.handlePopoverInteraction=function(e){var t,r;n.setState({isOpen:e}),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onInteraction)||void 0===r||r.call(t,e)},n.handlePopoverOpening=function(e){var t,r;n.previousFocusedElement=document.activeElement,n.props.resetOnClose&&n.resetQuery(),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpening)||void 0===r||r.call(t,e)},n.handlePopoverOpened=function(e){var t,r;null!=n.queryList&&n.queryList.scrollActiveItemIntoView(),n.requestAnimationFrame((function(){var e,t=n.props.inputProps;!1!==(void 0===t?{}:t).autoFocus&&(null===(e=Object(i.getRef)(n.inputElement))||void 0===e||e.focus())})),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpened)||void 0===r||r.call(t,e)},n.handlePopoverClosing=function(e){var t,r;n.requestAnimationFrame((function(){void 0!==n.previousFocusedElement&&(n.previousFocusedElement.focus(),n.previousFocusedElement=void 0)})),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onClosing)||void 0===r||r.call(t,e)},n.resetQuery=function(){return n.queryList&&n.queryList.setQuery("",!0)},n}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.filterable,e.inputProps,e.popoverProps,Object(I.__rest)(e,["filterable","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},t,{onItemSelect:this.handleItemSelect,ref:this.handleQueryListRef,renderer:this.renderQueryList}))},t.prototype.componentDidUpdate=function(e,t){this.state.isOpen&&!t.isOpen&&null!=this.queryList&&this.queryList.scrollActiveItemIntoView()},t.prototype.maybeRenderClearButton=function(e){return e.length>0?g.createElement(i.Button,{icon:"cross",minimal:!0,onClick:this.resetQuery}):void 0},t.displayName=i.DISPLAYNAME_PREFIX+".Select",t}(i.AbstractPureComponent2),K=function(e){function t(){var t,n=e.apply(this,arguments)||this;return n.state={isOpen:null!=n.props.popoverProps&&n.props.popoverProps.isOpen||!1,selectedItem:n.getInitialSelectedItem()},n.TypedQueryList=C.ofType(),n.inputElement=null,n.queryList=null,n.handleInputRef=Object(i.refHandler)(n,"inputElement",null===(t=n.props.inputProps)||void 0===t?void 0:t.inputRef),n.handleQueryListRef=function(e){return n.queryList=e},n.renderQueryList=function(e){var t=n.props,o=t.fill,s=t.inputProps,l=void 0===s?{}:s,a=t.popoverProps,p=void 0===a?{}:a,u=n.state,c=u.isOpen,d=u.selectedItem,v=e.handleKeyDown,m=e.handleKeyUp,h=l.autoComplete,f=void 0===h?"off":h,y=l.placeholder,O=void 0===y?"Search...":y,C=d?n.props.inputValueRenderer(d):"",E=c&&C?C:O,_=c?e.query:C||(n.props.resetOnClose?"":e.query);return o&&(p.fill=!0,l.fill=!0),g.createElement(i.Popover,Object(I.__assign)({autoFocus:!1,enforceFocus:!1,isOpen:c,position:i.Position.BOTTOM_LEFT},p,{className:P()(e.className,p.className),interactionKind:i.PopoverInteractionKind.CLICK,onInteraction:n.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,p.popoverClassName),onOpening:n.handlePopoverOpening,onOpened:n.handlePopoverOpened}),g.createElement(i.InputGroup,Object(I.__assign)({autoComplete:f,disabled:n.props.disabled},l,{inputRef:n.handleInputRef,onChange:e.handleQueryChange,onFocus:n.handleInputFocus,onKeyDown:n.getTargetKeyDownHandler(v),onKeyUp:n.getTargetKeyUpHandler(m),placeholder:E,value:_})),g.createElement("div",{onKeyDown:v,onKeyUp:m},e.itemList))},n.selectText=function(){n.requestAnimationFrame((function(){var e=Object(i.getRef)(n.inputElement);null==e||e.setSelectionRange(0,e.value.length)}))},n.handleInputFocus=function(e){var t,r;n.selectText(),n.props.openOnKeyDown||n.setState({isOpen:!0}),null===(r=null===(t=n.props.inputProps)||void 0===t?void 0:t.onFocus)||void 0===r||r.call(t,e)},n.handleItemSelect=function(e,t){var r,o,s,l,a;n.props.closeOnSelect?(null===(o=Object(i.getRef)(n.inputElement))||void 0===o||o.blur(),a=!1):(null===(r=Object(i.getRef)(n.inputElement))||void 0===r||r.focus(),n.selectText(),a=!0),void 0===n.props.selectedItem?n.setState({isOpen:a,selectedItem:e}):n.setState({isOpen:a}),null===(l=(s=n.props).onItemSelect)||void 0===l||l.call(s,e,t)},n.handlePopoverInteraction=function(e){return n.requestAnimationFrame((function(){var t,r,o=Object(i.getRef)(n.inputElement)===document.activeElement;null==n.inputElement||o||n.setState({isOpen:!1}),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onInteraction)||void 0===r||r.call(t,e)}))},n.handlePopoverOpening=function(e){var t,r;n.props.resetOnClose&&n.queryList&&n.queryList.setQuery("",!0),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpening)||void 0===r||r.call(t,e)},n.handlePopoverOpened=function(e){var t,r;null!=n.queryList&&n.queryList.scrollActiveItemIntoView(),null===(r=null===(t=n.props.popoverProps)||void 0===t?void 0:t.onOpened)||void 0===r||r.call(t,e)},n.getTargetKeyDownHandler=function(e){return function(t){var r,o,s,l=t.which;l===i.Keys.ESCAPE||l===i.Keys.TAB?(null===(r=Object(i.getRef)(n.inputElement))||void 0===r||r.blur(),n.setState({isOpen:!1})):n.props.openOnKeyDown&&l!==i.Keys.BACKSPACE&&l!==i.Keys.ARROW_LEFT&&l!==i.Keys.ARROW_RIGHT&&n.setState({isOpen:!0}),n.state.isOpen&&(null==e||e(t)),null===(s=null===(o=n.props.inputProps)||void 0===o?void 0:o.onKeyDown)||void 0===s||s.call(o,t)}},n.getTargetKeyUpHandler=function(e){return function(t){var r,i;n.state.isOpen&&(null==e||e(t)),null===(i=null===(r=n.props.inputProps)||void 0===r?void 0:r.onKeyUp)||void 0===i||i.call(r,t)}},n}return Object(I.__extends)(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e,t=this.props,n=(t.disabled,t.inputProps,t.popoverProps,Object(I.__rest)(t,["disabled","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},n,{initialActiveItem:null!==(e=this.props.selectedItem)&&void 0!==e?e:void 0,onItemSelect:this.handleItemSelect,ref:this.handleQueryListRef,renderer:this.renderQueryList}))},t.prototype.componentDidUpdate=function(e,t){var n,r,o=this;void 0!==this.props.selectedItem&&this.props.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:this.props.selectedItem}),!1===this.state.isOpen&&!0===t.isOpen&&setTimeout((function(){o.maybeResetActiveItemToSelectedItem()}),null!==(r=null===(n=this.props.popoverProps)||void 0===n?void 0:n.transitionDuration)&&void 0!==r?r:i.Popover.defaultProps.transitionDuration),this.state.isOpen&&!t.isOpen&&null!=this.queryList&&this.queryList.scrollActiveItemIntoView()},t.prototype.getInitialSelectedItem=function(){return void 0!==this.props.selectedItem?this.props.selectedItem:void 0!==this.props.defaultSelectedItem?this.props.defaultSelectedItem:null},t.prototype.maybeResetActiveItemToSelectedItem=function(){var e,t=void 0===this.props.activeItem&&null!==this.state.selectedItem&&!this.props.resetOnSelect;null!==this.queryList&&t&&this.queryList.setActiveItem(null!==(e=this.props.selectedItem)&&void 0!==e?e:this.state.selectedItem)},t.displayName=i.DISPLAYNAME_PREFIX+".Suggest",t.defaultProps={closeOnSelect:!0,fill:!1,openOnKeyDown:!1,resetOnClose:!1},t}(i.AbstractPureComponent2)}])}));
/// <reference types="react" />
import { IRef } from "@blueprintjs/core";
import { ICreateNewItem } from "./listItemsUtils";

@@ -35,3 +36,3 @@ /**

*/
itemsParentRef: (ref: HTMLElement | null) => void;
itemsParentRef: IRef<HTMLUListElement>;
/**

@@ -45,2 +46,3 @@ * Call this function to render an item.

* Call this function to render the "create new item" view component.
*
* @returns null when creating a new item is not available, and undefined if the createNewItemRenderer returns undefined

@@ -47,0 +49,0 @@ */

@@ -9,2 +9,3 @@ /// <reference types="react" />

* Equality test comparator to determine if two {@link IListItemsProps} items are equivalent.
*
* @return `true` if the two items are equivalent.

@@ -149,2 +150,3 @@ */

* last. Only relevant when `createNewItemRenderer` is defined.
*
* @default 'last'

@@ -156,2 +158,3 @@ */

* time the query changes_ (via prop or by user input).
*
* @default true

@@ -163,2 +166,3 @@ */

* an item is selected_. The query will also be reset to the empty string.
*
* @default false

@@ -173,2 +177,3 @@ */

* `activeItem` prop is omitted (uncontrolled behavior).
*
* @default true

@@ -187,4 +192,5 @@ */

* for equality between two items.
*
* @return `true` if the two items are equivalent according to `itemsEqualProp`.
*/
export declare function executeItemsEqual<T>(itemsEqualProp: ItemsEqualProp<T> | undefined, itemA: T | null | undefined, itemB: T | null | undefined): boolean;

@@ -23,2 +23,3 @@ "use strict";

* for equality between two items.
*
* @return `true` if the two items are equivalent according to `itemsEqualProp`.

@@ -25,0 +26,0 @@ */

import * as React from "react";
import { HTMLInputProps, IInputGroupProps, IOverlayProps } from "@blueprintjs/core";
import { IInputGroupProps2, IOverlayProps } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -10,3 +10,3 @@ export interface IOmnibarProps<T> extends IListItemsProps<T> {

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/**

@@ -13,0 +13,0 @@ * Toggles the visibility of the omnibar.

@@ -29,2 +29,3 @@ import * as React from "react";

* Whether the list is disabled.
*
* @default false

@@ -155,2 +156,3 @@ */

* index. A `null` return value means no suitable item was found.
*
* @param direction amount to move in each iteration, typically +/-1

@@ -169,2 +171,3 @@ * @param startIndex item to start iteration

* index. A `null` return value means no suitable item was found.
*
* @param items the list of items

@@ -171,0 +174,0 @@ * @param itemDisabled callback to determine if a given item is disabled

@@ -356,2 +356,3 @@ "use strict";

* index. A `null` return value means no suitable item was found.
*
* @param direction amount to move in each iteration, typically +/-1

@@ -456,2 +457,3 @@ * @param startIndex item to start iteration

* index. A `null` return value means no suitable item was found.
*
* @param items the list of items

@@ -458,0 +460,0 @@ * @param itemDisabled callback to determine if a given item is disabled

@@ -34,2 +34,3 @@ import * as React from "react";

* Input placeholder text. Shorthand for `tagInputProps.placeholder`.
*
* @default "Search..."

@@ -36,0 +37,0 @@ */

@@ -59,3 +59,5 @@ "use strict";

React.createElement("div", { onKeyDown: _this.getTagInputKeyDownHandler(handleKeyDown), onKeyUp: _this.getTagInputKeyUpHandler(handleKeyUp) },
React.createElement(core_1.TagInput, tslib_1.__assign({ placeholder: placeholder }, tagInputProps, { className: classnames_1.default(common_1.Classes.MULTISELECT, tagInputProps.className), inputRef: _this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query, onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, onRemove: _this.handleTagRemove, values: selectedItems.map(_this.props.tagRenderer) }))),
React.createElement(core_1.TagInput, tslib_1.__assign({ placeholder: placeholder }, tagInputProps, { className: classnames_1.default(common_1.Classes.MULTISELECT, tagInputProps.className), inputRef: _this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query,
/* eslint-disable-next-line react/jsx-no-bind */
onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, onRemove: _this.handleTagRemove, values: selectedItems.map(_this.props.tagRenderer) }))),
React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -62,0 +64,0 @@ };

/// <reference types="react" />
import { AbstractPureComponent2, HTMLInputProps, IInputGroupProps, IPopoverProps } from "@blueprintjs/core";
import { AbstractPureComponent2, IInputGroupProps2, IPopoverProps, IRefObject } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -8,2 +8,3 @@ export interface ISelectProps<T> extends IListItemsProps<T> {

* Disabling this option will remove the `InputGroup` and ignore `inputProps`.
*
* @default true

@@ -16,2 +17,3 @@ */

* Note that you'll also need to disable the component's children, if appropriate.
*
* @default false

@@ -25,3 +27,3 @@ */

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/** Props to spread to `Popover`. Note that `content` cannot be changed. */

@@ -32,2 +34,3 @@ popoverProps?: Partial<IPopoverProps> & object;

* the popover closes_. The query will also be reset to the empty string.
*
* @default false

@@ -45,6 +48,7 @@ */

private TypedQueryList;
private inputEl;
inputElement: HTMLInputElement | IRefObject<HTMLInputElement> | null;
private queryList;
private previousFocusedElement;
private refHandlers;
private handleInputRef;
private handleQueryListRef;
render(): JSX.Element;

@@ -51,0 +55,0 @@ componentDidUpdate(_prevProps: ISelectProps<T>, prevState: ISelectState): void;

@@ -32,18 +32,10 @@ "use strict";

_this.TypedQueryList = queryList_1.QueryList.ofType();
_this.inputEl = null;
_this.inputElement = null;
_this.queryList = null;
_this.refHandlers = {
input: core_1.isRefObject((_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef)
? (_this.inputEl = _this.props.inputProps.inputRef)
: function (ref) {
var _a, _b;
_this.inputEl = ref;
(_b = (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef) === null || _b === void 0 ? void 0 : _b(ref);
},
queryList: function (ref) { return (_this.queryList = ref); },
};
_this.handleInputRef = core_1.refHandler(_this, "inputElement", (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef);
_this.handleQueryListRef = function (ref) { return (_this.queryList = ref); };
_this.renderQueryList = function (listProps) {
// not using defaultProps cuz they're hard to type with generics (can't use <T> on static members)
var _a = _this.props, _b = _a.filterable, filterable = _b === void 0 ? true : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.inputProps, inputProps = _d === void 0 ? {} : _d, _e = _a.popoverProps, popoverProps = _e === void 0 ? {} : _e;
var input = (React.createElement(core_1.InputGroup, tslib_1.__assign({ leftIcon: "search", placeholder: "Filter...", rightElement: _this.maybeRenderClearButton(listProps.query) }, inputProps, { inputRef: _this.refHandlers.input, onChange: listProps.handleQueryChange, value: listProps.query })));
var input = (React.createElement(core_1.InputGroup, tslib_1.__assign({ leftIcon: "search", placeholder: "Filter...", rightElement: _this.maybeRenderClearButton(listProps.query) }, inputProps, { inputRef: _this.handleInputRef, onChange: listProps.handleQueryChange, value: listProps.query })));
var handleKeyDown = listProps.handleKeyDown, handleKeyUp = listProps.handleKeyUp;

@@ -95,3 +87,3 @@ return (React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, enforceFocus: false, isOpen: _this.state.isOpen, disabled: disabled, position: core_1.Position.BOTTOM_LEFT }, popoverProps, { className: classnames_1.default(listProps.className, popoverProps.className), onInteraction: _this.handlePopoverInteraction, popoverClassName: classnames_1.default(common_1.Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened, onClosing: _this.handlePopoverClosing }),

if (inputProps.autoFocus !== false) {
(_a = core_1.getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.focus();
(_a = core_1.getRef(_this.inputElement)) === null || _a === void 0 ? void 0 : _a.focus();
}

@@ -122,3 +114,3 @@ });

var _a = this.props, filterable = _a.filterable, inputProps = _a.inputProps, popoverProps = _a.popoverProps, restProps = tslib_1.__rest(_a, ["filterable", "inputProps", "popoverProps"]);
return (React.createElement(this.TypedQueryList, tslib_1.__assign({}, restProps, { onItemSelect: this.handleItemSelect, ref: this.refHandlers.queryList, renderer: this.renderQueryList })));
return (React.createElement(this.TypedQueryList, tslib_1.__assign({}, restProps, { onItemSelect: this.handleItemSelect, ref: this.handleQueryListRef, renderer: this.renderQueryList })));
};

@@ -125,0 +117,0 @@ Select.prototype.componentDidUpdate = function (_prevProps, prevState) {

/// <reference types="react" />
import { AbstractPureComponent2, HTMLInputProps, IInputGroupProps, IPopoverProps } from "@blueprintjs/core";
import { AbstractPureComponent2, IInputGroupProps2, IPopoverProps, IRefObject } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -7,2 +7,3 @@ export interface ISuggestProps<T> extends IListItemsProps<T> {

* Whether the popover should close after selecting an item.
*
* @default true

@@ -23,3 +24,3 @@ */

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/** Custom renderer to transform an item into a string for the input value. */

@@ -53,2 +54,3 @@ inputValueRenderer: (item: T) => string;

* the popover closes_. The query will also be reset to the empty string.
*
* @default false

@@ -68,5 +70,6 @@ */

private TypedQueryList;
private inputEl;
inputElement: HTMLInputElement | IRefObject<HTMLInputElement> | null;
private queryList;
private refHandlers;
private handleInputRef;
private handleQueryListRef;
render(): JSX.Element;

@@ -73,0 +76,0 @@ componentDidUpdate(_prevProps: ISuggestProps<T>, prevState: ISuggestState<T>): void;

@@ -35,14 +35,6 @@ "use strict";

_this.TypedQueryList = queryList_1.QueryList.ofType();
_this.inputEl = null;
_this.inputElement = null;
_this.queryList = null;
_this.refHandlers = {
input: core_1.isRefObject((_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef)
? (_this.inputEl = _this.props.inputProps.inputRef)
: function (ref) {
var _a, _b;
_this.inputEl = ref;
(_b = (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef) === null || _b === void 0 ? void 0 : _b(ref);
},
queryList: function (ref) { return (_this.queryList = ref); },
};
_this.handleInputRef = core_1.refHandler(_this, "inputElement", (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef);
_this.handleQueryListRef = function (ref) { return (_this.queryList = ref); };
_this.renderQueryList = function (listProps) {

@@ -66,3 +58,3 @@ var _a = _this.props, fill = _a.fill, _b = _a.inputProps, inputProps = _b === void 0 ? {} : _b, _c = _a.popoverProps, popoverProps = _c === void 0 ? {} : _c;

return (React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: core_1.Position.BOTTOM_LEFT }, popoverProps, { className: classnames_1.default(listProps.className, popoverProps.className), interactionKind: core_1.PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classnames_1.default(common_1.Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened }),
React.createElement(core_1.InputGroup, tslib_1.__assign({ autoComplete: autoComplete, disabled: _this.props.disabled }, inputProps, { inputRef: _this.refHandlers.input, onChange: listProps.handleQueryChange, onFocus: _this.handleInputFocus, onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: _this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })),
React.createElement(core_1.InputGroup, tslib_1.__assign({ autoComplete: autoComplete, disabled: _this.props.disabled }, inputProps, { inputRef: _this.handleInputRef, onChange: listProps.handleQueryChange, onFocus: _this.handleInputFocus, onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: _this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })),
React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -73,3 +65,3 @@ };

_this.requestAnimationFrame(function () {
var input = core_1.getRef(_this.inputEl);
var input = core_1.getRef(_this.inputElement);
input === null || input === void 0 ? void 0 : input.setSelectionRange(0, input.value.length);

@@ -91,3 +83,3 @@ });

if (!_this.props.closeOnSelect) {
(_a = core_1.getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.focus();
(_a = core_1.getRef(_this.inputElement)) === null || _a === void 0 ? void 0 : _a.focus();
_this.selectText();

@@ -97,3 +89,3 @@ nextOpenState = true;

else {
(_b = core_1.getRef(_this.inputEl)) === null || _b === void 0 ? void 0 : _b.blur();
(_b = core_1.getRef(_this.inputElement)) === null || _b === void 0 ? void 0 : _b.blur();
nextOpenState = false;

@@ -119,4 +111,4 @@ }

var _a, _b;
var isInputFocused = core_1.getRef(_this.inputEl) === document.activeElement;
if (_this.inputEl != null && !isInputFocused) {
var isInputFocused = core_1.getRef(_this.inputElement) === document.activeElement;
if (_this.inputElement != null && !isInputFocused) {
// the input is no longer focused, we should close the popover

@@ -152,3 +144,3 @@ _this.setState({ isOpen: false });

if (which === core_1.Keys.ESCAPE || which === core_1.Keys.TAB) {
(_a = core_1.getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.blur();
(_a = core_1.getRef(_this.inputElement)) === null || _a === void 0 ? void 0 : _a.blur();
_this.setState({ isOpen: false });

@@ -186,3 +178,3 @@ }

var _b = this.props, disabled = _b.disabled, inputProps = _b.inputProps, popoverProps = _b.popoverProps, restProps = tslib_1.__rest(_b, ["disabled", "inputProps", "popoverProps"]);
return (React.createElement(this.TypedQueryList, tslib_1.__assign({}, restProps, { initialActiveItem: (_a = this.props.selectedItem) !== null && _a !== void 0 ? _a : undefined, onItemSelect: this.handleItemSelect, ref: this.refHandlers.queryList, renderer: this.renderQueryList })));
return (React.createElement(this.TypedQueryList, tslib_1.__assign({}, restProps, { initialActiveItem: (_a = this.props.selectedItem) !== null && _a !== void 0 ? _a : undefined, onItemSelect: this.handleItemSelect, ref: this.handleQueryListRef, renderer: this.renderQueryList })));
};

@@ -189,0 +181,0 @@ Suggest.prototype.componentDidUpdate = function (_prevProps, prevState) {

/// <reference types="react" />
import { IRef } from "@blueprintjs/core";
import { ICreateNewItem } from "./listItemsUtils";

@@ -35,3 +36,3 @@ /**

*/
itemsParentRef: (ref: HTMLElement | null) => void;
itemsParentRef: IRef<HTMLUListElement>;
/**

@@ -45,2 +46,3 @@ * Call this function to render an item.

* Call this function to render the "create new item" view component.
*
* @returns null when creating a new item is not available, and undefined if the createNewItemRenderer returns undefined

@@ -47,0 +49,0 @@ */

@@ -9,2 +9,3 @@ /// <reference types="react" />

* Equality test comparator to determine if two {@link IListItemsProps} items are equivalent.
*
* @return `true` if the two items are equivalent.

@@ -149,2 +150,3 @@ */

* last. Only relevant when `createNewItemRenderer` is defined.
*
* @default 'last'

@@ -156,2 +158,3 @@ */

* time the query changes_ (via prop or by user input).
*
* @default true

@@ -163,2 +166,3 @@ */

* an item is selected_. The query will also be reset to the empty string.
*
* @default false

@@ -173,2 +177,3 @@ */

* `activeItem` prop is omitted (uncontrolled behavior).
*
* @default true

@@ -187,4 +192,5 @@ */

* for equality between two items.
*
* @return `true` if the two items are equivalent according to `itemsEqualProp`.
*/
export declare function executeItemsEqual<T>(itemsEqualProp: ItemsEqualProp<T> | undefined, itemA: T | null | undefined, itemB: T | null | undefined): boolean;

@@ -20,2 +20,3 @@ /*

* for equality between two items.
*
* @return `true` if the two items are equivalent according to `itemsEqualProp`.

@@ -22,0 +23,0 @@ */

import * as React from "react";
import { HTMLInputProps, IInputGroupProps, IOverlayProps } from "@blueprintjs/core";
import { IInputGroupProps2, IOverlayProps } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -10,3 +10,3 @@ export interface IOmnibarProps<T> extends IListItemsProps<T> {

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/**

@@ -13,0 +13,0 @@ * Toggles the visibility of the omnibar.

@@ -19,3 +19,3 @@ /*

import * as React from "react";
import { DISPLAYNAME_PREFIX, InputGroup, Overlay, } from "@blueprintjs/core";
import { DISPLAYNAME_PREFIX, InputGroup, Overlay } from "@blueprintjs/core";
import { Classes } from "../../common";

@@ -22,0 +22,0 @@ import { QueryList } from "../query-list/queryList";

@@ -29,2 +29,3 @@ import * as React from "react";

* Whether the list is disabled.
*
* @default false

@@ -155,2 +156,3 @@ */

* index. A `null` return value means no suitable item was found.
*
* @param direction amount to move in each iteration, typically +/-1

@@ -169,2 +171,3 @@ * @param startIndex item to start iteration

* index. A `null` return value means no suitable item was found.
*
* @param items the list of items

@@ -171,0 +174,0 @@ * @param itemDisabled callback to determine if a given item is disabled

@@ -353,2 +353,3 @@ /*

* index. A `null` return value means no suitable item was found.
*
* @param direction amount to move in each iteration, typically +/-1

@@ -453,2 +454,3 @@ * @param startIndex item to start iteration

* index. A `null` return value means no suitable item was found.
*
* @param items the list of items

@@ -455,0 +457,0 @@ * @param itemDisabled callback to determine if a given item is disabled

@@ -34,2 +34,3 @@ import * as React from "react";

* Input placeholder text. Shorthand for `tagInputProps.placeholder`.
*
* @default "Search..."

@@ -36,0 +37,0 @@ */

@@ -56,3 +56,5 @@ /*

React.createElement("div", { onKeyDown: _this.getTagInputKeyDownHandler(handleKeyDown), onKeyUp: _this.getTagInputKeyUpHandler(handleKeyUp) },
React.createElement(TagInput, __assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: _this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query, onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, onRemove: _this.handleTagRemove, values: selectedItems.map(_this.props.tagRenderer) }))),
React.createElement(TagInput, __assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: _this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query,
/* eslint-disable-next-line react/jsx-no-bind */
onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, onRemove: _this.handleTagRemove, values: selectedItems.map(_this.props.tagRenderer) }))),
React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -59,0 +61,0 @@ };

/// <reference types="react" />
import { AbstractPureComponent2, HTMLInputProps, IInputGroupProps, IPopoverProps } from "@blueprintjs/core";
import { AbstractPureComponent2, IInputGroupProps2, IPopoverProps, IRefObject } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -8,2 +8,3 @@ export interface ISelectProps<T> extends IListItemsProps<T> {

* Disabling this option will remove the `InputGroup` and ignore `inputProps`.
*
* @default true

@@ -16,2 +17,3 @@ */

* Note that you'll also need to disable the component's children, if appropriate.
*
* @default false

@@ -25,3 +27,3 @@ */

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/** Props to spread to `Popover`. Note that `content` cannot be changed. */

@@ -32,2 +34,3 @@ popoverProps?: Partial<IPopoverProps> & object;

* the popover closes_. The query will also be reset to the empty string.
*
* @default false

@@ -45,6 +48,7 @@ */

private TypedQueryList;
private inputEl;
inputElement: HTMLInputElement | IRefObject<HTMLInputElement> | null;
private queryList;
private previousFocusedElement;
private refHandlers;
private handleInputRef;
private handleQueryListRef;
render(): JSX.Element;

@@ -51,0 +55,0 @@ componentDidUpdate(_prevProps: ISelectProps<T>, prevState: ISelectState): void;

@@ -19,3 +19,3 @@ /*

import * as React from "react";
import { AbstractPureComponent2, Button, DISPLAYNAME_PREFIX, getRef, InputGroup, isRefObject, Keys, Popover, Position, } from "@blueprintjs/core";
import { AbstractPureComponent2, Button, DISPLAYNAME_PREFIX, getRef, InputGroup, Keys, Popover, Position, refHandler, } from "@blueprintjs/core";
import { Classes } from "../../common";

@@ -30,18 +30,10 @@ import { QueryList } from "../query-list/queryList";

_this.TypedQueryList = QueryList.ofType();
_this.inputEl = null;
_this.inputElement = null;
_this.queryList = null;
_this.refHandlers = {
input: isRefObject((_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef)
? (_this.inputEl = _this.props.inputProps.inputRef)
: function (ref) {
var _a, _b;
_this.inputEl = ref;
(_b = (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef) === null || _b === void 0 ? void 0 : _b(ref);
},
queryList: function (ref) { return (_this.queryList = ref); },
};
_this.handleInputRef = refHandler(_this, "inputElement", (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef);
_this.handleQueryListRef = function (ref) { return (_this.queryList = ref); };
_this.renderQueryList = function (listProps) {
// not using defaultProps cuz they're hard to type with generics (can't use <T> on static members)
var _a = _this.props, _b = _a.filterable, filterable = _b === void 0 ? true : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.inputProps, inputProps = _d === void 0 ? {} : _d, _e = _a.popoverProps, popoverProps = _e === void 0 ? {} : _e;
var input = (React.createElement(InputGroup, __assign({ leftIcon: "search", placeholder: "Filter...", rightElement: _this.maybeRenderClearButton(listProps.query) }, inputProps, { inputRef: _this.refHandlers.input, onChange: listProps.handleQueryChange, value: listProps.query })));
var input = (React.createElement(InputGroup, __assign({ leftIcon: "search", placeholder: "Filter...", rightElement: _this.maybeRenderClearButton(listProps.query) }, inputProps, { inputRef: _this.handleInputRef, onChange: listProps.handleQueryChange, value: listProps.query })));
var handleKeyDown = listProps.handleKeyDown, handleKeyUp = listProps.handleKeyUp;

@@ -93,3 +85,3 @@ return (React.createElement(Popover, __assign({ autoFocus: false, enforceFocus: false, isOpen: _this.state.isOpen, disabled: disabled, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened, onClosing: _this.handlePopoverClosing }),

if (inputProps.autoFocus !== false) {
(_a = getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.focus();
(_a = getRef(_this.inputElement)) === null || _a === void 0 ? void 0 : _a.focus();
}

@@ -120,3 +112,3 @@ });

var _a = this.props, filterable = _a.filterable, inputProps = _a.inputProps, popoverProps = _a.popoverProps, restProps = __rest(_a, ["filterable", "inputProps", "popoverProps"]);
return (React.createElement(this.TypedQueryList, __assign({}, restProps, { onItemSelect: this.handleItemSelect, ref: this.refHandlers.queryList, renderer: this.renderQueryList })));
return (React.createElement(this.TypedQueryList, __assign({}, restProps, { onItemSelect: this.handleItemSelect, ref: this.handleQueryListRef, renderer: this.renderQueryList })));
};

@@ -123,0 +115,0 @@ Select.prototype.componentDidUpdate = function (_prevProps, prevState) {

/// <reference types="react" />
import { AbstractPureComponent2, HTMLInputProps, IInputGroupProps, IPopoverProps } from "@blueprintjs/core";
import { AbstractPureComponent2, IInputGroupProps2, IPopoverProps, IRefObject } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -7,2 +7,3 @@ export interface ISuggestProps<T> extends IListItemsProps<T> {

* Whether the popover should close after selecting an item.
*
* @default true

@@ -23,3 +24,3 @@ */

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/** Custom renderer to transform an item into a string for the input value. */

@@ -53,2 +54,3 @@ inputValueRenderer: (item: T) => string;

* the popover closes_. The query will also be reset to the empty string.
*
* @default false

@@ -68,5 +70,6 @@ */

private TypedQueryList;
private inputEl;
inputElement: HTMLInputElement | IRefObject<HTMLInputElement> | null;
private queryList;
private refHandlers;
private handleInputRef;
private handleQueryListRef;
render(): JSX.Element;

@@ -73,0 +76,0 @@ componentDidUpdate(_prevProps: ISuggestProps<T>, prevState: ISuggestState<T>): void;

@@ -19,3 +19,3 @@ /*

import * as React from "react";
import { AbstractPureComponent2, DISPLAYNAME_PREFIX, getRef, InputGroup, isRefObject, Keys, Popover, PopoverInteractionKind, Position, } from "@blueprintjs/core";
import { AbstractPureComponent2, DISPLAYNAME_PREFIX, getRef, InputGroup, Keys, Popover, PopoverInteractionKind, Position, refHandler, } from "@blueprintjs/core";
import { Classes } from "../../common";

@@ -33,14 +33,6 @@ import { QueryList } from "../query-list/queryList";

_this.TypedQueryList = QueryList.ofType();
_this.inputEl = null;
_this.inputElement = null;
_this.queryList = null;
_this.refHandlers = {
input: isRefObject((_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef)
? (_this.inputEl = _this.props.inputProps.inputRef)
: function (ref) {
var _a, _b;
_this.inputEl = ref;
(_b = (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef) === null || _b === void 0 ? void 0 : _b(ref);
},
queryList: function (ref) { return (_this.queryList = ref); },
};
_this.handleInputRef = refHandler(_this, "inputElement", (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.inputRef);
_this.handleQueryListRef = function (ref) { return (_this.queryList = ref); };
_this.renderQueryList = function (listProps) {

@@ -64,3 +56,3 @@ var _a = _this.props, fill = _a.fill, _b = _a.inputProps, inputProps = _b === void 0 ? {} : _b, _c = _a.popoverProps, popoverProps = _c === void 0 ? {} : _c;

return (React.createElement(Popover, __assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: _this.handlePopoverOpening, onOpened: _this.handlePopoverOpened }),
React.createElement(InputGroup, __assign({ autoComplete: autoComplete, disabled: _this.props.disabled }, inputProps, { inputRef: _this.refHandlers.input, onChange: listProps.handleQueryChange, onFocus: _this.handleInputFocus, onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: _this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })),
React.createElement(InputGroup, __assign({ autoComplete: autoComplete, disabled: _this.props.disabled }, inputProps, { inputRef: _this.handleInputRef, onChange: listProps.handleQueryChange, onFocus: _this.handleInputFocus, onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: _this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })),
React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -71,3 +63,3 @@ };

_this.requestAnimationFrame(function () {
var input = getRef(_this.inputEl);
var input = getRef(_this.inputElement);
input === null || input === void 0 ? void 0 : input.setSelectionRange(0, input.value.length);

@@ -89,3 +81,3 @@ });

if (!_this.props.closeOnSelect) {
(_a = getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.focus();
(_a = getRef(_this.inputElement)) === null || _a === void 0 ? void 0 : _a.focus();
_this.selectText();

@@ -95,3 +87,3 @@ nextOpenState = true;

else {
(_b = getRef(_this.inputEl)) === null || _b === void 0 ? void 0 : _b.blur();
(_b = getRef(_this.inputElement)) === null || _b === void 0 ? void 0 : _b.blur();
nextOpenState = false;

@@ -117,4 +109,4 @@ }

var _a, _b;
var isInputFocused = getRef(_this.inputEl) === document.activeElement;
if (_this.inputEl != null && !isInputFocused) {
var isInputFocused = getRef(_this.inputElement) === document.activeElement;
if (_this.inputElement != null && !isInputFocused) {
// the input is no longer focused, we should close the popover

@@ -150,3 +142,3 @@ _this.setState({ isOpen: false });

if (which === Keys.ESCAPE || which === Keys.TAB) {
(_a = getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.blur();
(_a = getRef(_this.inputElement)) === null || _a === void 0 ? void 0 : _a.blur();
_this.setState({ isOpen: false });

@@ -184,3 +176,3 @@ }

var _b = this.props, disabled = _b.disabled, inputProps = _b.inputProps, popoverProps = _b.popoverProps, restProps = __rest(_b, ["disabled", "inputProps", "popoverProps"]);
return (React.createElement(this.TypedQueryList, __assign({}, restProps, { initialActiveItem: (_a = this.props.selectedItem) !== null && _a !== void 0 ? _a : undefined, onItemSelect: this.handleItemSelect, ref: this.refHandlers.queryList, renderer: this.renderQueryList })));
return (React.createElement(this.TypedQueryList, __assign({}, restProps, { initialActiveItem: (_a = this.props.selectedItem) !== null && _a !== void 0 ? _a : undefined, onItemSelect: this.handleItemSelect, ref: this.handleQueryListRef, renderer: this.renderQueryList })));
};

@@ -187,0 +179,0 @@ Suggest.prototype.componentDidUpdate = function (_prevProps, prevState) {

/// <reference types="react" />
import { IRef } from "@blueprintjs/core";
import { ICreateNewItem } from "./listItemsUtils";

@@ -35,3 +36,3 @@ /**

*/
itemsParentRef: (ref: HTMLElement | null) => void;
itemsParentRef: IRef<HTMLUListElement>;
/**

@@ -45,2 +46,3 @@ * Call this function to render an item.

* Call this function to render the "create new item" view component.
*
* @returns null when creating a new item is not available, and undefined if the createNewItemRenderer returns undefined

@@ -47,0 +49,0 @@ */

@@ -9,2 +9,3 @@ /// <reference types="react" />

* Equality test comparator to determine if two {@link IListItemsProps} items are equivalent.
*
* @return `true` if the two items are equivalent.

@@ -149,2 +150,3 @@ */

* last. Only relevant when `createNewItemRenderer` is defined.
*
* @default 'last'

@@ -156,2 +158,3 @@ */

* time the query changes_ (via prop or by user input).
*
* @default true

@@ -163,2 +166,3 @@ */

* an item is selected_. The query will also be reset to the empty string.
*
* @default false

@@ -173,2 +177,3 @@ */

* `activeItem` prop is omitted (uncontrolled behavior).
*
* @default true

@@ -187,4 +192,5 @@ */

* for equality between two items.
*
* @return `true` if the two items are equivalent according to `itemsEqualProp`.
*/
export declare function executeItemsEqual<T>(itemsEqualProp: ItemsEqualProp<T> | undefined, itemA: T | null | undefined, itemB: T | null | undefined): boolean;

@@ -20,2 +20,3 @@ /*

* for equality between two items.
*
* @return `true` if the two items are equivalent according to `itemsEqualProp`.

@@ -22,0 +23,0 @@ */

import * as React from "react";
import { HTMLInputProps, IInputGroupProps, IOverlayProps } from "@blueprintjs/core";
import { IInputGroupProps2, IOverlayProps } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -10,3 +10,3 @@ export interface IOmnibarProps<T> extends IListItemsProps<T> {

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/**

@@ -13,0 +13,0 @@ * Toggles the visibility of the omnibar.

@@ -18,3 +18,3 @@ /*

import * as React from "react";
import { DISPLAYNAME_PREFIX, InputGroup, Overlay, } from "@blueprintjs/core";
import { DISPLAYNAME_PREFIX, InputGroup, Overlay } from "@blueprintjs/core";
import { Classes } from "../../common";

@@ -21,0 +21,0 @@ import { QueryList } from "../query-list/queryList";

@@ -29,2 +29,3 @@ import * as React from "react";

* Whether the list is disabled.
*
* @default false

@@ -155,2 +156,3 @@ */

* index. A `null` return value means no suitable item was found.
*
* @param direction amount to move in each iteration, typically +/-1

@@ -169,2 +171,3 @@ * @param startIndex item to start iteration

* index. A `null` return value means no suitable item was found.
*
* @param items the list of items

@@ -171,0 +174,0 @@ * @param itemDisabled callback to determine if a given item is disabled

@@ -353,2 +353,3 @@ /*

* index. A `null` return value means no suitable item was found.
*
* @param direction amount to move in each iteration, typically +/-1

@@ -445,2 +446,3 @@ * @param startIndex item to start iteration

* index. A `null` return value means no suitable item was found.
*
* @param items the list of items

@@ -447,0 +449,0 @@ * @param itemDisabled callback to determine if a given item is disabled

@@ -34,2 +34,3 @@ import * as React from "react";

* Input placeholder text. Shorthand for `tagInputProps.placeholder`.
*
* @default "Search..."

@@ -36,0 +37,0 @@ */

@@ -55,3 +55,5 @@ /*

React.createElement("div", { onKeyDown: this.getTagInputKeyDownHandler(handleKeyDown), onKeyUp: this.getTagInputKeyUpHandler(handleKeyUp) },
React.createElement(TagInput, Object.assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query, onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, onRemove: this.handleTagRemove, values: selectedItems.map(this.props.tagRenderer) }))),
React.createElement(TagInput, Object.assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: this.refHandlers.input, inputProps: inputProps, inputValue: listProps.query,
/* eslint-disable-next-line react/jsx-no-bind */
onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, onRemove: this.handleTagRemove, values: selectedItems.map(this.props.tagRenderer) }))),
React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -58,0 +60,0 @@ };

/// <reference types="react" />
import { AbstractPureComponent2, HTMLInputProps, IInputGroupProps, IPopoverProps } from "@blueprintjs/core";
import { AbstractPureComponent2, IInputGroupProps2, IPopoverProps, IRefObject } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -8,2 +8,3 @@ export interface ISelectProps<T> extends IListItemsProps<T> {

* Disabling this option will remove the `InputGroup` and ignore `inputProps`.
*
* @default true

@@ -16,2 +17,3 @@ */

* Note that you'll also need to disable the component's children, if appropriate.
*
* @default false

@@ -25,3 +27,3 @@ */

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/** Props to spread to `Popover`. Note that `content` cannot be changed. */

@@ -32,2 +34,3 @@ popoverProps?: Partial<IPopoverProps> & object;

* the popover closes_. The query will also be reset to the empty string.
*
* @default false

@@ -45,6 +48,7 @@ */

private TypedQueryList;
private inputEl;
inputElement: HTMLInputElement | IRefObject<HTMLInputElement> | null;
private queryList;
private previousFocusedElement;
private refHandlers;
private handleInputRef;
private handleQueryListRef;
render(): JSX.Element;

@@ -51,0 +55,0 @@ componentDidUpdate(_prevProps: ISelectProps<T>, prevState: ISelectState): void;

@@ -18,3 +18,3 @@ /*

import * as React from "react";
import { AbstractPureComponent2, Button, DISPLAYNAME_PREFIX, getRef, InputGroup, isRefObject, Keys, Popover, Position, } from "@blueprintjs/core";
import { AbstractPureComponent2, Button, DISPLAYNAME_PREFIX, getRef, InputGroup, Keys, Popover, Position, refHandler, } from "@blueprintjs/core";
import { Classes } from "../../common";

@@ -27,17 +27,10 @@ import { QueryList } from "../query-list/queryList";

this.TypedQueryList = QueryList.ofType();
this.inputEl = null;
this.inputElement = null;
this.queryList = null;
this.refHandlers = {
input: isRefObject(this.props.inputProps?.inputRef)
? (this.inputEl = this.props.inputProps.inputRef)
: (ref) => {
this.inputEl = ref;
this.props.inputProps?.inputRef?.(ref);
},
queryList: (ref) => (this.queryList = ref),
};
this.handleInputRef = refHandler(this, "inputElement", this.props.inputProps?.inputRef);
this.handleQueryListRef = (ref) => (this.queryList = ref);
this.renderQueryList = (listProps) => {
// not using defaultProps cuz they're hard to type with generics (can't use <T> on static members)
const { filterable = true, disabled = false, inputProps = {}, popoverProps = {} } = this.props;
const input = (React.createElement(InputGroup, Object.assign({ leftIcon: "search", placeholder: "Filter...", rightElement: this.maybeRenderClearButton(listProps.query) }, inputProps, { inputRef: this.refHandlers.input, onChange: listProps.handleQueryChange, value: listProps.query })));
const input = (React.createElement(InputGroup, Object.assign({ leftIcon: "search", placeholder: "Filter...", rightElement: this.maybeRenderClearButton(listProps.query) }, inputProps, { inputRef: this.handleInputRef, onChange: listProps.handleQueryChange, value: listProps.query })));
const { handleKeyDown, handleKeyUp } = listProps;

@@ -84,3 +77,3 @@ return (React.createElement(Popover, Object.assign({ autoFocus: false, enforceFocus: false, isOpen: this.state.isOpen, disabled: disabled, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: this.handlePopoverOpening, onOpened: this.handlePopoverOpened, onClosing: this.handlePopoverClosing }),

if (inputProps.autoFocus !== false) {
getRef(this.inputEl)?.focus();
getRef(this.inputElement)?.focus();
}

@@ -109,3 +102,3 @@ });

const { filterable, inputProps, popoverProps, ...restProps } = this.props;
return (React.createElement(this.TypedQueryList, Object.assign({}, restProps, { onItemSelect: this.handleItemSelect, ref: this.refHandlers.queryList, renderer: this.renderQueryList })));
return (React.createElement(this.TypedQueryList, Object.assign({}, restProps, { onItemSelect: this.handleItemSelect, ref: this.handleQueryListRef, renderer: this.renderQueryList })));
}

@@ -112,0 +105,0 @@ componentDidUpdate(_prevProps, prevState) {

/// <reference types="react" />
import { AbstractPureComponent2, HTMLInputProps, IInputGroupProps, IPopoverProps } from "@blueprintjs/core";
import { AbstractPureComponent2, IInputGroupProps2, IPopoverProps, IRefObject } from "@blueprintjs/core";
import { IListItemsProps } from "../../common";

@@ -7,2 +7,3 @@ export interface ISuggestProps<T> extends IListItemsProps<T> {

* Whether the popover should close after selecting an item.
*
* @default true

@@ -23,3 +24,3 @@ */

*/
inputProps?: IInputGroupProps & HTMLInputProps;
inputProps?: IInputGroupProps2;
/** Custom renderer to transform an item into a string for the input value. */

@@ -53,2 +54,3 @@ inputValueRenderer: (item: T) => string;

* the popover closes_. The query will also be reset to the empty string.
*
* @default false

@@ -68,5 +70,6 @@ */

private TypedQueryList;
private inputEl;
inputElement: HTMLInputElement | IRefObject<HTMLInputElement> | null;
private queryList;
private refHandlers;
private handleInputRef;
private handleQueryListRef;
render(): JSX.Element;

@@ -73,0 +76,0 @@ componentDidUpdate(_prevProps: ISuggestProps<T>, prevState: ISuggestState<T>): void;

@@ -18,3 +18,3 @@ /*

import * as React from "react";
import { AbstractPureComponent2, DISPLAYNAME_PREFIX, getRef, InputGroup, isRefObject, Keys, Popover, PopoverInteractionKind, Position, } from "@blueprintjs/core";
import { AbstractPureComponent2, DISPLAYNAME_PREFIX, getRef, InputGroup, Keys, Popover, PopoverInteractionKind, Position, refHandler, } from "@blueprintjs/core";
import { Classes } from "../../common";

@@ -30,13 +30,6 @@ import { QueryList } from "../query-list/queryList";

this.TypedQueryList = QueryList.ofType();
this.inputEl = null;
this.inputElement = null;
this.queryList = null;
this.refHandlers = {
input: isRefObject(this.props.inputProps?.inputRef)
? (this.inputEl = this.props.inputProps.inputRef)
: (ref) => {
this.inputEl = ref;
this.props.inputProps?.inputRef?.(ref);
},
queryList: (ref) => (this.queryList = ref),
};
this.handleInputRef = refHandler(this, "inputElement", this.props.inputProps?.inputRef);
this.handleQueryListRef = (ref) => (this.queryList = ref);
this.renderQueryList = (listProps) => {

@@ -60,3 +53,3 @@ const { fill, inputProps = {}, popoverProps = {} } = this.props;

return (React.createElement(Popover, Object.assign({ autoFocus: false, enforceFocus: false, isOpen: isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), interactionKind: PopoverInteractionKind.CLICK, onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.SELECT_POPOVER, popoverProps.popoverClassName), onOpening: this.handlePopoverOpening, onOpened: this.handlePopoverOpened }),
React.createElement(InputGroup, Object.assign({ autoComplete: autoComplete, disabled: this.props.disabled }, inputProps, { inputRef: this.refHandlers.input, onChange: listProps.handleQueryChange, onFocus: this.handleInputFocus, onKeyDown: this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })),
React.createElement(InputGroup, Object.assign({ autoComplete: autoComplete, disabled: this.props.disabled }, inputProps, { inputRef: this.handleInputRef, onChange: listProps.handleQueryChange, onFocus: this.handleInputFocus, onKeyDown: this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: this.getTargetKeyUpHandler(handleKeyUp), placeholder: inputPlaceholder, value: inputValue })),
React.createElement("div", { onKeyDown: handleKeyDown, onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -67,3 +60,3 @@ };

this.requestAnimationFrame(() => {
const input = getRef(this.inputEl);
const input = getRef(this.inputElement);
input?.setSelectionRange(0, input.value.length);

@@ -83,3 +76,3 @@ });

if (!this.props.closeOnSelect) {
getRef(this.inputEl)?.focus();
getRef(this.inputElement)?.focus();
this.selectText();

@@ -89,3 +82,3 @@ nextOpenState = true;

else {
getRef(this.inputEl)?.blur();
getRef(this.inputElement)?.blur();
nextOpenState = false;

@@ -109,4 +102,4 @@ }

this.handlePopoverInteraction = (nextOpenState) => this.requestAnimationFrame(() => {
const isInputFocused = getRef(this.inputEl) === document.activeElement;
if (this.inputEl != null && !isInputFocused) {
const isInputFocused = getRef(this.inputElement) === document.activeElement;
if (this.inputElement != null && !isInputFocused) {
// the input is no longer focused, we should close the popover

@@ -138,3 +131,3 @@ this.setState({ isOpen: false });

if (which === Keys.ESCAPE || which === Keys.TAB) {
getRef(this.inputEl)?.blur();
getRef(this.inputElement)?.blur();
this.setState({ isOpen: false });

@@ -169,3 +162,3 @@ }

const { disabled, inputProps, popoverProps, ...restProps } = this.props;
return (React.createElement(this.TypedQueryList, Object.assign({}, restProps, { initialActiveItem: this.props.selectedItem ?? undefined, onItemSelect: this.handleItemSelect, ref: this.refHandlers.queryList, renderer: this.renderQueryList })));
return (React.createElement(this.TypedQueryList, Object.assign({}, restProps, { initialActiveItem: this.props.selectedItem ?? undefined, onItemSelect: this.handleItemSelect, ref: this.handleQueryListRef, renderer: this.renderQueryList })));
}

@@ -172,0 +165,0 @@ componentDidUpdate(_prevProps, prevState) {

{
"name": "@blueprintjs/select",
"version": "3.15.0",
"version": "3.15.1",
"description": "Components related to selecting items from a list",

@@ -38,3 +38,3 @@ "main": "lib/cjs/index.js",

"dependencies": {
"@blueprintjs/core": "^3.36.0",
"@blueprintjs/core": "^3.37.0",
"classnames": "^2.2",

@@ -48,12 +48,12 @@ "tslib": "~1.13.0"

"devDependencies": {
"@blueprintjs/karma-build-scripts": "^1.0.3",
"@blueprintjs/node-build-scripts": "^1.4.0",
"@blueprintjs/karma-build-scripts": "^1.1.0",
"@blueprintjs/node-build-scripts": "^1.5.0",
"enzyme": "^3.11.0",
"karma": "^5.2.2",
"mocha": "^8.1.3",
"karma": "^5.2.3",
"mocha": "^8.2.1",
"npm-run-all": "^4.1.5",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-test-renderer": "^16.13.1",
"typescript": "~4.0.3",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-test-renderer": "^16.14.0",
"typescript": "~4.1.2",
"webpack-cli": "^3.3.12"

@@ -60,0 +60,0 @@ },

@@ -17,2 +17,4 @@ /*

import { IRef } from "@blueprintjs/core";
import { ICreateNewItem } from "./listItemsUtils";

@@ -56,3 +58,3 @@

*/
itemsParentRef: (ref: HTMLElement | null) => void;
itemsParentRef: IRef<HTMLUListElement>;

@@ -68,2 +70,3 @@ /**

* Call this function to render the "create new item" view component.
*
* @returns null when creating a new item is not available, and undefined if the createNewItemRenderer returns undefined

@@ -70,0 +73,0 @@ */

@@ -18,2 +18,3 @@ /*

import { IProps, Utils } from "@blueprintjs/core";
import { ItemListRenderer } from "./itemListRenderer";

@@ -26,2 +27,3 @@ import { ItemRenderer } from "./itemRenderer";

* Equality test comparator to determine if two {@link IListItemsProps} items are equivalent.
*
* @return `true` if the two items are equivalent.

@@ -188,2 +190,3 @@ */

* last. Only relevant when `createNewItemRenderer` is defined.
*
* @default 'last'

@@ -196,2 +199,3 @@ */

* time the query changes_ (via prop or by user input).
*
* @default true

@@ -204,2 +208,3 @@ */

* an item is selected_. The query will also be reset to the empty string.
*
* @default false

@@ -215,2 +220,3 @@ */

* `activeItem` prop is omitted (uncontrolled behavior).
*
* @default true

@@ -231,2 +237,3 @@ */

* for equality between two items.
*
* @return `true` if the two items are equivalent according to `itemsEqualProp`.

@@ -233,0 +240,0 @@ */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc