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
226
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.7.0 to 3.8.0

28

dist/select.bundle.js

@@ -1,6 +0,16 @@

!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 o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));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=4)}([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(5)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"MULTISELECT",function(){return s}),n.d(r,"MULTISELECT_POPOVER",function(){return p}),n.d(r,"OMNIBAR",function(){return u}),n.d(r,"OMNIBAR_OVERLAY",function(){return a}),n.d(r,"SELECT",function(){return l}),n.d(r,"SELECT_POPOVER",function(){return c});var o=n(0),i=o.Classes.getClassNamespace(),s=i+"-multi-select",p=s+"-popover",u=i+"-omnibar",a=u+"-overlay",l=i+"-select",c=l+"-popover";
!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 o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));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=4)}([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(5)},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"MULTISELECT",function(){return s}),n.d(r,"MULTISELECT_POPOVER",function(){return p}),n.d(r,"OMNIBAR",function(){return a}),n.d(r,"OMNIBAR_OVERLAY",function(){return u}),n.d(r,"SELECT",function(){return l}),n.d(r,"SELECT_POPOVER",function(){return c});var o=n(0),i=o.Classes.getClassNamespace(),s=i+"-multi-select",p=s+"-popover",a=i+"-omnibar",u=a+"-overlay",l=i+"-select",c=l+"-popover";
/*!
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -11,3 +21,13 @@ function d(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:o.Utils.isFunction(e)?e(t,n):t[e]===n[e]}

*
* Licensed under the terms of the LICENSE file distributed with this project.
*/function f(){return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"}}function v(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 h(e){return null==e||v(e)?null:e}var y=n(1),I=n(3),P=n.n(I),g=n(2),O=function(e){function t(t,n){var r=e.call(this,t,n)||this;r.refHandlers={itemsParent:function(e){return r.itemsParentRef=e}},r.shouldCheckActiveItemInViewport=!1,r.expectedNextActiveItem=null,r.renderItemList=function(e){var t=r.props,n=t.initialContent,i=t.noResults,s=d(e,r.isCreateItemRendered()?null:i,n),p=r.isCreateItemRendered()?r.renderCreateItemMenuItem(r.state.query):null;return g.createElement(o.Menu,{ulRef:e.itemsParentRef},s,p)},r.renderItem=function(e,t){var n=r.state,o=n.activeItem,i=n.query,s=r.state.filteredItems.indexOf(e)>=0,p={active:m(r.props.itemsEqual,h(o),e),disabled:E(e,t,r.props.itemDisabled),matchesPredicate:s};return r.props.itemRenderer(e,{handleClick:function(t){return r.handleItemSelect(e,t)},index:t,modifiers:p,query:i})},r.renderCreateItemMenuItem=function(e){var t=v(r.state.activeItem);return o.Utils.safeInvoke(r.props.createNewItemRenderer,e,t,function(t){r.handleItemCreate(e,t)})},r.handleItemCreate=function(e,t){var n=o.Utils.safeInvoke(r.props.createNewItemFromQuery,e);null!=n&&(o.Utils.safeInvoke(r.props.onItemSelect,n,t),r.setQuery("",!0))},r.handleItemSelect=function(e,t){r.setActiveItem(e),o.Utils.safeInvoke(r.props.onItemSelect,e,t),r.props.resetOnSelect&&r.setQuery("",!0)},r.handleKeyDown=function(e){var t=e.keyCode;if(t===o.Keys.ARROW_UP||t===o.Keys.ARROW_DOWN){e.preventDefault();var n=r.getNextActiveItem(t===o.Keys.ARROW_UP?-1:1);null!=n&&r.setActiveItem(n)}o.Utils.safeInvoke(r.props.onKeyDown,e)},r.handleKeyUp=function(e){var t=r.props.onKeyUp,n=r.state.activeItem;e.keyCode===o.Keys.ENTER&&(e.preventDefault(),null==n||v(n)?r.handleItemCreate(r.state.query,e):r.handleItemSelect(n,e)),o.Utils.safeInvoke(t,e)},r.handleQueryChange=function(e){var t=null==e?"":e.target.value;r.setQuery(t),o.Utils.safeInvoke(r.props.onQueryChange,t,e)};var i=t.query,s=void 0===i?"":i,p=o.Utils.safeInvoke(t.createNewItemFromQuery,s),u=_(s,t);return r.state={activeItem:void 0!==r.props.activeItem?r.props.activeItem:L(u,t.itemDisabled),createNewItem:p,filteredItems:u,query:s},r}return y.__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,o=e.itemListRenderer,i=void 0===o?this.renderItemList:o,s=this.state,p=(s.createNewItem,y.__rest(s,["createNewItem"]));return r(y.__assign({},p,{className:t,handleItemSelect:this.handleItemSelect,handleKeyDown:this.handleKeyDown,handleKeyUp:this.handleKeyUp,handleQueryChange:this.handleQueryChange,itemList:i(y.__assign({},p,{items:n,itemsParentRef:this.refHandlers.itemsParent,renderItem:this.renderItem}))}))},t.prototype.componentWillReceiveProps=function(e){void 0!==e.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:e.activeItem})),null!=e.query&&this.setQuery(e.query,e.resetOnQuery,e)},t.prototype.componentDidUpdate=function(e){var t=this;o.Utils.shallowCompareKeys(this.props,e,{include:["items","itemListPredicate","itemPredicate"]})||this.setQuery(this.state.query),this.shouldCheckActiveItemInViewport&&(requestAnimationFrame(function(){return t.scrollActiveItemIntoView()}),this.shouldCheckActiveItemInViewport=!1)},t.prototype.scrollActiveItemIntoView=function(){var e=!1!==this.props.scrollToActiveItem,t=!m(this.props.itemsEqual,h(this.expectedNextActiveItem),h(this.props.activeItem));if(this.expectedNextActiveItem=null,e||!t){var n=this.getActiveElement();if(null!=this.itemsParentRef&&null!=n){var r=n.offsetTop,o=n.offsetHeight,i=this.itemsParentRef,s=i.offsetTop,p=i.scrollTop,u=i.clientHeight,a=this.getItemsParentPadding(),l=a.paddingTop,c=r+o+a.paddingBottom-s,d=r-l-s;c>=p+u?this.itemsParentRef.scrollTop=c+o-u:d<=p&&(this.itemsParentRef.scrollTop=d-o)}}},t.prototype.setQuery=function(e,t,n){void 0===t&&(t=this.props.resetOnQuery),void 0===n&&(n=this.props);var r=n.createNewItemFromQuery;this.shouldCheckActiveItemInViewport=!0;var i=e!==this.state.query;i&&o.Utils.safeInvoke(n.onQueryChange,e);var s=_(e,n),p=null!=r&&""!==e?r(e):void 0;this.setState({createNewItem:p,filteredItems:s,query:e});var u=this.getActiveIndex(s),a=t||u<0||E(h(this.state.activeItem),u,n.itemDisabled);i&&a&&this.setActiveItem(L(s,n.itemDisabled))},t.prototype.getActiveElement=function(){var e=this.state.activeItem;if(null!=this.itemsParentRef){if(v(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||v(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.setActiveItem=function(e){this.expectedNextActiveItem=e,void 0===this.props.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:e})),v(e)?o.Utils.safeInvoke(this.props.onActiveItemChange,null,!0):o.Utils.safeInvoke(this.props.onActiveItemChange,e,!1)},t.prototype.isCreateItemRendered=function(){return null!=this.props.createNewItemFromQuery&&null!=this.props.createNewItemRenderer&&""!==this.state.query&&!this.wouldCreatedItemMatchSomeExistingItem()},t.prototype.wouldCreatedItemMatchSomeExistingItem=function(){var e=this;return this.state.filteredItems.some(function(t){return m(e.props.itemsEqual,t,e.state.createNewItem)})},t.displayName=o.DISPLAYNAME_PREFIX+".QueryList",t.defaultProps={resetOnQuery:!0},t}(g.Component);function C(e){return null==e?0:parseInt(e.slice(0,-2),10)}function _(e,t){var n=t.items,r=t.itemPredicate,i=t.itemListPredicate;return o.Utils.isFunction(i)?i(e,n):o.Utils.isFunction(r)?n.filter(function(t,n){return r(e,t,n)}):n}function E(e,t,n){return null!=n&&null!=e&&(o.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 o,i,s,p=r,u=e.length-1;do{if(s=u,!E(e[p=(o=p+n)<(i=0)?s:o>s?i:o],p,t))return e[p]}while(p!==r);return null}var S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TypedQueryList=O.ofType(),t.queryList=null,t.refHandlers={queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n=t.props,i=n.inputProps,s=void 0===i?{}:i,p=n.isOpen,u=n.overlayProps,a=void 0===u?{}:u,l=e.handleKeyDown,c=e.handleKeyUp,d=p?{onKeyDown:l,onKeyUp:c}:{};return g.createElement(o.Overlay,y.__assign({hasBackdrop:!0},a,{isOpen:p,className:P()(r.OMNIBAR_OVERLAY,a.className),onClose:t.handleOverlayClose}),g.createElement("div",y.__assign({className:P()(r.OMNIBAR,e.className)},d),g.createElement(o.InputGroup,y.__assign({autoFocus:!0,large:!0,leftIcon:"search",placeholder:"Search..."},s,{onChange:e.handleQueryChange,value:e.query})),e.itemList))},t.handleOverlayClose=function(e){o.Utils.safeInvokeMember(t.props.overlayProps,"onClose",e),o.Utils.safeInvoke(t.props.onClose,e)},t}return y.__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,y.__rest(e,["initialContent","isOpen","inputProps","overlayProps"]));return g.createElement(this.TypedQueryList,y.__assign({},r,{initialContent:n,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.displayName=o.DISPLAYNAME_PREFIX+".Omnibar",t}(g.PureComponent),w=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=O.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){t.input=e,o.Utils.safeInvokeMember(t.props.tagInputProps,"inputRef",e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n=t.props,i=n.tagInputProps,s=void 0===i?{}:i,p=n.popoverProps,u=void 0===p?{}:p,a=n.selectedItems,l=void 0===a?[]:a,c=n.placeholder,d=e.handleKeyDown,m=e.handleKeyUp;return g.createElement(o.Popover,y.__assign({autoFocus:!1,canEscapeKeyClose:!0,enforceFocus:!1,isOpen:t.state.isOpen,position:o.Position.BOTTOM_LEFT},u,{className:P()(e.className,u.className),onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.MULTISELECT_POPOVER,u.popoverClassName),onOpened:t.handlePopoverOpened}),g.createElement("div",{onKeyDown:t.getTargetKeyDownHandler(d),onKeyUp:t.state.isOpen?m:void 0},g.createElement(o.TagInput,y.__assign({placeholder:c},s,{className:P()(r.MULTISELECT,s.className),inputRef:t.refHandlers.input,inputValue:e.query,onInputChange:e.handleQueryChange,values:l.map(t.props.tagRenderer)}))),g.createElement("div",{onKeyDown:t.getTargetKeyDownHandler(d),onKeyUp:m},e.itemList))},t.handleItemSelect=function(e,n){null!=t.input&&t.input.focus(),o.Utils.safeInvoke(t.props.onItemSelect,e,n)},t.handleQueryChange=function(e,n){t.setState({isOpen:e.length>0||!t.props.openOnKeyDown}),o.Utils.safeInvoke(t.props.onQueryChange,e,n)},t.handlePopoverInteraction=function(e){return requestAnimationFrame(function(){null!=t.input&&t.input!==document.activeElement?t.setState({isOpen:!1}):t.props.openOnKeyDown||t.setState({isOpen:!0}),o.Utils.safeInvokeMember(t.props.popoverProps,"onInteraction",e)})},t.handlePopoverOpened=function(e){null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpened",e)},t.getTargetKeyDownHandler=function(e){return function(n){var r=n.which;r===o.Keys.ESCAPE||r===o.Keys.TAB?(null!=t.input&&t.input.blur(),t.setState({isOpen:!1})):r!==o.Keys.BACKSPACE&&r!==o.Keys.ARROW_LEFT&&r!==o.Keys.ARROW_RIGHT&&t.setState({isOpen:!0}),t.state.isOpen&&o.Utils.safeInvoke(e,n)}},t}return y.__extends(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.openOnKeyDown,e.popoverProps,e.tagInputProps,y.__rest(e,["openOnKeyDown","popoverProps","tagInputProps"]));return g.createElement(this.TypedQueryList,y.__assign({},t,{onItemSelect:this.handleItemSelect,onQueryChange:this.handleQueryChange,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.displayName=o.DISPLAYNAME_PREFIX+".MultiSelect",t.defaultProps={placeholder:"Search..."},t}(g.PureComponent),A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isOpen:!1},t.TypedQueryList=O.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){t.input=e,o.Utils.safeInvokeMember(t.props.inputProps,"inputRef",e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n=t.props,i=n.filterable,s=void 0===i||i,p=n.disabled,u=void 0!==p&&p,a=n.inputProps,l=void 0===a?{}:a,c=n.popoverProps,d=void 0===c?{}:c,m=g.createElement(o.InputGroup,y.__assign({leftIcon:"search",placeholder:"Filter...",rightElement:t.maybeRenderClearButton(e.query)},l,{inputRef:t.refHandlers.input,onChange:e.handleQueryChange,value:e.query})),f=e.handleKeyDown,v=e.handleKeyUp;return g.createElement(o.Popover,y.__assign({autoFocus:!1,enforceFocus:!1,isOpen:t.state.isOpen,disabled:u,position:o.Position.BOTTOM_LEFT},d,{className:P()(e.className,d.className),onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,d.popoverClassName),onOpening:t.handlePopoverOpening,onOpened:t.handlePopoverOpened,onClosing:t.handlePopoverClosing}),g.createElement("div",{onKeyDown:t.state.isOpen?f:t.handleTargetKeyDown,onKeyUp:t.state.isOpen?v:void 0},t.props.children),g.createElement("div",{onKeyDown:f,onKeyUp:v},s?m:void 0,e.itemList))},t.handleTargetKeyDown=function(e){e.which!==o.Keys.ARROW_UP&&e.which!==o.Keys.ARROW_DOWN||(e.preventDefault(),t.setState({isOpen:!0}))},t.handleItemSelect=function(e,n){t.setState({isOpen:!1}),o.Utils.safeInvoke(t.props.onItemSelect,e,n)},t.handlePopoverInteraction=function(e){t.setState({isOpen:e}),o.Utils.safeInvokeMember(t.props.popoverProps,"onInteraction",e)},t.handlePopoverOpening=function(e){t.previousFocusedElement=document.activeElement,t.props.resetOnClose&&t.resetQuery(),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpening",e)},t.handlePopoverOpened=function(e){null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),requestAnimationFrame(function(){var e=t.props.inputProps;!1!==(void 0===e?{}:e).autoFocus&&null!=t.input&&t.input.focus()}),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpened",e)},t.handlePopoverClosing=function(e){requestAnimationFrame(function(){void 0!==t.previousFocusedElement&&(t.previousFocusedElement.focus(),t.previousFocusedElement=void 0)}),o.Utils.safeInvokeMember(t.props.popoverProps,"onClosing",e)},t.resetQuery=function(){return t.queryList&&t.queryList.setQuery("",!0)},t}return y.__extends(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.filterable,e.inputProps,e.popoverProps,y.__rest(e,["filterable","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,y.__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(o.Button,{icon:"cross",minimal:!0,onClick:this.resetQuery}):void 0},t.displayName=o.DISPLAYNAME_PREFIX+".Select",t}(g.PureComponent),R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isOpen:null!=t.props.popoverProps&&t.props.popoverProps.isOpen||!1,selectedItem:t.getInitialSelectedItem()},t.TypedQueryList=O.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){t.input=e,o.Utils.safeInvokeMember(t.props.inputProps,"inputRef",e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n=t.props,i=n.inputProps,s=void 0===i?{}:i,p=n.popoverProps,u=void 0===p?{}:p,a=t.state,l=a.isOpen,c=a.selectedItem,d=e.handleKeyDown,m=e.handleKeyUp,f=s.placeholder,v=void 0===f?"Search...":f,h=c?t.props.inputValueRenderer(c):"",I=l&&h?h:v,O=l?e.query:h||(t.props.resetOnClose?"":e.query);return g.createElement(o.Popover,y.__assign({autoFocus:!1,enforceFocus:!1,isOpen:l,position:o.Position.BOTTOM_LEFT},u,{className:P()(e.className,u.className),onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,u.popoverClassName),onOpening:t.handlePopoverOpening,onOpened:t.handlePopoverOpened}),g.createElement(o.InputGroup,y.__assign({disabled:t.props.disabled},s,{inputRef:t.refHandlers.input,onChange:e.handleQueryChange,onFocus:t.handleInputFocus,onKeyDown:t.getTargetKeyDownHandler(d),onKeyUp:t.getTargetKeyUpHandler(m),placeholder:I,value:O})),g.createElement("div",{onKeyDown:d,onKeyUp:m},e.itemList))},t.selectText=function(){requestAnimationFrame(function(){null!=t.input&&t.input.setSelectionRange(0,t.input.value.length)})},t.handleInputFocus=function(e){t.selectText(),t.props.openOnKeyDown||t.setState({isOpen:!0}),o.Utils.safeInvokeMember(t.props.inputProps,"onFocus",e)},t.handleItemSelect=function(e,n){var r;t.props.closeOnSelect?(null!=t.input&&t.input.blur(),r=!1):(null!=t.input&&t.input.focus(),t.selectText(),r=!0),void 0===t.props.selectedItem?t.setState({isOpen:r,selectedItem:e}):t.setState({isOpen:r}),o.Utils.safeInvoke(t.props.onItemSelect,e,n)},t.handlePopoverInteraction=function(e){return requestAnimationFrame(function(){null!=t.input&&t.input!==document.activeElement&&t.setState({isOpen:!1}),o.Utils.safeInvokeMember(t.props.popoverProps,"onInteraction",e)})},t.handlePopoverOpening=function(e){t.props.resetOnClose&&t.queryList&&t.queryList.setQuery("",!0),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpening",e)},t.handlePopoverOpened=function(e){null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpened",e)},t.getTargetKeyDownHandler=function(e){return function(n){var r=n.which;r===o.Keys.ESCAPE||r===o.Keys.TAB?(null!=t.input&&t.input.blur(),t.setState({isOpen:!1})):t.props.openOnKeyDown&&r!==o.Keys.BACKSPACE&&r!==o.Keys.ARROW_LEFT&&r!==o.Keys.ARROW_RIGHT&&t.setState({isOpen:!0}),t.state.isOpen&&o.Utils.safeInvoke(e,n),o.Utils.safeInvokeMember(t.props.inputProps,"onKeyDown",n)}},t.getTargetKeyUpHandler=function(e){return function(n){t.state.isOpen&&o.Utils.safeInvoke(e,n),o.Utils.safeInvokeMember(t.props.inputProps,"onKeyUp",n)}},t}return y.__extends(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.disabled,e.inputProps,e.popoverProps,y.__rest(e,["disabled","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,y.__assign({},t,{onItemSelect:this.handleItemSelect,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.prototype.componentWillReceiveProps=function(e){void 0!==e.selectedItem&&e.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:e.selectedItem})},t.prototype.componentDidUpdate=function(e,t){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.displayName=o.DISPLAYNAME_PREFIX+".Suggest",t.defaultProps={closeOnSelect:!0,openOnKeyDown:!1,resetOnClose:!1},t}(g.PureComponent);n.d(t,"Classes",function(){return r}),n.d(t,"renderFilteredItems",function(){return d}),n.d(t,"executeItemsEqual",function(){return m}),n.d(t,"getCreateNewItem",function(){return f}),n.d(t,"isCreateNewItem",function(){return v}),n.d(t,"getActiveItem",function(){return h}),n.d(t,"Omnibar",function(){return S}),n.d(t,"QueryList",function(){return O}),n.d(t,"getFirstEnabledItem",function(){return L}),n.d(t,"MultiSelect",function(){return w}),n.d(t,"Select",function(){return A}),n.d(t,"Suggest",function(){return R})}])});
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function f(){return{__blueprintCreateNewItemBrand:"blueprint-create-new-item"}}function v(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 h(e){return null==e||v(e)?null:e}var y=n(1),I=n(3),P=n.n(I),g=n(2),O=function(e){function t(t,n){var r=e.call(this,t,n)||this;r.refHandlers={itemsParent:function(e){return r.itemsParentRef=e}},r.shouldCheckActiveItemInViewport=!1,r.expectedNextActiveItem=null,r.renderItemList=function(e){var t=r.props,n=t.initialContent,i=t.noResults,s=d(e,r.isCreateItemRendered()?null:i,n),p=r.isCreateItemRendered()?r.renderCreateItemMenuItem(r.state.query):null;return null==s&&null==p?null:g.createElement(o.Menu,{ulRef:e.itemsParentRef},s,p)},r.renderItem=function(e,t){var n=r.state,o=n.activeItem,i=n.query,s=r.state.filteredItems.indexOf(e)>=0,p={active:m(r.props.itemsEqual,h(o),e),disabled:L(e,t,r.props.itemDisabled),matchesPredicate:s};return r.props.itemRenderer(e,{handleClick:function(t){return r.handleItemSelect(e,t)},index:t,modifiers:p,query:i})},r.renderCreateItemMenuItem=function(e){var t=v(r.state.activeItem);return o.Utils.safeInvoke(r.props.createNewItemRenderer,e,t,function(t){r.handleItemCreate(e,t)})},r.handleItemCreate=function(e,t){var n=o.Utils.safeInvoke(r.props.createNewItemFromQuery,e);null!=n&&(o.Utils.safeInvoke(r.props.onItemSelect,n,t),r.setQuery("",!0))},r.handleItemSelect=function(e,t){r.setActiveItem(e),o.Utils.safeInvoke(r.props.onItemSelect,e,t),r.props.resetOnSelect&&r.setQuery("",!0)},r.handlePaste=function(e){for(var t,n=r.props,i=n.createNewItemFromQuery,s=n.onItemsPaste,p=[],a=[],u=0,l=e;u<l.length;u++){var c=l[u],d=_(c,r.props);if(void 0!==d)t=d,a.push(d);else if(r.canCreateItems()){var m=o.Utils.safeInvoke(i,c);void 0!==m&&a.push(m)}else p.push(c)}r.setQuery(p.join(", "),!1),void 0!==t&&r.setActiveItem(t),o.Utils.safeInvoke(s,a)},r.handleKeyDown=function(e){var t=e.keyCode;if(t===o.Keys.ARROW_UP||t===o.Keys.ARROW_DOWN){e.preventDefault();var n=r.getNextActiveItem(t===o.Keys.ARROW_UP?-1:1);null!=n&&r.setActiveItem(n)}o.Utils.safeInvoke(r.props.onKeyDown,e)},r.handleKeyUp=function(e){var t=r.props.onKeyUp,n=r.state.activeItem;e.keyCode===o.Keys.ENTER&&(e.preventDefault(),null==n||v(n)?r.handleItemCreate(r.state.query,e):r.handleItemSelect(n,e)),o.Utils.safeInvoke(t,e)},r.handleQueryChange=function(e){var t=null==e?"":e.target.value;r.setQuery(t),o.Utils.safeInvoke(r.props.onQueryChange,t,e)};var i=t.query,s=void 0===i?"":i,p=o.Utils.safeInvoke(t.createNewItemFromQuery,s),a=E(s,t);return r.state={activeItem:void 0!==r.props.activeItem?r.props.activeItem:S(a,t.itemDisabled),createNewItem:p,filteredItems:a,query:s},r}return y.__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,o=e.itemListRenderer,i=void 0===o?this.renderItemList:o,s=this.state,p=(s.createNewItem,y.__rest(s,["createNewItem"]));return r(y.__assign({},p,{className:t,handleItemSelect:this.handleItemSelect,handleKeyDown:this.handleKeyDown,handleKeyUp:this.handleKeyUp,handlePaste:this.handlePaste,handleQueryChange:this.handleQueryChange,itemList:i(y.__assign({},p,{items:n,itemsParentRef:this.refHandlers.itemsParent,renderItem:this.renderItem}))}))},t.prototype.componentWillReceiveProps=function(e){void 0!==e.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:e.activeItem})),null!=e.query&&this.setQuery(e.query,e.resetOnQuery,e)},t.prototype.componentDidUpdate=function(e){var t=this;o.Utils.shallowCompareKeys(this.props,e,{include:["items","itemListPredicate","itemPredicate"]})||this.setQuery(this.state.query),this.shouldCheckActiveItemInViewport&&(requestAnimationFrame(function(){return t.scrollActiveItemIntoView()}),this.shouldCheckActiveItemInViewport=!1)},t.prototype.scrollActiveItemIntoView=function(){var e=!1!==this.props.scrollToActiveItem,t=!m(this.props.itemsEqual,h(this.expectedNextActiveItem),h(this.props.activeItem));if(this.expectedNextActiveItem=null,e||!t){var n=this.getActiveElement();if(null!=this.itemsParentRef&&null!=n){var r=n.offsetTop,o=n.offsetHeight,i=this.itemsParentRef,s=i.offsetTop,p=i.scrollTop,a=i.clientHeight,u=this.getItemsParentPadding(),l=u.paddingTop,c=r+o+u.paddingBottom-s,d=r-l-s;c>=p+a?this.itemsParentRef.scrollTop=c+o-a:d<=p&&(this.itemsParentRef.scrollTop=d-o)}}},t.prototype.setQuery=function(e,t,n){void 0===t&&(t=this.props.resetOnQuery),void 0===n&&(n=this.props);var r=n.createNewItemFromQuery;this.shouldCheckActiveItemInViewport=!0;var i=e!==this.state.query;i&&o.Utils.safeInvoke(n.onQueryChange,e);var s=E(e,n),p=null!=r&&""!==e?r(e):void 0;this.setState({createNewItem:p,filteredItems:s,query:e});var a=this.getActiveIndex(s),u=t||a<0||L(h(this.state.activeItem),a,n.itemDisabled);i&&u&&this.setActiveItem(S(s,n.itemDisabled))},t.prototype.getActiveElement=function(){var e=this.state.activeItem;if(null!=this.itemsParentRef){if(v(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||v(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 S(this.state.filteredItems,this.props.itemDisabled,e,t)},t.prototype.setActiveItem=function(e){this.expectedNextActiveItem=e,void 0===this.props.activeItem&&(this.shouldCheckActiveItemInViewport=!0,this.setState({activeItem:e})),v(e)?o.Utils.safeInvoke(this.props.onActiveItemChange,null,!0):o.Utils.safeInvoke(this.props.onActiveItemChange,e,!1)},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.displayName=o.DISPLAYNAME_PREFIX+".QueryList",t.defaultProps={resetOnQuery:!0},t}(g.Component);function C(e){return null==e?0:parseInt(e.slice(0,-2),10)}function _(e,t){var n=t.items,r=t.itemPredicate;if(o.Utils.isFunction(r))for(var i=0;i<n.length;i++){var s=n[i];if(r(e,s,i,!0))return s}}function E(e,t){var n=t.items,r=t.itemPredicate,i=t.itemListPredicate;return o.Utils.isFunction(i)?i(e,n):o.Utils.isFunction(r)?n.filter(function(t,n){return r(e,t,n)}):n}function L(e,t,n){return null!=n&&null!=e&&(o.Utils.isFunction(n)?n(e,t):!!e[n])}function S(e,t,n,r){if(void 0===n&&(n=1),void 0===r&&(r=e.length-1),0===e.length)return null;var o,i,s,p=r,a=e.length-1;do{if(s=a,!L(e[p=(o=p+n)<(i=0)?s:o>s?i:o],p,t))return e[p]}while(p!==r);return null}var w=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.TypedQueryList=O.ofType(),t.queryList=null,t.refHandlers={queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n=t.props,i=n.inputProps,s=void 0===i?{}:i,p=n.isOpen,a=n.overlayProps,u=void 0===a?{}:a,l=e.handleKeyDown,c=e.handleKeyUp,d=p?{onKeyDown:l,onKeyUp:c}:{};return g.createElement(o.Overlay,y.__assign({hasBackdrop:!0},u,{isOpen:p,className:P()(r.OMNIBAR_OVERLAY,u.className),onClose:t.handleOverlayClose}),g.createElement("div",y.__assign({className:P()(r.OMNIBAR,e.className)},d),g.createElement(o.InputGroup,y.__assign({autoFocus:!0,large:!0,leftIcon:"search",placeholder:"Search..."},s,{onChange:e.handleQueryChange,value:e.query})),e.itemList))},t.handleOverlayClose=function(e){o.Utils.safeInvokeMember(t.props.overlayProps,"onClose",e),o.Utils.safeInvoke(t.props.onClose,e)},t}return y.__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,y.__rest(e,["initialContent","isOpen","inputProps","overlayProps"]));return g.createElement(this.TypedQueryList,y.__assign({},r,{initialContent:n,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.displayName=o.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=O.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){t.input=e,o.Utils.safeInvokeMember(t.props.tagInputProps,"inputRef",e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n=t.props,i=n.tagInputProps,s=void 0===i?{}:i,p=n.popoverProps,a=void 0===p?{}:p,u=n.selectedItems,l=void 0===u?[]:u,c=n.placeholder,d=e.handlePaste,m=e.handleKeyDown,f=e.handleKeyUp;return g.createElement(o.Popover,y.__assign({autoFocus:!1,canEscapeKeyClose:!0,enforceFocus:!1,isOpen:t.state.isOpen,position:o.Position.BOTTOM_LEFT},a,{className:P()(e.className,a.className),onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.MULTISELECT_POPOVER,a.popoverClassName),onOpened:t.handlePopoverOpened}),g.createElement("div",{onKeyDown:t.getTargetKeyDownHandler(m),onKeyUp:t.state.isOpen?f:void 0},g.createElement(o.TagInput,y.__assign({placeholder:c},s,{className:P()(r.MULTISELECT,s.className),inputRef:t.refHandlers.input,inputValue:e.query,onAdd:function(e,t){"paste"===t&&d(e)},onInputChange:e.handleQueryChange,values:l.map(t.props.tagRenderer)}))),g.createElement("div",{onKeyDown:t.getTargetKeyDownHandler(m),onKeyUp:f},e.itemList))},t.handleItemSelect=function(e,n){null!=t.input&&t.input.focus(),o.Utils.safeInvoke(t.props.onItemSelect,e,n)},t.handleQueryChange=function(e,n){t.setState({isOpen:e.length>0||!t.props.openOnKeyDown}),o.Utils.safeInvoke(t.props.onQueryChange,e,n)},t.handlePopoverInteraction=function(e){return requestAnimationFrame(function(){null!=t.input&&t.input!==document.activeElement?t.setState({isOpen:!1}):t.props.openOnKeyDown||t.setState({isOpen:!0}),o.Utils.safeInvokeMember(t.props.popoverProps,"onInteraction",e)})},t.handlePopoverOpened=function(e){null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpened",e)},t.getTargetKeyDownHandler=function(e){return function(n){var r=n.which;r===o.Keys.ESCAPE||r===o.Keys.TAB?(null!=t.input&&t.input.blur(),t.setState({isOpen:!1})):r!==o.Keys.BACKSPACE&&r!==o.Keys.ARROW_LEFT&&r!==o.Keys.ARROW_RIGHT&&t.setState({isOpen:!0}),t.state.isOpen&&o.Utils.safeInvoke(e,n)}},t}return y.__extends(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.openOnKeyDown,e.popoverProps,e.tagInputProps,y.__rest(e,["openOnKeyDown","popoverProps","tagInputProps"]));return g.createElement(this.TypedQueryList,y.__assign({},t,{onItemSelect:this.handleItemSelect,onQueryChange:this.handleQueryChange,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.displayName=o.DISPLAYNAME_PREFIX+".MultiSelect",t.defaultProps={placeholder:"Search..."},t}(g.PureComponent),R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isOpen:!1},t.TypedQueryList=O.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){t.input=e,o.Utils.safeInvokeMember(t.props.inputProps,"inputRef",e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n=t.props,i=n.filterable,s=void 0===i||i,p=n.disabled,a=void 0!==p&&p,u=n.inputProps,l=void 0===u?{}:u,c=n.popoverProps,d=void 0===c?{}:c,m=g.createElement(o.InputGroup,y.__assign({leftIcon:"search",placeholder:"Filter...",rightElement:t.maybeRenderClearButton(e.query)},l,{inputRef:t.refHandlers.input,onChange:e.handleQueryChange,value:e.query})),f=e.handleKeyDown,v=e.handleKeyUp;return g.createElement(o.Popover,y.__assign({autoFocus:!1,enforceFocus:!1,isOpen:t.state.isOpen,disabled:a,position:o.Position.BOTTOM_LEFT},d,{className:P()(e.className,d.className),onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,d.popoverClassName),onOpening:t.handlePopoverOpening,onOpened:t.handlePopoverOpened,onClosing:t.handlePopoverClosing}),g.createElement("div",{onKeyDown:t.state.isOpen?f:t.handleTargetKeyDown,onKeyUp:t.state.isOpen?v:void 0},t.props.children),g.createElement("div",{onKeyDown:f,onKeyUp:v},s?m:void 0,e.itemList))},t.handleTargetKeyDown=function(e){e.which!==o.Keys.ARROW_UP&&e.which!==o.Keys.ARROW_DOWN||(e.preventDefault(),t.setState({isOpen:!0}))},t.handleItemSelect=function(e,n){t.setState({isOpen:!1}),o.Utils.safeInvoke(t.props.onItemSelect,e,n)},t.handlePopoverInteraction=function(e){t.setState({isOpen:e}),o.Utils.safeInvokeMember(t.props.popoverProps,"onInteraction",e)},t.handlePopoverOpening=function(e){t.previousFocusedElement=document.activeElement,t.props.resetOnClose&&t.resetQuery(),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpening",e)},t.handlePopoverOpened=function(e){null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),requestAnimationFrame(function(){var e=t.props.inputProps;!1!==(void 0===e?{}:e).autoFocus&&null!=t.input&&t.input.focus()}),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpened",e)},t.handlePopoverClosing=function(e){requestAnimationFrame(function(){void 0!==t.previousFocusedElement&&(t.previousFocusedElement.focus(),t.previousFocusedElement=void 0)}),o.Utils.safeInvokeMember(t.props.popoverProps,"onClosing",e)},t.resetQuery=function(){return t.queryList&&t.queryList.setQuery("",!0)},t}return y.__extends(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.filterable,e.inputProps,e.popoverProps,y.__rest(e,["filterable","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,y.__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(o.Button,{icon:"cross",minimal:!0,onClick:this.resetQuery}):void 0},t.displayName=o.DISPLAYNAME_PREFIX+".Select",t}(g.PureComponent),U=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isOpen:null!=t.props.popoverProps&&t.props.popoverProps.isOpen||!1,selectedItem:t.getInitialSelectedItem()},t.TypedQueryList=O.ofType(),t.input=null,t.queryList=null,t.refHandlers={input:function(e){t.input=e,o.Utils.safeInvokeMember(t.props.inputProps,"inputRef",e)},queryList:function(e){return t.queryList=e}},t.renderQueryList=function(e){var n=t.props,i=n.inputProps,s=void 0===i?{}:i,p=n.popoverProps,a=void 0===p?{}:p,u=t.state,l=u.isOpen,c=u.selectedItem,d=e.handleKeyDown,m=e.handleKeyUp,f=s.placeholder,v=void 0===f?"Search...":f,h=c?t.props.inputValueRenderer(c):"",I=l&&h?h:v,O=l?e.query:h||(t.props.resetOnClose?"":e.query);return g.createElement(o.Popover,y.__assign({autoFocus:!1,enforceFocus:!1,isOpen:l,position:o.Position.BOTTOM_LEFT},a,{className:P()(e.className,a.className),onInteraction:t.handlePopoverInteraction,popoverClassName:P()(r.SELECT_POPOVER,a.popoverClassName),onOpening:t.handlePopoverOpening,onOpened:t.handlePopoverOpened}),g.createElement(o.InputGroup,y.__assign({disabled:t.props.disabled},s,{inputRef:t.refHandlers.input,onChange:e.handleQueryChange,onFocus:t.handleInputFocus,onKeyDown:t.getTargetKeyDownHandler(d),onKeyUp:t.getTargetKeyUpHandler(m),placeholder:I,value:O})),g.createElement("div",{onKeyDown:d,onKeyUp:m},e.itemList))},t.selectText=function(){requestAnimationFrame(function(){null!=t.input&&t.input.setSelectionRange(0,t.input.value.length)})},t.handleInputFocus=function(e){t.selectText(),t.props.openOnKeyDown||t.setState({isOpen:!0}),o.Utils.safeInvokeMember(t.props.inputProps,"onFocus",e)},t.handleItemSelect=function(e,n){var r;t.props.closeOnSelect?(null!=t.input&&t.input.blur(),r=!1):(null!=t.input&&t.input.focus(),t.selectText(),r=!0),void 0===t.props.selectedItem?t.setState({isOpen:r,selectedItem:e}):t.setState({isOpen:r}),o.Utils.safeInvoke(t.props.onItemSelect,e,n)},t.handlePopoverInteraction=function(e){return requestAnimationFrame(function(){null!=t.input&&t.input!==document.activeElement&&t.setState({isOpen:!1}),o.Utils.safeInvokeMember(t.props.popoverProps,"onInteraction",e)})},t.handlePopoverOpening=function(e){t.props.resetOnClose&&t.queryList&&t.queryList.setQuery("",!0),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpening",e)},t.handlePopoverOpened=function(e){null!=t.queryList&&t.queryList.scrollActiveItemIntoView(),o.Utils.safeInvokeMember(t.props.popoverProps,"onOpened",e)},t.getTargetKeyDownHandler=function(e){return function(n){var r=n.which;r===o.Keys.ESCAPE||r===o.Keys.TAB?(null!=t.input&&t.input.blur(),t.setState({isOpen:!1})):t.props.openOnKeyDown&&r!==o.Keys.BACKSPACE&&r!==o.Keys.ARROW_LEFT&&r!==o.Keys.ARROW_RIGHT&&t.setState({isOpen:!0}),t.state.isOpen&&o.Utils.safeInvoke(e,n),o.Utils.safeInvokeMember(t.props.inputProps,"onKeyDown",n)}},t.getTargetKeyUpHandler=function(e){return function(n){t.state.isOpen&&o.Utils.safeInvoke(e,n),o.Utils.safeInvokeMember(t.props.inputProps,"onKeyUp",n)}},t}return y.__extends(t,e),t.ofType=function(){return t},t.prototype.render=function(){var e=this.props,t=(e.disabled,e.inputProps,e.popoverProps,y.__rest(e,["disabled","inputProps","popoverProps"]));return g.createElement(this.TypedQueryList,y.__assign({},t,{onItemSelect:this.handleItemSelect,ref:this.refHandlers.queryList,renderer:this.renderQueryList}))},t.prototype.componentWillReceiveProps=function(e){void 0!==e.selectedItem&&e.selectedItem!==this.state.selectedItem&&this.setState({selectedItem:e.selectedItem})},t.prototype.componentDidUpdate=function(e,t){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.displayName=o.DISPLAYNAME_PREFIX+".Suggest",t.defaultProps={closeOnSelect:!0,openOnKeyDown:!1,resetOnClose:!1},t}(g.PureComponent);n.d(t,"Classes",function(){return r}),n.d(t,"renderFilteredItems",function(){return d}),n.d(t,"executeItemsEqual",function(){return m}),n.d(t,"getCreateNewItem",function(){return f}),n.d(t,"isCreateNewItem",function(){return v}),n.d(t,"getActiveItem",function(){return h}),n.d(t,"Omnibar",function(){return w}),n.d(t,"QueryList",function(){return O}),n.d(t,"getFirstEnabledItem",function(){return S}),n.d(t,"MultiSelect",function(){return A}),n.d(t,"Select",function(){return R}),n.d(t,"Suggest",function(){return U})}])});

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -5,3 +5,13 @@ /// <reference types="react" />

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ import { ICreateNewItem } from "./listItemsUtils";

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -5,5 +5,15 @@ "use strict";

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=itemRenderer.js.map

@@ -56,7 +56,17 @@ /// <reference types="react" />

/**
* Customize querying of individual items. Return `true` to keep the item, `false` to hide.
* This method will be invoked once for each item, so it should be performant. For more complex
* queries, use `itemListPredicate` to operate once on the entire array.
* Customize querying of individual items.
*
* This prop is ignored if `itemListPredicate` is also defined.
* __Filtering a list of items.__ This function is invoked to filter the
* list of items as a query is typed. Return `true` to keep the item, or
* `false` to hide. This method is invoked once for each item, so it should
* be performant. For more complex queries, use `itemListPredicate` to
* operate once on the entire array. For the purposes of filtering the list,
* this prop is ignored if `itemListPredicate` is also defined.
*
* __Matching a pasted value to an item.__ This function is also invoked to
* match a pasted value to an existing item if possible. In this case, the
* function will receive `exactMatch=true`, and the function should return
* true only if the item _exactly_ matches the query. For the purposes of
* matching pasted values, this prop will be invoked even if
* `itemListPredicate` is defined.
*/

@@ -115,2 +125,6 @@ itemPredicate?: ItemPredicate<T>;

/**
* Callback invoked when multiple items are selected at once via pasting.
*/
onItemsPaste?: (items: T[]) => void;
/**
* Callback invoked when the query string changes.

@@ -117,0 +131,0 @@ */

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

/*!
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ /**

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

16

lib/cjs/common/predicate.d.ts
/**
* Customize querying of entire `items` array. Return new list of items.
* This method can reorder, add, or remove items at will.
* (Supports filter algorithms that operate on the entire set, rather than individual items.)
*
* If defined with `itemPredicate`, this prop takes priority and the other will be ignored.
* A custom predicate for returning an entirely new `items` array based on the provided query.
* See usage sites in `IListItemsProps`.
*/
export declare type ItemListPredicate<T> = (query: string, items: T[]) => T[];
/**
* Customize querying of individual items. Return `true` to keep the item, `false` to hide.
* This method will be invoked once for each item, so it should be performant. For more complex
* queries, use `itemListPredicate` to operate once on the entire array.
*
* If defined with `itemListPredicate`, this prop will be ignored.
* A custom predicate for filtering items based on the provided query.
* See usage sites in `IListItemsProps`.
*/
export declare type ItemPredicate<T> = (query: string, item: T, index?: number) => boolean;
export declare type ItemPredicate<T> = (query: string, item: T, index?: number, exactMatch?: boolean) => boolean;

@@ -5,5 +5,15 @@ "use strict";

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=predicate.js.map

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

@@ -35,2 +35,19 @@ /// <reference types="react" />

/**
* Handler that should be invoked when the user pastes one or more values.
*
* This callback will use `itemPredicate` with `exactMatch=true` to find a
* subset of `items` exactly matching the pasted `values` provided, then it
* will invoke `onItemsPaste` with those found items. Each pasted value that
* does not exactly match an item will be ignored.
*
* If creating items is enabled (by providing both `createNewItemFromQuery`
* and `createNewItemRenderer`), then pasted values that do not exactly
* match an existing item will emit a new item as created via
* `createNewItemFromQuery`.
*
* If `itemPredicate` returns multiple matching items for a particular query
* in `queries`, then only the first matching item will be emitted.
*/
handlePaste: (queries: string[]) => void;
/**
* Keyboard handler for up/down arrow keys to shift the active item.

@@ -106,2 +123,3 @@ * Attach this handler to any element that should support this interaction.

private handleItemSelect;
private handlePaste;
private handleKeyDown;

@@ -118,2 +136,3 @@ private handleKeyUp;

private isCreateItemRendered();
private canCreateItems();
private wouldCreatedItemMatchSomeExistingItem();

@@ -120,0 +139,0 @@ }

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -39,2 +49,5 @@ Object.defineProperty(exports, "__esModule", { value: true });

var createItemView = _this.isCreateItemRendered() ? _this.renderCreateItemMenuItem(_this.state.query) : null;
if (menuContent == null && createItemView == null) {
return null;
}
return (React.createElement(core_1.Menu, { ulRef: listProps.itemsParentRef },

@@ -84,2 +97,38 @@ menuContent,

};
_this.handlePaste = function (queries) {
var _a = _this.props, createNewItemFromQuery = _a.createNewItemFromQuery, onItemsPaste = _a.onItemsPaste;
var nextActiveItem;
var nextQueries = [];
// Find an exising item that exactly matches each pasted value, or
// create a new item if possible. Ignore unmatched values if creating
// items is disabled.
var pastedItemsToEmit = [];
for (var _i = 0, queries_1 = queries; _i < queries_1.length; _i++) {
var query = queries_1[_i];
var equalItem = getMatchingItem(query, _this.props);
if (equalItem !== undefined) {
nextActiveItem = equalItem;
pastedItemsToEmit.push(equalItem);
}
else if (_this.canCreateItems()) {
var newItem = core_1.Utils.safeInvoke(createNewItemFromQuery, query);
if (newItem !== undefined) {
pastedItemsToEmit.push(newItem);
}
}
else {
nextQueries.push(query);
}
}
// UX nicety: combine all unmatched queries into a single
// comma-separated query in the input, so we don't lose any information.
// And don't reset the active item; we'll do that ourselves below.
_this.setQuery(nextQueries.join(", "), false);
// UX nicety: update the active item if we matched with at least one
// existing item.
if (nextActiveItem !== undefined) {
_this.setActiveItem(nextActiveItem);
}
core_1.Utils.safeInvoke(onItemsPaste, pastedItemsToEmit);
};
_this.handleKeyDown = function (event) {

@@ -137,3 +186,3 @@ var keyCode = event.keyCode;

var _c = this.state, createNewItem = _c.createNewItem, spreadableState = tslib_1.__rest(_c, ["createNewItem"]);
return renderer(tslib_1.__assign({}, spreadableState, { className: className, handleItemSelect: this.handleItemSelect, handleKeyDown: this.handleKeyDown, handleKeyUp: this.handleKeyUp, handleQueryChange: this.handleQueryChange, itemList: itemListRenderer(tslib_1.__assign({}, spreadableState, { items: items, itemsParentRef: this.refHandlers.itemsParent, renderItem: this.renderItem })) }));
return renderer(tslib_1.__assign({}, spreadableState, { className: className, handleItemSelect: this.handleItemSelect, handleKeyDown: this.handleKeyDown, handleKeyUp: this.handleKeyUp, handlePaste: this.handlePaste, handleQueryChange: this.handleQueryChange, itemList: itemListRenderer(tslib_1.__assign({}, spreadableState, { items: items, itemsParentRef: this.refHandlers.itemsParent, renderItem: this.renderItem })) }));
};

@@ -277,5 +326,3 @@ QueryList.prototype.componentWillReceiveProps = function (nextProps) {

QueryList.prototype.isCreateItemRendered = function () {
var createNewItemFromQuery = this.props.createNewItemFromQuery;
return (createNewItemFromQuery != null &&
this.props.createNewItemRenderer != null &&
return (this.canCreateItems() &&
this.state.query !== "" &&

@@ -287,2 +334,5 @@ // this check is unfortunately O(N) on the number of items, but

};
QueryList.prototype.canCreateItems = function () {
return this.props.createNewItemFromQuery != null && this.props.createNewItemRenderer != null;
};
QueryList.prototype.wouldCreatedItemMatchSomeExistingItem = function () {

@@ -306,2 +356,16 @@ var _this = this;

}
function getMatchingItem(query, _a) {
var items = _a.items, itemPredicate = _a.itemPredicate;
if (core_1.Utils.isFunction(itemPredicate)) {
// .find() doesn't exist in ES5. Alternative: use a for loop instead of
// .filter() so that we can return as soon as we find the first match.
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (itemPredicate(query, item, i, true)) {
return item;
}
}
}
return undefined;
}
function getFilteredItems(query, _a) {

@@ -308,0 +372,0 @@ var items = _a.items, itemPredicate = _a.itemPredicate, itemListPredicate = _a.itemListPredicate;

"use strict";
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -32,6 +42,11 @@ Object.defineProperty(exports, "__esModule", { value: true });

var _a = _this.props, _b = _a.tagInputProps, tagInputProps = _b === void 0 ? {} : _b, _c = _a.popoverProps, popoverProps = _c === void 0 ? {} : _c, _d = _a.selectedItems, selectedItems = _d === void 0 ? [] : _d, placeholder = _a.placeholder;
var handleKeyDown = listProps.handleKeyDown, handleKeyUp = listProps.handleKeyUp;
var handlePaste = listProps.handlePaste, handleKeyDown = listProps.handleKeyDown, handleKeyUp = listProps.handleKeyUp;
var handleTagInputAdd = function (values, method) {
if (method === "paste") {
handlePaste(values);
}
};
return (React.createElement(core_1.Popover, tslib_1.__assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: _this.state.isOpen, 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.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: _this.handlePopoverOpened }),
React.createElement("div", { onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: _this.state.isOpen ? handleKeyUp : undefined },
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, inputValue: listProps.query, onInputChange: listProps.handleQueryChange, 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, inputValue: listProps.query, onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, values: selectedItems.map(_this.props.tagRenderer) }))),
React.createElement("div", { onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -38,0 +53,0 @@ };

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

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

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ Object.defineProperty(exports, "__esModule", { value: true });

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import { Classes } from "@blueprintjs/core";

/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import * as Classes from "./classes";

@@ -5,3 +5,13 @@ /// <reference types="react" />

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ import { ICreateNewItem } from "./listItemsUtils";

/*!
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ /**

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//# sourceMappingURL=itemRenderer.js.map

@@ -56,7 +56,17 @@ /// <reference types="react" />

/**
* Customize querying of individual items. Return `true` to keep the item, `false` to hide.
* This method will be invoked once for each item, so it should be performant. For more complex
* queries, use `itemListPredicate` to operate once on the entire array.
* Customize querying of individual items.
*
* This prop is ignored if `itemListPredicate` is also defined.
* __Filtering a list of items.__ This function is invoked to filter the
* list of items as a query is typed. Return `true` to keep the item, or
* `false` to hide. This method is invoked once for each item, so it should
* be performant. For more complex queries, use `itemListPredicate` to
* operate once on the entire array. For the purposes of filtering the list,
* this prop is ignored if `itemListPredicate` is also defined.
*
* __Matching a pasted value to an item.__ This function is also invoked to
* match a pasted value to an existing item if possible. In this case, the
* function will receive `exactMatch=true`, and the function should return
* true only if the item _exactly_ matches the query. For the purposes of
* matching pasted values, this prop will be invoked even if
* `itemListPredicate` is defined.
*/

@@ -115,2 +125,6 @@ itemPredicate?: ItemPredicate<T>;

/**
* Callback invoked when multiple items are selected at once via pasting.
*/
onItemsPaste?: (items: T[]) => void;
/**
* Callback invoked when the query string changes.

@@ -117,0 +131,0 @@ */

/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import { Utils } from "@blueprintjs/core";

/*!
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ /**

/*!
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ /** Returns an instance of a "Create Item" object. */

/**
* Customize querying of entire `items` array. Return new list of items.
* This method can reorder, add, or remove items at will.
* (Supports filter algorithms that operate on the entire set, rather than individual items.)
*
* If defined with `itemPredicate`, this prop takes priority and the other will be ignored.
* A custom predicate for returning an entirely new `items` array based on the provided query.
* See usage sites in `IListItemsProps`.
*/
export declare type ItemListPredicate<T> = (query: string, items: T[]) => T[];
/**
* Customize querying of individual items. Return `true` to keep the item, `false` to hide.
* This method will be invoked once for each item, so it should be performant. For more complex
* queries, use `itemListPredicate` to operate once on the entire array.
*
* If defined with `itemListPredicate`, this prop will be ignored.
* A custom predicate for filtering items based on the provided query.
* See usage sites in `IListItemsProps`.
*/
export declare type ItemPredicate<T> = (query: string, item: T, index?: number) => boolean;
export declare type ItemPredicate<T> = (query: string, item: T, index?: number, exactMatch?: boolean) => boolean;
/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//# sourceMappingURL=predicate.js.map
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ export * from "./omnibar/omnibar";

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import * as tslib_1 from "tslib";

@@ -35,2 +35,19 @@ /// <reference types="react" />

/**
* Handler that should be invoked when the user pastes one or more values.
*
* This callback will use `itemPredicate` with `exactMatch=true` to find a
* subset of `items` exactly matching the pasted `values` provided, then it
* will invoke `onItemsPaste` with those found items. Each pasted value that
* does not exactly match an item will be ignored.
*
* If creating items is enabled (by providing both `createNewItemFromQuery`
* and `createNewItemRenderer`), then pasted values that do not exactly
* match an existing item will emit a new item as created via
* `createNewItemFromQuery`.
*
* If `itemPredicate` returns multiple matching items for a particular query
* in `queries`, then only the first matching item will be emitted.
*/
handlePaste: (queries: string[]) => void;
/**
* Keyboard handler for up/down arrow keys to shift the active item.

@@ -106,2 +123,3 @@ * Attach this handler to any element that should support this interaction.

private handleItemSelect;
private handlePaste;
private handleKeyDown;

@@ -118,2 +136,3 @@ private handleKeyUp;

private isCreateItemRendered();
private canCreateItems();
private wouldCreatedItemMatchSomeExistingItem();

@@ -120,0 +139,0 @@ }

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -36,2 +46,5 @@ import * as tslib_1 from "tslib";

var createItemView = _this.isCreateItemRendered() ? _this.renderCreateItemMenuItem(_this.state.query) : null;
if (menuContent == null && createItemView == null) {
return null;
}
return (React.createElement(Menu, { ulRef: listProps.itemsParentRef },

@@ -81,2 +94,38 @@ menuContent,

};
_this.handlePaste = function (queries) {
var _a = _this.props, createNewItemFromQuery = _a.createNewItemFromQuery, onItemsPaste = _a.onItemsPaste;
var nextActiveItem;
var nextQueries = [];
// Find an exising item that exactly matches each pasted value, or
// create a new item if possible. Ignore unmatched values if creating
// items is disabled.
var pastedItemsToEmit = [];
for (var _i = 0, queries_1 = queries; _i < queries_1.length; _i++) {
var query = queries_1[_i];
var equalItem = getMatchingItem(query, _this.props);
if (equalItem !== undefined) {
nextActiveItem = equalItem;
pastedItemsToEmit.push(equalItem);
}
else if (_this.canCreateItems()) {
var newItem = Utils.safeInvoke(createNewItemFromQuery, query);
if (newItem !== undefined) {
pastedItemsToEmit.push(newItem);
}
}
else {
nextQueries.push(query);
}
}
// UX nicety: combine all unmatched queries into a single
// comma-separated query in the input, so we don't lose any information.
// And don't reset the active item; we'll do that ourselves below.
_this.setQuery(nextQueries.join(", "), false);
// UX nicety: update the active item if we matched with at least one
// existing item.
if (nextActiveItem !== undefined) {
_this.setActiveItem(nextActiveItem);
}
Utils.safeInvoke(onItemsPaste, pastedItemsToEmit);
};
_this.handleKeyDown = function (event) {

@@ -134,3 +183,3 @@ var keyCode = event.keyCode;

var _c = this.state, createNewItem = _c.createNewItem, spreadableState = tslib_1.__rest(_c, ["createNewItem"]);
return renderer(tslib_1.__assign({}, spreadableState, { className: className, handleItemSelect: this.handleItemSelect, handleKeyDown: this.handleKeyDown, handleKeyUp: this.handleKeyUp, handleQueryChange: this.handleQueryChange, itemList: itemListRenderer(tslib_1.__assign({}, spreadableState, { items: items, itemsParentRef: this.refHandlers.itemsParent, renderItem: this.renderItem })) }));
return renderer(tslib_1.__assign({}, spreadableState, { className: className, handleItemSelect: this.handleItemSelect, handleKeyDown: this.handleKeyDown, handleKeyUp: this.handleKeyUp, handlePaste: this.handlePaste, handleQueryChange: this.handleQueryChange, itemList: itemListRenderer(tslib_1.__assign({}, spreadableState, { items: items, itemsParentRef: this.refHandlers.itemsParent, renderItem: this.renderItem })) }));
};

@@ -274,5 +323,3 @@ QueryList.prototype.componentWillReceiveProps = function (nextProps) {

QueryList.prototype.isCreateItemRendered = function () {
var createNewItemFromQuery = this.props.createNewItemFromQuery;
return (createNewItemFromQuery != null &&
this.props.createNewItemRenderer != null &&
return (this.canCreateItems() &&
this.state.query !== "" &&

@@ -284,2 +331,5 @@ // this check is unfortunately O(N) on the number of items, but

};
QueryList.prototype.canCreateItems = function () {
return this.props.createNewItemFromQuery != null && this.props.createNewItemRenderer != null;
};
QueryList.prototype.wouldCreatedItemMatchSomeExistingItem = function () {

@@ -303,2 +353,16 @@ var _this = this;

}
function getMatchingItem(query, _a) {
var items = _a.items, itemPredicate = _a.itemPredicate;
if (Utils.isFunction(itemPredicate)) {
// .find() doesn't exist in ES5. Alternative: use a for loop instead of
// .filter() so that we can return as soon as we find the first match.
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (itemPredicate(query, item, i, true)) {
return item;
}
}
}
return undefined;
}
function getFilteredItems(query, _a) {

@@ -305,0 +369,0 @@ var items = _a.items, itemPredicate = _a.itemPredicate, itemListPredicate = _a.itemListPredicate;

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -30,6 +40,11 @@ import * as tslib_1 from "tslib";

var _a = _this.props, _b = _a.tagInputProps, tagInputProps = _b === void 0 ? {} : _b, _c = _a.popoverProps, popoverProps = _c === void 0 ? {} : _c, _d = _a.selectedItems, selectedItems = _d === void 0 ? [] : _d, placeholder = _a.placeholder;
var handleKeyDown = listProps.handleKeyDown, handleKeyUp = listProps.handleKeyUp;
var handlePaste = listProps.handlePaste, handleKeyDown = listProps.handleKeyDown, handleKeyUp = listProps.handleKeyUp;
var handleTagInputAdd = function (values, method) {
if (method === "paste") {
handlePaste(values);
}
};
return (React.createElement(Popover, tslib_1.__assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: _this.state.isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), onInteraction: _this.handlePopoverInteraction, popoverClassName: classNames(Classes.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: _this.handlePopoverOpened }),
React.createElement("div", { onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: _this.state.isOpen ? handleKeyUp : undefined },
React.createElement(TagInput, tslib_1.__assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: _this.refHandlers.input, inputValue: listProps.query, onInputChange: listProps.handleQueryChange, values: selectedItems.map(_this.props.tagRenderer) }))),
React.createElement(TagInput, tslib_1.__assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: _this.refHandlers.input, inputValue: listProps.query, onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, values: selectedItems.map(_this.props.tagRenderer) }))),
React.createElement("div", { onKeyDown: _this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -36,0 +51,0 @@ };

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import * as tslib_1 from "tslib";

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import * as tslib_1 from "tslib";

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ export * from "./common";

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import { Classes } from "@blueprintjs/core";

/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import * as Classes from "./classes";

@@ -5,3 +5,13 @@ /// <reference types="react" />

*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -8,0 +18,0 @@ import { ICreateNewItem } from "./listItemsUtils";

/*!
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ /**

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//# sourceMappingURL=itemRenderer.js.map

@@ -56,7 +56,17 @@ /// <reference types="react" />

/**
* Customize querying of individual items. Return `true` to keep the item, `false` to hide.
* This method will be invoked once for each item, so it should be performant. For more complex
* queries, use `itemListPredicate` to operate once on the entire array.
* Customize querying of individual items.
*
* This prop is ignored if `itemListPredicate` is also defined.
* __Filtering a list of items.__ This function is invoked to filter the
* list of items as a query is typed. Return `true` to keep the item, or
* `false` to hide. This method is invoked once for each item, so it should
* be performant. For more complex queries, use `itemListPredicate` to
* operate once on the entire array. For the purposes of filtering the list,
* this prop is ignored if `itemListPredicate` is also defined.
*
* __Matching a pasted value to an item.__ This function is also invoked to
* match a pasted value to an existing item if possible. In this case, the
* function will receive `exactMatch=true`, and the function should return
* true only if the item _exactly_ matches the query. For the purposes of
* matching pasted values, this prop will be invoked even if
* `itemListPredicate` is defined.
*/

@@ -115,2 +125,6 @@ itemPredicate?: ItemPredicate<T>;

/**
* Callback invoked when multiple items are selected at once via pasting.
*/
onItemsPaste?: (items: T[]) => void;
/**
* Callback invoked when the query string changes.

@@ -117,0 +131,0 @@ */

/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import { Utils } from "@blueprintjs/core";

/*!
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ /**

/*!
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ /** Returns an instance of a "Create Item" object. */

/**
* Customize querying of entire `items` array. Return new list of items.
* This method can reorder, add, or remove items at will.
* (Supports filter algorithms that operate on the entire set, rather than individual items.)
*
* If defined with `itemPredicate`, this prop takes priority and the other will be ignored.
* A custom predicate for returning an entirely new `items` array based on the provided query.
* See usage sites in `IListItemsProps`.
*/
export declare type ItemListPredicate<T> = (query: string, items: T[]) => T[];
/**
* Customize querying of individual items. Return `true` to keep the item, `false` to hide.
* This method will be invoked once for each item, so it should be performant. For more complex
* queries, use `itemListPredicate` to operate once on the entire array.
*
* If defined with `itemListPredicate`, this prop will be ignored.
* A custom predicate for filtering items based on the provided query.
* See usage sites in `IListItemsProps`.
*/
export declare type ItemPredicate<T> = (query: string, item: T, index?: number) => boolean;
export declare type ItemPredicate<T> = (query: string, item: T, index?: number, exactMatch?: boolean) => boolean;
/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//# sourceMappingURL=predicate.js.map
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ export * from "./omnibar/omnibar";

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import classNames from "classnames";

@@ -35,2 +35,19 @@ /// <reference types="react" />

/**
* Handler that should be invoked when the user pastes one or more values.
*
* This callback will use `itemPredicate` with `exactMatch=true` to find a
* subset of `items` exactly matching the pasted `values` provided, then it
* will invoke `onItemsPaste` with those found items. Each pasted value that
* does not exactly match an item will be ignored.
*
* If creating items is enabled (by providing both `createNewItemFromQuery`
* and `createNewItemRenderer`), then pasted values that do not exactly
* match an existing item will emit a new item as created via
* `createNewItemFromQuery`.
*
* If `itemPredicate` returns multiple matching items for a particular query
* in `queries`, then only the first matching item will be emitted.
*/
handlePaste: (queries: string[]) => void;
/**
* Keyboard handler for up/down arrow keys to shift the active item.

@@ -106,2 +123,3 @@ * Attach this handler to any element that should support this interaction.

private handleItemSelect;
private handlePaste;
private handleKeyDown;

@@ -118,2 +136,3 @@ private handleKeyUp;

private isCreateItemRendered();
private canCreateItems();
private wouldCreatedItemMatchSomeExistingItem();

@@ -120,0 +139,0 @@ }

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

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

const createItemView = this.isCreateItemRendered() ? this.renderCreateItemMenuItem(this.state.query) : null;
if (menuContent == null && createItemView == null) {
return null;
}
return (React.createElement(Menu, { ulRef: listProps.itemsParentRef },

@@ -79,2 +92,37 @@ menuContent,

};
this.handlePaste = (queries) => {
const { createNewItemFromQuery, onItemsPaste } = this.props;
let nextActiveItem;
const nextQueries = [];
// Find an exising item that exactly matches each pasted value, or
// create a new item if possible. Ignore unmatched values if creating
// items is disabled.
const pastedItemsToEmit = [];
for (const query of queries) {
const equalItem = getMatchingItem(query, this.props);
if (equalItem !== undefined) {
nextActiveItem = equalItem;
pastedItemsToEmit.push(equalItem);
}
else if (this.canCreateItems()) {
const newItem = Utils.safeInvoke(createNewItemFromQuery, query);
if (newItem !== undefined) {
pastedItemsToEmit.push(newItem);
}
}
else {
nextQueries.push(query);
}
}
// UX nicety: combine all unmatched queries into a single
// comma-separated query in the input, so we don't lose any information.
// And don't reset the active item; we'll do that ourselves below.
this.setQuery(nextQueries.join(", "), false);
// UX nicety: update the active item if we matched with at least one
// existing item.
if (nextActiveItem !== undefined) {
this.setActiveItem(nextActiveItem);
}
Utils.safeInvoke(onItemsPaste, pastedItemsToEmit);
};
this.handleKeyDown = (event) => {

@@ -137,2 +185,3 @@ const { keyCode } = event;

handleKeyUp: this.handleKeyUp,
handlePaste: this.handlePaste,
handleQueryChange: this.handleQueryChange,

@@ -279,5 +328,3 @@ itemList: itemListRenderer({

isCreateItemRendered() {
const { createNewItemFromQuery } = this.props;
return (createNewItemFromQuery != null &&
this.props.createNewItemRenderer != null &&
return (this.canCreateItems() &&
this.state.query !== "" &&

@@ -289,2 +336,5 @@ // this check is unfortunately O(N) on the number of items, but

}
canCreateItems() {
return this.props.createNewItemFromQuery != null && this.props.createNewItemRenderer != null;
}
wouldCreatedItemMatchSomeExistingItem() {

@@ -303,2 +353,15 @@ // search only the filtered items, not the full items list, because we

}
function getMatchingItem(query, { items, itemPredicate }) {
if (Utils.isFunction(itemPredicate)) {
// .find() doesn't exist in ES5. Alternative: use a for loop instead of
// .filter() so that we can return as soon as we find the first match.
for (let i = 0; i < items.length; i++) {
const item = items[i];
if (itemPredicate(query, item, i, true)) {
return item;
}
}
}
return undefined;
}
function getFilteredItems(query, { items, itemPredicate, itemListPredicate }) {

@@ -305,0 +368,0 @@ if (Utils.isFunction(itemListPredicate)) {

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -28,6 +38,11 @@ import classNames from "classnames";

const { tagInputProps = {}, popoverProps = {}, selectedItems = [], placeholder } = this.props;
const { handleKeyDown, handleKeyUp } = listProps;
const { handlePaste, handleKeyDown, handleKeyUp } = listProps;
const handleTagInputAdd = (values, method) => {
if (method === "paste") {
handlePaste(values);
}
};
return (React.createElement(Popover, Object.assign({ autoFocus: false, canEscapeKeyClose: true, enforceFocus: false, isOpen: this.state.isOpen, position: Position.BOTTOM_LEFT }, popoverProps, { className: classNames(listProps.className, popoverProps.className), onInteraction: this.handlePopoverInteraction, popoverClassName: classNames(Classes.MULTISELECT_POPOVER, popoverProps.popoverClassName), onOpened: this.handlePopoverOpened }),
React.createElement("div", { onKeyDown: this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: this.state.isOpen ? handleKeyUp : undefined },
React.createElement(TagInput, Object.assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: this.refHandlers.input, inputValue: listProps.query, onInputChange: listProps.handleQueryChange, values: selectedItems.map(this.props.tagRenderer) }))),
React.createElement(TagInput, Object.assign({ placeholder: placeholder }, tagInputProps, { className: classNames(Classes.MULTISELECT, tagInputProps.className), inputRef: this.refHandlers.input, inputValue: listProps.query, onAdd: handleTagInputAdd, onInputChange: listProps.handleQueryChange, values: selectedItems.map(this.props.tagRenderer) }))),
React.createElement("div", { onKeyDown: this.getTargetKeyDownHandler(handleKeyDown), onKeyUp: handleKeyUp }, listProps.itemList)));

@@ -34,0 +49,0 @@ };

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import classNames from "classnames";

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ import classNames from "classnames";

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@ export * from "./common";

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

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

"dependencies": {
"@blueprintjs/core": "^3.14.0",
"@blueprintjs/core": "^3.15.0",
"classnames": "^2.2",

@@ -44,4 +44,4 @@ "tslib": "^1.9.0"

"devDependencies": {
"@blueprintjs/karma-build-scripts": "^0.9.1",
"@blueprintjs/node-build-scripts": "^0.8.1",
"@blueprintjs/karma-build-scripts": "^0.10.0",
"@blueprintjs/node-build-scripts": "^0.9.0",
"enzyme": "^3.3.0",

@@ -75,3 +75,3 @@ "karma": "^3.1.4",

"author": "Palantir Technologies",
"license": "SEE LICENSE IN LICENSE"
"license": "Apache-2.0"
}
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@

/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@

/*!
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@

/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -69,7 +79,17 @@

/**
* Customize querying of individual items. Return `true` to keep the item, `false` to hide.
* This method will be invoked once for each item, so it should be performant. For more complex
* queries, use `itemListPredicate` to operate once on the entire array.
* Customize querying of individual items.
*
* This prop is ignored if `itemListPredicate` is also defined.
* __Filtering a list of items.__ This function is invoked to filter the
* list of items as a query is typed. Return `true` to keep the item, or
* `false` to hide. This method is invoked once for each item, so it should
* be performant. For more complex queries, use `itemListPredicate` to
* operate once on the entire array. For the purposes of filtering the list,
* this prop is ignored if `itemListPredicate` is also defined.
*
* __Matching a pasted value to an item.__ This function is also invoked to
* match a pasted value to an existing item if possible. In this case, the
* function will receive `exactMatch=true`, and the function should return
* true only if the item _exactly_ matches the query. For the purposes of
* matching pasted values, this prop will be invoked even if
* `itemListPredicate` is defined.
*/

@@ -135,2 +155,7 @@ itemPredicate?: ItemPredicate<T>;

/**
* Callback invoked when multiple items are selected at once via pasting.
*/
onItemsPaste?: (items: T[]) => void;
/**
* Callback invoked when the query string changes.

@@ -137,0 +162,0 @@ */

/*!
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@

/*
* Copyright 2018 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Customize querying of entire `items` array. Return new list of items.
* This method can reorder, add, or remove items at will.
* (Supports filter algorithms that operate on the entire set, rather than individual items.)
*
* If defined with `itemPredicate`, this prop takes priority and the other will be ignored.
* A custom predicate for returning an entirely new `items` array based on the provided query.
* See usage sites in `IListItemsProps`.
*/

@@ -17,8 +24,5 @@ export type ItemListPredicate<T> = (query: string, items: T[]) => T[];

/**
* Customize querying of individual items. Return `true` to keep the item, `false` to hide.
* This method will be invoked once for each item, so it should be performant. For more complex
* queries, use `itemListPredicate` to operate once on the entire array.
*
* If defined with `itemListPredicate`, this prop will be ignored.
* A custom predicate for filtering items based on the provided query.
* See usage sites in `IListItemsProps`.
*/
export type ItemPredicate<T> = (query: string, item: T, index?: number) => boolean;
export type ItemPredicate<T> = (query: string, item: T, index?: number, exactMatch?: boolean) => boolean;
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,0 @@

/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the terms of the LICENSE file distributed with this project.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

@@ -6,0 +16,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

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