@propellerads/tags-input 3.3.0 → 3.5.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
+ #### `3.5.0`
2
+
3
+ * New action color from themePovider
4
+
5
+ #### `3.4.0`
6
+
7
+ * updated peerDependencies
8
+
1
9
  #### `3.3.0`
2
10
 
3
11
  * Added fixed scrollbar
package/dist/style.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare const StyledTagsInput: import("styled-components").StyledComponent<"div", any, {}, never>;
2
2
  declare const TagsInputErrors: import("styled-components").StyledComponent<"div", any, {}, never>;
3
- declare const defaultStyles: {
3
+ declare const prepareStyles: (customActionColor: string) => {
4
4
  control: (styles: any, { isFocused, isDisabled }: {
5
5
  isFocused: any;
6
6
  isDisabled: any;
@@ -42,4 +42,4 @@ declare const defaultStyles: {
42
42
  };
43
43
  input: (styles: any) => any;
44
44
  };
45
- export { defaultStyles, StyledTagsInput, TagsInputErrors };
45
+ export { prepareStyles, StyledTagsInput, TagsInputErrors };
@@ -120,119 +120,123 @@ function _templateObject() {
120
120
  }
121
121
  var StyledTagsInput = /*#__PURE__*/styled.div( /*#__PURE__*/_templateObject());
122
122
  var TagsInputErrors = /*#__PURE__*/styled.div( /*#__PURE__*/_templateObject2(), stylevariables.lineHeight);
123
- var defaultStyles = {
124
- control: function control(styles, _ref) {
125
- var isFocused = _ref.isFocused,
126
- isDisabled = _ref.isDisabled;
127
- return _extends({}, styles, {
128
- borderRadius: stylevariables.borderRadius,
129
- backgroundColor: isDisabled ? '#ededed' : '#fff',
130
- minHeight: stylevariables.lineHeight + "px",
131
- borderWidth: 1,
132
- boxShadow: 'none',
133
- borderColor: isFocused ? stylevariables.actionColor : stylevariables.gray80
134
- });
135
- },
136
- valueContainer: function valueContainer(styles) {
137
- return _extends({}, styles, {
138
- overflow: 'hidden',
139
- padding: '2px 2px 4px 2px',
140
- justifyContent: 'flex-start'
141
- });
142
- },
143
- placeholder: function placeholder() {
144
- return {
145
- color: '#c0c0c0',
146
- fontWeight: 100,
147
- paddingLeft: '4px',
148
- position: 'absolute'
149
- };
150
- },
151
- clearIndicator: function clearIndicator() {
152
- return {
153
- color: '#c0c0c0',
154
- display: 'inline-flex',
155
- marginRight: '4px'
156
- };
157
- },
158
- dropdownIndicator: function dropdownIndicator() {
159
- return {
160
- display: 'none'
161
- };
162
- },
163
- indicatorSeparator: function indicatorSeparator() {
164
- return {
165
- display: 'none'
166
- };
167
- },
168
- multiValue: function multiValue(styles, _ref2) {
169
- var data = _ref2.data;
170
- return _extends({}, styles, {
171
- backgroundColor: data.isException ? stylevariables.errorColor : stylevariables.actionColor,
172
- color: stylevariables.white,
173
- borderRadius: stylevariables.borderRadius / 2 + "px",
174
- height: '22px',
175
- display: 'flex',
176
- alignItems: 'center',
177
- margin: '2px 0 0 2px'
178
- });
179
- },
180
- multiValueLabel: function multiValueLabel(styles) {
181
- return _extends({}, styles, {
182
- color: stylevariables.white,
183
- padding: '0 0 0 5px',
184
- fontSize: '12px',
185
- borderRadius: 0,
186
- display: 'inline-flex',
187
- lineHeight: '1'
188
- });
189
- },
190
- multiValueRemove: function multiValueRemove(styles, _ref3) {
191
- var data = _ref3.data;
192
- return _extends({}, styles, {
193
- padding: 0,
194
- margin: '0 4px 0 2px',
195
- backgroundColor: data.isException ? stylevariables.errorColor : stylevariables.actionColor,
196
- cursor: 'pointer',
197
- ':hover': {
198
- backgroundColor: data.isException ? stylevariables.errorColor : stylevariables.actionColor,
199
- color: 'white'
200
- }
201
- });
202
- },
203
- menu: function menu(styles) {
204
- return _extends({}, styles, {
205
- margin: 0,
206
- borderRadius: 0,
207
- zIndex: 10
208
- });
209
- },
210
- menuList: function menuList(styles) {
211
- return _extends({}, styles, {
212
- '::-webkit-scrollbar': {
213
- width: '7px'
214
- },
215
- '::-webkit-scrollbar-thumb': {
216
- borderRadius: '4px',
217
- backgroundColor: 'rgba(0, 0, 0, .5)',
218
- boxShadow: '0 0 1px rgba(255, 255, 255, .5)'
219
- }
220
- });
221
- },
222
- option: function option(styles, _ref4) {
223
- var isFocused = _ref4.isFocused;
224
- return {
225
- backgroundColor: isFocused ? stylevariables.actionColor : null,
226
- padding: '5px 10px',
227
- fontSize: '14px',
228
- color: isFocused ? stylevariables.white : stylevariables.black
229
- };
230
- },
231
- input: function input(styles) {
232
- return _extends({}, styles, {
233
- height: '16px'
234
- });
235
- }
123
+
124
+ var prepareStyles = function prepareStyles(customActionColor) {
125
+ var mainColor = customActionColor || stylevariables.actionColor;
126
+ return {
127
+ control: function control(styles, _ref) {
128
+ var isFocused = _ref.isFocused,
129
+ isDisabled = _ref.isDisabled;
130
+ return _extends({}, styles, {
131
+ borderRadius: stylevariables.borderRadius,
132
+ backgroundColor: isDisabled ? '#ededed' : '#fff',
133
+ minHeight: stylevariables.lineHeight + "px",
134
+ borderWidth: 1,
135
+ boxShadow: 'none',
136
+ borderColor: isFocused ? mainColor : stylevariables.gray80
137
+ });
138
+ },
139
+ valueContainer: function valueContainer(styles) {
140
+ return _extends({}, styles, {
141
+ overflow: 'hidden',
142
+ padding: '2px 2px 4px 2px',
143
+ justifyContent: 'flex-start'
144
+ });
145
+ },
146
+ placeholder: function placeholder() {
147
+ return {
148
+ color: '#c0c0c0',
149
+ fontWeight: 100,
150
+ paddingLeft: '4px',
151
+ position: 'absolute'
152
+ };
153
+ },
154
+ clearIndicator: function clearIndicator() {
155
+ return {
156
+ color: '#c0c0c0',
157
+ display: 'inline-flex',
158
+ marginRight: '4px'
159
+ };
160
+ },
161
+ dropdownIndicator: function dropdownIndicator() {
162
+ return {
163
+ display: 'none'
164
+ };
165
+ },
166
+ indicatorSeparator: function indicatorSeparator() {
167
+ return {
168
+ display: 'none'
169
+ };
170
+ },
171
+ multiValue: function multiValue(styles, _ref2) {
172
+ var data = _ref2.data;
173
+ return _extends({}, styles, {
174
+ backgroundColor: data.isException ? stylevariables.errorColor : mainColor,
175
+ color: stylevariables.white,
176
+ borderRadius: stylevariables.borderRadius / 2 + "px",
177
+ height: '22px',
178
+ display: 'flex',
179
+ alignItems: 'center',
180
+ margin: '2px 0 0 2px'
181
+ });
182
+ },
183
+ multiValueLabel: function multiValueLabel(styles) {
184
+ return _extends({}, styles, {
185
+ color: stylevariables.white,
186
+ padding: '0 0 0 5px',
187
+ fontSize: '12px',
188
+ borderRadius: 0,
189
+ display: 'inline-flex',
190
+ lineHeight: '1'
191
+ });
192
+ },
193
+ multiValueRemove: function multiValueRemove(styles, _ref3) {
194
+ var data = _ref3.data;
195
+ return _extends({}, styles, {
196
+ padding: 0,
197
+ margin: '0 4px 0 2px',
198
+ backgroundColor: data.isException ? stylevariables.errorColor : mainColor,
199
+ cursor: 'pointer',
200
+ ':hover': {
201
+ backgroundColor: data.isException ? stylevariables.errorColor : mainColor,
202
+ color: 'white'
203
+ }
204
+ });
205
+ },
206
+ menu: function menu(styles) {
207
+ return _extends({}, styles, {
208
+ margin: 0,
209
+ borderRadius: 0,
210
+ zIndex: 10
211
+ });
212
+ },
213
+ menuList: function menuList(styles) {
214
+ return _extends({}, styles, {
215
+ '::-webkit-scrollbar': {
216
+ width: '7px'
217
+ },
218
+ '::-webkit-scrollbar-thumb': {
219
+ borderRadius: '4px',
220
+ backgroundColor: 'rgba(0, 0, 0, .5)',
221
+ boxShadow: '0 0 1px rgba(255, 255, 255, .5)'
222
+ }
223
+ });
224
+ },
225
+ option: function option(styles, _ref4) {
226
+ var isFocused = _ref4.isFocused;
227
+ return {
228
+ backgroundColor: isFocused ? mainColor : null,
229
+ padding: '5px 10px',
230
+ fontSize: '14px',
231
+ color: isFocused ? stylevariables.white : stylevariables.black
232
+ };
233
+ },
234
+ input: function input(styles) {
235
+ return _extends({}, styles, {
236
+ height: '16px'
237
+ });
238
+ }
239
+ };
236
240
  };
237
241
 
238
242
  var REGEXPS = [/(?:\b|\B)\n+\b/, /(?:\b|\B),\s\b/, /(?:\b|\B),+\b/];
@@ -351,15 +355,17 @@ var TagsInput = function TagsInput(props) {
351
355
  searchableKeys = _props$searchableKeys === void 0 ? ['label'] : _props$searchableKeys,
352
356
  _props$value = props.value,
353
357
  value = _props$value === void 0 ? [] : _props$value,
358
+ _props$actionColor = props.actionColor,
359
+ actionColor = _props$actionColor === void 0 ? '' : _props$actionColor,
354
360
  _props$minHeightInput = props.minHeightInput,
355
361
  minHeightInput = _props$minHeightInput === void 0 ? 36 : _props$minHeightInput;
356
362
  var currentValue = value;
357
363
 
358
- var preparedStyled = _extends({}, defaultStyles, customStyles, {
364
+ var preparedStyled = _extends({}, prepareStyles(actionColor), customStyles, {
359
365
  control: function control(base, state) {
360
366
  var styles = customStyles.control && isFunction(customStyles.control) ? customStyles.control(base, state) : {};
361
- return _extends({}, defaultStyles.control(base, state), styles, {
362
- border: errors.length ? '1px solid #ed3030' : defaultStyles.control(base, state).border,
367
+ return _extends({}, prepareStyles(actionColor).control(base, state), styles, {
368
+ border: errors.length ? '1px solid #ed3030' : prepareStyles(actionColor).control(base, state).border,
363
369
  minHeight: minHeightInput
364
370
  });
365
371
  }
@@ -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 defaultStyles = {\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 ? actionColor : 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 : actionColor,\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 : actionColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : actionColor,\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 ? actionColor : 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\nexport {defaultStyles, 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 {defaultStyles, 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 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 ...defaultStyles,\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...defaultStyles.control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : defaultStyles.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","defaultStyles","control","styles","isFocused","isDisabled","borderRadius","backgroundColor","minHeight","borderWidth","boxShadow","borderColor","actionColor","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;AACpBC,EAAAA,OAAO,EAAE,iBAACC,MAAD;AAAA,QAAUC,SAAV,QAAUA,SAAV;AAAA,QAAqBC,UAArB,QAAqBA,UAArB;AAAA,wBACJF,MADI;AAEPG,MAAAA,YAAY,EAAZA,2BAFO;AAGPC,MAAAA,eAAe,EAAEF,UAAU,GAAG,SAAH,GAAe,MAHnC;AAIPG,MAAAA,SAAS,EAAKR,yBAAL,OAJF;AAKPS,MAAAA,WAAW,EAAE,CALN;AAMPC,MAAAA,SAAS,EAAE,MANJ;AAOPC,MAAAA,WAAW,EAAEP,SAAS,GAAGQ,0BAAH,GAAiBC;AAPhC;AAAA,GADW;AAUpBC,EAAAA,cAAc,EAAE,wBAACX,MAAD;AAAA,wBACXA,MADW;AAEdY,MAAAA,QAAQ,EAAE,QAFI;AAGdC,MAAAA,OAAO,EAAE,iBAHK;AAIdC,M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AI,CAACD,GAAG,CAACrD,IAAJ,CAAS,UAACuD,EAAD;AAAA,eAAQA,EAAE,CAACnF,KAAH,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,4BAAA,CAACmD,gBAAD,oBACMpB;AACJqB,IAAAA,WAAW,EAAE,qBAAClB,QAAD;AAAA,aAAcD,kBAAkB,CAACC,QAAD,CAAhC;AAAA;IAFf,CADF;AAOA,MAAMc,MAAM,GACVhD,4BAAA,MAAA;AAAKmC,IAAAA,OAAO,EAAEA;GAAd,EACEnC,4BAAA,CAACqD,oBAAD,oBACMtB;AACJjC,IAAAA,GAAG,EAAEY;AACLU,IAAAA,OAAO,EAAEA;IAHX,CADF,CADF;AAUA,SACEpB,4BAAA,CAAC5F,eAAD,MAAA,EACG2G,OAAO,GAAGmC,WAAH,GAAiBF,MAD3B,EAEGlC,MAAM,IAAIA,MAAM,CAAChD,MAAP,GAAgB,CAA1B,IAA+BkD,mBAA/B,IACChB,4BAAA,CAACzF,eAAD,MAAA,EACEyF,4BAAA,CAACsD,UAAD;AACE3D,IAAAA,SAAS,EAAEA;AACXmB,IAAAA,MAAM,EAAEA;GAFV,CADF,CAHJ,CADF;AAaD,CAhID;;;;;;;;;;"}
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,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A,CAACmD,gBAAD,oBACMpB;AACJqB,IAAAA,WAAW,EAAE,qBAAClB,QAAD;AAAA,aAAcD,kBAAkB,CAACC,QAAD,CAAhC;AAAA;IAFf,CADF;AAOA,MAAMc,MAAM,GACVhD,4BAAA,MAAA;AAAKmC,IAAAA,OAAO,EAAEA;GAAd,EACEnC,4BAAA,CAACqD,oBAAD,oBACMtB;AACJjC,IAAAA,GAAG,EAAEY;AACLU,IAAAA,OAAO,EAAEA;IAHX,CADF,CADF;AAUA,SACEpB,4BAAA,CAAC9F,eAAD,MAAA,EACG6G,OAAO,GAAGmC,WAAH,GAAiBF,MAD3B,EAEGlC,MAAM,IAAIA,MAAM,CAAChD,MAAP,GAAgB,CAA1B,IAA+BkD,mBAA/B,IACChB,4BAAA,CAAC3F,eAAD,MAAA,EACE2F,4BAAA,CAACsD,UAAD;AACE3D,IAAAA,SAAS,EAAEA;AACXmB,IAAAA,MAAM,EAAEA;GAFV,CADF,CAHJ,CADF;AAaD,CAjID;;;;;;;;;;"}
@@ -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={control:function(e,r){return d({},e,{borderRadius:s.borderRadius,backgroundColor:r.isDisabled?"#ededed":"#fff",minHeight:s.lineHeight+"px",borderWidth:1,boxShadow:"none",borderColor:r.isFocused?s.actionColor: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,r){return d({},e,{backgroundColor:r.data.isException?s.errorColor:s.actionColor,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,r){var n=r.data;return d({},e,{padding:0,margin:"0 4px 0 2px",backgroundColor:n.isException?s.errorColor:s.actionColor,cursor:"pointer",":hover":{backgroundColor:n.isException?s.errorColor:s.actionColor,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,r){var n=r.isFocused;return{backgroundColor:n?s.actionColor:null,padding:"5px 10px",fontSize:"14px",color:n?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.minHeightInput,V=void 0===B?36:B,_=void 0===z?[]:z,F=d({},m,p,{control:function(e,r){var n=p.control&&i(p.control)?p.control(e,r):{};return d({},m.control(e,r),n,{border:C.length?"1px solid #ed3030":m.control(e,r).border,minHeight:V})}}),K=d({},e,{id:b,onChange:E},R&&{onInputChange:R},L&&{filterOption:L},{styles:F,components:d({ClearIndicator:function(e){return n.createElement(y,Object.assign({},e,{elementId:b}))}},c)}),T=n.createElement(l,Object.assign({},K,{loadOptions:function(e){return function(e){return!e.length||e.length<2?null:P(e)}(e)}})),U=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}),_);0!==r.length&&(E(n),setTimeout((function(){t.current.select.blur()}),0))}},n.createElement(o,Object.assign({},K,{ref:t,options:q})));return n.createElement(v,null,O?T:U,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=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})))};
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 defaultStyles = {\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 ? actionColor : 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 : actionColor,\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 : actionColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : actionColor,\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 ? actionColor : 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\nexport {defaultStyles, 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 {defaultStyles, 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 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 ...defaultStyles,\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...defaultStyles.control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : defaultStyles.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","defaultStyles","control","styles","borderRadius","backgroundColor","isDisabled","minHeight","borderWidth","boxShadow","borderColor","isFocused","actionColor","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,SAIzBC,EAAkBF,EAAOC,QAMjBE,cAIRC,EAAgB,CACpBC,QAAS,SAACC,iBACLA,GACHC,aAAAA,eACAC,kBAH4BC,WAGE,UAAY,OAC1CC,UAAcP,kBACdQ,YAAa,EACbC,UAAW,OACXC,cAPiBC,UAOQC,cAAcC,YAEzCC,eAAgB,SAACX,eACZA,GACHY,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,SAACzB,iBACRA,GACHE,kBAFoBwB,KA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ACC,EAASC,UACVD,EAAQE,MAAMxB,OAASuB,EAASC,MAAMxB,QAChC,EAENsB,EAAQE,MAAMxB,OAASuB,EAASC,MAAMxB,OACjC,EAGF,KAERyB,QAAO,SAACpE,UAAWkC,EAAemC,QAAO,SAACC,EAAWC,OAC9CC,EAAcC,OAAOzE,EAAOuE,IAC/BR,cAEGW,GAA0B,IADfb,EAAgBc,OAAOH,UAEpCE,IACFb,EAAkBA,EAAgBe,QAAQJ,EAAa,KAGlDF,GAAaI,KACnB,aAGAjB,EAAOoB,KAAI,SAACC,UAAetB,EAAiBuB,MAAK,SAAC/E,OACjDgF,EAAkBF,EAAWG,OAAOlB,qBAEnC7B,EAAemC,QAAO,SAACC,EAAWC,OACjCC,EAAcC,OAAOzE,EAAOuE,IAC/BR,qBAGIO,GAFWE,IAAgBQ,KAGjC,SAEFZ,OAAOc,SAqHcC,CAFJ9B,EAAE+B,cAAcC,QAAQ,cAEavD,EAASI,GAE1DoD,EAAkBhC,EAAce,QAAO,SAACkB,EAAKC,UAC5CD,EAAIR,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,gBAAC3D,OACEyE,EAAUqB,EAAcK,EACxB3B,GAAUA,EAAOmB,OAAS,GAAKjB,GAC9Bf,gBAACxD,OACCwD,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} 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,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,MA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+6,7 @@ import ReactAsyncSelect from 'react-select/lib/Async';
6
6
  import ErrorLabel from '@propellerads/error-label';
7
7
  import { Close, COLOR, SIZE } from '@propellerads/icon';
8
8
  import styled from 'styled-components';
9
- import { lineHeight, borderRadius, actionColor, gray80, errorColor, white, black } from '@propellerads/stylevariables';
9
+ import { borderRadius, lineHeight, gray80, errorColor, white, black, actionColor } from '@propellerads/stylevariables';
10
10
 
11
11
  function _extends() {
12
12
  _extends = Object.assign || function (target) {
@@ -113,119 +113,123 @@ function _templateObject() {
113
113
  }
114
114
  var StyledTagsInput = /*#__PURE__*/styled.div( /*#__PURE__*/_templateObject());
115
115
  var TagsInputErrors = /*#__PURE__*/styled.div( /*#__PURE__*/_templateObject2(), lineHeight);
116
- var defaultStyles = {
117
- control: function control(styles, _ref) {
118
- var isFocused = _ref.isFocused,
119
- isDisabled = _ref.isDisabled;
120
- return _extends({}, styles, {
121
- borderRadius: borderRadius,
122
- backgroundColor: isDisabled ? '#ededed' : '#fff',
123
- minHeight: lineHeight + "px",
124
- borderWidth: 1,
125
- boxShadow: 'none',
126
- borderColor: isFocused ? actionColor : gray80
127
- });
128
- },
129
- valueContainer: function valueContainer(styles) {
130
- return _extends({}, styles, {
131
- overflow: 'hidden',
132
- padding: '2px 2px 4px 2px',
133
- justifyContent: 'flex-start'
134
- });
135
- },
136
- placeholder: function placeholder() {
137
- return {
138
- color: '#c0c0c0',
139
- fontWeight: 100,
140
- paddingLeft: '4px',
141
- position: 'absolute'
142
- };
143
- },
144
- clearIndicator: function clearIndicator() {
145
- return {
146
- color: '#c0c0c0',
147
- display: 'inline-flex',
148
- marginRight: '4px'
149
- };
150
- },
151
- dropdownIndicator: function dropdownIndicator() {
152
- return {
153
- display: 'none'
154
- };
155
- },
156
- indicatorSeparator: function indicatorSeparator() {
157
- return {
158
- display: 'none'
159
- };
160
- },
161
- multiValue: function multiValue(styles, _ref2) {
162
- var data = _ref2.data;
163
- return _extends({}, styles, {
164
- backgroundColor: data.isException ? errorColor : actionColor,
165
- color: white,
166
- borderRadius: borderRadius / 2 + "px",
167
- height: '22px',
168
- display: 'flex',
169
- alignItems: 'center',
170
- margin: '2px 0 0 2px'
171
- });
172
- },
173
- multiValueLabel: function multiValueLabel(styles) {
174
- return _extends({}, styles, {
175
- color: white,
176
- padding: '0 0 0 5px',
177
- fontSize: '12px',
178
- borderRadius: 0,
179
- display: 'inline-flex',
180
- lineHeight: '1'
181
- });
182
- },
183
- multiValueRemove: function multiValueRemove(styles, _ref3) {
184
- var data = _ref3.data;
185
- return _extends({}, styles, {
186
- padding: 0,
187
- margin: '0 4px 0 2px',
188
- backgroundColor: data.isException ? errorColor : actionColor,
189
- cursor: 'pointer',
190
- ':hover': {
191
- backgroundColor: data.isException ? errorColor : actionColor,
192
- color: 'white'
193
- }
194
- });
195
- },
196
- menu: function menu(styles) {
197
- return _extends({}, styles, {
198
- margin: 0,
199
- borderRadius: 0,
200
- zIndex: 10
201
- });
202
- },
203
- menuList: function menuList(styles) {
204
- return _extends({}, styles, {
205
- '::-webkit-scrollbar': {
206
- width: '7px'
207
- },
208
- '::-webkit-scrollbar-thumb': {
209
- borderRadius: '4px',
210
- backgroundColor: 'rgba(0, 0, 0, .5)',
211
- boxShadow: '0 0 1px rgba(255, 255, 255, .5)'
212
- }
213
- });
214
- },
215
- option: function option(styles, _ref4) {
216
- var isFocused = _ref4.isFocused;
217
- return {
218
- backgroundColor: isFocused ? actionColor : null,
219
- padding: '5px 10px',
220
- fontSize: '14px',
221
- color: isFocused ? white : black
222
- };
223
- },
224
- input: function input(styles) {
225
- return _extends({}, styles, {
226
- height: '16px'
227
- });
228
- }
116
+
117
+ var prepareStyles = function prepareStyles(customActionColor) {
118
+ var mainColor = customActionColor || actionColor;
119
+ return {
120
+ control: function control(styles, _ref) {
121
+ var isFocused = _ref.isFocused,
122
+ isDisabled = _ref.isDisabled;
123
+ return _extends({}, styles, {
124
+ borderRadius: borderRadius,
125
+ backgroundColor: isDisabled ? '#ededed' : '#fff',
126
+ minHeight: lineHeight + "px",
127
+ borderWidth: 1,
128
+ boxShadow: 'none',
129
+ borderColor: isFocused ? mainColor : gray80
130
+ });
131
+ },
132
+ valueContainer: function valueContainer(styles) {
133
+ return _extends({}, styles, {
134
+ overflow: 'hidden',
135
+ padding: '2px 2px 4px 2px',
136
+ justifyContent: 'flex-start'
137
+ });
138
+ },
139
+ placeholder: function placeholder() {
140
+ return {
141
+ color: '#c0c0c0',
142
+ fontWeight: 100,
143
+ paddingLeft: '4px',
144
+ position: 'absolute'
145
+ };
146
+ },
147
+ clearIndicator: function clearIndicator() {
148
+ return {
149
+ color: '#c0c0c0',
150
+ display: 'inline-flex',
151
+ marginRight: '4px'
152
+ };
153
+ },
154
+ dropdownIndicator: function dropdownIndicator() {
155
+ return {
156
+ display: 'none'
157
+ };
158
+ },
159
+ indicatorSeparator: function indicatorSeparator() {
160
+ return {
161
+ display: 'none'
162
+ };
163
+ },
164
+ multiValue: function multiValue(styles, _ref2) {
165
+ var data = _ref2.data;
166
+ return _extends({}, styles, {
167
+ backgroundColor: data.isException ? errorColor : mainColor,
168
+ color: white,
169
+ borderRadius: borderRadius / 2 + "px",
170
+ height: '22px',
171
+ display: 'flex',
172
+ alignItems: 'center',
173
+ margin: '2px 0 0 2px'
174
+ });
175
+ },
176
+ multiValueLabel: function multiValueLabel(styles) {
177
+ return _extends({}, styles, {
178
+ color: white,
179
+ padding: '0 0 0 5px',
180
+ fontSize: '12px',
181
+ borderRadius: 0,
182
+ display: 'inline-flex',
183
+ lineHeight: '1'
184
+ });
185
+ },
186
+ multiValueRemove: function multiValueRemove(styles, _ref3) {
187
+ var data = _ref3.data;
188
+ return _extends({}, styles, {
189
+ padding: 0,
190
+ margin: '0 4px 0 2px',
191
+ backgroundColor: data.isException ? errorColor : mainColor,
192
+ cursor: 'pointer',
193
+ ':hover': {
194
+ backgroundColor: data.isException ? errorColor : mainColor,
195
+ color: 'white'
196
+ }
197
+ });
198
+ },
199
+ menu: function menu(styles) {
200
+ return _extends({}, styles, {
201
+ margin: 0,
202
+ borderRadius: 0,
203
+ zIndex: 10
204
+ });
205
+ },
206
+ menuList: function menuList(styles) {
207
+ return _extends({}, styles, {
208
+ '::-webkit-scrollbar': {
209
+ width: '7px'
210
+ },
211
+ '::-webkit-scrollbar-thumb': {
212
+ borderRadius: '4px',
213
+ backgroundColor: 'rgba(0, 0, 0, .5)',
214
+ boxShadow: '0 0 1px rgba(255, 255, 255, .5)'
215
+ }
216
+ });
217
+ },
218
+ option: function option(styles, _ref4) {
219
+ var isFocused = _ref4.isFocused;
220
+ return {
221
+ backgroundColor: isFocused ? mainColor : null,
222
+ padding: '5px 10px',
223
+ fontSize: '14px',
224
+ color: isFocused ? white : black
225
+ };
226
+ },
227
+ input: function input(styles) {
228
+ return _extends({}, styles, {
229
+ height: '16px'
230
+ });
231
+ }
232
+ };
229
233
  };
230
234
 
231
235
  var REGEXPS = [/(?:\b|\B)\n+\b/, /(?:\b|\B),\s\b/, /(?:\b|\B),+\b/];
@@ -344,15 +348,17 @@ var TagsInput = function TagsInput(props) {
344
348
  searchableKeys = _props$searchableKeys === void 0 ? ['label'] : _props$searchableKeys,
345
349
  _props$value = props.value,
346
350
  value = _props$value === void 0 ? [] : _props$value,
351
+ _props$actionColor = props.actionColor,
352
+ actionColor = _props$actionColor === void 0 ? '' : _props$actionColor,
347
353
  _props$minHeightInput = props.minHeightInput,
348
354
  minHeightInput = _props$minHeightInput === void 0 ? 36 : _props$minHeightInput;
349
355
  var currentValue = value;
350
356
 
351
- var preparedStyled = _extends({}, defaultStyles, customStyles, {
357
+ var preparedStyled = _extends({}, prepareStyles(actionColor), customStyles, {
352
358
  control: function control(base, state) {
353
359
  var styles = customStyles.control && isFunction(customStyles.control) ? customStyles.control(base, state) : {};
354
- return _extends({}, defaultStyles.control(base, state), styles, {
355
- border: errors.length ? '1px solid #ed3030' : defaultStyles.control(base, state).border,
360
+ return _extends({}, prepareStyles(actionColor).control(base, state), styles, {
361
+ border: errors.length ? '1px solid #ed3030' : prepareStyles(actionColor).control(base, state).border,
356
362
  minHeight: minHeightInput
357
363
  });
358
364
  }
@@ -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 defaultStyles = {\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 ? actionColor : 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 : actionColor,\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 : actionColor,\n cursor: 'pointer',\n ':hover': {\n backgroundColor: data.isException ? errorColor : actionColor,\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 ? actionColor : 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\nexport {defaultStyles, 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 {defaultStyles, 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 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 ...defaultStyles,\n ...customStyles,\n control: (base, state) => {\n const styles = (customStyles.control && isFunction(customStyles.control))\n ? customStyles.control(base, state)\n : {};\n\n return {\n ...defaultStyles.control(base, state),\n ...styles,\n border: errors.length ? '1px solid #ed3030' : defaultStyles.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","defaultStyles","control","styles","isFocused","isDisabled","borderRadius","backgroundColor","minHeight","borderWidth","boxShadow","borderColor","actionColor","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,I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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,CAAC5F,eAAD,MAAA,EACG2G,OAAO,GAAGmC,WAAH,GAAiBF,MAD3B,EAEGlC,MAAM,IAAIA,MAAM,CAAChD,MAAP,GAAgB,CAA1B,IAA+BkD,mBAA/B,IACChB,mBAAA,CAACzF,eAAD,MAAA,EACEyF,mBAAA,CAACsD,UAAD;AACE3D,IAAAA,SAAS,EAAEA;AACXmB,IAAAA,MAAM,EAAEA;GAFV,CADF,CAHJ,CADF;AAaD,CAhID;;;;"}
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,K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agsInputProps {
9
9
  customStyles?: {
10
10
  control?: (value?: any, value2?: any) => void;
11
11
  };
12
+ actionColor: string;
12
13
  elementId: string;
13
14
  errors?: string[];
14
15
  isAsync?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/tags-input",
3
- "version": "3.3.0",
3
+ "version": "3.5.0",
4
4
  "main": "dist/index.js",
5
5
  "repository": "https://github.com/propellerads/ui-components",
6
6
  "author": "i.pasyuk@propellerads.net",
@@ -11,8 +11,7 @@
11
11
  "@propellerads/icon": "^3.4.0",
12
12
  "@propellerads/stylevariables": "^1.3.0",
13
13
  "lodash.isfunction": "^3.0.9",
14
- "react-select": "2.4.3",
15
- "styled-components": "^5.2.0"
14
+ "react-select": "2.4.3"
16
15
  },
17
16
  "typings": "dist/index.d.ts",
18
17
  "files": [
@@ -27,18 +26,18 @@
27
26
  "build": "tsdx build"
28
27
  },
29
28
  "peerDependencies": {
30
- "react": ">=16"
29
+ "@types/react": "^17.0.2",
30
+ "@types/react-dom": "^17.0.2",
31
+ "@types/styled-components": "5.1.1",
32
+ "react": "^17.0.2",
33
+ "react-dom": "^17.0.2",
34
+ "styled-components": "5.1.1"
31
35
  },
32
36
  "module": "dist/tags-input.esm.js",
33
37
  "devDependencies": {
34
- "@types/react": "^16.9.46",
35
- "@types/react-dom": "^16.9.8",
36
- "@types/styled-components": "^5.1.2",
37
- "react": "^16.13.1",
38
- "react-dom": "^16.13.1",
39
38
  "tsdx": "^0.13.2",
40
39
  "tslib": "^2.0.1",
41
40
  "typescript": "^3.9.7"
42
41
  },
43
- "gitHead": "d7120a4ee980bb71e2717497a4ee28cfab740bb2"
42
+ "gitHead": "60e12fbee9f680d868d22d915c82bb7aaf6a0447"
44
43
  }