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

react-customize-token-input

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-customize-token-input - npm Package Compare versions

Comparing version 2.0.0-beta.0 to 2.0.0-beta.1

4

lib/hooks/useTokenDelete.d.ts

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

import type { TokenValue, TokenIndex } from '../types/token';
import type { TokenIndex } from '../types/token';
import type { OnTokenValuesChange } from '../types/interfaces';
declare type ParameterType<ValueType> = {
tokenValues: TokenValue<ValueType>[];
tokenValues: ValueType[];
onTokenValuesChange?: OnTokenValuesChange<ValueType>;

@@ -6,0 +6,0 @@ focusTokenCreator: () => void;

import type { OnTokenValuesChange } from '../types/interfaces';
import type { TokenValue, TokenIndex } from '../types/token';
import type { TokenIndex } from '../types/token';
import type { SetTokenActivated } from './useTokenMetas';
import type { HandleTokenInputFocus, HandleTokenInputBlur } from './useTokenInputFocusEffect';
declare type HandleTokenEditStart = (targetIndex: TokenIndex) => () => void;
declare type HandleTokenEditEnd<ValueType> = (targetIndex: TokenIndex) => (newTokenValue?: TokenValue<ValueType>) => void;
declare type HandleTokenEditEnd<ValueType> = (targetIndex: TokenIndex) => (newTokenValue?: ValueType) => void;
declare type ParameterType<ValueType, ErrorType> = {
tokenValues: TokenValue<ValueType>[];
tokenValues: ValueType[];
onTokenValuesChange?: OnTokenValuesChange<ValueType>;

@@ -10,0 +10,0 @@ setTokenActivated: SetTokenActivated<ErrorType>;

@@ -1,5 +0,4 @@

import type { TokenValue } from '../types/token';
import type { OnTokenValueValidate } from '../types/interfaces';
declare type ParameterType<ValueType, ErrorType> = {
tokenValues: TokenValue<ValueType>[];
tokenValues: ValueType[];
onTokenValueValidate: OnTokenValueValidate<ValueType, ErrorType>;

@@ -9,3 +8,3 @@ };

hasInvalidToken: boolean;
internalTokenValues: TokenValue<ValueType>[];
internalTokenValues: ValueType[];
tokenMetas: import("../types/token").TokenMeta<ErrorType>[];

@@ -12,0 +11,0 @@ setTokenActivated: import("./useTokenMetas").SetTokenActivated<ErrorType>;

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

import TokenInput from './TokenInput';
import TokenInput, { type Props as TokenInputProps } from './TokenInput';
import { JS__TOKEN__DELETE_BUTTON__CLASS_NAME, KEY_DOWN_HANDLER_CONFIG_OPTION } from './constants';
export { JS__TOKEN__DELETE_BUTTON__CLASS_NAME, KEY_DOWN_HANDLER_CONFIG_OPTION, };
export { TokenInputProps, JS__TOKEN__DELETE_BUTTON__CLASS_NAME, KEY_DOWN_HANDLER_CONFIG_OPTION, };
export default TokenInput;
/*! For license information please see index.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["token-input"]=t(require("react")):e.TokenInput=t(e.React)}(this,(function(e){return(()=>{var t={733:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(787)),a=r(n(433));t.default=function(){return o.default.createElement("div",{"data-component-name":"CloseIcon",role:"img",className:a.default["delete-button__close-icon"],"aria-hidden":"true"})}},242:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(787)),a=r(n(184)),u=r(n(733)),l=r(n(433)),i=n(754);t.default=function(e){var t,n=e.onRenderContent;return o.default.createElement("span",{"data-component-name":"DeleteButton",role:"button",className:(0,a.default)(i.JS__TOKEN__DELETE_BUTTON__CLASS_NAME,l.default["token__delete-button"]),"aria-hidden":"true"},null!==(t=null==n?void 0:n())&&void 0!==t?t:o.default.createElement(u.default,null))}},83:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var a=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return u(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=l(n(787)),c=i(n(184)),f=i(n(639)),d=i(n(971)),p=i(n(242)),y=n(754),h=i(n(433)),_=function(e){e.stopPropagation()};t.default=function(e){var t,n,a=e.readOnly,u=e.tokenValue,l=e.tokenMeta,i=e.onGetClassName,v=e.onGetDisplayLabel,b=e.onRenderDeleteButtonContent,m=e.onGetIsEditable,k=e.onGetEditableValue,O=e.onGetErrorMessage,T=e.onBuildTokenValue,E=e.onEditStart,g=e.onEditEnd,S=e.onDelete,A=(0,s.useRef)(null),I=(t=(0,s.useState)(y.DEFAULT_INPUT_INIT_VALUE),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),C=I[0],N=I[1],w=l.activated,D=l.error,j=(0,s.useMemo)((function(){return m(u,l)}),[m,u,l]),P=(0,s.useCallback)((function(){var e=k(u,l);N(e),E()}),[N,u,l,k,E]);(0,s.useEffect)((function(){var e=A.current;w&&e&&e.getInput().focus()}),[w]);var M=(0,s.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.reset,n=void 0!==t&&t,r=0===C.length;if(n||r)g();else{var o=T(C);g(o)}}),[C,T,g]),L=(0,s.useCallback)((function(e){e.stopPropagation(),a||(e.target.closest(".".concat(h.default.token," .").concat(y.JS__TOKEN__DELETE_BUTTON__CLASS_NAME))?S():j&&P())}),[a,j,S,P]),V=(0,s.useCallback)((function(e){var t=e.target.value;N(t)}),[N]),F=(0,s.useCallback)((function(e){(0,d.default)(e,{onEscape:function(){return M({reset:!0})},onEnter:function(){return M()}})}),[M]),W=(0,s.useCallback)((function(){M()}),[M]),U=(0,s.useMemo)((function(){var e;return(0,c.default)(null==i?void 0:i(u,l),h.default.token,(r(e={},h.default["token--read-only"],a),r(e,h.default["token--editable"],j&&!a),r(e,h.default["token--active"],w),r(e,h.default["token--error"],D&&!w),e))}),[i,a,j,w,D,u,l]),R=(0,s.useMemo)((function(){return O(u,l)}),[O,u,l]);return w?s.default.createElement("div",{"data-component-name":"Token",role:"presentation",className:U,onClick:_},s.default.createElement("div",{className:h.default["autosized-wrapper"]},s.default.createElement(f.default,{ref:A,value:C,onChange:V,onKeyDown:F,onBlur:W}))):s.default.createElement("div",{"data-component-name":"Token",role:"presentation",className:U,onClick:L,title:"string"==typeof R?R:void 0},s.default.createElement("div",{className:h.default["token__label-wrapper"]},v(u,l)),!a&&s.default.createElement(p.default,{onRenderContent:b}))}},84:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(83));t.default=o.default},962:function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),u=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return a(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=u(n(787)),s=l(n(639)),c=l(n(971)),f=l(n(732)),d=n(754),p=l(n(433)),y=(0,i.forwardRef)((function(e,t){var n,o,a=e.placeholder,u=e.autoFocus,l=e.onFocus,y=e.onBlur,h=e.separators,_=e.specialKeyDown,v=e.onInputValueChange,b=e.onPreprocess,m=e.onBuildTokenValue,k=e.onNewTokenValuesAppend,O=e.onLastTokenDelete,T=(n=(0,i.useState)(d.DEFAULT_INPUT_INIT_VALUE),o=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(n,o)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),E=T[0],g=T[1],S=(0,i.useMemo)((function(){return new RegExp(h.join("|"))}),[h]),A=(0,i.useCallback)((function(e){g(e),null==v||v(e,E)}),[v,E,g]),I=(0,i.useCallback)((function(e){if(0!==e.trim().length){var t=e.split(S).filter((function(e){return e.trim().length>0})),n=b(t).map((function(e){return m(e)}));k(n),A(d.DEFAULT_INPUT_INIT_VALUE)}}),[S,b,m,k,A]),C=(0,i.useCallback)((function(e){var t=e.target.value,n=t.substring(t.length-1);!0!==S.test(n)?A(t):I(E)}),[S,I,E,A]),N=(0,f.default)({specialKeyDownConfig:_,inputInitValue:d.DEFAULT_INPUT_INIT_VALUE,inputValue:E,onLastTokenDelete:O,handleInputValueUpdate:A,handleTokensCreate:I}),w=N.handleBackspaceKeyDown,D=N.handleTabKeyDown,j=N.handleEnterKeyDown,P=N.handleEscapeKeyDown,M=(0,i.useCallback)((function(e){(0,c.default)(e,{onBackspace:w,onTab:D,onEnter:j,onEscape:P})}),[w,D,j,P]),L=(0,i.useCallback)((function(){I(E),y()}),[I,E,y]),V=(0,i.useCallback)((function(e){e.preventDefault();var t=e.clipboardData.getData("text");I(t)}),[I]);return i.default.createElement("div",{className:p.default["autosized-wrapper"]},i.default.createElement(s.default,{ref:t,autoFocus:u,placeholder:a,value:E,onChange:C,onKeyDown:M,onPaste:V,onFocus:l,onBlur:L}))}));t.default=y},922:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),l=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&u(t,e,n);return l(t,e),t},s=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var f=i(n(787)),d=c(n(184)),p=c(n(962)),y=c(n(84)),h=c(n(598)),_=c(n(872)),v=c(n(870)),b=c(n(970)),m=c(n(120)),k=c(n(835)),O=c(n(360)),T=c(n(453)),E=c(n(810)),g=c(n(196)),S=n(754),A=c(n(433));t.default=function(e){var t,n=e.className,a=e.readOnly,u=void 0!==a&&a,l=e.autoFocus,i=void 0!==l&&l,c=e.placeholder,I=e.tokenValues,C=e.separators,N=void 0===C?S.DEFAULT_SEPARATORS:C,w=e.specialKeyDown,D=void 0===w?S.DEFAULT_SPECIAL_KEY_DOWN_CONFIG:w,j=e.onInputValueChange,P=e.onPreprocess,M=e.onTokenValueValidate,L=void 0===M?k.default:M,V=e.onTokenValuesChange,F=e.onBuildTokenValue,W=void 0===F?O.default:F,U=e.customizeTokenComponent,R=e.onGetTokenClassName,x=e.onGetTokenDisplayLabel,B=void 0===x?E.default:x,K=e.onRenderTokenDeleteButtonContent,G=e.onGetIsTokenEditable,H=void 0===G?T.default:G,z=e.onGetTokenEditableValue,Y=void 0===z?E.default:z,J=e.onGetTokenErrorMessage,$=void 0===J?g.default:J,q=s(e,["className","readOnly","autoFocus","placeholder","tokenValues","separators","specialKeyDown","onInputValueChange","onPreprocess","onTokenValueValidate","onTokenValuesChange","onBuildTokenValue","customizeTokenComponent","onGetTokenClassName","onGetTokenDisplayLabel","onRenderTokenDeleteButtonContent","onGetIsTokenEditable","onGetTokenEditableValue","onGetTokenErrorMessage"]),Q=(0,h.default)(),X=Q.isTokenInputFocused,Z=Q.handleTokenInputFocus,ee=Q.handleTokenInputBlur,te=(0,_.default)(),ne=te.tokenCreatorRef,re=te.focusTokenCreator,oe=(0,v.default)({tokenValues:I,onTokenValueValidate:L}),ae=oe.hasInvalidToken,ue=oe.internalTokenValues,le=oe.tokenMetas,ie=oe.setTokenActivated,se=(0,b.default)({tokenValues:I,onTokenValuesChange:V,setTokenActivated:ie,handleTokenInputFocus:Z,handleTokenInputBlur:ee}),ce=se.handleTokenEditStart,fe=se.handleTokenEditEnd,de=(0,m.default)({tokenValues:I,onTokenValuesChange:V,focusTokenCreator:re}),pe=de.handleTokenDelete,ye=de.handleLastTokenDelete,he=(0,f.useCallback)((function(e){if(0!==e.length){var t=[].concat(o(I),o(e));null==V||V(t)}}),[I,V]),_e=(0,f.useCallback)((function(e){if("function"!=typeof P)return e;var t=P(e);if(!0!==Array.isArray(t))throw new Error("onPreprocess should return an array of values");return t}),[P]),ve=U||y.default;return f.default.createElement("div",Object.assign({"data-component-name":"TokenInput"},q,{className:(0,d.default)(n,A.default.container,(t={},r(t,A.default["container--focused"],X),r(t,A.default["container--errors"],ae),t)),onClick:re,role:"presentation"}),f.default.createElement("div",{className:A.default["token-list"]},ue.map((function(e,t){var n=le[t],r=n.key;return f.default.createElement(ve,{key:r,readOnly:u,tokenValue:e,tokenMeta:n,onGetClassName:R,onGetDisplayLabel:B,onRenderDeleteButtonContent:K,onGetIsEditable:H,onGetEditableValue:Y,onGetErrorMessage:$,onBuildTokenValue:W,onEditStart:ce(t),onEditEnd:fe(t),onDelete:pe(t)})}))),!u&&f.default.createElement(p.default,{ref:ne,placeholder:c,autoFocus:i,onFocus:Z,onBlur:ee,separators:N,specialKeyDown:D,onInputValueChange:j,onPreprocess:_e,onBuildTokenValue:W,onNewTokenValuesAppend:he,onLastTokenDelete:ye}))}},754:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_INPUT_INIT_VALUE=t.JS__TOKEN__DELETE_BUTTON__CLASS_NAME=t.DEFAULT_SPECIAL_KEY_DOWN_CONFIG=t.KEY_DOWN_HANDLER_CONFIG_OPTION=t.DEFAULT_SEPARATORS=void 0,t.DEFAULT_SEPARATORS=[",",";","\n","\r","\r\n"],t.KEY_DOWN_HANDLER_CONFIG_OPTION={OFF:0,ON:1},t.DEFAULT_SPECIAL_KEY_DOWN_CONFIG={onBackspace:t.KEY_DOWN_HANDLER_CONFIG_OPTION.ON,onTab:t.KEY_DOWN_HANDLER_CONFIG_OPTION.OFF,onEnter:t.KEY_DOWN_HANDLER_CONFIG_OPTION.ON,onEscape:t.KEY_DOWN_HANDLER_CONFIG_OPTION.ON},t.JS__TOKEN__DELETE_BUTTON__CLASS_NAME="js__token__delete-button",t.DEFAULT_INPUT_INIT_VALUE=""},732:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(787),o=n(754),a=function(e){var t=e.keyDownHandlerConfig,n=e.predefinedHandler;switch(!0){case t===o.KEY_DOWN_HANDLER_CONFIG_OPTION.ON:n()}};t.default=function(e){var t=e.specialKeyDownConfig,n=e.inputInitValue,u=e.inputValue,l=e.onLastTokenDelete,i=e.handleInputValueUpdate,s=e.handleTokensCreate,c=Object.assign(Object.assign({},o.DEFAULT_SPECIAL_KEY_DOWN_CONFIG),t),f=c.onBackspace,d=c.onTab,p=c.onEnter,y=c.onEscape;return{handleBackspaceKeyDown:(0,r.useCallback)((function(){a({keyDownHandlerConfig:f,predefinedHandler:function(){0===u.length&&l()}})}),[f,u,l]),handleTabKeyDown:(0,r.useCallback)((function(e){a({keyDownHandlerConfig:d,predefinedHandler:function(){e.preventDefault(),s(u)}})}),[d,u,s]),handleEnterKeyDown:(0,r.useCallback)((function(){a({keyDownHandlerConfig:p,predefinedHandler:function(){s(u)}})}),[p,u,s]),handleEscapeKeyDown:(0,r.useCallback)((function(){a({keyDownHandlerConfig:y,predefinedHandler:function(){i(n)}})}),[y,n,i])}}},872:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(787);t.default=function(){var e=(0,r.useRef)(null),t=(0,r.useCallback)((function(){var t=null==e?void 0:e.current;t&&t.getInput().focus()}),[]);return{tokenCreatorRef:e,focusTokenCreator:t}}},120:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0});var o=n(787);t.default=function(e){var t=e.tokenValues,n=e.onTokenValuesChange,a=e.focusTokenCreator,u=(0,o.useCallback)((function(e){var o,u=function(e){if(Array.isArray(e))return r(e)}(o=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();u.splice(e,1),null==n||n(u),a()}),[t,n,a]);return{handleTokenDelete:(0,o.useCallback)((function(e){return function(){u(e)}}),[u]),handleLastTokenDelete:(0,o.useCallback)((function(){u(-1)}),[u])}}},970:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0});var o=n(787);t.default=function(e){var t=e.tokenValues,n=e.onTokenValuesChange,a=e.setTokenActivated,u=e.handleTokenInputFocus,l=e.handleTokenInputBlur;return{handleTokenEditStart:(0,o.useCallback)((function(e){return function(){a(e,!0),u()}}),[a,u]),handleTokenEditEnd:(0,o.useCallback)((function(e){return function(o){if(a(e,!1),l(),void 0!==o){var u=function(e){if(Array.isArray(e))return r(e)}(i=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();u[e]=o,null==n||n(u)}var i}}),[t,n,a,l])}}},598:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0});var o=n(787);t.default=function(){var e,t,n=(e=(0,o.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=n[0],u=n[1];return{isTokenInputFocused:a,handleTokenInputFocus:(0,o.useCallback)((function(){u(!0)}),[]),handleTokenInputBlur:(0,o.useCallback)((function(){u(!1)}),[])}}},55:(e,t,n)=>{"use strict";function r(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0});var a=n(787);t.default=function(){var e,t,n=(e=(0,a.useState)([]),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=n[0],l=n[1],i=(0,a.useCallback)((function(e,t){if(e>=u.length)throw new Error("setTokenActivated out of tokenMetas scope; targetIndex ".concat(e,"; tokenMetas.length ").concat(u.length));var n=function(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(u);n[e].activated=t,l(n)}),[u]);return{tokenMetas:u,setTokenMetas:l,setTokenActivated:i}}},870:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||o(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var l=n(787),i=u(n(55)),s=u(n(748));t.default=function(e){var t=e.tokenValues,n=e.onTokenValueValidate,u=(0,i.default)(),c=u.tokenMetas,f=u.setTokenMetas,d=u.setTokenActivated,p=r((0,l.useState)(!1),2),y=p[0],h=p[1],_=r((0,l.useState)([]),2),v=_[0],b=_[1];return(0,l.useLayoutEffect)((function(){var e,r=!1,u=t.map((function(e,o){var a=n(e,o,t),u=(0,s.default)(a,e,o);return u.error&&!u.activated&&(r=!0),u}));b(function(e){if(Array.isArray(e))return a(e)}(e=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f(u),h(r)}),[t,n,f]),{hasInvalidToken:y,internalTokenValues:v,tokenMetas:c,setTokenActivated:d}}},820:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KEY_DOWN_HANDLER_CONFIG_OPTION=t.JS__TOKEN__DELETE_BUTTON__CLASS_NAME=void 0;var o=r(n(922)),a=n(754);Object.defineProperty(t,"JS__TOKEN__DELETE_BUTTON__CLASS_NAME",{enumerable:!0,get:function(){return a.JS__TOKEN__DELETE_BUTTON__CLASS_NAME}}),Object.defineProperty(t,"KEY_DOWN_HANDLER_CONFIG_OPTION",{enumerable:!0,get:function(){return a.KEY_DOWN_HANDLER_CONFIG_OPTION}}),t.default=o.default},748:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){return{key:"".concat(JSON.stringify(t),"-").concat(Date.now(),"-").concat(n),activated:!1,error:e}}},360:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.trim()}},453:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return!0}},810:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return"".concat(e)}},196:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if("string"==typeof t.error)return t.error}},835:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){}},971:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(776));t.default=function(e,t){var n=t.onBackspace,r=t.onTab,a=t.onEnter,u=t.onEscape;switch((0,o.default)(e).key){case"Backspace":null==n||n(e);break;case"Tab":null==r||r(e);break;case"Enter":null==a||a(e);break;case"Escape":null==u||u(e)}}},184:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var u=o.apply(null,n);u&&e.push(u)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var l in n)r.call(n,l)&&n[l]&&e.push(l);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},776:e=>{self,e.exports=(()=>{"use strict";var e,t={};return e=t,Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){var t=e.keyCode,n=e.key;return t&&229===t&&(n="Process"),{key:n}},t})()},433:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={container:"token-input-container","container--focused":"token-input-container--focused","container--errors":"token-input-container--errors","autosized-wrapper":"token-input-autosized-wrapper","token-list":"token-input-token-list",token:"token-input-token","token--error":"token-input-token--error","token--read-only":"token-input-token--read-only","token--editable":"token-input-token--editable","token--active":"token-input-token--active","token__label-wrapper":"token-input-token__label-wrapper","token__delete-button":"token-input-token__delete-button","delete-button__close-icon":"token-input-delete-button__close-icon"}},639:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(787),u=i(a),l=i(n(863));function i(e){return e&&e.__esModule?e:{default:e}}var s={position:"absolute",top:0,left:0,visibility:"hidden",height:0,overflow:"scroll",whiteSpace:"pre"},c=["extraWidth","injectStyles","inputClassName","inputRef","inputStyle","minWidth","onAutosize","placeholderIsMinWidth"],f=function(e,t){t.style.fontSize=e.fontSize,t.style.fontFamily=e.fontFamily,t.style.fontWeight=e.fontWeight,t.style.fontStyle=e.fontStyle,t.style.letterSpacing=e.letterSpacing,t.style.textTransform=e.textTransform},d=!("undefined"==typeof window||!window.navigator)&&/MSIE |Trident\/|Edge\//.test(window.navigator.userAgent),p=function(){return d?"_"+Math.random().toString(36).substr(2,12):void 0},y=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.inputRef=function(e){n.input=e,"function"==typeof n.props.inputRef&&n.props.inputRef(e)},n.placeHolderSizerRef=function(e){n.placeHolderSizer=e},n.sizerRef=function(e){n.sizer=e},n.state={inputWidth:e.minWidth,inputId:e.id||p(),prevId:e.id},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,null,[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.id;return n!==t.prevId?{inputId:n||p(),prevId:n}:null}}]),o(t,[{key:"componentDidMount",value:function(){this.mounted=!0,this.copyInputStyles(),this.updateInputWidth()}},{key:"componentDidUpdate",value:function(e,t){t.inputWidth!==this.state.inputWidth&&"function"==typeof this.props.onAutosize&&this.props.onAutosize(this.state.inputWidth),this.updateInputWidth()}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"copyInputStyles",value:function(){if(this.mounted&&window.getComputedStyle){var e=this.input&&window.getComputedStyle(this.input);e&&(f(e,this.sizer),this.placeHolderSizer&&f(e,this.placeHolderSizer))}}},{key:"updateInputWidth",value:function(){if(this.mounted&&this.sizer&&void 0!==this.sizer.scrollWidth){var e=void 0;e=this.props.placeholder&&(!this.props.value||this.props.value&&this.props.placeholderIsMinWidth)?Math.max(this.sizer.scrollWidth,this.placeHolderSizer.scrollWidth)+2:this.sizer.scrollWidth+2,(e+="number"===this.props.type&&void 0===this.props.extraWidth?16:parseInt(this.props.extraWidth)||0)<this.props.minWidth&&(e=this.props.minWidth),e!==this.state.inputWidth&&this.setState({inputWidth:e})}}},{key:"getInput",value:function(){return this.input}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"renderStyles",value:function(){var e=this.props.injectStyles;return d&&e?u.default.createElement("style",{dangerouslySetInnerHTML:{__html:"input#"+this.state.inputId+"::-ms-clear {display: none;}"}}):null}},{key:"render",value:function(){var e=[this.props.defaultValue,this.props.value,""].reduce((function(e,t){return null!=e?e:t})),t=r({},this.props.style);t.display||(t.display="inline-block");var n=r({boxSizing:"content-box",width:this.state.inputWidth+"px"},this.props.inputStyle),o=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(this.props,[]);return function(e){c.forEach((function(t){return delete e[t]}))}(o),o.className=this.props.inputClassName,o.id=this.state.inputId,o.style=n,u.default.createElement("div",{className:this.props.className,style:t},this.renderStyles(),u.default.createElement("input",r({},o,{ref:this.inputRef})),u.default.createElement("div",{ref:this.sizerRef,style:s},e),this.props.placeholder?u.default.createElement("div",{ref:this.placeHolderSizerRef,style:s},this.props.placeholder):null)}}]),t}(a.Component);y.propTypes={className:l.default.string,defaultValue:l.default.any,extraWidth:l.default.oneOfType([l.default.number,l.default.string]),id:l.default.string,injectStyles:l.default.bool,inputClassName:l.default.string,inputRef:l.default.func,inputStyle:l.default.object,minWidth:l.default.oneOfType([l.default.number,l.default.string]),onAutosize:l.default.func,onChange:l.default.func,placeholder:l.default.string,placeholderIsMinWidth:l.default.bool,style:l.default.object,value:l.default.any},y.defaultProps={minWidth:1,injectStyles:!0},t.default=y},216:(e,t,n)=>{"use strict";var r=n(138);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,u){if(u!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return n.PropTypes=n,n}},863:(e,t,n)=>{e.exports=n(216)()},138:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},787:t=>{"use strict";t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e].call(a.exports,a,a.exports,r),a.exports}return r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(820)})()}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["token-input"]=t(require("react")):e.TokenInput=t(e.React)}(this,(function(e){return(()=>{var t={733:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(787)),a=r(n(433));t.default=function(){return o.default.createElement("div",{"data-component-name":"CloseIcon",role:"img",className:a.default["delete-button__close-icon"],"aria-hidden":"true"})}},242:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(787)),a=r(n(184)),u=r(n(733)),l=r(n(433)),i=n(754);t.default=function(e){var t,n=e.onRenderContent;return o.default.createElement("span",{"data-component-name":"DeleteButton",role:"button",className:(0,a.default)(i.JS__TOKEN__DELETE_BUTTON__CLASS_NAME,l.default["token__delete-button"]),"aria-hidden":"true"},null!==(t=null==n?void 0:n())&&void 0!==t?t:o.default.createElement(u.default,null))}},83:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var a=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),u=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return u(t,e),t},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=l(n(787)),c=i(n(184)),f=i(n(639)),d=i(n(971)),p=i(n(242)),y=n(754),h=i(n(433)),_=function(e){e.stopPropagation()};t.default=function(e){var t,n,a=e.readOnly,u=e.tokenValue,l=e.tokenMeta,i=e.onGetClassName,v=e.onGetDisplayLabel,b=e.onRenderDeleteButtonContent,m=e.onGetIsEditable,k=e.onGetEditableValue,T=e.onGetErrorMessage,O=e.onBuildTokenValue,E=e.onEditStart,g=e.onEditEnd,S=e.onDelete,A=(0,s.useRef)(null),I=(t=(0,s.useState)(y.DEFAULT_INPUT_INIT_VALUE),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(t,n)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),C=I[0],N=I[1],w=l.activated,D=l.error,j=(0,s.useMemo)((function(){return m(u,l)}),[m,u,l]),P=(0,s.useCallback)((function(){var e=k(u,l);N(e),E()}),[N,u,l,k,E]);(0,s.useEffect)((function(){var e=A.current;w&&e&&e.getInput().focus()}),[w]);var M=(0,s.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.reset,n=void 0!==t&&t,r=0===C.length;if(n||r)g();else{var o=O(C);g(o)}}),[C,O,g]),L=(0,s.useCallback)((function(e){e.stopPropagation(),a||(e.target.closest(".".concat(h.default.token," .").concat(y.JS__TOKEN__DELETE_BUTTON__CLASS_NAME))?S():j&&P())}),[a,j,S,P]),V=(0,s.useCallback)((function(e){var t=e.target.value;N(t)}),[N]),F=(0,s.useCallback)((function(e){(0,d.default)(e,{onEscape:function(){return M({reset:!0})},onEnter:function(){return M()}})}),[M]),W=(0,s.useCallback)((function(){M()}),[M]),U=(0,s.useMemo)((function(){var e;return(0,c.default)(null==i?void 0:i(u,l),h.default.token,(r(e={},h.default["token--read-only"],a),r(e,h.default["token--editable"],j&&!a),r(e,h.default["token--active"],w),r(e,h.default["token--error"],D&&!w),e))}),[i,a,j,w,D,u,l]),R=(0,s.useMemo)((function(){var e=T(u,l);return"string"==typeof e?e:void 0}),[T,u,l]);return w?s.default.createElement("div",{"data-component-name":"Token",role:"presentation",className:U,onClick:_},s.default.createElement("div",{className:h.default["autosized-wrapper"]},s.default.createElement(f.default,{ref:A,value:C,onChange:V,onKeyDown:F,onBlur:W}))):s.default.createElement("div",{"data-component-name":"Token",role:"presentation",className:U,onClick:L,title:R},s.default.createElement("div",{className:h.default["token__label-wrapper"]},v(u,l)),!a&&s.default.createElement(p.default,{onRenderContent:b}))}},84:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(83));t.default=o.default},962:function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),u=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&o(t,e,n);return a(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=u(n(787)),s=l(n(639)),c=l(n(971)),f=l(n(732)),d=n(754),p=l(n(433)),y=(0,i.forwardRef)((function(e,t){var n,o,a=e.placeholder,u=e.autoFocus,l=e.onFocus,y=e.onBlur,h=e.separators,_=e.specialKeyDown,v=e.onInputValueChange,b=e.onPreprocess,m=e.onBuildTokenValue,k=e.onNewTokenValuesAppend,T=e.onLastTokenDelete,O=(n=(0,i.useState)(d.DEFAULT_INPUT_INIT_VALUE),o=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(n,o)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),E=O[0],g=O[1],S=(0,i.useMemo)((function(){return new RegExp(h.join("|"))}),[h]),A=(0,i.useCallback)((function(e){g(e),null==v||v(e,E)}),[v,E,g]),I=(0,i.useCallback)((function(e){if(0!==e.trim().length){var t=e.split(S).filter((function(e){return e.trim().length>0})),n=b(t).map((function(e){return m(e)}));k(n),A(d.DEFAULT_INPUT_INIT_VALUE)}}),[S,b,m,k,A]),C=(0,i.useCallback)((function(e){var t=e.target.value,n=t.substring(t.length-1);!0!==S.test(n)?A(t):I(E)}),[S,I,E,A]),N=(0,f.default)({specialKeyDownConfig:_,inputInitValue:d.DEFAULT_INPUT_INIT_VALUE,inputValue:E,onLastTokenDelete:T,handleInputValueUpdate:A,handleTokensCreate:I}),w=N.handleBackspaceKeyDown,D=N.handleTabKeyDown,j=N.handleEnterKeyDown,P=N.handleEscapeKeyDown,M=(0,i.useCallback)((function(e){(0,c.default)(e,{onBackspace:w,onTab:D,onEnter:j,onEscape:P})}),[w,D,j,P]),L=(0,i.useCallback)((function(){I(E),y()}),[I,E,y]),V=(0,i.useCallback)((function(e){e.preventDefault();var t=e.clipboardData.getData("text");I(t)}),[I]);return i.default.createElement("div",{className:p.default["autosized-wrapper"]},i.default.createElement(s.default,{ref:t,autoFocus:u,placeholder:a,value:E,onChange:C,onKeyDown:M,onPaste:V,onFocus:l,onBlur:L}))}));t.default=y},922:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),l=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&u(t,e,n);return l(t,e),t},s=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var f=i(n(787)),d=c(n(184)),p=c(n(962)),y=c(n(84)),h=c(n(598)),_=c(n(872)),v=c(n(870)),b=c(n(970)),m=c(n(120)),k=c(n(835)),T=c(n(360)),O=c(n(453)),E=c(n(810)),g=c(n(196)),S=n(754),A=c(n(433));t.default=function(e){var t,n=e.className,a=e.placeholder,u=e.readOnly,l=void 0!==u&&u,i=e.autoFocus,c=void 0!==i&&i,I=e.tokenValues,C=e.separators,N=void 0===C?S.DEFAULT_SEPARATORS:C,w=e.specialKeyDown,D=void 0===w?S.DEFAULT_SPECIAL_KEY_DOWN_CONFIG:w,j=e.onInputValueChange,P=e.onPreprocess,M=e.onTokenValueValidate,L=void 0===M?k.default:M,V=e.onTokenValuesChange,F=e.onBuildTokenValue,W=void 0===F?T.default:F,U=e.customizeTokenComponent,R=e.onGetTokenClassName,x=e.onGetTokenDisplayLabel,B=void 0===x?E.default:x,K=e.onRenderTokenDeleteButtonContent,G=e.onGetIsTokenEditable,H=void 0===G?O.default:G,z=e.onGetTokenEditableValue,Y=void 0===z?E.default:z,J=e.onGetTokenErrorMessage,$=void 0===J?g.default:J,q=s(e,["className","placeholder","readOnly","autoFocus","tokenValues","separators","specialKeyDown","onInputValueChange","onPreprocess","onTokenValueValidate","onTokenValuesChange","onBuildTokenValue","customizeTokenComponent","onGetTokenClassName","onGetTokenDisplayLabel","onRenderTokenDeleteButtonContent","onGetIsTokenEditable","onGetTokenEditableValue","onGetTokenErrorMessage"]),Q=(0,h.default)(),X=Q.isTokenInputFocused,Z=Q.handleTokenInputFocus,ee=Q.handleTokenInputBlur,te=(0,_.default)(),ne=te.tokenCreatorRef,re=te.focusTokenCreator,oe=(0,v.default)({tokenValues:I,onTokenValueValidate:L}),ae=oe.hasInvalidToken,ue=oe.internalTokenValues,le=oe.tokenMetas,ie=oe.setTokenActivated,se=(0,b.default)({tokenValues:I,onTokenValuesChange:V,setTokenActivated:ie,handleTokenInputFocus:Z,handleTokenInputBlur:ee}),ce=se.handleTokenEditStart,fe=se.handleTokenEditEnd,de=(0,m.default)({tokenValues:I,onTokenValuesChange:V,focusTokenCreator:re}),pe=de.handleTokenDelete,ye=de.handleLastTokenDelete,he=(0,f.useCallback)((function(e){if(0!==e.length){var t=[].concat(o(I),o(e));null==V||V(t)}}),[I,V]),_e=(0,f.useCallback)((function(e){if("function"!=typeof P)return e;var t=P(e);if(!0!==Array.isArray(t))throw new Error("onPreprocess should return an array of values");return t}),[P]),ve=U||y.default;return f.default.createElement("div",Object.assign({"data-component-name":"TokenInput"},q,{className:(0,d.default)(n,A.default.container,(t={},r(t,A.default["container--focused"],X),r(t,A.default["container--errors"],ae),t)),onClick:re,role:"presentation"}),f.default.createElement("div",{className:A.default["token-list"]},ue.map((function(e,t){var n=le[t],r=n.key;return f.default.createElement(ve,{key:r,readOnly:l,tokenValue:e,tokenMeta:n,onGetClassName:R,onGetDisplayLabel:B,onRenderDeleteButtonContent:K,onGetIsEditable:H,onGetEditableValue:Y,onGetErrorMessage:$,onBuildTokenValue:W,onEditStart:ce(t),onEditEnd:fe(t),onDelete:pe(t)})}))),!l&&f.default.createElement(p.default,{ref:ne,placeholder:a,autoFocus:c,onFocus:Z,onBlur:ee,separators:N,specialKeyDown:D,onInputValueChange:j,onPreprocess:_e,onBuildTokenValue:W,onNewTokenValuesAppend:he,onLastTokenDelete:ye}))}},754:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_INPUT_INIT_VALUE=t.JS__TOKEN__DELETE_BUTTON__CLASS_NAME=t.DEFAULT_SPECIAL_KEY_DOWN_CONFIG=t.KEY_DOWN_HANDLER_CONFIG_OPTION=t.DEFAULT_SEPARATORS=void 0,t.DEFAULT_SEPARATORS=[",",";","\n","\r","\r\n"],t.KEY_DOWN_HANDLER_CONFIG_OPTION={OFF:0,ON:1},t.DEFAULT_SPECIAL_KEY_DOWN_CONFIG={onBackspace:t.KEY_DOWN_HANDLER_CONFIG_OPTION.ON,onTab:t.KEY_DOWN_HANDLER_CONFIG_OPTION.OFF,onEnter:t.KEY_DOWN_HANDLER_CONFIG_OPTION.ON,onEscape:t.KEY_DOWN_HANDLER_CONFIG_OPTION.ON},t.JS__TOKEN__DELETE_BUTTON__CLASS_NAME="js__token__delete-button",t.DEFAULT_INPUT_INIT_VALUE=""},732:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(787),o=n(754),a=function(e){var t=e.keyDownHandlerConfig,n=e.predefinedHandler;switch(!0){case t===o.KEY_DOWN_HANDLER_CONFIG_OPTION.ON:n()}};t.default=function(e){var t=e.specialKeyDownConfig,n=e.inputInitValue,u=e.inputValue,l=e.onLastTokenDelete,i=e.handleInputValueUpdate,s=e.handleTokensCreate,c=Object.assign(Object.assign({},o.DEFAULT_SPECIAL_KEY_DOWN_CONFIG),t),f=c.onBackspace,d=c.onTab,p=c.onEnter,y=c.onEscape;return{handleBackspaceKeyDown:(0,r.useCallback)((function(){a({keyDownHandlerConfig:f,predefinedHandler:function(){0===u.length&&l()}})}),[f,u,l]),handleTabKeyDown:(0,r.useCallback)((function(e){a({keyDownHandlerConfig:d,predefinedHandler:function(){e.preventDefault(),s(u)}})}),[d,u,s]),handleEnterKeyDown:(0,r.useCallback)((function(){a({keyDownHandlerConfig:p,predefinedHandler:function(){s(u)}})}),[p,u,s]),handleEscapeKeyDown:(0,r.useCallback)((function(){a({keyDownHandlerConfig:y,predefinedHandler:function(){i(n)}})}),[y,n,i])}}},872:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(787);t.default=function(){var e=(0,r.useRef)(null),t=(0,r.useCallback)((function(){var t=null==e?void 0:e.current;t&&t.getInput().focus()}),[]);return{tokenCreatorRef:e,focusTokenCreator:t}}},120:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0});var o=n(787);t.default=function(e){var t=e.tokenValues,n=e.onTokenValuesChange,a=e.focusTokenCreator,u=(0,o.useCallback)((function(e){var o,u=function(e){if(Array.isArray(e))return r(e)}(o=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();u.splice(e,1),null==n||n(u),a()}),[t,n,a]);return{handleTokenDelete:(0,o.useCallback)((function(e){return function(){u(e)}}),[u]),handleLastTokenDelete:(0,o.useCallback)((function(){u(-1)}),[u])}}},970:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0});var o=n(787);t.default=function(e){var t=e.tokenValues,n=e.onTokenValuesChange,a=e.setTokenActivated,u=e.handleTokenInputFocus,l=e.handleTokenInputBlur;return{handleTokenEditStart:(0,o.useCallback)((function(e){return function(){a(e,!0),u()}}),[a,u]),handleTokenEditEnd:(0,o.useCallback)((function(e){return function(o){if(a(e,!1),l(),void 0!==o){var u=function(e){if(Array.isArray(e))return r(e)}(i=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(i)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();u[e]=o,null==n||n(u)}var i}}),[t,n,a,l])}}},598:(e,t,n)=>{"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0});var o=n(787);t.default=function(){var e,t,n=(e=(0,o.useState)(!1),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=n[0],u=n[1];return{isTokenInputFocused:a,handleTokenInputFocus:(0,o.useCallback)((function(){u(!0)}),[]),handleTokenInputBlur:(0,o.useCallback)((function(){u(!1)}),[])}}},55:(e,t,n)=>{"use strict";function r(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Object.defineProperty(t,"__esModule",{value:!0});var a=n(787);t.default=function(){var e,t,n=(e=(0,a.useState)([]),t=2,function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||r(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=n[0],l=n[1],i=(0,a.useCallback)((function(e,t){if(e>=u.length)throw new Error("setTokenActivated out of tokenMetas scope; targetIndex ".concat(e,"; tokenMetas.length ").concat(u.length));var n=function(e){return function(e){if(Array.isArray(e))return o(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||r(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(u);n[e].activated=t,l(n)}),[u]);return{tokenMetas:u,setTokenMetas:l,setTokenActivated:i}}},870:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a=[],u=!0,l=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{u||null==n.return||n.return()}finally{if(l)throw o}}return a}}(e,t)||o(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var l=n(787),i=u(n(55)),s=u(n(748));t.default=function(e){var t=e.tokenValues,n=e.onTokenValueValidate,u=(0,i.default)(),c=u.tokenMetas,f=u.setTokenMetas,d=u.setTokenActivated,p=r((0,l.useState)(!1),2),y=p[0],h=p[1],_=r((0,l.useState)([]),2),v=_[0],b=_[1];return(0,l.useLayoutEffect)((function(){var e,r=!1,u=t.map((function(e,o){var a=n(e,o,t),u=(0,s.default)(a,e,o);return u.error&&!u.activated&&(r=!0),u}));b(function(e){if(Array.isArray(e))return a(e)}(e=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||o(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),f(u),h(r)}),[t,n,f]),{hasInvalidToken:y,internalTokenValues:v,tokenMetas:c,setTokenActivated:d}}},820:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.KEY_DOWN_HANDLER_CONFIG_OPTION=t.JS__TOKEN__DELETE_BUTTON__CLASS_NAME=void 0;var o=r(n(922)),a=n(754);Object.defineProperty(t,"JS__TOKEN__DELETE_BUTTON__CLASS_NAME",{enumerable:!0,get:function(){return a.JS__TOKEN__DELETE_BUTTON__CLASS_NAME}}),Object.defineProperty(t,"KEY_DOWN_HANDLER_CONFIG_OPTION",{enumerable:!0,get:function(){return a.KEY_DOWN_HANDLER_CONFIG_OPTION}}),t.default=o.default},748:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,n){return{key:"".concat(JSON.stringify(t),"-").concat(Date.now(),"-").concat(n),activated:!1,error:e}}},360:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return e.trim()}},453:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return!0}},810:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return"".concat(e)}},196:(e,t)=>{"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){if(!["string","undefined"].includes(n(t.error))&&null!==t.error)throw new TypeError('"onGetTokenErrorMessage" is required when "ErrorType" not "string"');return t.error}},835:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){}},971:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(776));t.default=function(e,t){var n=t.onBackspace,r=t.onTab,a=t.onEnter,u=t.onEscape;switch((0,o.default)(e).key){case"Backspace":null==n||n(e);break;case"Tab":null==r||r(e);break;case"Enter":null==a||a(e);break;case"Escape":null==u||u(e)}}},184:(e,t)=>{var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var u=o.apply(null,n);u&&e.push(u)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var l in n)r.call(n,l)&&n[l]&&e.push(l);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},776:e=>{self,e.exports=(()=>{"use strict";var e,t={};return e=t,Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e){var t=e.keyCode,n=e.key;return t&&229===t&&(n="Process"),{key:n}},t})()},433:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});const r={container:"token-input-container","container--focused":"token-input-container--focused","container--errors":"token-input-container--errors","autosized-wrapper":"token-input-autosized-wrapper","token-list":"token-input-token-list",token:"token-input-token","token--error":"token-input-token--error","token--read-only":"token-input-token--read-only","token--editable":"token-input-token--editable","token--active":"token-input-token--active","token__label-wrapper":"token-input-token__label-wrapper","token__delete-button":"token-input-token__delete-button","delete-button__close-icon":"token-input-delete-button__close-icon"}},639:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(787),u=i(a),l=i(n(863));function i(e){return e&&e.__esModule?e:{default:e}}var s={position:"absolute",top:0,left:0,visibility:"hidden",height:0,overflow:"scroll",whiteSpace:"pre"},c=["extraWidth","injectStyles","inputClassName","inputRef","inputStyle","minWidth","onAutosize","placeholderIsMinWidth"],f=function(e,t){t.style.fontSize=e.fontSize,t.style.fontFamily=e.fontFamily,t.style.fontWeight=e.fontWeight,t.style.fontStyle=e.fontStyle,t.style.letterSpacing=e.letterSpacing,t.style.textTransform=e.textTransform},d=!("undefined"==typeof window||!window.navigator)&&/MSIE |Trident\/|Edge\//.test(window.navigator.userAgent),p=function(){return d?"_"+Math.random().toString(36).substr(2,12):void 0},y=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.inputRef=function(e){n.input=e,"function"==typeof n.props.inputRef&&n.props.inputRef(e)},n.placeHolderSizerRef=function(e){n.placeHolderSizer=e},n.sizerRef=function(e){n.sizer=e},n.state={inputWidth:e.minWidth,inputId:e.id||p(),prevId:e.id},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,null,[{key:"getDerivedStateFromProps",value:function(e,t){var n=e.id;return n!==t.prevId?{inputId:n||p(),prevId:n}:null}}]),o(t,[{key:"componentDidMount",value:function(){this.mounted=!0,this.copyInputStyles(),this.updateInputWidth()}},{key:"componentDidUpdate",value:function(e,t){t.inputWidth!==this.state.inputWidth&&"function"==typeof this.props.onAutosize&&this.props.onAutosize(this.state.inputWidth),this.updateInputWidth()}},{key:"componentWillUnmount",value:function(){this.mounted=!1}},{key:"copyInputStyles",value:function(){if(this.mounted&&window.getComputedStyle){var e=this.input&&window.getComputedStyle(this.input);e&&(f(e,this.sizer),this.placeHolderSizer&&f(e,this.placeHolderSizer))}}},{key:"updateInputWidth",value:function(){if(this.mounted&&this.sizer&&void 0!==this.sizer.scrollWidth){var e=void 0;e=this.props.placeholder&&(!this.props.value||this.props.value&&this.props.placeholderIsMinWidth)?Math.max(this.sizer.scrollWidth,this.placeHolderSizer.scrollWidth)+2:this.sizer.scrollWidth+2,(e+="number"===this.props.type&&void 0===this.props.extraWidth?16:parseInt(this.props.extraWidth)||0)<this.props.minWidth&&(e=this.props.minWidth),e!==this.state.inputWidth&&this.setState({inputWidth:e})}}},{key:"getInput",value:function(){return this.input}},{key:"focus",value:function(){this.input.focus()}},{key:"blur",value:function(){this.input.blur()}},{key:"select",value:function(){this.input.select()}},{key:"renderStyles",value:function(){var e=this.props.injectStyles;return d&&e?u.default.createElement("style",{dangerouslySetInnerHTML:{__html:"input#"+this.state.inputId+"::-ms-clear {display: none;}"}}):null}},{key:"render",value:function(){var e=[this.props.defaultValue,this.props.value,""].reduce((function(e,t){return null!=e?e:t})),t=r({},this.props.style);t.display||(t.display="inline-block");var n=r({boxSizing:"content-box",width:this.state.inputWidth+"px"},this.props.inputStyle),o=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(this.props,[]);return function(e){c.forEach((function(t){return delete e[t]}))}(o),o.className=this.props.inputClassName,o.id=this.state.inputId,o.style=n,u.default.createElement("div",{className:this.props.className,style:t},this.renderStyles(),u.default.createElement("input",r({},o,{ref:this.inputRef})),u.default.createElement("div",{ref:this.sizerRef,style:s},e),this.props.placeholder?u.default.createElement("div",{ref:this.placeHolderSizerRef,style:s},this.props.placeholder):null)}}]),t}(a.Component);y.propTypes={className:l.default.string,defaultValue:l.default.any,extraWidth:l.default.oneOfType([l.default.number,l.default.string]),id:l.default.string,injectStyles:l.default.bool,inputClassName:l.default.string,inputRef:l.default.func,inputStyle:l.default.object,minWidth:l.default.oneOfType([l.default.number,l.default.string]),onAutosize:l.default.func,onChange:l.default.func,placeholder:l.default.string,placeholderIsMinWidth:l.default.bool,style:l.default.object,value:l.default.any},y.defaultProps={minWidth:1,injectStyles:!0},t.default=y},216:(e,t,n)=>{"use strict";var r=n(138);function o(){}function a(){}a.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,a,u){if(u!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:o};return n.PropTypes=n,n}},863:(e,t,n)=>{e.exports=n(216)()},138:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},787:t=>{"use strict";t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e].call(a.exports,a,a.exports,r),a.exports}return r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(820)})()}));
//# sourceMappingURL=index.js.map

@@ -9,2 +9,2 @@ /*!

/*! react-customize-token-input v2.0.0-beta.0 | (c) 2022 Mark Lin. | MIT | https://github.com/seawind543/react-token-input */
/*! react-customize-token-input v2.0.0-beta.1 | (c) 2022 Mark Lin. | MIT | https://github.com/seawind543/react-token-input */

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

import type { ReactNode } from 'react';
import { type ReactNode } from 'react';
declare type Props = {

@@ -3,0 +3,0 @@ onRenderContent?: () => ReactNode;

@@ -1,4 +0,3 @@

import Token from './Token';
import type { Props } from './Token';
import Token, { type Props } from './Token';
export type { Props };
export default Token;

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

import type { TokenValue, TokenMeta } from '../types/token';
import type { TokenMeta } from '../types/token';
import type { OnBuildTokenValue, OnGetTokenClassName, OnGetTokenDisplayLabel, OnRenderTokenDeleteButtonContent, OnGetIsTokenEditable, OnGetTokenEditableValue, OnGetTokenErrorMessage } from '../types/interfaces';
export declare type Props<ValueType, ErrorType> = {
readOnly: boolean;
tokenValue: TokenValue<ValueType>;
tokenValue: ValueType;
tokenMeta: TokenMeta<ErrorType>;

@@ -15,3 +15,3 @@ onGetClassName?: OnGetTokenClassName<ValueType, ErrorType>;

onEditStart: () => void;
onEditEnd: (newTokenValue?: TokenValue<ValueType>) => void;
onEditEnd: (newTokenValue?: ValueType) => void;
onDelete: () => void;

@@ -18,0 +18,0 @@ };

@@ -1,6 +0,5 @@

import type { ReactElement, Ref } from 'react';
import { type ReactElement, type Ref } from 'react';
import type { HandleTokenInputFocus, HandleTokenInputBlur } from './hooks/useTokenInputFocusEffect';
import type { TokenSeparator } from './types/mix';
import type { SpecialKeyDownConfig } from './types/specialKeyDown';
import type { TokenValue } from './types/token';
import type { OnInputValueChange, OnPreprocess, OnBuildTokenValue } from './types/interfaces';

@@ -17,3 +16,3 @@ declare type Props<ValueType> = {

onBuildTokenValue: OnBuildTokenValue<ValueType>;
onNewTokenValuesAppend: (appendTokenValues: TokenValue<ValueType>[]) => void;
onNewTokenValuesAppend: (appendTokenValues: ValueType[]) => void;
onLastTokenDelete: () => void;

@@ -20,0 +19,0 @@ };

@@ -1,14 +0,13 @@

import type { CSSProperties, FunctionComponent } from 'react';
import type { Props as TokenProps } from './Token';
import { type CSSProperties, type FunctionComponent } from 'react';
import { type Props as TokenProps } from './Token';
import type { TokenSeparator } from './types/mix';
import type { SpecialKeyDownConfig } from './types/specialKeyDown';
import type { OnInputValueChange, OnPreprocess, OnBuildTokenValue, OnTokenValueValidate, OnTokenValuesChange, OnGetTokenClassName, OnGetTokenDisplayLabel, OnRenderTokenDeleteButtonContent, OnGetIsTokenEditable, OnGetTokenEditableValue, OnGetTokenErrorMessage } from './types/interfaces';
import type { TokenValue } from './types/token';
declare type Props<ValueType, ErrorType> = {
export declare type Props<ValueType, ErrorType> = {
style?: CSSProperties;
className?: string;
placeholder?: string;
readOnly?: boolean;
autoFocus?: boolean;
placeholder?: string;
tokenValues: TokenValue<ValueType>[];
tokenValues: ValueType[];
separators?: TokenSeparator[];

@@ -29,3 +28,3 @@ specialKeyDown?: SpecialKeyDownConfig;

};
declare const TokenInput: <ValueType, ErrorType>({ className, readOnly, autoFocus, placeholder, tokenValues, separators, specialKeyDown, onInputValueChange, onPreprocess, onTokenValueValidate, onTokenValuesChange, onBuildTokenValue, customizeTokenComponent, onGetTokenClassName, onGetTokenDisplayLabel, onRenderTokenDeleteButtonContent, onGetIsTokenEditable, onGetTokenEditableValue, onGetTokenErrorMessage, ...props }: Props<ValueType, ErrorType>) => JSX.Element;
declare const TokenInput: <ValueType, ErrorType>({ className, placeholder, readOnly, autoFocus, tokenValues, separators, specialKeyDown, onInputValueChange, onPreprocess, onTokenValueValidate, onTokenValuesChange, onBuildTokenValue, customizeTokenComponent, onGetTokenClassName, onGetTokenDisplayLabel, onRenderTokenDeleteButtonContent, onGetIsTokenEditable, onGetTokenEditableValue, onGetTokenErrorMessage, ...props }: Props<ValueType, ErrorType>) => JSX.Element;
export default TokenInput;
import type { ReactNode } from 'react';
import { InputString } from './mix';
import { TokenIndex, TokenValue, TokenMeta } from './token';
import { TokenIndex, TokenMeta } from './token';
export declare type OnInputValueChange = (newValue: InputString, previousValue: InputString) => void;
export declare type OnPreprocess = (values: InputString[]) => InputString[];
export declare type OnBuildTokenValue<ValueType> = (inputValue: InputString) => TokenValue<ValueType>;
export declare type OnTokenValuesChange<ValueType> = (modifiedTokenValues: TokenValue<ValueType>[]) => void;
export declare type OnTokenValueValidate<ValueType, ErrorType> = (tokenValue: TokenValue<ValueType>, tokenIndex: TokenIndex, tokenValues: TokenValue<ValueType>[]) => TokenMeta<ErrorType>['error'];
export declare type OnGetTokenClassName<ValueType, ErrorType> = (tokenValue: TokenValue<ValueType>, tokenMeta: TokenMeta<ErrorType>) => undefined | string;
export declare type OnGetTokenDisplayLabel<ValueType, ErrorType> = (tokenValue: TokenValue<ValueType>, tokenMeta: TokenMeta<ErrorType>) => InputString | ReactNode;
export declare type OnBuildTokenValue<ValueType> = (inputValue: InputString) => ValueType;
export declare type OnTokenValuesChange<ValueType> = (modifiedTokenValues: ValueType[]) => void;
export declare type OnTokenValueValidate<ValueType, ErrorType> = (tokenValue: ValueType, tokenIndex: TokenIndex, tokenValues: ValueType[]) => TokenMeta<ErrorType>['error'];
export declare type OnGetTokenClassName<ValueType, ErrorType> = (tokenValue: ValueType, tokenMeta: TokenMeta<ErrorType>) => undefined | string;
export declare type OnGetTokenDisplayLabel<ValueType, ErrorType> = (tokenValue: ValueType, tokenMeta: TokenMeta<ErrorType>) => InputString | ReactNode;
export declare type OnRenderTokenDeleteButtonContent = () => ReactNode;
export declare type OnGetIsTokenEditable<ValueType, ErrorType> = (tokenValue: TokenValue<ValueType>, tokenMeta: TokenMeta<ErrorType>) => boolean;
export declare type OnGetTokenEditableValue<ValueType, ErrorType> = (tokenValue: TokenValue<ValueType>, tokenMeta: TokenMeta<ErrorType>) => InputString;
export declare type OnGetTokenErrorMessage<ValueType, ErrorType> = (tokenValue: TokenValue<ValueType>, tokenMeta: TokenMeta<ErrorType>) => TokenMeta<ErrorType>['error'];
export declare type OnGetIsTokenEditable<ValueType, ErrorType> = (tokenValue: ValueType, tokenMeta: TokenMeta<ErrorType>) => boolean;
export declare type OnGetTokenEditableValue<ValueType, ErrorType> = (tokenValue: ValueType, tokenMeta: TokenMeta<ErrorType>) => InputString;
export declare type OnGetTokenErrorMessage<ValueType, ErrorType> = (tokenValue: ValueType, tokenMeta: TokenMeta<ErrorType>) => TokenMeta<ErrorType>['error'];
export declare type InputString = string;
export declare type TokenSeparator = string;
export declare type Nullish = null | undefined;

@@ -1,4 +0,2 @@

export declare type DefaultValueType = string;
export declare type DefaultErrorType = string;
export declare type TokenValue<ValueType> = DefaultValueType | ValueType;
import type { Nullish } from './mix';
export declare type TokenIndex = number;

@@ -8,3 +6,3 @@ export declare type TokenMeta<ErrorType> = {

activated: boolean;
error: undefined | DefaultErrorType | ErrorType;
error: Nullish | ErrorType;
};

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

import type { TokenValue, TokenIndex, TokenMeta } from '../types/token';
declare const buildTokenMeta: <ValueType, ErrorType>(customizeError: string | ErrorType | undefined, tokenValue: TokenValue<ValueType>, tokenIndex: TokenIndex) => TokenMeta<ErrorType>;
import type { TokenIndex, TokenMeta } from '../types/token';
declare const buildTokenMeta: <ValueType, ErrorType>(customizeError: import("../types/mix").Nullish | ErrorType, tokenValue: ValueType, tokenIndex: TokenIndex) => TokenMeta<ErrorType>;
export default buildTokenMeta;
import type { InputString } from '../types/mix';
import type { DefaultValueType, TokenValue } from '../types/token';
declare const defaultBuildTokenValue: (inputValue: InputString) => TokenValue<DefaultValueType>;
declare const defaultBuildTokenValue: <ValueType>(inputValue: InputString) => ValueType;
export default defaultBuildTokenValue;
import type { InputString } from '../types/mix';
import type { TokenValue, TokenMeta } from '../types/token';
declare const defaultGetTokenEditableValue: <ValueType, ErrorType>(tokenValue: TokenValue<ValueType>, tokenMeta: TokenMeta<ErrorType>) => InputString;
import type { TokenMeta } from '../types/token';
declare const defaultGetTokenEditableValue: <ValueType, ErrorType>(tokenValue: ValueType, tokenMeta: TokenMeta<ErrorType>) => InputString;
export default defaultGetTokenEditableValue;

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

import type { DefaultErrorType, TokenValue, TokenMeta } from '../types/token';
declare const defaultGetTokenErrorMessage: <ValueType, ErrorType>(_: TokenValue<ValueType>, tokenMeta: TokenMeta<ErrorType>) => undefined | DefaultErrorType;
import type { TokenMeta } from '../types/token';
declare const defaultGetTokenErrorMessage: <ValueType, ErrorType>(_: ValueType, tokenMeta: TokenMeta<ErrorType>) => import("../types/mix").Nullish | ErrorType;
export default defaultGetTokenErrorMessage;
{
"name": "react-customize-token-input",
"version": "2.0.0-beta.0",
"version": "2.0.0-beta.1",
"description": "A react token (tag) input component. Allow customize data structure and Look & Feel",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -20,4 +20,2 @@ # React TokenInput [![build status](https://travis-ci.org/seawind543/react-token-input.svg?branch=master)](https://travis-ci.org/seawind543/react-token-input) [![Coverage Status](https://coveralls.io/repos/github/seawind543/react-token-input/badge.svg?branch=master)](https://coveralls.io/github/seawind543/react-token-input?branch=master)

## Installation

@@ -69,24 +67,42 @@

type Props<ValueType, ErrorType> = {
// Assign style to the TokenInput
/**
* For assign style to the TokenInput
*/
style?: CSSProperties;
// Assign className to the TokenInput
/**
* For assign class to the TokenInput
*/
className?: string;
// Specific TokenInput is `readOnly` or not
/**
* For set placeholder to the TokenInput
*/
placeholder?: string;
/**
* To specific TokenInput is `readOnly` mode or not
* @default false
*/
readOnly?: boolean;
// Specific TokenInput should be autoFocus or not
/**
* To specific TokenInput should be autoFocus or not
* @default false
*/
autoFocus?: boolean;
// Placeholder of TokenInput
placeholder?: string;
// The array of tokenValue of TokenInput
tokenValues: TokenValue<ValueType>[];
/**
* TokenCreator props
* The array of tokenValue of TokenInput.
* This array will be used to render the tokens.
*
* Type: ValueType
* Description:
* Customize data structure data
* Could be string | number | object | customize data structure...etc.
*/
tokenValues: ValueType[];
// TokenCreator props
/**

@@ -106,2 +122,24 @@ * An array of characters to split the user input string into array.

/**
* [Beta; Might be change in the future version]
* Current only apply to the `TokenCreator`
*
* The settings to control the behavior of specials keyDown's event handler.
* Recommend to use the build-in constant `KEY_DOWN_HANDLER_CONFIG_OPTION` to config the setting.
*
* `KEY_DOWN_HANDLER_CONFIG_OPTION.OFF` means turn `off`
* (Took native browser behavior. The TokenInput should NOT handle it).
*
* `KEY_DOWN_HANDLER_CONFIG_OPTION.ON` means apply TokenInput predefined event handler.
*
* Default setting as below.
* specialKeyDown: {
* onBackspace: KEY_DOWN_HANDLER_CONFIG_OPTION.ON,
* onTab: KEY_DOWN_HANDLER_CONFIG_OPTION.OFF,
* onEnter: KEY_DOWN_HANDLER_CONFIG_OPTION.ON,
* onEscape: KEY_DOWN_HANDLER_CONFIG_OPTION.ON,
* },
*/
specialKeyDown?: SpecialKeyDownConfig;
/**
* A callback function invoked when end-user typing but not become token yet

@@ -149,3 +187,4 @@ *

/**
* A callback function to validate tokenValue
* A callback function to validate a tokenValue
* (The returned result will be use by `onGetTokenErrorMessage`)
*

@@ -155,3 +194,3 @@ * onTokenValueValidate(tokenValue, tokenIndex, tokenValues)

* @ tokenValue
* Type: any (string | number | object | customize data structure)
* Type: ValueType
* Description: The tokenValue build by `onBuildTokenValue`

@@ -164,19 +203,17 @@ *

* @ tokenValues
* Type: array
* Type: ValueType[]
* Description: The array of tokenValue of TokenInput
*
* @ return
* Type: any (string | number | object | customize data structure)
* Type: TokenMeta<ErrorType>['error']
* Description:
* The customize error.
* Specific the token's validate status or errorMessage.
* Could be an error message to display or error object
* Could be `an error message` to display, or an error object for further operations.
*
* Will be use by `onGetTokenErrorMessage`
* Return `Nullish` types means the token is valid.
*/
onTokenValueValidate?: OnTokenValueValidate<ValueType, ErrorType>;
/**
* Token props
*/
// Token props

@@ -189,3 +226,3 @@ /**

* @ modifiedTokenValues
* Type: TokenValue<ValueType>[]
* Type: ValueType[]
* Description: the new tokenValues

@@ -208,4 +245,6 @@ */

* @ return
* Type: TokenValue<ValueType>
* Description: customize data structure TokenValue
* Type: ValueType
* Description:
* Customize data structure data
* Could be string | number | object | customize data structure...etc.
*/

@@ -229,3 +268,3 @@ onBuildTokenValue?: OnBuildTokenValue<ValueType>;

* @ tokenValue
* Type: TokenValue<ValueType>
* Type: ValueType
* Description: The tokenValue build by `onBuildTokenValue`

@@ -251,3 +290,3 @@ *

* @ tokenValue
* Type: TokenValue<ValueType>
* Type: ValueType
* Description: The tokenValue build by `onBuildTokenValue`

@@ -287,3 +326,3 @@ *

* @ tokenValue
* Type: TokenValue<ValueType>
* Type: ValueType
* Description: The tokenValue build by `onBuildTokenValue`

@@ -308,3 +347,3 @@ *

* @ tokenValue
* Type: TokenValue<ValueType>
* Type: ValueType
* Description: The tokenValue build by `onBuildTokenValue`

@@ -329,3 +368,3 @@ *

* @ tokenValue
* Type: TokenValue<ValueType>
* Type: ValueType
* Description: The tokenValue build by `onBuildTokenValue`

@@ -338,3 +377,3 @@ *

* @ return
* Type: undefined | DefaultErrorType | ErrorType
* Type: Nullish | ErrorType
* Description: The error message to describe an invalid token

@@ -346,29 +385,2 @@ */

### Beta props
```JavaScript
/**
* [Beta; Might be change in the future version]
* Current only apply to the `TokenCreator`
*
* The settings to control the behavior of specials keyDown's event handler.
* Recommend to use the build-in constant `KEY_DOWN_HANDLER_CONFIG_OPTION` to config the setting.
*
* `KEY_DOWN_HANDLER_CONFIG_OPTION.OFF` means turn `off`
* (Took native browser behavior. The TokenInput should NOT handle it).
*
* `KEY_DOWN_HANDLER_CONFIG_OPTION.ON` means apply TokenInput predefined event handler.
*
* Default setting as below.
* specialKeyDown: {
* onBackspace: KEY_DOWN_HANDLER_CONFIG_OPTION.ON,
* onTab: KEY_DOWN_HANDLER_CONFIG_OPTION.OFF,
* onEnter: KEY_DOWN_HANDLER_CONFIG_OPTION.ON,
* onEscape: KEY_DOWN_HANDLER_CONFIG_OPTION.ON,
* },
*/
specialKeyDown?: SpecialKeyDownConfig;
```
## Predefined KeyDown Event Handlers

@@ -382,4 +394,4 @@

---------- | :------------ | :---
Backspace | In case the value is an `empty string`, the latest **token** in the list tail will be deleted. |
Escape | Clear the input value. | A.K.A. Reset.
Backspace | In case the current inputValue is an `empty string`, the latest **token** in the list tail will be deleted. |
Escape | Clear the input-box's value. | A.K.A. Reset.
Enter | Create a token with the inputValue and continually focused on the inputBox for the next inputting. |

@@ -395,3 +407,3 @@ Tab | Same as onEnter. | <ul> <li>Default not apply</li> <li>Under Beta</li> </ul>

## Default value of optional Props
## Default value of the optional Props

@@ -401,5 +413,5 @@ ```JavaScript

className = undefined,
placeholder = undefined,
readOnly = false,
autoFocus = false,
placeholder = undefined,

@@ -452,27 +464,46 @@ // TokenCreator

Your CustomizeTokenComponent will receive these props from the TokenInput. You could decide where & how to use them to Customize your Token component.
Could also reference this [Example Demo](https://seawind543.github.io/react-token-input/#example-customize-token-component) and its source code `ExampleCustomizeToken` from the folder `examples`.
```JavaScript
type Props<ValueType, ErrorType> = {
// Same as props of TokenInput
export type Props<ValueType, ErrorType> = {
/**
* Same as props of TokenInput
*/
readOnly: boolean;
// tokenValue of token
tokenValue: TokenValue<ValueType>;
// tokenMeta of token
tokenValue: ValueType;
tokenMeta: TokenMeta<ErrorType>;
// Same as props `onGetTokenClassName` of TokenInput
/**
* Same as props `onGetTokenClassName` of TokenInput
*/
onGetClassName?: OnGetTokenClassName<ValueType, ErrorType>;
// Same as props `onGetTokenDisplayLabel` of TokenInput
/**
* Same as props `onGetTokenDisplayLabel` of TokenInput
*/
onGetDisplayLabel: OnGetTokenDisplayLabel<ValueType, ErrorType>;
// Same as props `onRenderTokenDeleteButtonContent` of TokenInput
/**
* Same as props `onRenderTokenDeleteButtonContent` of TokenInput
*/
onRenderDeleteButtonContent?: OnRenderTokenDeleteButtonContent;
// Same as props `onGetIsTokenEditable` of TokenInput
/**
* Same as props `onGetIsTokenEditable` of TokenInput
*/
onGetIsEditable: OnGetIsTokenEditable<ValueType, ErrorType>;
// Same as props `onGetTokenEditableValue` of TokenInput
/**
* Same as props `onGetTokenEditableValue` of TokenInput
*/
onGetEditableValue: OnGetTokenEditableValue<ValueType, ErrorType>;
// Same as props `onBuildTokenValue` of TokenInput
/**
* Same as props `onBuildTokenValue` of TokenInput
*/
onBuildTokenValue: OnBuildTokenValue<ValueType>;
// Same as props `onGetTokenErrorMessage` of TokenInput
/**
* Same as props `onGetTokenErrorMessage` of TokenInput
*/
onGetErrorMessage: OnGetTokenErrorMessage<ValueType, ErrorType>;

@@ -510,3 +541,3 @@

* @ newTokenValue
* Type: undefined | TokenValue<ValueType>
* Type: undefined | ValueType
* Description:

@@ -523,3 +554,3 @@ * The new tokenValue build by `onBuildTokenValue.

*/
onEditEnd: (newTokenValue?: TokenValue<ValueType>) => void;
onEditEnd: (newTokenValue?: ValueType) => void;

@@ -526,0 +557,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

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