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.14.1 to 3.14.2

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 R})),n.d(t,"QueryList",(function(){return E})),n.d(t,"getFirstEnabledItem",(function(){return L})),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),E=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);return null==l&&null==o?null:g.createElement(i.Menu,{ulRef:e.itemsParentRef},l,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:T(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:L(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||T(y(this.state.activeItem),p,n.itemDisabled))&&this.setActiveItem(L(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))return this.itemsParentRef.children.item(this.state.filteredItems.length);var t=this.getActiveIndex();return this.itemsParentRef.children.item(t)}},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:C(e.paddingBottom),paddingTop:C(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 L(this.state.filteredItems,this.props.itemDisabled,e,t)},t.prototype.isCreateItemRendered=function(){return this.canCreateItems()&&""!==this.state.query&&!this.wouldCreatedItemMatchSomeExistingItem()},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 C(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 T(e,t,n){return null!=n&&null!=e&&(i.Utils.isFunction(n)?n(e,t):!!e[n])}function L(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,!T(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 R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TypedQueryList=E.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.initialContent,n=void 0===t?null:t,r=(e.isOpen,e.inputProps,e.overlayProps,Object(I.__rest)(e,["initialContent","isOpen","inputProps","overlayProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},r,{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=E.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,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.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=E.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=n.props.inputProps;!1!==(void 0===e?{}:e).autoFocus&&null!=n.inputEl&&Object(i.getRef)(n.inputEl).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=E.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,E=d?n.props.inputValueRenderer(d):"",C=c&&E?E:O,_=c?e.query:E||(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:C,value:_})),g.createElement("div",{onKeyDown:v,onKeyUp:m},e.itemList))},n.selectText=function(){n.requestAnimationFrame((function(){if(null!=n.inputEl){var e=Object(i.getRef)(n.inputEl);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;n.props.closeOnSelect?(null!=n.inputEl&&Object(i.getRef)(n.inputEl).blur(),s=!1):(null!=n.inputEl&&Object(i.getRef)(n.inputEl).focus(),n.selectText(),s=!0),void 0===n.props.selectedItem?n.setState({isOpen:s,selectedItem:e}):n.setState({isOpen:s}),null===(o=(r=n.props).onItemSelect)||void 0===o||o.call(r,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=t.which;s===i.Keys.ESCAPE||s===i.Keys.TAB?(null!=n.inputEl&&Object(i.getRef)(n.inputEl).blur(),n.setState({isOpen:!1})):n.props.openOnKeyDown&&s!==i.Keys.BACKSPACE&&s!==i.Keys.ARROW_LEFT&&s!==i.Keys.ARROW_RIGHT&&n.setState({isOpen:!0}),n.state.isOpen&&(null==e||e(t)),null===(o=null===(r=n.props.inputProps)||void 0===r?void 0:r.onKeyDown)||void 0===o||o.call(r,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 f})),n.d(t,"isCreateNewItem",(function(){return h})),n.d(t,"getActiveItem",(function(){return y})),n.d(t,"Omnibar",(function(){return R})),n.d(t,"QueryList",(function(){return E})),n.d(t,"getFirstEnabledItem",(function(){return L})),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),E=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);return null==l&&null==o?null:g.createElement(i.Menu,{ulRef:e.itemsParentRef},l,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:T(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:L(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||T(y(this.state.activeItem),p,n.itemDisabled))&&this.setActiveItem(L(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))return this.itemsParentRef.children.item(this.state.filteredItems.length);var t=this.getActiveIndex();return this.itemsParentRef.children.item(t)}},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:C(e.paddingBottom),paddingTop:C(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 L(this.state.filteredItems,this.props.itemDisabled,e,t)},t.prototype.isCreateItemRendered=function(){return this.canCreateItems()&&""!==this.state.query&&!this.wouldCreatedItemMatchSomeExistingItem()},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 C(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 T(e,t,n){return null!=n&&null!=e&&(i.Utils.isFunction(n)?n(e,t):!!e[n])}function L(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,!T(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 R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TypedQueryList=E.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.initialContent,n=void 0===t?null:t,r=(e.isOpen,e.inputProps,e.overlayProps,Object(I.__rest)(e,["initialContent","isOpen","inputProps","overlayProps"]));return g.createElement(this.TypedQueryList,Object(I.__assign)({},r,{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=E.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,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.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=E.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=E.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,E=d?n.props.inputValueRenderer(d):"",C=c&&E?E:O,_=c?e.query:E||(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:C,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)}])}));

@@ -90,6 +90,7 @@ "use strict";

_this.requestAnimationFrame(function () {
var _a = _this.props.inputProps, inputProps = _a === void 0 ? {} : _a;
var _a;
var _b = _this.props.inputProps, inputProps = _b === void 0 ? {} : _b;
// autofocus is enabled by default
if (inputProps.autoFocus !== false && _this.inputEl != null) {
core_1.getRef(_this.inputEl).focus();
if (inputProps.autoFocus !== false) {
(_a = core_1.getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.focus();
}

@@ -96,0 +97,0 @@ });

@@ -71,6 +71,4 @@ "use strict";

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

@@ -88,8 +86,6 @@ };

_this.handleItemSelect = function (item, event) {
var _a, _b;
var _a, _b, _c, _d;
var nextOpenState;
if (!_this.props.closeOnSelect) {
if (_this.inputEl != null) {
core_1.getRef(_this.inputEl).focus();
}
(_a = core_1.getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.focus();
_this.selectText();

@@ -99,5 +95,3 @@ nextOpenState = true;

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

@@ -116,3 +110,3 @@ }

}
(_b = (_a = _this.props).onItemSelect) === null || _b === void 0 ? void 0 : _b.call(_a, item, event);
(_d = (_c = _this.props).onItemSelect) === null || _d === void 0 ? void 0 : _d.call(_c, item, event);
};

@@ -151,3 +145,3 @@ // Popover interaction kind is CLICK, so this only handles click events.

return function (evt) {
var _a, _b;
var _a, _b, _c;
// HACKHACK: https://github.com/palantir/blueprint/issues/4165

@@ -157,5 +151,3 @@ // eslint-disable-next-line deprecation/deprecation

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

@@ -172,3 +164,3 @@ }

}
(_b = (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, evt);
(_c = (_b = _this.props.inputProps) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, evt);
};

@@ -175,0 +167,0 @@ };

@@ -87,6 +87,7 @@ /*

_this.requestAnimationFrame(function () {
var _a = _this.props.inputProps, inputProps = _a === void 0 ? {} : _a;
var _a;
var _b = _this.props.inputProps, inputProps = _b === void 0 ? {} : _b;
// autofocus is enabled by default
if (inputProps.autoFocus !== false && _this.inputEl != null) {
getRef(_this.inputEl).focus();
if (inputProps.autoFocus !== false) {
(_a = getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.focus();
}

@@ -93,0 +94,0 @@ });

@@ -68,6 +68,4 @@ /*

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

@@ -85,8 +83,6 @@ };

_this.handleItemSelect = function (item, event) {
var _a, _b;
var _a, _b, _c, _d;
var nextOpenState;
if (!_this.props.closeOnSelect) {
if (_this.inputEl != null) {
getRef(_this.inputEl).focus();
}
(_a = getRef(_this.inputEl)) === null || _a === void 0 ? void 0 : _a.focus();
_this.selectText();

@@ -96,5 +92,3 @@ nextOpenState = true;

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

@@ -113,3 +107,3 @@ }

}
(_b = (_a = _this.props).onItemSelect) === null || _b === void 0 ? void 0 : _b.call(_a, item, event);
(_d = (_c = _this.props).onItemSelect) === null || _d === void 0 ? void 0 : _d.call(_c, item, event);
};

@@ -148,3 +142,3 @@ // Popover interaction kind is CLICK, so this only handles click events.

return function (evt) {
var _a, _b;
var _a, _b, _c;
// HACKHACK: https://github.com/palantir/blueprint/issues/4165

@@ -154,5 +148,3 @@ // eslint-disable-next-line deprecation/deprecation

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

@@ -169,3 +161,3 @@ }

}
(_b = (_a = _this.props.inputProps) === null || _a === void 0 ? void 0 : _a.onKeyDown) === null || _b === void 0 ? void 0 : _b.call(_a, evt);
(_c = (_b = _this.props.inputProps) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, evt);
};

@@ -172,0 +164,0 @@ };

@@ -81,4 +81,4 @@ /*

// autofocus is enabled by default
if (inputProps.autoFocus !== false && this.inputEl != null) {
getRef(this.inputEl).focus();
if (inputProps.autoFocus !== false) {
getRef(this.inputEl)?.focus();
}

@@ -85,0 +85,0 @@ });

@@ -64,6 +64,4 @@ /*

this.requestAnimationFrame(() => {
if (this.inputEl != null) {
const input = getRef(this.inputEl);
input.setSelectionRange(0, input.value.length);
}
const input = getRef(this.inputEl);
input?.setSelectionRange(0, input.value.length);
});

@@ -82,5 +80,3 @@ };

if (!this.props.closeOnSelect) {
if (this.inputEl != null) {
getRef(this.inputEl).focus();
}
getRef(this.inputEl)?.focus();
this.selectText();

@@ -90,5 +86,3 @@ nextOpenState = true;

else {
if (this.inputEl != null) {
getRef(this.inputEl).blur();
}
getRef(this.inputEl)?.blur();
nextOpenState = false;

@@ -140,5 +134,3 @@ }

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

@@ -145,0 +137,0 @@ }

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

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

"dependencies": {
"@blueprintjs/core": "^3.32.1",
"@blueprintjs/core": "^3.33.0",
"classnames": "^2.2",

@@ -41,0 +41,0 @@ "tslib": "~1.13.0"

{
"extends": "../../../config/tsconfig.base",
"compilerOptions": {
"outDir": "../lib/esm",
"strict": true
"outDir": "../lib/esm"
}
}

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