@propellerads/tags-input 3.6.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ #### `4.0.0`
2
+
3
+ * Added creatable select
4
+
5
+ #### `3.7.0`
6
+
7
+ * Show minimal length info for async select
8
+
1
9
  #### `3.5.0`
2
10
 
3
11
  * New action color from themeProvider
@@ -11,6 +11,7 @@ var ReactSelect__default = _interopDefault(ReactSelect);
11
11
  var isFunction = _interopDefault(require('lodash.isfunction'));
12
12
  var ReactAsyncSelect = _interopDefault(require('react-select/lib/Async'));
13
13
  var ErrorLabel = _interopDefault(require('@propellerads/error-label'));
14
+ var CreatableSelect = _interopDefault(require('react-select/lib/Creatable'));
14
15
  var icon = require('@propellerads/icon');
15
16
  var styled = _interopDefault(require('styled-components'));
16
17
  var stylevariables = require('@propellerads/stylevariables');
@@ -329,6 +330,11 @@ var _ClearIndicator = function ClearIndicator(props) {
329
330
 
330
331
  var TagsInput = function TagsInput(props) {
331
332
  var reactSelectElement = React.useRef(null);
333
+
334
+ var _useState = React.useState(false),
335
+ showMinLenTip = _useState[0],
336
+ setShowMinLenTip = _useState[1];
337
+
332
338
  var _props$components = props.components,
333
339
  components = _props$components === void 0 ? {} : _props$components,
334
340
  _props$customStyles = props.customStyles,
@@ -357,8 +363,23 @@ var TagsInput = function TagsInput(props) {
357
363
  value = _props$value === void 0 ? [] : _props$value,
358
364
  _props$actionColor = props.actionColor,
359
365
  actionColor = _props$actionColor === void 0 ? '' : _props$actionColor,
366
+ _props$isCreatable = props.isCreatable,
367
+ isCreatable = _props$isCreatable === void 0 ? false : _props$isCreatable,
368
+ _props$isLoading = props.isLoading,
369
+ isLoading = _props$isLoading === void 0 ? false : _props$isLoading,
370
+ _props$loadingMessage = props.loadingMessage,
371
+ loadingMessage = _props$loadingMessage === void 0 ? function () {
372
+ return 'Loading...';
373
+ } : _props$loadingMessage,
360
374
  _props$minHeightInput = props.minHeightInput,
361
- minHeightInput = _props$minHeightInput === void 0 ? 36 : _props$minHeightInput;
375
+ minHeightInput = _props$minHeightInput === void 0 ? 36 : _props$minHeightInput,
376
+ _props$createOptionPl = props.createOptionPlaceholder,
377
+ createOptionPlaceholder = _props$createOptionPl === void 0 ? 'Create ' : _props$createOptionPl,
378
+ _props$onCreateOption = props.onCreateOption,
379
+ _onCreateOption = _props$onCreateOption === void 0 ? function () {
380
+ return null;
381
+ } : _props$onCreateOption;
382
+
362
383
  var currentValue = value;
363
384
 
364
385
  var preparedStyled = _extends({}, prepareStyles(actionColor), customStyles, {
@@ -380,6 +401,9 @@ var TagsInput = function TagsInput(props) {
380
401
  filterOption: filterOption
381
402
  }, {
382
403
  styles: preparedStyled,
404
+ loadingMessage: showMinLenTip ? function () {
405
+ return 'Enter two or more characters';
406
+ } : loadingMessage,
383
407
  components: _extends({
384
408
  ClearIndicator: function ClearIndicator(clearIndicatorProps) {
385
409
  return React__default.createElement(_ClearIndicator, Object.assign({}, clearIndicatorProps, {
@@ -391,9 +415,14 @@ var TagsInput = function TagsInput(props) {
391
415
 
392
416
  var handleAsyncRequest = function handleAsyncRequest(newValue) {
393
417
  if (!newValue.length || newValue.length < 2) {
418
+ setShowMinLenTip(true);
394
419
  return null;
395
420
  }
396
421
 
422
+ if (!showMinLenTip) {
423
+ setShowMinLenTip(false);
424
+ }
425
+
397
426
  return promiseOptions(newValue);
398
427
  };
399
428
 
@@ -418,18 +447,29 @@ var TagsInput = function TagsInput(props) {
418
447
  }
419
448
  };
420
449
 
421
- var asyncSelect = React__default.createElement(ReactAsyncSelect, Object.assign({}, config, {
450
+ var regularSelect = isAsync ? React__default.createElement(ReactAsyncSelect, Object.assign({}, config, {
422
451
  loadOptions: function loadOptions(newValue) {
423
452
  return handleAsyncRequest(newValue);
424
453
  }
425
- }));
426
- var select = React__default.createElement("div", {
454
+ })) : React__default.createElement("div", {
427
455
  onPaste: onPaste
428
456
  }, React__default.createElement(ReactSelect__default, Object.assign({}, config, {
429
457
  ref: reactSelectElement,
430
458
  options: options
431
459
  })));
432
- return React__default.createElement(StyledTagsInput, null, isAsync ? asyncSelect : select, errors && errors.length > 0 && isErrorLabelVisible && React__default.createElement(TagsInputErrors, null, React__default.createElement(ErrorLabel, {
460
+ var select = isCreatable ? React__default.createElement(CreatableSelect, Object.assign({
461
+ formatCreateLabel: function formatCreateLabel(newValue) {
462
+ return createOptionPlaceholder + "\"" + newValue + "\"";
463
+ },
464
+ isLoading: isLoading,
465
+ onCreateOption: function onCreateOption(newOption) {
466
+ return _onCreateOption(newOption);
467
+ }
468
+ }, config, {
469
+ ref: reactSelectElement,
470
+ options: options
471
+ })) : regularSelect;
472
+ return React__default.createElement(StyledTagsInput, null, select, errors && errors.length > 0 && isErrorLabelVisible && React__default.createElement(TagsInputErrors, null, React__default.createElement(ErrorLabel, {
433
473
  elementId: elementId,
434
474
  errors: errors
435
475
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"tags-input.cjs.development.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport {\n lineHeight, actionColor, borderRadius, gray80, errorColor, black, white,\n} from '@propellerads/stylevariables';\n\nconst StyledTagsInput = styled.div`\n position: relative;\n`;\n\nconst TagsInputErrors = styled.div`\n position: absolute;\n display: flex;\n flex-direction: row;\n right: 1px;\n top: 0;\n height: ${lineHeight}px;\n align-items: center;\n`;\n\nconst prepareStyles = (customActionColor: string) => {\n const mainColor = customActionColor || actionColor;\n return {\n control: (styles, {isFocused, isDisabled}) => ({\n ...styles,\n borderRadius,\n backgroundColor: isDisabled ? '#ededed' : '#fff',\n minHeight: `${lineHeight}px`,\n borderWidth: 1,\n boxShadow: 'none',\n borderColor: isFocused ? mainColor : gray80,\n }),\n valueContainer: (styles) => ({\n ...styles,\n overflow: 'hidden',\n padding: '2px 2px 4px 2px',\n justifyContent: 'flex-start',\n }),\n placeholder: () => ({\n color: '#c0c0c0',\n fontWeight: 100,\n paddingLeft: '4px',\n position: 'absolute',\n }),\n clearIndicator: () => ({\n color: '#c0c0c0',\n display: 'inline-flex',\n marginRight: '4px',\n }),\n dropdownIndicator: () => ({\n display: 'none',\n }),\n indicatorSeparator: () => ({\n display: 'none',\n }),\n multiValue: (styles, {data}) => ({\n ...styles,\n backgroundColor: data.isException ? errorColor : mainColor,\n color: white,\n borderRadius: `${borderRadius / 2}px`,\n height: '22px',\n display: 'flex',\n alignItems: 'center',\n margin: '2px 0 0 2px',\n }),\n multiValueLabel: (styles) => ({\n ...styles,\n color: white,\n padding: '0 0 0 5px',\n fontSize: '12px',\n borderRadius: 0,\n display: 'inline-flex',\n lineHeight: '1',\n }),\n multiValueRemove: (styles, {data}) => ({\n ...styles,\n padding: 0,\n margin: '0 4px 0 2px',\n backgroundColor: data.isException ? errorColor : mainColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : mainColor,\n color: 'white',\n },\n }),\n menu: (styles) => ({\n ...styles,\n margin: 0,\n borderRadius: 0,\n zIndex: 10,\n }),\n menuList: (styles) => ({\n ...styles,\n '::-webkit-scrollbar': {\n width: '7px',\n },\n '::-webkit-scrollbar-thumb': {\n borderRadius: '4px',\n backgroundColor: 'rgba(0, 0, 0, .5)',\n boxShadow: '0 0 1px rgba(255, 255, 255, .5)',\n },\n }),\n option: (styles, {isFocused}) => ({\n backgroundColor: isFocused ? mainColor : null,\n padding: '5px 10px',\n fontSize: '14px',\n color: isFocused ? white : black,\n }),\n input: (styles) => ({\n ...styles,\n height: '16px',\n }),\n };\n};\n\nexport {prepareStyles, StyledTagsInput, TagsInputErrors};\n","import React, {useRef} from 'react';\nimport ReactSelect, {components as reactSelectComponents} from 'react-select';\nimport isFunction from 'lodash.isfunction';\nimport ReactAsyncSelect from 'react-select/lib/Async';\nimport ErrorLabel from '@propellerads/error-label';\nimport {Close, SIZE, COLOR} from '@propellerads/icon';\n\nimport {TagsInputProps} from './types';\nimport {prepareStyles, StyledTagsInput, TagsInputErrors} from './style';\n\n// regexps by priority\nconst REGEXPS = [\n /(?:\\b|\\B)\\n+\\b/,\n /(?:\\b|\\B),\\s\\b/,\n /(?:\\b|\\B),+\\b/,\n];\n\ninterface SplitStringReturnValue {\n splits: string[]\n specialHandle: boolean\n}\n\nfunction splitString(value: string): SplitStringReturnValue {\n let splits: string[] = [];\n\n let specialHandle = false;\n // eslint-disable-next-line no-restricted-syntax\n for (const regex of REGEXPS) {\n splits = value.split(regex);\n if (splits.length > 1) {\n break;\n }\n }\n\n // special case. Need handle in special way\n if (splits.length === 1) {\n splits = value.split(/\\b\\s+\\b/);\n specialHandle = splits.length > 1;\n }\n\n return {\n splits,\n specialHandle,\n };\n}\n\nfunction searchSuitableOptions(pastedValue, availableOptions, searchableKeys) {\n const {splits, specialHandle} = splitString(pastedValue);\n\n if (specialHandle) {\n let rawPastedString = splits.join(' ')\n .toLowerCase();\n\n return availableOptions\n .sort((firstEl, secondEl) => {\n if (firstEl.label.length > secondEl.label.length) {\n return -1;\n }\n if (firstEl.label.length < secondEl.label.length) {\n return 1;\n }\n\n return 0;\n })\n .filter((option) => searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const position = rawPastedString.search(optionValue);\n const condition = position !== -1;\n if (condition) {\n rawPastedString = rawPastedString.replace(optionValue, '');\n }\n\n return prevValue || condition;\n }, false));\n }\n\n return splits.map((splitValue) => availableOptions.find((option) => {\n const comparableValue = splitValue.trim().toLowerCase();\n\n return searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const condition = optionValue === comparableValue;\n\n return prevValue || condition;\n }, false);\n }))\n .filter(Boolean);\n}\n\ninterface ClearIndicatorProps {\n // eslint-disable-next-line @typescript-eslint/ban-types\n getStyles: (clearIndicator: string, props: any) => {},\n innerProps: {\n ref: React.Ref<HTMLDivElement>\n },\n elementId: string,\n}\n\nconst ClearIndicator = (props: ClearIndicatorProps) => {\n const {\n elementId,\n getStyles,\n innerProps: {\n ref,\n ...restInnerProps\n },\n } = props;\n\n return (\n <div\n {...restInnerProps}\n ref={ref}\n style={getStyles('clearIndicator', props)}\n id={`${elementId}-clear`}\n >\n <Close\n color={COLOR.GRAY_DARK}\n size={SIZE.MEDIUM_SMALL}\n />\n </div>\n );\n};\n\nconst TagsInput = (props: TagsInputProps) => {\n const reactSelectElement = useRef<any>(null);\n\n const {\n components = {},\n customStyles = {},\n elementId,\n errors = [],\n isAsync = false,\n isErrorLabelVisible = false,\n onChange,\n onInputChange = null,\n filterOption = null,\n options = [],\n promiseOptions = () => Promise.resolve(),\n searchableKeys = [\n 'label',\n ],\n value = [],\n actionColor = '',\n isClearable = true,\n isDisabled = false,\n isLoading = false,\n isRtl = false,\n isMulti = true,\n isSearchable = true,\n cacheOptions = false,\n placeholder = 'Start typing...',\n noOptionsMessage = () => 'No options...',\n loadingMessage = () => 'Loading...',\n minHeightInput = 36,\n } = props;\n\n const currentValue = value;\n\n const preparedStyled = {\n ...prepareStyles(actionColor),\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...prepareStyles(actionColor).control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : prepareStyles(actionColor).control(base, state).border,\n minHeight: minHeightInput,\n };\n },\n };\n\n const config = {\n ...props,\n id: elementId,\n onChange,\n ...(onInputChange && {onInputChange}),\n ...(filterOption && {filterOption}),\n styles: preparedStyled,\n components: {\n ClearIndicator: (clearIndicatorProps) => (\n <ClearIndicator\n {...clearIndicatorProps}\n elementId={elementId}\n />\n ),\n ...components,\n },\n };\n\n const handleAsyncRequest = (newValue: any) => {\n if (!newValue.length || newValue.length < 2) {\n return null;\n }\n\n return promiseOptions(newValue);\n };\n\n const onPaste = (e) => {\n const pasteData = e.clipboardData.getData('text/plain');\n\n const pastedOptions = searchSuitableOptions(pasteData, options, searchableKeys);\n\n const newInputOptions = pastedOptions.reduce((acc, curVal) => {\n if (!acc.find((el) => el.value === curVal.value)) {\n acc.push(curVal);\n }\n\n return acc;\n }, currentValue);\n\n if (pastedOptions.length !== 0) {\n onChange(newInputOptions);\n setTimeout(() => {\n reactSelectElement.current.select.blur();\n }, 0);\n }\n };\n\n const asyncSelect = (\n <ReactAsyncSelect\n {...config}\n loadOptions={(newValue) => handleAsyncRequest(newValue)}\n />\n );\n\n const select = (\n <div onPaste={onPaste}>\n <ReactSelect\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n </div>\n );\n\n return (\n <StyledTagsInput>\n {isAsync ? asyncSelect : select}\n {errors && errors.length > 0 && isErrorLabelVisible && (\n <TagsInputErrors>\n <ErrorLabel\n elementId={elementId}\n errors={errors}\n />\n </TagsInputErrors>\n )}\n </StyledTagsInput>\n );\n};\n\nfunction customChecker(props, propName, component) {\n const {[propName]: propValue} = props;\n if (typeof propValue !== 'function') {\n return new Error(`Invalid prop \"${propName}\" passed to ${component}`);\n }\n\n const value = propValue();\n if (typeof value !== 'string' && !React.isValidElement(value)) {\n // eslint-disable-next-line max-len\n return new Error(`Invalid prop \"${propName}\" passed to ${component}. Function should return \"string\" or \"react.Node\"`);\n }\n\n return null;\n}\n\nexport {reactSelectComponents as components};\n\nexport default TagsInput;\n"],"names":["StyledTagsInput","styled","div","TagsInputErrors","lineHeight","prepareStyles","customActionColor","mainColor","actionColor","control","styles","isFocused","isDisabled","borderRadius","backgroundColor","minHeight","borderWidth","boxShadow","borderColor","gray80","valueContainer","overflow","padding","justifyContent","placeholder","color","fontWeight","paddingLeft","position","clearIndicator","display","marginRight","dropdownIndicator","indicatorSeparator","multiValue","data","isException","errorColor","white","height","alignItems","margin","multiValueLabel","fontSize","multiValueRemove","cursor","menu","zIndex","menuList","width","option","black","input","REGEXPS","splitString","value","splits","specialHandle","regex","split","length","searchSuitableOptions","pastedValue","availableOptions","searchableKeys","rawPastedString","join","toLowerCase","sort","firstEl","secondEl","label","filter","reduce","prevValue","currValue","optionValue","String","search","condition","replace","map","splitValue","find","comparableValue","trim","Boolean","ClearIndicator","props","elementId","getStyles","innerProps","ref","restInnerProps","React","style","id","Close","COLOR","GRAY_DARK","size","SIZE","MEDIUM_SMALL","TagsInput","reactSelectElement","useRef","components","customStyles","errors","isAsync","isErrorLabelVisible","onChange","onInputChange","filterOption","options","promiseOptions","Promise","resolve","minHeightInput","currentValue","preparedStyled","base","state","isFunction","border","config","clearIndicatorProps","handleAsyncRequest","newValue","onPaste","e","pasteData","clipboardData","getData","pastedOptions","newInputOptions","acc","curVal","el","push","setTimeout","current","select","blur","asyncSelect","ReactAsyncSelect","loadOptions","ReactSelect","ErrorLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,eAAe,gBAAGC,MAAM,CAACC,GAAV,iCAArB;AAIA,IAAMC,eAAe,gBAAGF,MAAM,CAACC,GAAV,mCAMPE,yBANO,CAArB;;AAUA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,iBAAD;AACpB,MAAMC,SAAS,GAAGD,iBAAiB,IAAIE,0BAAvC;AACA,SAAO;AACLC,IAAAA,OAAO,EAAE,iBAACC,MAAD;AAAA,UAAUC,SAAV,QAAUA,SAAV;AAAA,UAAqBC,UAArB,QAAqBA,UAArB;AAAA,0BACJF,MADI;AAEPG,QAAAA,YAAY,EAAZA,2BAFO;AAGPC,QAAAA,eAAe,EAAEF,UAAU,GAAG,SAAH,GAAe,MAHnC;AAIPG,QAAAA,SAAS,EAAKX,yBAAL,OAJF;AAKPY,QAAAA,WAAW,EAAE,CALN;AAMPC,QAAAA,SAAS,EAAE,MANJ;AAOPC,QAAAA,WAAW,EAAEP,SAAS,GAAGJ,SAAH,GAAeY;AAP9B;AAAA,KADJ;AAULC,IAAAA,cAAc,EAAE,wBAACV,MAAD;AAAA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A,SAAS,EAAEA;AACXmB,IAAAA,MAAM,EAAEA;GAFV,CADF,CAHJ,CADF;AAaD,CAjID;;;;;;;;;;"}
1
+ {"version":3,"file":"tags-input.cjs.development.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport {\n lineHeight, actionColor, borderRadius, gray80, errorColor, black, white,\n} from '@propellerads/stylevariables';\n\nconst StyledTagsInput = styled.div`\n position: relative;\n`;\n\nconst TagsInputErrors = styled.div`\n position: absolute;\n display: flex;\n flex-direction: row;\n right: 1px;\n top: 0;\n height: ${lineHeight}px;\n align-items: center;\n`;\n\nconst prepareStyles = (customActionColor: string) => {\n const mainColor = customActionColor || actionColor;\n return {\n control: (styles, {isFocused, isDisabled}) => ({\n ...styles,\n borderRadius,\n backgroundColor: isDisabled ? '#ededed' : '#fff',\n minHeight: `${lineHeight}px`,\n borderWidth: 1,\n boxShadow: 'none',\n borderColor: isFocused ? mainColor : gray80,\n }),\n valueContainer: (styles) => ({\n ...styles,\n overflow: 'hidden',\n padding: '2px 2px 4px 2px',\n justifyContent: 'flex-start',\n }),\n placeholder: () => ({\n color: '#c0c0c0',\n fontWeight: 100,\n paddingLeft: '4px',\n position: 'absolute',\n }),\n clearIndicator: () => ({\n color: '#c0c0c0',\n display: 'inline-flex',\n marginRight: '4px',\n }),\n dropdownIndicator: () => ({\n display: 'none',\n }),\n indicatorSeparator: () => ({\n display: 'none',\n }),\n multiValue: (styles, {data}) => ({\n ...styles,\n backgroundColor: data.isException ? errorColor : mainColor,\n color: white,\n borderRadius: `${borderRadius / 2}px`,\n height: '22px',\n display: 'flex',\n alignItems: 'center',\n margin: '2px 0 0 2px',\n }),\n multiValueLabel: (styles) => ({\n ...styles,\n color: white,\n padding: '0 0 0 5px',\n fontSize: '12px',\n borderRadius: 0,\n display: 'inline-flex',\n lineHeight: '1',\n }),\n multiValueRemove: (styles, {data}) => ({\n ...styles,\n padding: 0,\n margin: '0 4px 0 2px',\n backgroundColor: data.isException ? errorColor : mainColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : mainColor,\n color: 'white',\n },\n }),\n menu: (styles) => ({\n ...styles,\n margin: 0,\n borderRadius: 0,\n zIndex: 10,\n }),\n menuList: (styles) => ({\n ...styles,\n '::-webkit-scrollbar': {\n width: '7px',\n },\n '::-webkit-scrollbar-thumb': {\n borderRadius: '4px',\n backgroundColor: 'rgba(0, 0, 0, .5)',\n boxShadow: '0 0 1px rgba(255, 255, 255, .5)',\n },\n }),\n option: (styles, {isFocused}) => ({\n backgroundColor: isFocused ? mainColor : null,\n padding: '5px 10px',\n fontSize: '14px',\n color: isFocused ? white : black,\n }),\n input: (styles) => ({\n ...styles,\n height: '16px',\n }),\n };\n};\n\nexport {prepareStyles, StyledTagsInput, TagsInputErrors};\n","import React, {useRef, useState} from 'react';\nimport ReactSelect, {components as reactSelectComponents} from 'react-select';\nimport isFunction from 'lodash.isfunction';\nimport ReactAsyncSelect from 'react-select/lib/Async';\nimport ErrorLabel from '@propellerads/error-label';\nimport CreatableSelect from 'react-select/lib/Creatable';\nimport {Close, SIZE, COLOR} from '@propellerads/icon';\n\nimport {TagsInputProps} from './types';\nimport {prepareStyles, StyledTagsInput, TagsInputErrors} from './style';\n\n// regexps by priority\nconst REGEXPS = [\n /(?:\\b|\\B)\\n+\\b/,\n /(?:\\b|\\B),\\s\\b/,\n /(?:\\b|\\B),+\\b/,\n];\n\ninterface SplitStringReturnValue {\n splits: string[]\n specialHandle: boolean\n}\n\nfunction splitString(value: string): SplitStringReturnValue {\n let splits: string[] = [];\n\n let specialHandle = false;\n // eslint-disable-next-line no-restricted-syntax\n for (const regex of REGEXPS) {\n splits = value.split(regex);\n if (splits.length > 1) {\n break;\n }\n }\n\n // special case. Need handle in special way\n if (splits.length === 1) {\n splits = value.split(/\\b\\s+\\b/);\n specialHandle = splits.length > 1;\n }\n\n return {\n splits,\n specialHandle,\n };\n}\n\nfunction searchSuitableOptions(pastedValue, availableOptions, searchableKeys) {\n const {splits, specialHandle} = splitString(pastedValue);\n\n if (specialHandle) {\n let rawPastedString = splits.join(' ')\n .toLowerCase();\n\n return availableOptions\n .sort((firstEl, secondEl) => {\n if (firstEl.label.length > secondEl.label.length) {\n return -1;\n }\n if (firstEl.label.length < secondEl.label.length) {\n return 1;\n }\n\n return 0;\n })\n .filter((option) => searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const position = rawPastedString.search(optionValue);\n const condition = position !== -1;\n if (condition) {\n rawPastedString = rawPastedString.replace(optionValue, '');\n }\n\n return prevValue || condition;\n }, false));\n }\n\n return splits.map((splitValue) => availableOptions.find((option) => {\n const comparableValue = splitValue.trim().toLowerCase();\n\n return searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const condition = optionValue === comparableValue;\n\n return prevValue || condition;\n }, false);\n }))\n .filter(Boolean);\n}\n\ninterface ClearIndicatorProps {\n // eslint-disable-next-line @typescript-eslint/ban-types\n getStyles: (clearIndicator: string, props: any) => {},\n innerProps: {\n ref: React.Ref<HTMLDivElement>\n },\n elementId: string,\n}\n\nconst ClearIndicator = (props: ClearIndicatorProps) => {\n const {\n elementId,\n getStyles,\n innerProps: {\n ref,\n ...restInnerProps\n },\n } = props;\n\n return (\n <div\n {...restInnerProps}\n ref={ref}\n style={getStyles('clearIndicator', props)}\n id={`${elementId}-clear`}\n >\n <Close\n color={COLOR.GRAY_DARK}\n size={SIZE.MEDIUM_SMALL}\n />\n </div>\n );\n};\n\nconst TagsInput = (props: TagsInputProps) => {\n const reactSelectElement = useRef<any>(null);\n const [showMinLenTip, setShowMinLenTip] = useState(false);\n\n const {\n components = {},\n customStyles = {},\n elementId,\n errors = [],\n isAsync = false,\n isErrorLabelVisible = false,\n onChange,\n onInputChange = null,\n filterOption = null,\n options = [],\n promiseOptions = () => Promise.resolve(),\n searchableKeys = [\n 'label',\n ],\n value = [],\n actionColor = '',\n isClearable = true,\n isCreatable = false,\n isDisabled = false,\n isLoading = false,\n isRtl = false,\n isMulti = true,\n isSearchable = true,\n cacheOptions = false,\n placeholder = 'Start typing...',\n noOptionsMessage = () => 'No options...',\n loadingMessage = () => 'Loading...',\n minHeightInput = 36,\n createOptionPlaceholder = 'Create ',\n onCreateOption = () => null,\n } = props;\n\n const currentValue = value;\n\n const preparedStyled = {\n ...prepareStyles(actionColor),\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...prepareStyles(actionColor).control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : prepareStyles(actionColor).control(base, state).border,\n minHeight: minHeightInput,\n };\n },\n };\n\n const config = {\n ...props,\n id: elementId,\n onChange,\n ...(onInputChange && {onInputChange}),\n ...(filterOption && {filterOption}),\n styles: preparedStyled,\n loadingMessage: showMinLenTip ? () => 'Enter two or more characters' : loadingMessage,\n components: {\n ClearIndicator: (clearIndicatorProps) => (\n <ClearIndicator\n {...clearIndicatorProps}\n elementId={elementId}\n />\n ),\n ...components,\n },\n };\n\n const handleAsyncRequest = (newValue: any) => {\n if (!newValue.length || newValue.length < 2) {\n setShowMinLenTip(true);\n\n return null;\n }\n\n if (!showMinLenTip) {\n setShowMinLenTip(false);\n }\n\n return promiseOptions(newValue);\n };\n\n const onPaste = (e) => {\n const pasteData = e.clipboardData.getData('text/plain');\n\n const pastedOptions = searchSuitableOptions(pasteData, options, searchableKeys);\n\n const newInputOptions = pastedOptions.reduce((acc, curVal) => {\n if (!acc.find((el) => el.value === curVal.value)) {\n acc.push(curVal);\n }\n\n return acc;\n }, currentValue);\n\n if (pastedOptions.length !== 0) {\n onChange(newInputOptions);\n setTimeout(() => {\n reactSelectElement.current.select.blur();\n }, 0);\n }\n };\n\n const regularSelect = isAsync\n ? (\n <ReactAsyncSelect\n {...config}\n loadOptions={(newValue) => handleAsyncRequest(newValue)}\n />\n )\n : (\n <div onPaste={onPaste}>\n <ReactSelect\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n </div>\n );\n\n const select = isCreatable\n ? (\n <CreatableSelect\n formatCreateLabel={(newValue) => `${createOptionPlaceholder}\"${newValue}\"`}\n isLoading={isLoading}\n onCreateOption={(newOption) => onCreateOption(newOption)}\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n ) : regularSelect;\n\n return (\n <StyledTagsInput>\n {select}\n {errors && errors.length > 0 && isErrorLabelVisible && (\n <TagsInputErrors>\n <ErrorLabel\n elementId={elementId}\n errors={errors}\n />\n </TagsInputErrors>\n )}\n </StyledTagsInput>\n );\n};\n\nexport {reactSelectComponents as components};\n\nexport default TagsInput;\n"],"names":["StyledTagsInput","styled","div","TagsInputErrors","lineHeight","prepareStyles","customActionColor","mainColor","actionColor","control","styles","isFocused","isDisabled","borderRadius","backgroundColor","minHeight","borderWidth","boxShadow","borderColor","gray80","valueContainer","overflow","padding","justifyContent","placeholder","color","fontWeight","paddingLeft","position","clearIndicator","display","marginRight","dropdownIndicator","indicatorSeparator","multiValue","data","isException","errorColor","white","height","alignItems","margin","multiValueLabel","fontSize","multiValueRemove","cursor","menu","zIndex","menuList","width","option","black","input","REGEXPS","splitString","value","splits","specialHandle","regex","split","length","searchSuitableOptions","pastedValue","availableOptions","searchableKeys","rawPastedString","join","toLowerCase","sort","firstEl","secondEl","label","filter","reduce","prevValue","currValue","optionValue","String","search","condition","replace","map","splitValue","find","comparableValue","trim","Boolean","ClearIndicator","props","elementId","getStyles","innerProps","ref","restInnerProps","React","style","id","Close","COLOR","GRAY_DARK","size","SIZE","MEDIUM_SMALL","TagsInput","reactSelectElement","useRef","useState","showMinLenTip","setShowMinLenTip","components","customStyles","errors","isAsync","isErrorLabelVisible","onChange","onInputChange","filterOption","options","promiseOptions","Promise","resolve","isCreatable","isLoading","loadingMessage","minHeightInput","createOptionPlaceholder","onCreateOption","currentValue","preparedStyled","base","state","isFunction","border","config","clearIndicatorProps","handleAsyncRequest","newValue","onPaste","e","pasteData","clipboardData","getData","pastedOptions","newInputOptions","acc","curVal","el","push","setTimeout","current","select","blur","regularSelect","ReactAsyncSelect","loadOptions","ReactSelect","CreatableSelect","formatCreateLabel","newOption","ErrorLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,eAAe,gBAAGC,MAAM,CAACC,GAAV,iCAArB;AAIA,IAAMC,eAAe,gBAAGF,MAAM,CAACC,GAAV,mCAMPE,yBANO,CAArB;;AAUA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,iBAAD;AACpB,MAAMC,SAAS,GAAGD,iBAAiB,IAAIE,0BAAvC;AACA,SAAO;AACLC,IAAAA,OAAO,EAAE,iBAACC,MAAD;AAAA,UAAUC,SAAV,QAAUA,SAAV;AAAA,UAAqBC,UAArB,QAAqBA,UAArB;AAAA,0BACJF,MADI;AAEPG,QAAAA,YAAY,EAAZA,2BAFO;AAGPC,QAAAA,eAAe,EAAEF,UAAU,GAAG,SAAH,GAAe,MAHnC;AAIPG,QAAAA,SAAS,EAAKX,yBAAL,OAJF;AAKPY,QAAAA,WAAW,EAAE,CALN;AAMPC,QAAAA,SAAS,EAAE,MANJ;AAOPC,QAAAA,WAAW,EAAEP,SAAS,GAAGJ,SAAH,GAAeY;AAP9B;AAAA,KADJ;AAULC,IAAAA,cAAc,EAAE,wBAACV,MAAD;AAAA,0BACXA,MADW;AAEdW,QAAAA,QAAQ,EAAE,QAFI;AAGdC,QAAAA,OAAO,EAAE,iBAHK;AAIdC,QAAAA,cAAc,EAAE;AAJF;AAAA,KAVX;AAgBLC,IAAAA,WAAW,EAAE;AAAA,aAAO;AAClBC,QAAAA,KAAK,EAAE,SADW;AAElBC,QAAAA,UAAU,EAAE,GAFM;AAGlBC,QAAAA,WAAW,EAAE,KAHK;AAIlBC,QAAA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,MAAM,GAAG7B,WAAW,GAEtB3B,4BAAA,CAAC8D,eAAD;AACEC,IAAAA,iBAAiB,EAAE,2BAACrB,QAAD;AAAA,aAAiBX,uBAAjB,UAA4CW,QAA5C;AAAA;AACnBd,IAAAA,SAAS,EAAEA;AACXI,IAAAA,cAAc,EAAE,wBAACgC,SAAD;AAAA,aAAehC,eAAc,CAACgC,SAAD,CAA7B;AAAA;KACZzB;AACJzC,IAAAA,GAAG,EAAEY;AACLa,IAAAA,OAAO,EAAEA;IANX,CAFsB,GAUpBmC,aAVN;AAYA,SACE1D,4BAAA,CAAC9F,eAAD,MAAA,EACGsJ,MADH,EAEGvC,MAAM,IAAIA,MAAM,CAACnD,MAAP,GAAgB,CAA1B,IAA+BqD,mBAA/B,IACCnB,4BAAA,CAAC3F,eAAD,MAAA,EACE2F,4BAAA,CAACiE,UAAD;AACEtE,IAAAA,SAAS,EAAEA;AACXsB,IAAAA,MAAM,EAAEA;GAFV,CADF,CAHJ,CADF;AAaD,CAxJD;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react"),n=e(r),t=require("react-select"),o=e(t),i=e(require("lodash.isfunction")),l=e(require("react-select/lib/Async")),a=e(require("@propellerads/error-label")),u=require("@propellerads/icon"),c=e(require("styled-components")),s=require("@propellerads/stylevariables");function d(){return(d=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function p(e,r){return r||(r=e.slice(0)),e.raw=r,e}function f(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function b(){var e=p(["\n position: absolute;\n display: flex;\n flex-direction: row;\n right: 1px;\n top: 0;\n height: ","px;\n align-items: center;\n"]);return b=function(){return e},e}function g(){var e=p(["\n position: relative;\n"]);return g=function(){return e},e}var v=c.div(g()),h=c.div(b(),s.lineHeight),m=function(e){var r=e||s.actionColor;return{control:function(e,n){return d({},e,{borderRadius:s.borderRadius,backgroundColor:n.isDisabled?"#ededed":"#fff",minHeight:s.lineHeight+"px",borderWidth:1,boxShadow:"none",borderColor:n.isFocused?r:s.gray80})},valueContainer:function(e){return d({},e,{overflow:"hidden",padding:"2px 2px 4px 2px",justifyContent:"flex-start"})},placeholder:function(){return{color:"#c0c0c0",fontWeight:100,paddingLeft:"4px",position:"absolute"}},clearIndicator:function(){return{color:"#c0c0c0",display:"inline-flex",marginRight:"4px"}},dropdownIndicator:function(){return{display:"none"}},indicatorSeparator:function(){return{display:"none"}},multiValue:function(e,n){return d({},e,{backgroundColor:n.data.isException?s.errorColor:r,color:s.white,borderRadius:s.borderRadius/2+"px",height:"22px",display:"flex",alignItems:"center",margin:"2px 0 0 2px"})},multiValueLabel:function(e){return d({},e,{color:s.white,padding:"0 0 0 5px",fontSize:"12px",borderRadius:0,display:"inline-flex",lineHeight:"1"})},multiValueRemove:function(e,n){var t=n.data;return d({},e,{padding:0,margin:"0 4px 0 2px",backgroundColor:t.isException?s.errorColor:r,cursor:"pointer",":hover":{backgroundColor:t.isException?s.errorColor:r,color:"white"}})},menu:function(e){return d({},e,{margin:0,borderRadius:0,zIndex:10})},menuList:function(e){return d({},e,{"::-webkit-scrollbar":{width:"7px"},"::-webkit-scrollbar-thumb":{borderRadius:"4px",backgroundColor:"rgba(0, 0, 0, .5)",boxShadow:"0 0 1px rgba(255, 255, 255, .5)"}})},option:function(e,n){var t=n.isFocused;return{backgroundColor:t?r:null,padding:"5px 10px",fontSize:"14px",color:t?s.white:s.black}},input:function(e){return d({},e,{height:"16px"})}}},x=[/(?:\b|\B)\n+\b/,/(?:\b|\B),\s\b/,/(?:\b|\B),+\b/],y=function(e){var r=e.elementId,t=e.getStyles,o=e.innerProps,i=o.ref,l=function(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)r.indexOf(n=i[t])>=0||(o[n]=e[n]);return o}(o,["ref"]);return n.createElement("div",Object.assign({},l,{ref:i,style:t("clearIndicator",e),id:r+"-clear"}),n.createElement(u.Close,{color:u.COLOR.GRAY_DARK,size:u.SIZE.MEDIUM_SMALL}))};Object.defineProperty(exports,"components",{enumerable:!0,get:function(){return t.components}}),exports.default=function(e){var t=r.useRef(null),u=e.components,c=void 0===u?{}:u,s=e.customStyles,p=void 0===s?{}:s,b=e.elementId,g=e.errors,C=void 0===g?[]:g,w=e.isAsync,O=void 0!==w&&w,I=e.isErrorLabelVisible,S=void 0!==I&&I,E=e.onChange,j=e.onInputChange,R=void 0===j?null:j,A=e.filterOption,L=void 0===A?null:A,k=e.options,q=void 0===k?[]:k,H=e.promiseOptions,P=void 0===H?function(){return Promise.resolve()}:H,D=e.searchableKeys,M=void 0===D?["label"]:D,z=e.value,B=e.actionColor,V=void 0===B?"":B,_=e.minHeightInput,F=void 0===_?36:_,K=void 0===z?[]:z,T=d({},m(V),p,{control:function(e,r){var n=p.control&&i(p.control)?p.control(e,r):{};return d({},m(V).control(e,r),n,{border:C.length?"1px solid #ed3030":m(V).control(e,r).border,minHeight:F})}}),U=d({},e,{id:b,onChange:E},R&&{onInputChange:R},L&&{filterOption:L},{styles:T,components:d({ClearIndicator:function(e){return n.createElement(y,Object.assign({},e,{elementId:b}))}},c)}),W=n.createElement(l,Object.assign({},U,{loadOptions:function(e){return function(e){return!e.length||e.length<2?null:P(e)}(e)}})),G=n.createElement("div",{onPaste:function(e){var r=function(e,r,n){var t=function(e){for(var r,n=[],t=!1,o=function(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return f(e,void 0);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)?f(e,void 0):void 0}}(e))){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(x);!((r=o()).done||(n=e.split(r.value)).length>1););return 1===n.length&&(t=(n=e.split(/\b\s+\b/)).length>1),{splits:n,specialHandle:t}}(e),o=t.splits;if(t.specialHandle){var i=o.join(" ").toLowerCase();return r.sort((function(e,r){return e.label.length>r.label.length?-1:e.label.length<r.label.length?1:0})).filter((function(e){return n.reduce((function(r,n){var t=String(e[n]).toLowerCase(),o=-1!==i.search(t);return o&&(i=i.replace(t,"")),r||o}),!1)}))}return o.map((function(e){return r.find((function(r){var t=e.trim().toLowerCase();return n.reduce((function(e,n){var o=String(r[n]).toLowerCase();return e||o===t}),!1)}))})).filter(Boolean)}(e.clipboardData.getData("text/plain"),q,M),n=r.reduce((function(e,r){return e.find((function(e){return e.value===r.value}))||e.push(r),e}),K);0!==r.length&&(E(n),setTimeout((function(){t.current.select.blur()}),0))}},n.createElement(o,Object.assign({},U,{ref:t,options:q})));return n.createElement(v,null,O?W:G,C&&C.length>0&&S&&n.createElement(h,null,n.createElement(a,{elementId:b,errors:C})))};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react"),n=e(r),t=require("react-select"),o=e(t),i=e(require("lodash.isfunction")),l=e(require("react-select/lib/Async")),a=e(require("@propellerads/error-label")),u=e(require("react-select/lib/Creatable")),c=require("@propellerads/icon"),s=e(require("styled-components")),d=require("@propellerads/stylevariables");function p(){return(p=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])}return e}).apply(this,arguments)}function f(e,r){return r||(r=e.slice(0)),e.raw=r,e}function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function g(){var e=f(["\n position: absolute;\n display: flex;\n flex-direction: row;\n right: 1px;\n top: 0;\n height: ","px;\n align-items: center;\n"]);return g=function(){return e},e}function v(){var e=f(["\n position: relative;\n"]);return v=function(){return e},e}var h=s.div(v()),m=s.div(g(),d.lineHeight),x=function(e){var r=e||d.actionColor;return{control:function(e,n){return p({},e,{borderRadius:d.borderRadius,backgroundColor:n.isDisabled?"#ededed":"#fff",minHeight:d.lineHeight+"px",borderWidth:1,boxShadow:"none",borderColor:n.isFocused?r:d.gray80})},valueContainer:function(e){return p({},e,{overflow:"hidden",padding:"2px 2px 4px 2px",justifyContent:"flex-start"})},placeholder:function(){return{color:"#c0c0c0",fontWeight:100,paddingLeft:"4px",position:"absolute"}},clearIndicator:function(){return{color:"#c0c0c0",display:"inline-flex",marginRight:"4px"}},dropdownIndicator:function(){return{display:"none"}},indicatorSeparator:function(){return{display:"none"}},multiValue:function(e,n){return p({},e,{backgroundColor:n.data.isException?d.errorColor:r,color:d.white,borderRadius:d.borderRadius/2+"px",height:"22px",display:"flex",alignItems:"center",margin:"2px 0 0 2px"})},multiValueLabel:function(e){return p({},e,{color:d.white,padding:"0 0 0 5px",fontSize:"12px",borderRadius:0,display:"inline-flex",lineHeight:"1"})},multiValueRemove:function(e,n){var t=n.data;return p({},e,{padding:0,margin:"0 4px 0 2px",backgroundColor:t.isException?d.errorColor:r,cursor:"pointer",":hover":{backgroundColor:t.isException?d.errorColor:r,color:"white"}})},menu:function(e){return p({},e,{margin:0,borderRadius:0,zIndex:10})},menuList:function(e){return p({},e,{"::-webkit-scrollbar":{width:"7px"},"::-webkit-scrollbar-thumb":{borderRadius:"4px",backgroundColor:"rgba(0, 0, 0, .5)",boxShadow:"0 0 1px rgba(255, 255, 255, .5)"}})},option:function(e,n){var t=n.isFocused;return{backgroundColor:t?r:null,padding:"5px 10px",fontSize:"14px",color:t?d.white:d.black}},input:function(e){return p({},e,{height:"16px"})}}},y=[/(?:\b|\B)\n+\b/,/(?:\b|\B),\s\b/,/(?:\b|\B),+\b/],C=function(e){var r=e.elementId,t=e.getStyles,o=e.innerProps,i=o.ref,l=function(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)r.indexOf(n=i[t])>=0||(o[n]=e[n]);return o}(o,["ref"]);return n.createElement("div",Object.assign({},l,{ref:i,style:t("clearIndicator",e),id:r+"-clear"}),n.createElement(c.Close,{color:c.COLOR.GRAY_DARK,size:c.SIZE.MEDIUM_SMALL}))};Object.defineProperty(exports,"components",{enumerable:!0,get:function(){return t.components}}),exports.default=function(e){var t=r.useRef(null),c=r.useState(!1),s=c[0],d=c[1],f=e.components,g=void 0===f?{}:f,v=e.customStyles,O=void 0===v?{}:v,w=e.elementId,E=e.errors,I=void 0===E?[]:E,S=e.isAsync,j=void 0!==S&&S,L=e.isErrorLabelVisible,R=void 0!==L&&L,A=e.onChange,k=e.onInputChange,q=void 0===k?null:k,H=e.filterOption,M=void 0===H?null:H,P=e.options,D=void 0===P?[]:P,z=e.promiseOptions,B=void 0===z?function(){return Promise.resolve()}:z,V=e.searchableKeys,_=void 0===V?["label"]:V,F=e.value,K=e.actionColor,T=void 0===K?"":K,U=e.isCreatable,W=void 0!==U&&U,G=e.isLoading,Y=void 0!==G&&G,Z=e.loadingMessage,$=void 0===Z?function(){return"Loading..."}:Z,J=e.minHeightInput,N=void 0===J?36:J,Q=e.createOptionPlaceholder,X=void 0===Q?"Create ":Q,ee=e.onCreateOption,re=void 0===ee?function(){return null}:ee,ne=void 0===F?[]:F,te=p({},x(T),O,{control:function(e,r){var n=O.control&&i(O.control)?O.control(e,r):{};return p({},x(T).control(e,r),n,{border:I.length?"1px solid #ed3030":x(T).control(e,r).border,minHeight:N})}}),oe=p({},e,{id:w,onChange:A},q&&{onInputChange:q},M&&{filterOption:M},{styles:te,loadingMessage:s?function(){return"Enter two or more characters"}:$,components:p({ClearIndicator:function(e){return n.createElement(C,Object.assign({},e,{elementId:w}))}},g)}),ie=j?n.createElement(l,Object.assign({},oe,{loadOptions:function(e){return function(e){return!e.length||e.length<2?(d(!0),null):(s||d(!1),B(e))}(e)}})):n.createElement("div",{onPaste:function(e){var r=function(e,r,n){var t=function(e){for(var r,n=[],t=!1,o=function(e,r){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return b(e,void 0);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)?b(e,void 0):void 0}}(e))){n&&(e=n);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}(y);!((r=o()).done||(n=e.split(r.value)).length>1););return 1===n.length&&(t=(n=e.split(/\b\s+\b/)).length>1),{splits:n,specialHandle:t}}(e),o=t.splits;if(t.specialHandle){var i=o.join(" ").toLowerCase();return r.sort((function(e,r){return e.label.length>r.label.length?-1:e.label.length<r.label.length?1:0})).filter((function(e){return n.reduce((function(r,n){var t=String(e[n]).toLowerCase(),o=-1!==i.search(t);return o&&(i=i.replace(t,"")),r||o}),!1)}))}return o.map((function(e){return r.find((function(r){var t=e.trim().toLowerCase();return n.reduce((function(e,n){var o=String(r[n]).toLowerCase();return e||o===t}),!1)}))})).filter(Boolean)}(e.clipboardData.getData("text/plain"),D,_),n=r.reduce((function(e,r){return e.find((function(e){return e.value===r.value}))||e.push(r),e}),ne);0!==r.length&&(A(n),setTimeout((function(){t.current.select.blur()}),0))}},n.createElement(o,Object.assign({},oe,{ref:t,options:D}))),le=W?n.createElement(u,Object.assign({formatCreateLabel:function(e){return X+'"'+e+'"'},isLoading:Y,onCreateOption:function(e){return re(e)}},oe,{ref:t,options:D})):ie;return n.createElement(h,null,le,I&&I.length>0&&R&&n.createElement(m,null,n.createElement(a,{elementId:w,errors:I})))};
2
2
  //# sourceMappingURL=tags-input.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tags-input.cjs.production.min.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport {\n lineHeight, actionColor, borderRadius, gray80, errorColor, black, white,\n} from '@propellerads/stylevariables';\n\nconst StyledTagsInput = styled.div`\n position: relative;\n`;\n\nconst TagsInputErrors = styled.div`\n position: absolute;\n display: flex;\n flex-direction: row;\n right: 1px;\n top: 0;\n height: ${lineHeight}px;\n align-items: center;\n`;\n\nconst prepareStyles = (customActionColor: string) => {\n const mainColor = customActionColor || actionColor;\n return {\n control: (styles, {isFocused, isDisabled}) => ({\n ...styles,\n borderRadius,\n backgroundColor: isDisabled ? '#ededed' : '#fff',\n minHeight: `${lineHeight}px`,\n borderWidth: 1,\n boxShadow: 'none',\n borderColor: isFocused ? mainColor : gray80,\n }),\n valueContainer: (styles) => ({\n ...styles,\n overflow: 'hidden',\n padding: '2px 2px 4px 2px',\n justifyContent: 'flex-start',\n }),\n placeholder: () => ({\n color: '#c0c0c0',\n fontWeight: 100,\n paddingLeft: '4px',\n position: 'absolute',\n }),\n clearIndicator: () => ({\n color: '#c0c0c0',\n display: 'inline-flex',\n marginRight: '4px',\n }),\n dropdownIndicator: () => ({\n display: 'none',\n }),\n indicatorSeparator: () => ({\n display: 'none',\n }),\n multiValue: (styles, {data}) => ({\n ...styles,\n backgroundColor: data.isException ? errorColor : mainColor,\n color: white,\n borderRadius: `${borderRadius / 2}px`,\n height: '22px',\n display: 'flex',\n alignItems: 'center',\n margin: '2px 0 0 2px',\n }),\n multiValueLabel: (styles) => ({\n ...styles,\n color: white,\n padding: '0 0 0 5px',\n fontSize: '12px',\n borderRadius: 0,\n display: 'inline-flex',\n lineHeight: '1',\n }),\n multiValueRemove: (styles, {data}) => ({\n ...styles,\n padding: 0,\n margin: '0 4px 0 2px',\n backgroundColor: data.isException ? errorColor : mainColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : mainColor,\n color: 'white',\n },\n }),\n menu: (styles) => ({\n ...styles,\n margin: 0,\n borderRadius: 0,\n zIndex: 10,\n }),\n menuList: (styles) => ({\n ...styles,\n '::-webkit-scrollbar': {\n width: '7px',\n },\n '::-webkit-scrollbar-thumb': {\n borderRadius: '4px',\n backgroundColor: 'rgba(0, 0, 0, .5)',\n boxShadow: '0 0 1px rgba(255, 255, 255, .5)',\n },\n }),\n option: (styles, {isFocused}) => ({\n backgroundColor: isFocused ? mainColor : null,\n padding: '5px 10px',\n fontSize: '14px',\n color: isFocused ? white : black,\n }),\n input: (styles) => ({\n ...styles,\n height: '16px',\n }),\n };\n};\n\nexport {prepareStyles, StyledTagsInput, TagsInputErrors};\n","import React, {useRef} from 'react';\nimport ReactSelect, {components as reactSelectComponents} from 'react-select';\nimport isFunction from 'lodash.isfunction';\nimport ReactAsyncSelect from 'react-select/lib/Async';\nimport ErrorLabel from '@propellerads/error-label';\nimport {Close, SIZE, COLOR} from '@propellerads/icon';\n\nimport {TagsInputProps} from './types';\nimport {prepareStyles, StyledTagsInput, TagsInputErrors} from './style';\n\n// regexps by priority\nconst REGEXPS = [\n /(?:\\b|\\B)\\n+\\b/,\n /(?:\\b|\\B),\\s\\b/,\n /(?:\\b|\\B),+\\b/,\n];\n\ninterface SplitStringReturnValue {\n splits: string[]\n specialHandle: boolean\n}\n\nfunction splitString(value: string): SplitStringReturnValue {\n let splits: string[] = [];\n\n let specialHandle = false;\n // eslint-disable-next-line no-restricted-syntax\n for (const regex of REGEXPS) {\n splits = value.split(regex);\n if (splits.length > 1) {\n break;\n }\n }\n\n // special case. Need handle in special way\n if (splits.length === 1) {\n splits = value.split(/\\b\\s+\\b/);\n specialHandle = splits.length > 1;\n }\n\n return {\n splits,\n specialHandle,\n };\n}\n\nfunction searchSuitableOptions(pastedValue, availableOptions, searchableKeys) {\n const {splits, specialHandle} = splitString(pastedValue);\n\n if (specialHandle) {\n let rawPastedString = splits.join(' ')\n .toLowerCase();\n\n return availableOptions\n .sort((firstEl, secondEl) => {\n if (firstEl.label.length > secondEl.label.length) {\n return -1;\n }\n if (firstEl.label.length < secondEl.label.length) {\n return 1;\n }\n\n return 0;\n })\n .filter((option) => searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const position = rawPastedString.search(optionValue);\n const condition = position !== -1;\n if (condition) {\n rawPastedString = rawPastedString.replace(optionValue, '');\n }\n\n return prevValue || condition;\n }, false));\n }\n\n return splits.map((splitValue) => availableOptions.find((option) => {\n const comparableValue = splitValue.trim().toLowerCase();\n\n return searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const condition = optionValue === comparableValue;\n\n return prevValue || condition;\n }, false);\n }))\n .filter(Boolean);\n}\n\ninterface ClearIndicatorProps {\n // eslint-disable-next-line @typescript-eslint/ban-types\n getStyles: (clearIndicator: string, props: any) => {},\n innerProps: {\n ref: React.Ref<HTMLDivElement>\n },\n elementId: string,\n}\n\nconst ClearIndicator = (props: ClearIndicatorProps) => {\n const {\n elementId,\n getStyles,\n innerProps: {\n ref,\n ...restInnerProps\n },\n } = props;\n\n return (\n <div\n {...restInnerProps}\n ref={ref}\n style={getStyles('clearIndicator', props)}\n id={`${elementId}-clear`}\n >\n <Close\n color={COLOR.GRAY_DARK}\n size={SIZE.MEDIUM_SMALL}\n />\n </div>\n );\n};\n\nconst TagsInput = (props: TagsInputProps) => {\n const reactSelectElement = useRef<any>(null);\n\n const {\n components = {},\n customStyles = {},\n elementId,\n errors = [],\n isAsync = false,\n isErrorLabelVisible = false,\n onChange,\n onInputChange = null,\n filterOption = null,\n options = [],\n promiseOptions = () => Promise.resolve(),\n searchableKeys = [\n 'label',\n ],\n value = [],\n actionColor = '',\n isClearable = true,\n isDisabled = false,\n isLoading = false,\n isRtl = false,\n isMulti = true,\n isSearchable = true,\n cacheOptions = false,\n placeholder = 'Start typing...',\n noOptionsMessage = () => 'No options...',\n loadingMessage = () => 'Loading...',\n minHeightInput = 36,\n } = props;\n\n const currentValue = value;\n\n const preparedStyled = {\n ...prepareStyles(actionColor),\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...prepareStyles(actionColor).control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : prepareStyles(actionColor).control(base, state).border,\n minHeight: minHeightInput,\n };\n },\n };\n\n const config = {\n ...props,\n id: elementId,\n onChange,\n ...(onInputChange && {onInputChange}),\n ...(filterOption && {filterOption}),\n styles: preparedStyled,\n components: {\n ClearIndicator: (clearIndicatorProps) => (\n <ClearIndicator\n {...clearIndicatorProps}\n elementId={elementId}\n />\n ),\n ...components,\n },\n };\n\n const handleAsyncRequest = (newValue: any) => {\n if (!newValue.length || newValue.length < 2) {\n return null;\n }\n\n return promiseOptions(newValue);\n };\n\n const onPaste = (e) => {\n const pasteData = e.clipboardData.getData('text/plain');\n\n const pastedOptions = searchSuitableOptions(pasteData, options, searchableKeys);\n\n const newInputOptions = pastedOptions.reduce((acc, curVal) => {\n if (!acc.find((el) => el.value === curVal.value)) {\n acc.push(curVal);\n }\n\n return acc;\n }, currentValue);\n\n if (pastedOptions.length !== 0) {\n onChange(newInputOptions);\n setTimeout(() => {\n reactSelectElement.current.select.blur();\n }, 0);\n }\n };\n\n const asyncSelect = (\n <ReactAsyncSelect\n {...config}\n loadOptions={(newValue) => handleAsyncRequest(newValue)}\n />\n );\n\n const select = (\n <div onPaste={onPaste}>\n <ReactSelect\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n </div>\n );\n\n return (\n <StyledTagsInput>\n {isAsync ? asyncSelect : select}\n {errors && errors.length > 0 && isErrorLabelVisible && (\n <TagsInputErrors>\n <ErrorLabel\n elementId={elementId}\n errors={errors}\n />\n </TagsInputErrors>\n )}\n </StyledTagsInput>\n );\n};\n\nfunction customChecker(props, propName, component) {\n const {[propName]: propValue} = props;\n if (typeof propValue !== 'function') {\n return new Error(`Invalid prop \"${propName}\" passed to ${component}`);\n }\n\n const value = propValue();\n if (typeof value !== 'string' && !React.isValidElement(value)) {\n // eslint-disable-next-line max-len\n return new Error(`Invalid prop \"${propName}\" passed to ${component}. Function should return \"string\" or \"react.Node\"`);\n }\n\n return null;\n}\n\nexport {reactSelectComponents as components};\n\nexport default TagsInput;\n"],"names":["StyledTagsInput","styled","div","TagsInputErrors","lineHeight","prepareStyles","customActionColor","mainColor","actionColor","control","styles","borderRadius","backgroundColor","isDisabled","minHeight","borderWidth","boxShadow","borderColor","isFocused","gray80","valueContainer","overflow","padding","justifyContent","placeholder","color","fontWeight","paddingLeft","position","clearIndicator","display","marginRight","dropdownIndicator","indicatorSeparator","multiValue","data","isException","errorColor","white","height","alignItems","margin","multiValueLabel","fontSize","multiValueRemove","cursor","menu","zIndex","menuList","width","option","black","input","REGEXPS","ClearIndicator","props","elementId","getStyles","innerProps","ref","restInnerProps","React","style","id","Close","COLOR","GRAY_DARK","size","SIZE","MEDIUM_SMALL","reactSelectElement","useRef","components","customStyles","errors","isAsync","isErrorLabelVisible","onChange","onInputChange","filterOption","options","promiseOptions","Promise","resolve","searchableKeys","value","minHeightInput","currentValue","preparedStyled","base","state","isFunction","border","length","config","clearIndicatorProps","asyncSelect","ReactAsyncSelect","loadOptions","newValue","handleAsyncRequest","select","onPaste","e","pastedOptions","pastedValue","availableOptions","splits","specialHandle","split","splitString","rawPastedString","join","toLowerCase","sort","firstEl","secondEl","label","filter","reduce","prevValue","currValue","optionValue","String","condition","search","replace","map","splitValue","find","comparableValue","trim","Boolean","searchSuitableOptions","clipboardData","getData","newInputOptions","acc","curVal","el","push","setTimeout","current","blur","ReactSelect","ErrorLabel"],"mappings":"wjCAKA,IAAMA,EAAkBC,EAAOC,SA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IR,MAAK,SAACU,UAAOA,EAAGtD,QAAUqD,EAAOrD,UACxCoD,EAAIG,KAAKF,GAGJD,IACNlD,GAE0B,IAAzBiB,EAAcX,SAChBhB,EAAS2D,GACTK,YAAW,WACTvE,EAAmBwE,QAAQzC,OAAO0C,SACjC,MAaHlF,gBAACmF,mBACKlD,GACJnC,IAAKW,EACLU,QAASA,aAMbnB,gBAAC7D,OACE2E,EAAUqB,EAAcK,EACxB3B,GAAUA,EAAOmB,OAAS,GAAKjB,GAC9Bf,gBAAC1D,OACC0D,gBAACoF,GACCzF,UAAWA,EACXkB,OAAQA"}
1
+ {"version":3,"file":"tags-input.cjs.production.min.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport {\n lineHeight, actionColor, borderRadius, gray80, errorColor, black, white,\n} from '@propellerads/stylevariables';\n\nconst StyledTagsInput = styled.div`\n position: relative;\n`;\n\nconst TagsInputErrors = styled.div`\n position: absolute;\n display: flex;\n flex-direction: row;\n right: 1px;\n top: 0;\n height: ${lineHeight}px;\n align-items: center;\n`;\n\nconst prepareStyles = (customActionColor: string) => {\n const mainColor = customActionColor || actionColor;\n return {\n control: (styles, {isFocused, isDisabled}) => ({\n ...styles,\n borderRadius,\n backgroundColor: isDisabled ? '#ededed' : '#fff',\n minHeight: `${lineHeight}px`,\n borderWidth: 1,\n boxShadow: 'none',\n borderColor: isFocused ? mainColor : gray80,\n }),\n valueContainer: (styles) => ({\n ...styles,\n overflow: 'hidden',\n padding: '2px 2px 4px 2px',\n justifyContent: 'flex-start',\n }),\n placeholder: () => ({\n color: '#c0c0c0',\n fontWeight: 100,\n paddingLeft: '4px',\n position: 'absolute',\n }),\n clearIndicator: () => ({\n color: '#c0c0c0',\n display: 'inline-flex',\n marginRight: '4px',\n }),\n dropdownIndicator: () => ({\n display: 'none',\n }),\n indicatorSeparator: () => ({\n display: 'none',\n }),\n multiValue: (styles, {data}) => ({\n ...styles,\n backgroundColor: data.isException ? errorColor : mainColor,\n color: white,\n borderRadius: `${borderRadius / 2}px`,\n height: '22px',\n display: 'flex',\n alignItems: 'center',\n margin: '2px 0 0 2px',\n }),\n multiValueLabel: (styles) => ({\n ...styles,\n color: white,\n padding: '0 0 0 5px',\n fontSize: '12px',\n borderRadius: 0,\n display: 'inline-flex',\n lineHeight: '1',\n }),\n multiValueRemove: (styles, {data}) => ({\n ...styles,\n padding: 0,\n margin: '0 4px 0 2px',\n backgroundColor: data.isException ? errorColor : mainColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : mainColor,\n color: 'white',\n },\n }),\n menu: (styles) => ({\n ...styles,\n margin: 0,\n borderRadius: 0,\n zIndex: 10,\n }),\n menuList: (styles) => ({\n ...styles,\n '::-webkit-scrollbar': {\n width: '7px',\n },\n '::-webkit-scrollbar-thumb': {\n borderRadius: '4px',\n backgroundColor: 'rgba(0, 0, 0, .5)',\n boxShadow: '0 0 1px rgba(255, 255, 255, .5)',\n },\n }),\n option: (styles, {isFocused}) => ({\n backgroundColor: isFocused ? mainColor : null,\n padding: '5px 10px',\n fontSize: '14px',\n color: isFocused ? white : black,\n }),\n input: (styles) => ({\n ...styles,\n height: '16px',\n }),\n };\n};\n\nexport {prepareStyles, StyledTagsInput, TagsInputErrors};\n","import React, {useRef, useState} from 'react';\nimport ReactSelect, {components as reactSelectComponents} from 'react-select';\nimport isFunction from 'lodash.isfunction';\nimport ReactAsyncSelect from 'react-select/lib/Async';\nimport ErrorLabel from '@propellerads/error-label';\nimport CreatableSelect from 'react-select/lib/Creatable';\nimport {Close, SIZE, COLOR} from '@propellerads/icon';\n\nimport {TagsInputProps} from './types';\nimport {prepareStyles, StyledTagsInput, TagsInputErrors} from './style';\n\n// regexps by priority\nconst REGEXPS = [\n /(?:\\b|\\B)\\n+\\b/,\n /(?:\\b|\\B),\\s\\b/,\n /(?:\\b|\\B),+\\b/,\n];\n\ninterface SplitStringReturnValue {\n splits: string[]\n specialHandle: boolean\n}\n\nfunction splitString(value: string): SplitStringReturnValue {\n let splits: string[] = [];\n\n let specialHandle = false;\n // eslint-disable-next-line no-restricted-syntax\n for (const regex of REGEXPS) {\n splits = value.split(regex);\n if (splits.length > 1) {\n break;\n }\n }\n\n // special case. Need handle in special way\n if (splits.length === 1) {\n splits = value.split(/\\b\\s+\\b/);\n specialHandle = splits.length > 1;\n }\n\n return {\n splits,\n specialHandle,\n };\n}\n\nfunction searchSuitableOptions(pastedValue, availableOptions, searchableKeys) {\n const {splits, specialHandle} = splitString(pastedValue);\n\n if (specialHandle) {\n let rawPastedString = splits.join(' ')\n .toLowerCase();\n\n return availableOptions\n .sort((firstEl, secondEl) => {\n if (firstEl.label.length > secondEl.label.length) {\n return -1;\n }\n if (firstEl.label.length < secondEl.label.length) {\n return 1;\n }\n\n return 0;\n })\n .filter((option) => searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const position = rawPastedString.search(optionValue);\n const condition = position !== -1;\n if (condition) {\n rawPastedString = rawPastedString.replace(optionValue, '');\n }\n\n return prevValue || condition;\n }, false));\n }\n\n return splits.map((splitValue) => availableOptions.find((option) => {\n const comparableValue = splitValue.trim().toLowerCase();\n\n return searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const condition = optionValue === comparableValue;\n\n return prevValue || condition;\n }, false);\n }))\n .filter(Boolean);\n}\n\ninterface ClearIndicatorProps {\n // eslint-disable-next-line @typescript-eslint/ban-types\n getStyles: (clearIndicator: string, props: any) => {},\n innerProps: {\n ref: React.Ref<HTMLDivElement>\n },\n elementId: string,\n}\n\nconst ClearIndicator = (props: ClearIndicatorProps) => {\n const {\n elementId,\n getStyles,\n innerProps: {\n ref,\n ...restInnerProps\n },\n } = props;\n\n return (\n <div\n {...restInnerProps}\n ref={ref}\n style={getStyles('clearIndicator', props)}\n id={`${elementId}-clear`}\n >\n <Close\n color={COLOR.GRAY_DARK}\n size={SIZE.MEDIUM_SMALL}\n />\n </div>\n );\n};\n\nconst TagsInput = (props: TagsInputProps) => {\n const reactSelectElement = useRef<any>(null);\n const [showMinLenTip, setShowMinLenTip] = useState(false);\n\n const {\n components = {},\n customStyles = {},\n elementId,\n errors = [],\n isAsync = false,\n isErrorLabelVisible = false,\n onChange,\n onInputChange = null,\n filterOption = null,\n options = [],\n promiseOptions = () => Promise.resolve(),\n searchableKeys = [\n 'label',\n ],\n value = [],\n actionColor = '',\n isClearable = true,\n isCreatable = false,\n isDisabled = false,\n isLoading = false,\n isRtl = false,\n isMulti = true,\n isSearchable = true,\n cacheOptions = false,\n placeholder = 'Start typing...',\n noOptionsMessage = () => 'No options...',\n loadingMessage = () => 'Loading...',\n minHeightInput = 36,\n createOptionPlaceholder = 'Create ',\n onCreateOption = () => null,\n } = props;\n\n const currentValue = value;\n\n const preparedStyled = {\n ...prepareStyles(actionColor),\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...prepareStyles(actionColor).control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : prepareStyles(actionColor).control(base, state).border,\n minHeight: minHeightInput,\n };\n },\n };\n\n const config = {\n ...props,\n id: elementId,\n onChange,\n ...(onInputChange && {onInputChange}),\n ...(filterOption && {filterOption}),\n styles: preparedStyled,\n loadingMessage: showMinLenTip ? () => 'Enter two or more characters' : loadingMessage,\n components: {\n ClearIndicator: (clearIndicatorProps) => (\n <ClearIndicator\n {...clearIndicatorProps}\n elementId={elementId}\n />\n ),\n ...components,\n },\n };\n\n const handleAsyncRequest = (newValue: any) => {\n if (!newValue.length || newValue.length < 2) {\n setShowMinLenTip(true);\n\n return null;\n }\n\n if (!showMinLenTip) {\n setShowMinLenTip(false);\n }\n\n return promiseOptions(newValue);\n };\n\n const onPaste = (e) => {\n const pasteData = e.clipboardData.getData('text/plain');\n\n const pastedOptions = searchSuitableOptions(pasteData, options, searchableKeys);\n\n const newInputOptions = pastedOptions.reduce((acc, curVal) => {\n if (!acc.find((el) => el.value === curVal.value)) {\n acc.push(curVal);\n }\n\n return acc;\n }, currentValue);\n\n if (pastedOptions.length !== 0) {\n onChange(newInputOptions);\n setTimeout(() => {\n reactSelectElement.current.select.blur();\n }, 0);\n }\n };\n\n const regularSelect = isAsync\n ? (\n <ReactAsyncSelect\n {...config}\n loadOptions={(newValue) => handleAsyncRequest(newValue)}\n />\n )\n : (\n <div onPaste={onPaste}>\n <ReactSelect\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n </div>\n );\n\n const select = isCreatable\n ? (\n <CreatableSelect\n formatCreateLabel={(newValue) => `${createOptionPlaceholder}\"${newValue}\"`}\n isLoading={isLoading}\n onCreateOption={(newOption) => onCreateOption(newOption)}\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n ) : regularSelect;\n\n return (\n <StyledTagsInput>\n {select}\n {errors && errors.length > 0 && isErrorLabelVisible && (\n <TagsInputErrors>\n <ErrorLabel\n elementId={elementId}\n errors={errors}\n />\n </TagsInputErrors>\n )}\n </StyledTagsInput>\n );\n};\n\nexport {reactSelectComponents as components};\n\nexport default TagsInput;\n"],"names":["StyledTagsInput","styled","div","TagsInputErrors","lineHeight","prepareStyles","customActionColor","mainColor","actionColor","control","styles","borderRadius","backgroundColor","isDisabled","minHeight","borderWidth","boxShadow","borderColor","isFocused","gray80","valueContainer","overflow","padding","justifyContent","placeholder","color","fontWeight","paddingLeft","position","clearIndicator","display","marginRight","dropdownIndicator","indicatorSeparator","multiValue","data","isException","errorColor","white","height","alignItems","margin","multiValueLabel","fontSize","multiValueRemove","cursor","menu","zIndex","menuList","width","option","black","input","REGEXPS","ClearIndicator","props","elementId","getStyles","innerProps","ref","restInnerProps","React","style","id","Close","COLOR","GRAY_DARK","size","SIZE","MEDIUM_SMALL","reactSelectElement","useRef","useState","showMinLenTip","setShowMinLenTip","components","customStyles","errors","isAsync","isErrorLabelVisible","onChange","onInputChange","filterOption","options","promiseOptions","Promise","resolve","searchableKeys","value","isCreatable","isLoading","loadingMessage","minHeightInput","createOptionPlaceholder","onCreateOption","currentValue","preparedStyled","base","state","isFunction","border","length","config","clearIndicatorProps","regularSelect","ReactAsyncSelect","loadOptions","newValue","handleAsyncRequest","onPaste","e","pastedOptions","pastedValue","availableOptions","splits","specialHandle","split","splitString","rawPastedString","join","toLowerCase","sort","firstEl","secondEl","label","filter","reduce","prevValue","currValue","optionValue","String","condition","search","replace","map","splitValue","find","comparableValue","trim","Boolean","searchSuitableOptions","clipboardData","getData","newInputOptions","acc","curVal","el","push","setTimeout","current","select","blur","ReactSelect","CreatableSelect","formatCreateLabel","newOption","ErrorLabel"],"mappings":"mmCAKA,IAAMA,EAAkBC,EAAOC,SAIzBC,EAAkBF,EAAOC,QAMjBE,cAIRC,EAAgB,SAACC,OACfC,EAAYD,GAAqBE,oBAChC,CACLC,QAAS,SAACC,iBACLA,GACHC,aAAAA,eACAC,kBAH4BC,WAGE,UAAY,OAC1CC,UAAcV,kBACdW,YAAa,EACbC,UAAW,OACXC,cAPiBC,UAOQX,EAAYY,YAEvCC,eAAgB,SAACV,eACZA,GACHW,SAAU,SACVC,QAAS,kBACTC,eAAgB,gBAElBC,YAAa,iBAAO,CAClBC,MAAO,UACPC,WAAY,IACZC,YAAa,MACbC,SAAU,aAEZC,eAAgB,iBAAO,CACrBJ,MAAO,UACPK,QAAS,cACTC,YAAa,QAEfC,kBAAmB,iBAAO,CACxBF,QAAS,SAEXG,mBAAoB,iBAAO,CACzBH,QAAS,SAEXI,WAAY,SAACxB,iBACRA,GACHE,kBAFoBuB,KAEEC,YAAcC,aAAa9B,EACjDkB,MAAOa,QACP3B,aAAiBA,eAAe,OAChC4B,OAAQ,OACRT,QAAS,OACTU,WAAY,SACZC,OAAQ,iBAEVC,gBAAiB,SAAChC,eACbA,GACHe,MAAOa,QACPhB,QAAS,YACTqB,SAAU,OACVhC,aAAc,EACdmB,QAAS,cACT1B,WAAY,OAEdwC,iBAAkB,SAAClC,SAASyB,IAAAA,iBAC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ACCpG,UAAWA,EACXqB,OAAQA"}
@@ -1,9 +1,10 @@
1
- import React, { useRef } from 'react';
1
+ import React, { useRef, useState } from 'react';
2
2
  import ReactSelect from 'react-select';
3
3
  export { components } from 'react-select';
4
4
  import isFunction from 'lodash.isfunction';
5
5
  import ReactAsyncSelect from 'react-select/lib/Async';
6
6
  import ErrorLabel from '@propellerads/error-label';
7
+ import CreatableSelect from 'react-select/lib/Creatable';
7
8
  import { Close, COLOR, SIZE } from '@propellerads/icon';
8
9
  import styled from 'styled-components';
9
10
  import { borderRadius, lineHeight, gray80, errorColor, white, black, actionColor } from '@propellerads/stylevariables';
@@ -322,6 +323,11 @@ var _ClearIndicator = function ClearIndicator(props) {
322
323
 
323
324
  var TagsInput = function TagsInput(props) {
324
325
  var reactSelectElement = useRef(null);
326
+
327
+ var _useState = useState(false),
328
+ showMinLenTip = _useState[0],
329
+ setShowMinLenTip = _useState[1];
330
+
325
331
  var _props$components = props.components,
326
332
  components = _props$components === void 0 ? {} : _props$components,
327
333
  _props$customStyles = props.customStyles,
@@ -350,8 +356,23 @@ var TagsInput = function TagsInput(props) {
350
356
  value = _props$value === void 0 ? [] : _props$value,
351
357
  _props$actionColor = props.actionColor,
352
358
  actionColor = _props$actionColor === void 0 ? '' : _props$actionColor,
359
+ _props$isCreatable = props.isCreatable,
360
+ isCreatable = _props$isCreatable === void 0 ? false : _props$isCreatable,
361
+ _props$isLoading = props.isLoading,
362
+ isLoading = _props$isLoading === void 0 ? false : _props$isLoading,
363
+ _props$loadingMessage = props.loadingMessage,
364
+ loadingMessage = _props$loadingMessage === void 0 ? function () {
365
+ return 'Loading...';
366
+ } : _props$loadingMessage,
353
367
  _props$minHeightInput = props.minHeightInput,
354
- minHeightInput = _props$minHeightInput === void 0 ? 36 : _props$minHeightInput;
368
+ minHeightInput = _props$minHeightInput === void 0 ? 36 : _props$minHeightInput,
369
+ _props$createOptionPl = props.createOptionPlaceholder,
370
+ createOptionPlaceholder = _props$createOptionPl === void 0 ? 'Create ' : _props$createOptionPl,
371
+ _props$onCreateOption = props.onCreateOption,
372
+ _onCreateOption = _props$onCreateOption === void 0 ? function () {
373
+ return null;
374
+ } : _props$onCreateOption;
375
+
355
376
  var currentValue = value;
356
377
 
357
378
  var preparedStyled = _extends({}, prepareStyles(actionColor), customStyles, {
@@ -373,6 +394,9 @@ var TagsInput = function TagsInput(props) {
373
394
  filterOption: filterOption
374
395
  }, {
375
396
  styles: preparedStyled,
397
+ loadingMessage: showMinLenTip ? function () {
398
+ return 'Enter two or more characters';
399
+ } : loadingMessage,
376
400
  components: _extends({
377
401
  ClearIndicator: function ClearIndicator(clearIndicatorProps) {
378
402
  return React.createElement(_ClearIndicator, Object.assign({}, clearIndicatorProps, {
@@ -384,9 +408,14 @@ var TagsInput = function TagsInput(props) {
384
408
 
385
409
  var handleAsyncRequest = function handleAsyncRequest(newValue) {
386
410
  if (!newValue.length || newValue.length < 2) {
411
+ setShowMinLenTip(true);
387
412
  return null;
388
413
  }
389
414
 
415
+ if (!showMinLenTip) {
416
+ setShowMinLenTip(false);
417
+ }
418
+
390
419
  return promiseOptions(newValue);
391
420
  };
392
421
 
@@ -411,18 +440,29 @@ var TagsInput = function TagsInput(props) {
411
440
  }
412
441
  };
413
442
 
414
- var asyncSelect = React.createElement(ReactAsyncSelect, Object.assign({}, config, {
443
+ var regularSelect = isAsync ? React.createElement(ReactAsyncSelect, Object.assign({}, config, {
415
444
  loadOptions: function loadOptions(newValue) {
416
445
  return handleAsyncRequest(newValue);
417
446
  }
418
- }));
419
- var select = React.createElement("div", {
447
+ })) : React.createElement("div", {
420
448
  onPaste: onPaste
421
449
  }, React.createElement(ReactSelect, Object.assign({}, config, {
422
450
  ref: reactSelectElement,
423
451
  options: options
424
452
  })));
425
- return React.createElement(StyledTagsInput, null, isAsync ? asyncSelect : select, errors && errors.length > 0 && isErrorLabelVisible && React.createElement(TagsInputErrors, null, React.createElement(ErrorLabel, {
453
+ var select = isCreatable ? React.createElement(CreatableSelect, Object.assign({
454
+ formatCreateLabel: function formatCreateLabel(newValue) {
455
+ return createOptionPlaceholder + "\"" + newValue + "\"";
456
+ },
457
+ isLoading: isLoading,
458
+ onCreateOption: function onCreateOption(newOption) {
459
+ return _onCreateOption(newOption);
460
+ }
461
+ }, config, {
462
+ ref: reactSelectElement,
463
+ options: options
464
+ })) : regularSelect;
465
+ return React.createElement(StyledTagsInput, null, select, errors && errors.length > 0 && isErrorLabelVisible && React.createElement(TagsInputErrors, null, React.createElement(ErrorLabel, {
426
466
  elementId: elementId,
427
467
  errors: errors
428
468
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"tags-input.esm.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport {\n lineHeight, actionColor, borderRadius, gray80, errorColor, black, white,\n} from '@propellerads/stylevariables';\n\nconst StyledTagsInput = styled.div`\n position: relative;\n`;\n\nconst TagsInputErrors = styled.div`\n position: absolute;\n display: flex;\n flex-direction: row;\n right: 1px;\n top: 0;\n height: ${lineHeight}px;\n align-items: center;\n`;\n\nconst prepareStyles = (customActionColor: string) => {\n const mainColor = customActionColor || actionColor;\n return {\n control: (styles, {isFocused, isDisabled}) => ({\n ...styles,\n borderRadius,\n backgroundColor: isDisabled ? '#ededed' : '#fff',\n minHeight: `${lineHeight}px`,\n borderWidth: 1,\n boxShadow: 'none',\n borderColor: isFocused ? mainColor : gray80,\n }),\n valueContainer: (styles) => ({\n ...styles,\n overflow: 'hidden',\n padding: '2px 2px 4px 2px',\n justifyContent: 'flex-start',\n }),\n placeholder: () => ({\n color: '#c0c0c0',\n fontWeight: 100,\n paddingLeft: '4px',\n position: 'absolute',\n }),\n clearIndicator: () => ({\n color: '#c0c0c0',\n display: 'inline-flex',\n marginRight: '4px',\n }),\n dropdownIndicator: () => ({\n display: 'none',\n }),\n indicatorSeparator: () => ({\n display: 'none',\n }),\n multiValue: (styles, {data}) => ({\n ...styles,\n backgroundColor: data.isException ? errorColor : mainColor,\n color: white,\n borderRadius: `${borderRadius / 2}px`,\n height: '22px',\n display: 'flex',\n alignItems: 'center',\n margin: '2px 0 0 2px',\n }),\n multiValueLabel: (styles) => ({\n ...styles,\n color: white,\n padding: '0 0 0 5px',\n fontSize: '12px',\n borderRadius: 0,\n display: 'inline-flex',\n lineHeight: '1',\n }),\n multiValueRemove: (styles, {data}) => ({\n ...styles,\n padding: 0,\n margin: '0 4px 0 2px',\n backgroundColor: data.isException ? errorColor : mainColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : mainColor,\n color: 'white',\n },\n }),\n menu: (styles) => ({\n ...styles,\n margin: 0,\n borderRadius: 0,\n zIndex: 10,\n }),\n menuList: (styles) => ({\n ...styles,\n '::-webkit-scrollbar': {\n width: '7px',\n },\n '::-webkit-scrollbar-thumb': {\n borderRadius: '4px',\n backgroundColor: 'rgba(0, 0, 0, .5)',\n boxShadow: '0 0 1px rgba(255, 255, 255, .5)',\n },\n }),\n option: (styles, {isFocused}) => ({\n backgroundColor: isFocused ? mainColor : null,\n padding: '5px 10px',\n fontSize: '14px',\n color: isFocused ? white : black,\n }),\n input: (styles) => ({\n ...styles,\n height: '16px',\n }),\n };\n};\n\nexport {prepareStyles, StyledTagsInput, TagsInputErrors};\n","import React, {useRef} from 'react';\nimport ReactSelect, {components as reactSelectComponents} from 'react-select';\nimport isFunction from 'lodash.isfunction';\nimport ReactAsyncSelect from 'react-select/lib/Async';\nimport ErrorLabel from '@propellerads/error-label';\nimport {Close, SIZE, COLOR} from '@propellerads/icon';\n\nimport {TagsInputProps} from './types';\nimport {prepareStyles, StyledTagsInput, TagsInputErrors} from './style';\n\n// regexps by priority\nconst REGEXPS = [\n /(?:\\b|\\B)\\n+\\b/,\n /(?:\\b|\\B),\\s\\b/,\n /(?:\\b|\\B),+\\b/,\n];\n\ninterface SplitStringReturnValue {\n splits: string[]\n specialHandle: boolean\n}\n\nfunction splitString(value: string): SplitStringReturnValue {\n let splits: string[] = [];\n\n let specialHandle = false;\n // eslint-disable-next-line no-restricted-syntax\n for (const regex of REGEXPS) {\n splits = value.split(regex);\n if (splits.length > 1) {\n break;\n }\n }\n\n // special case. Need handle in special way\n if (splits.length === 1) {\n splits = value.split(/\\b\\s+\\b/);\n specialHandle = splits.length > 1;\n }\n\n return {\n splits,\n specialHandle,\n };\n}\n\nfunction searchSuitableOptions(pastedValue, availableOptions, searchableKeys) {\n const {splits, specialHandle} = splitString(pastedValue);\n\n if (specialHandle) {\n let rawPastedString = splits.join(' ')\n .toLowerCase();\n\n return availableOptions\n .sort((firstEl, secondEl) => {\n if (firstEl.label.length > secondEl.label.length) {\n return -1;\n }\n if (firstEl.label.length < secondEl.label.length) {\n return 1;\n }\n\n return 0;\n })\n .filter((option) => searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const position = rawPastedString.search(optionValue);\n const condition = position !== -1;\n if (condition) {\n rawPastedString = rawPastedString.replace(optionValue, '');\n }\n\n return prevValue || condition;\n }, false));\n }\n\n return splits.map((splitValue) => availableOptions.find((option) => {\n const comparableValue = splitValue.trim().toLowerCase();\n\n return searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const condition = optionValue === comparableValue;\n\n return prevValue || condition;\n }, false);\n }))\n .filter(Boolean);\n}\n\ninterface ClearIndicatorProps {\n // eslint-disable-next-line @typescript-eslint/ban-types\n getStyles: (clearIndicator: string, props: any) => {},\n innerProps: {\n ref: React.Ref<HTMLDivElement>\n },\n elementId: string,\n}\n\nconst ClearIndicator = (props: ClearIndicatorProps) => {\n const {\n elementId,\n getStyles,\n innerProps: {\n ref,\n ...restInnerProps\n },\n } = props;\n\n return (\n <div\n {...restInnerProps}\n ref={ref}\n style={getStyles('clearIndicator', props)}\n id={`${elementId}-clear`}\n >\n <Close\n color={COLOR.GRAY_DARK}\n size={SIZE.MEDIUM_SMALL}\n />\n </div>\n );\n};\n\nconst TagsInput = (props: TagsInputProps) => {\n const reactSelectElement = useRef<any>(null);\n\n const {\n components = {},\n customStyles = {},\n elementId,\n errors = [],\n isAsync = false,\n isErrorLabelVisible = false,\n onChange,\n onInputChange = null,\n filterOption = null,\n options = [],\n promiseOptions = () => Promise.resolve(),\n searchableKeys = [\n 'label',\n ],\n value = [],\n actionColor = '',\n isClearable = true,\n isDisabled = false,\n isLoading = false,\n isRtl = false,\n isMulti = true,\n isSearchable = true,\n cacheOptions = false,\n placeholder = 'Start typing...',\n noOptionsMessage = () => 'No options...',\n loadingMessage = () => 'Loading...',\n minHeightInput = 36,\n } = props;\n\n const currentValue = value;\n\n const preparedStyled = {\n ...prepareStyles(actionColor),\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...prepareStyles(actionColor).control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : prepareStyles(actionColor).control(base, state).border,\n minHeight: minHeightInput,\n };\n },\n };\n\n const config = {\n ...props,\n id: elementId,\n onChange,\n ...(onInputChange && {onInputChange}),\n ...(filterOption && {filterOption}),\n styles: preparedStyled,\n components: {\n ClearIndicator: (clearIndicatorProps) => (\n <ClearIndicator\n {...clearIndicatorProps}\n elementId={elementId}\n />\n ),\n ...components,\n },\n };\n\n const handleAsyncRequest = (newValue: any) => {\n if (!newValue.length || newValue.length < 2) {\n return null;\n }\n\n return promiseOptions(newValue);\n };\n\n const onPaste = (e) => {\n const pasteData = e.clipboardData.getData('text/plain');\n\n const pastedOptions = searchSuitableOptions(pasteData, options, searchableKeys);\n\n const newInputOptions = pastedOptions.reduce((acc, curVal) => {\n if (!acc.find((el) => el.value === curVal.value)) {\n acc.push(curVal);\n }\n\n return acc;\n }, currentValue);\n\n if (pastedOptions.length !== 0) {\n onChange(newInputOptions);\n setTimeout(() => {\n reactSelectElement.current.select.blur();\n }, 0);\n }\n };\n\n const asyncSelect = (\n <ReactAsyncSelect\n {...config}\n loadOptions={(newValue) => handleAsyncRequest(newValue)}\n />\n );\n\n const select = (\n <div onPaste={onPaste}>\n <ReactSelect\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n </div>\n );\n\n return (\n <StyledTagsInput>\n {isAsync ? asyncSelect : select}\n {errors && errors.length > 0 && isErrorLabelVisible && (\n <TagsInputErrors>\n <ErrorLabel\n elementId={elementId}\n errors={errors}\n />\n </TagsInputErrors>\n )}\n </StyledTagsInput>\n );\n};\n\nfunction customChecker(props, propName, component) {\n const {[propName]: propValue} = props;\n if (typeof propValue !== 'function') {\n return new Error(`Invalid prop \"${propName}\" passed to ${component}`);\n }\n\n const value = propValue();\n if (typeof value !== 'string' && !React.isValidElement(value)) {\n // eslint-disable-next-line max-len\n return new Error(`Invalid prop \"${propName}\" passed to ${component}. Function should return \"string\" or \"react.Node\"`);\n }\n\n return null;\n}\n\nexport {reactSelectComponents as components};\n\nexport default TagsInput;\n"],"names":["StyledTagsInput","styled","div","TagsInputErrors","lineHeight","prepareStyles","customActionColor","mainColor","actionColor","control","styles","isFocused","isDisabled","borderRadius","backgroundColor","minHeight","borderWidth","boxShadow","borderColor","gray80","valueContainer","overflow","padding","justifyContent","placeholder","color","fontWeight","paddingLeft","position","clearIndicator","display","marginRight","dropdownIndicator","indicatorSeparator","multiValue","data","isException","errorColor","white","height","alignItems","margin","multiValueLabel","fontSize","multiValueRemove","cursor","menu","zIndex","menuList","width","option","black","input","REGEXPS","splitString","value","splits","specialHandle","regex","split","length","searchSuitableOptions","pastedValue","availableOptions","searchableKeys","rawPastedString","join","toLowerCase","sort","firstEl","secondEl","label","filter","reduce","prevValue","currValue","optionValue","String","search","condition","replace","map","splitValue","find","comparableValue","trim","Boolean","ClearIndicator","props","elementId","getStyles","innerProps","ref","restInnerProps","React","style","id","Close","COLOR","GRAY_DARK","size","SIZE","MEDIUM_SMALL","TagsInput","reactSelectElement","useRef","components","customStyles","errors","isAsync","isErrorLabelVisible","onChange","onInputChange","filterOption","options","promiseOptions","Promise","resolve","minHeightInput","currentValue","preparedStyled","base","state","isFunction","border","config","clearIndicatorProps","handleAsyncRequest","newValue","onPaste","e","pasteData","clipboardData","getData","pastedOptions","newInputOptions","acc","curVal","el","push","setTimeout","current","select","blur","asyncSelect","ReactAsyncSelect","loadOptions","ReactSelect","ErrorLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAMA,eAAe,gBAAGC,MAAM,CAACC,GAAV,iCAArB;AAIA,IAAMC,eAAe,gBAAGF,MAAM,CAACC,GAAV,mCAMPE,UANO,CAArB;;AAUA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,iBAAD;AACpB,MAAMC,SAAS,GAAGD,iBAAiB,IAAIE,WAAvC;AACA,SAAO;AACLC,IAAAA,OAAO,EAAE,iBAACC,MAAD;AAAA,UAAUC,SAAV,QAAUA,SAAV;AAAA,UAAqBC,UAArB,QAAqBA,UAArB;AAAA,0BACJF,MADI;AAEPG,QAAAA,YAAY,EAAZA,YAFO;AAGPC,QAAAA,eAAe,EAAEF,UAAU,GAAG,SAAH,GAAe,MAHnC;AAIPG,QAAAA,SAAS,EAAKX,UAAL,OAJF;AAKPY,QAAAA,WAAW,EAAE,CALN;AAMPC,QAAAA,SAAS,EAAE,MANJ;AAOPC,QAAAA,WAAW,EAAEP,SAAS,GAAGJ,SAAH,GAAeY;AAP9B;AAAA,KADJ;AAULC,IAAAA,cAAc,EAAE,wBAACV,MAAD;AAAA,0BACXA,MADW;AAEdW,QAAAA,QAAQ,EAAE,QAFI;AAGdC,QAAAA,OAAO,EAAE,iBAHK;AAIdC,QAAAA,cAAc,EAAE;AAJF;AAAA,KAVX;AAgBLC,IAAAA,WAAW,EAAE;AAAA,aAAO;AAClBC,QAAAA,KAAK,EAAE,SADW;AAElBC,QAAAA,UAAU,EAAE,GAFM;AAGlBC,QAAAA,WAAW,EAAE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,KAAakF,MAAM,CAAClF,KAA5B;AAAA,OAAT,CAAL,EAAkD;AAChDiF,QAAAA,GAAG,CAACG,IAAJ,CAASF,MAAT;AACD;;AAED,aAAOD,GAAP;AACD,KANuB,EAMrBjB,YANqB,CAAxB;;AAQA,QAAIe,aAAa,CAAC1E,MAAd,KAAyB,CAA7B,EAAgC;AAC9BmD,MAAAA,QAAQ,CAACwB,eAAD,CAAR;AACAK,MAAAA,UAAU,CAAC;AACTpC,QAAAA,kBAAkB,CAACqC,OAAnB,CAA2BC,MAA3B,CAAkCC,IAAlC;AACD,OAFS,EAEP,CAFO,CAAV;AAGD;AACF,GAnBD;;AAqBA,MAAMC,WAAW,GACflD,mBAAA,CAACmD,gBAAD,oBACMpB;AACJqB,IAAAA,WAAW,EAAE,qBAAClB,QAAD;AAAA,aAAcD,kBAAkB,CAACC,QAAD,CAAhC;AAAA;IAFf,CADF;AAOA,MAAMc,MAAM,GACVhD,mBAAA,MAAA;AAAKmC,IAAAA,OAAO,EAAEA;GAAd,EACEnC,mBAAA,CAACqD,WAAD,oBACMtB;AACJjC,IAAAA,GAAG,EAAEY;AACLU,IAAAA,OAAO,EAAEA;IAHX,CADF,CADF;AAUA,SACEpB,mBAAA,CAAC9F,eAAD,MAAA,EACG6G,OAAO,GAAGmC,WAAH,GAAiBF,MAD3B,EAEGlC,MAAM,IAAIA,MAAM,CAAChD,MAAP,GAAgB,CAA1B,IAA+BkD,mBAA/B,IACChB,mBAAA,CAAC3F,eAAD,MAAA,EACE2F,mBAAA,CAACsD,UAAD;AACE3D,IAAAA,SAAS,EAAEA;AACXmB,IAAAA,MAAM,EAAEA;GAFV,CADF,CAHJ,CADF;AAaD,CAjID;;;;"}
1
+ {"version":3,"file":"tags-input.esm.js","sources":["../src/style.tsx","../src/index.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport {\n lineHeight, actionColor, borderRadius, gray80, errorColor, black, white,\n} from '@propellerads/stylevariables';\n\nconst StyledTagsInput = styled.div`\n position: relative;\n`;\n\nconst TagsInputErrors = styled.div`\n position: absolute;\n display: flex;\n flex-direction: row;\n right: 1px;\n top: 0;\n height: ${lineHeight}px;\n align-items: center;\n`;\n\nconst prepareStyles = (customActionColor: string) => {\n const mainColor = customActionColor || actionColor;\n return {\n control: (styles, {isFocused, isDisabled}) => ({\n ...styles,\n borderRadius,\n backgroundColor: isDisabled ? '#ededed' : '#fff',\n minHeight: `${lineHeight}px`,\n borderWidth: 1,\n boxShadow: 'none',\n borderColor: isFocused ? mainColor : gray80,\n }),\n valueContainer: (styles) => ({\n ...styles,\n overflow: 'hidden',\n padding: '2px 2px 4px 2px',\n justifyContent: 'flex-start',\n }),\n placeholder: () => ({\n color: '#c0c0c0',\n fontWeight: 100,\n paddingLeft: '4px',\n position: 'absolute',\n }),\n clearIndicator: () => ({\n color: '#c0c0c0',\n display: 'inline-flex',\n marginRight: '4px',\n }),\n dropdownIndicator: () => ({\n display: 'none',\n }),\n indicatorSeparator: () => ({\n display: 'none',\n }),\n multiValue: (styles, {data}) => ({\n ...styles,\n backgroundColor: data.isException ? errorColor : mainColor,\n color: white,\n borderRadius: `${borderRadius / 2}px`,\n height: '22px',\n display: 'flex',\n alignItems: 'center',\n margin: '2px 0 0 2px',\n }),\n multiValueLabel: (styles) => ({\n ...styles,\n color: white,\n padding: '0 0 0 5px',\n fontSize: '12px',\n borderRadius: 0,\n display: 'inline-flex',\n lineHeight: '1',\n }),\n multiValueRemove: (styles, {data}) => ({\n ...styles,\n padding: 0,\n margin: '0 4px 0 2px',\n backgroundColor: data.isException ? errorColor : mainColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : mainColor,\n color: 'white',\n },\n }),\n menu: (styles) => ({\n ...styles,\n margin: 0,\n borderRadius: 0,\n zIndex: 10,\n }),\n menuList: (styles) => ({\n ...styles,\n '::-webkit-scrollbar': {\n width: '7px',\n },\n '::-webkit-scrollbar-thumb': {\n borderRadius: '4px',\n backgroundColor: 'rgba(0, 0, 0, .5)',\n boxShadow: '0 0 1px rgba(255, 255, 255, .5)',\n },\n }),\n option: (styles, {isFocused}) => ({\n backgroundColor: isFocused ? mainColor : null,\n padding: '5px 10px',\n fontSize: '14px',\n color: isFocused ? white : black,\n }),\n input: (styles) => ({\n ...styles,\n height: '16px',\n }),\n };\n};\n\nexport {prepareStyles, StyledTagsInput, TagsInputErrors};\n","import React, {useRef, useState} from 'react';\nimport ReactSelect, {components as reactSelectComponents} from 'react-select';\nimport isFunction from 'lodash.isfunction';\nimport ReactAsyncSelect from 'react-select/lib/Async';\nimport ErrorLabel from '@propellerads/error-label';\nimport CreatableSelect from 'react-select/lib/Creatable';\nimport {Close, SIZE, COLOR} from '@propellerads/icon';\n\nimport {TagsInputProps} from './types';\nimport {prepareStyles, StyledTagsInput, TagsInputErrors} from './style';\n\n// regexps by priority\nconst REGEXPS = [\n /(?:\\b|\\B)\\n+\\b/,\n /(?:\\b|\\B),\\s\\b/,\n /(?:\\b|\\B),+\\b/,\n];\n\ninterface SplitStringReturnValue {\n splits: string[]\n specialHandle: boolean\n}\n\nfunction splitString(value: string): SplitStringReturnValue {\n let splits: string[] = [];\n\n let specialHandle = false;\n // eslint-disable-next-line no-restricted-syntax\n for (const regex of REGEXPS) {\n splits = value.split(regex);\n if (splits.length > 1) {\n break;\n }\n }\n\n // special case. Need handle in special way\n if (splits.length === 1) {\n splits = value.split(/\\b\\s+\\b/);\n specialHandle = splits.length > 1;\n }\n\n return {\n splits,\n specialHandle,\n };\n}\n\nfunction searchSuitableOptions(pastedValue, availableOptions, searchableKeys) {\n const {splits, specialHandle} = splitString(pastedValue);\n\n if (specialHandle) {\n let rawPastedString = splits.join(' ')\n .toLowerCase();\n\n return availableOptions\n .sort((firstEl, secondEl) => {\n if (firstEl.label.length > secondEl.label.length) {\n return -1;\n }\n if (firstEl.label.length < secondEl.label.length) {\n return 1;\n }\n\n return 0;\n })\n .filter((option) => searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const position = rawPastedString.search(optionValue);\n const condition = position !== -1;\n if (condition) {\n rawPastedString = rawPastedString.replace(optionValue, '');\n }\n\n return prevValue || condition;\n }, false));\n }\n\n return splits.map((splitValue) => availableOptions.find((option) => {\n const comparableValue = splitValue.trim().toLowerCase();\n\n return searchableKeys.reduce((prevValue, currValue) => {\n const optionValue = String(option[currValue])\n .toLowerCase();\n const condition = optionValue === comparableValue;\n\n return prevValue || condition;\n }, false);\n }))\n .filter(Boolean);\n}\n\ninterface ClearIndicatorProps {\n // eslint-disable-next-line @typescript-eslint/ban-types\n getStyles: (clearIndicator: string, props: any) => {},\n innerProps: {\n ref: React.Ref<HTMLDivElement>\n },\n elementId: string,\n}\n\nconst ClearIndicator = (props: ClearIndicatorProps) => {\n const {\n elementId,\n getStyles,\n innerProps: {\n ref,\n ...restInnerProps\n },\n } = props;\n\n return (\n <div\n {...restInnerProps}\n ref={ref}\n style={getStyles('clearIndicator', props)}\n id={`${elementId}-clear`}\n >\n <Close\n color={COLOR.GRAY_DARK}\n size={SIZE.MEDIUM_SMALL}\n />\n </div>\n );\n};\n\nconst TagsInput = (props: TagsInputProps) => {\n const reactSelectElement = useRef<any>(null);\n const [showMinLenTip, setShowMinLenTip] = useState(false);\n\n const {\n components = {},\n customStyles = {},\n elementId,\n errors = [],\n isAsync = false,\n isErrorLabelVisible = false,\n onChange,\n onInputChange = null,\n filterOption = null,\n options = [],\n promiseOptions = () => Promise.resolve(),\n searchableKeys = [\n 'label',\n ],\n value = [],\n actionColor = '',\n isClearable = true,\n isCreatable = false,\n isDisabled = false,\n isLoading = false,\n isRtl = false,\n isMulti = true,\n isSearchable = true,\n cacheOptions = false,\n placeholder = 'Start typing...',\n noOptionsMessage = () => 'No options...',\n loadingMessage = () => 'Loading...',\n minHeightInput = 36,\n createOptionPlaceholder = 'Create ',\n onCreateOption = () => null,\n } = props;\n\n const currentValue = value;\n\n const preparedStyled = {\n ...prepareStyles(actionColor),\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...prepareStyles(actionColor).control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : prepareStyles(actionColor).control(base, state).border,\n minHeight: minHeightInput,\n };\n },\n };\n\n const config = {\n ...props,\n id: elementId,\n onChange,\n ...(onInputChange && {onInputChange}),\n ...(filterOption && {filterOption}),\n styles: preparedStyled,\n loadingMessage: showMinLenTip ? () => 'Enter two or more characters' : loadingMessage,\n components: {\n ClearIndicator: (clearIndicatorProps) => (\n <ClearIndicator\n {...clearIndicatorProps}\n elementId={elementId}\n />\n ),\n ...components,\n },\n };\n\n const handleAsyncRequest = (newValue: any) => {\n if (!newValue.length || newValue.length < 2) {\n setShowMinLenTip(true);\n\n return null;\n }\n\n if (!showMinLenTip) {\n setShowMinLenTip(false);\n }\n\n return promiseOptions(newValue);\n };\n\n const onPaste = (e) => {\n const pasteData = e.clipboardData.getData('text/plain');\n\n const pastedOptions = searchSuitableOptions(pasteData, options, searchableKeys);\n\n const newInputOptions = pastedOptions.reduce((acc, curVal) => {\n if (!acc.find((el) => el.value === curVal.value)) {\n acc.push(curVal);\n }\n\n return acc;\n }, currentValue);\n\n if (pastedOptions.length !== 0) {\n onChange(newInputOptions);\n setTimeout(() => {\n reactSelectElement.current.select.blur();\n }, 0);\n }\n };\n\n const regularSelect = isAsync\n ? (\n <ReactAsyncSelect\n {...config}\n loadOptions={(newValue) => handleAsyncRequest(newValue)}\n />\n )\n : (\n <div onPaste={onPaste}>\n <ReactSelect\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n </div>\n );\n\n const select = isCreatable\n ? (\n <CreatableSelect\n formatCreateLabel={(newValue) => `${createOptionPlaceholder}\"${newValue}\"`}\n isLoading={isLoading}\n onCreateOption={(newOption) => onCreateOption(newOption)}\n {...config}\n ref={reactSelectElement}\n options={options}\n />\n ) : regularSelect;\n\n return (\n <StyledTagsInput>\n {select}\n {errors && errors.length > 0 && isErrorLabelVisible && (\n <TagsInputErrors>\n <ErrorLabel\n elementId={elementId}\n errors={errors}\n />\n </TagsInputErrors>\n )}\n </StyledTagsInput>\n );\n};\n\nexport {reactSelectComponents as components};\n\nexport default TagsInput;\n"],"names":["StyledTagsInput","styled","div","TagsInputErrors","lineHeight","prepareStyles","customActionColor","mainColor","actionColor","control","styles","isFocused","isDisabled","borderRadius","backgroundColor","minHeight","borderWidth","boxShadow","borderColor","gray80","valueContainer","overflow","padding","justifyContent","placeholder","color","fontWeight","paddingLeft","position","clearIndicator","display","marginRight","dropdownIndicator","indicatorSeparator","multiValue","data","isException","errorColor","white","height","alignItems","margin","multiValueLabel","fontSize","multiValueRemove","cursor","menu","zIndex","menuList","width","option","black","input","REGEXPS","splitString","value","splits","specialHandle","regex","split","length","searchSuitableOptions","pastedValue","availableOptions","searchableKeys","rawPastedString","join","toLowerCase","sort","firstEl","secondEl","label","filter","reduce","prevValue","currValue","optionValue","String","search","condition","replace","map","splitValue","find","comparableValue","trim","Boolean","ClearIndicator","props","elementId","getStyles","innerProps","ref","restInnerProps","React","style","id","Close","COLOR","GRAY_DARK","size","SIZE","MEDIUM_SMALL","TagsInput","reactSelectElement","useRef","useState","showMinLenTip","setShowMinLenTip","components","customStyles","errors","isAsync","isErrorLabelVisible","onChange","onInputChange","filterOption","options","promiseOptions","Promise","resolve","isCreatable","isLoading","loadingMessage","minHeightInput","createOptionPlaceholder","onCreateOption","currentValue","preparedStyled","base","state","isFunction","border","config","clearIndicatorProps","handleAsyncRequest","newValue","onPaste","e","pasteData","clipboardData","getData","pastedOptions","newInputOptions","acc","curVal","el","push","setTimeout","current","select","blur","regularSelect","ReactAsyncSelect","loadOptions","ReactSelect","CreatableSelect","formatCreateLabel","newOption","ErrorLabel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK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A,OAAO,EAAEA;IANX,CAFsB,GAUpBmC,aAVN;AAYA,SACE1D,mBAAA,CAAC9F,eAAD,MAAA,EACGsJ,MADH,EAEGvC,MAAM,IAAIA,MAAM,CAACnD,MAAP,GAAgB,CAA1B,IAA+BqD,mBAA/B,IACCnB,mBAAA,CAAC3F,eAAD,MAAA,EACE2F,mBAAA,CAACiE,UAAD;AACEtE,IAAAA,SAAS,EAAEA;AACXsB,IAAAA,MAAM,EAAEA;GAFV,CADF,CAHJ,CADF;AAaD,CAxJD;;;;"}
package/dist/types.d.ts CHANGED
@@ -22,6 +22,7 @@ export interface TagsInputProps {
22
22
  searchableKeys?: string[];
23
23
  value?: Option[];
24
24
  isClearable?: boolean;
25
+ isCreatable?: boolean;
25
26
  isDisabled?: boolean;
26
27
  isLoading?: boolean;
27
28
  isRtl?: boolean;
@@ -32,6 +33,8 @@ export interface TagsInputProps {
32
33
  noOptionsMessage?: () => string;
33
34
  loadingMessage?: () => string;
34
35
  minHeightInput?: number;
36
+ createOptionPlaceholder?: string;
37
+ onCreateOption?: (newValue: string) => void;
35
38
  }
36
39
  export default class TagsInput extends React.Component<TagsInputProps> {
37
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/tags-input",
3
- "version": "3.6.0",
3
+ "version": "4.0.0",
4
4
  "main": "dist/index.js",
5
5
  "repository": "https://github.com/propellerads/ui-components",
6
6
  "author": "i.pasyuk@propellerads.net",
@@ -39,5 +39,5 @@
39
39
  "tslib": "^2.0.1",
40
40
  "typescript": "^3.9.7"
41
41
  },
42
- "gitHead": "ceecda4693937eb4957e158dbd621301d2869ea2"
42
+ "gitHead": "179bd51f376626c402808885f857d0ba917c8d06"
43
43
  }