@nulogy/components 8.4.7 → 8.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/dist/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('styled-components'), require('@babel/runtime/helpers/typeof'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/defineProperty'), require('object-assign'), require('@nulogy/icons'), require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/assertThisInitialized'), require('@babel/runtime/helpers/inheritsLoose'), require('prop-types'), require('react-fast-compare'), require('warning'), require('@babel/runtime/helpers/slicedToArray'), require('@babel/runtime/helpers/objectWithoutPropertiesLoose'), require('deep-equal'), require('create-react-context'), require('react-resize-detector'), require('react-windowed-select'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', 'styled-components', '@babel/runtime/helpers/typeof', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/defineProperty', 'object-assign', '@nulogy/icons', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/assertThisInitialized', '@babel/runtime/helpers/inheritsLoose', 'prop-types', 'react-fast-compare', 'warning', '@babel/runtime/helpers/slicedToArray', '@babel/runtime/helpers/objectWithoutPropertiesLoose', 'deep-equal', 'create-react-context', 'react-resize-detector', 'react-windowed-select', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NDSComponents = {}, global.React, global.styled, global.typeof, global.classCallCheck, global.createClass, global.defineProperty, global.assign, global.icons, global.extends, global.assertThisInitialized, global.inheritsLoose, global.PropTypes, global.isEqual, global.warning, global.slicedToArray, global.objectWithoutPropertiesLoose, global.deepEqual, global.createReactContext, global.ReactResizeDetector, global.components, global.
|
|
5
|
-
}(this, (function (exports, React, styled, _typeof$1, _classCallCheck$1, _createClass$1, _defineProperty$1, assign$1, icons, _extends$4, _assertThisInitialized$2, _inheritsLoose$2, PropTypes, isEqual$2, warning$1, _slicedToArray$1, _objectWithoutPropertiesLoose$2, deepEqual, createContext, ReactResizeDetector, WindowedSelect,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('styled-components'), require('@babel/runtime/helpers/typeof'), require('@babel/runtime/helpers/classCallCheck'), require('@babel/runtime/helpers/createClass'), require('@babel/runtime/helpers/defineProperty'), require('object-assign'), require('@nulogy/icons'), require('@babel/runtime/helpers/extends'), require('@babel/runtime/helpers/assertThisInitialized'), require('@babel/runtime/helpers/inheritsLoose'), require('prop-types'), require('react-fast-compare'), require('warning'), require('@babel/runtime/helpers/slicedToArray'), require('@babel/runtime/helpers/objectWithoutPropertiesLoose'), require('deep-equal'), require('create-react-context'), require('react-resize-detector'), require('react-windowed-select'), require('react-dom'), require('exenv'), require('smoothscroll-polyfill'), require('classnames'), require('@babel/runtime/helpers/toConsumableArray'), require('react-input-autosize'), require('@babel/runtime/helpers/taggedTemplateLiteral')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', 'styled-components', '@babel/runtime/helpers/typeof', '@babel/runtime/helpers/classCallCheck', '@babel/runtime/helpers/createClass', '@babel/runtime/helpers/defineProperty', 'object-assign', '@nulogy/icons', '@babel/runtime/helpers/extends', '@babel/runtime/helpers/assertThisInitialized', '@babel/runtime/helpers/inheritsLoose', 'prop-types', 'react-fast-compare', 'warning', '@babel/runtime/helpers/slicedToArray', '@babel/runtime/helpers/objectWithoutPropertiesLoose', 'deep-equal', 'create-react-context', 'react-resize-detector', 'react-windowed-select', 'react-dom', 'exenv', 'smoothscroll-polyfill', 'classnames', '@babel/runtime/helpers/toConsumableArray', 'react-input-autosize', '@babel/runtime/helpers/taggedTemplateLiteral'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.NDSComponents = {}, global.React, global.styled, global.typeof, global.classCallCheck, global.createClass, global.defineProperty, global.assign, global.icons, global.extends, global.assertThisInitialized, global.inheritsLoose, global.PropTypes, global.isEqual, global.warning, global.slicedToArray, global.objectWithoutPropertiesLoose, global.deepEqual, global.createReactContext, global.ReactResizeDetector, global.components, global.reactDom, global.exenv, global.smoothscroll, global.t, null, global.AutosizeInput));
|
|
5
|
+
}(this, (function (exports, React, styled, _typeof$1, _classCallCheck$1, _createClass$1, _defineProperty$1, assign$1, icons, _extends$4, _assertThisInitialized$2, _inheritsLoose$2, PropTypes, isEqual$2, warning$1, _slicedToArray$1, _objectWithoutPropertiesLoose$2, deepEqual, createContext, ReactResizeDetector, WindowedSelect, reactDom, exenv, smoothscroll, t, toConsumableArray, AutosizeInput) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
var createContext__default = /*#__PURE__*/_interopDefaultLegacy(createContext);
|
|
48
48
|
var ReactResizeDetector__default = /*#__PURE__*/_interopDefaultLegacy(ReactResizeDetector);
|
|
49
49
|
var WindowedSelect__default = /*#__PURE__*/_interopDefaultLegacy(WindowedSelect);
|
|
50
|
-
var regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(regeneratorRuntime);
|
|
51
50
|
var reactDom__default = /*#__PURE__*/_interopDefaultLegacy(reactDom);
|
|
52
51
|
var exenv__default = /*#__PURE__*/_interopDefaultLegacy(exenv);
|
|
53
52
|
var smoothscroll__default = /*#__PURE__*/_interopDefaultLegacy(smoothscroll);
|
|
@@ -11751,16 +11750,6 @@
|
|
|
11751
11750
|
t[p[i]] = s[p[i]];
|
|
11752
11751
|
}
|
|
11753
11752
|
return t;
|
|
11754
|
-
}
|
|
11755
|
-
|
|
11756
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
11757
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11758
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11759
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11760
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11761
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11762
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11763
|
-
});
|
|
11764
11753
|
}
|
|
11765
11754
|
|
|
11766
11755
|
var prefix = "random-id-";
|
|
@@ -23006,8 +22995,6 @@
|
|
|
23006
22995
|
}), /*#__PURE__*/React__default['default'].createElement(WindowedSelect.components.Option, Object.assign({}, props)));
|
|
23007
22996
|
};
|
|
23008
22997
|
|
|
23009
|
-
var regenerator = regeneratorRuntime__default['default'];
|
|
23010
|
-
|
|
23011
22998
|
var getBorderColor = function getBorderColor(_ref) {
|
|
23012
22999
|
var errored = _ref.errored,
|
|
23013
23000
|
disabled = _ref.disabled,
|
|
@@ -23221,20 +23208,6 @@
|
|
|
23221
23208
|
};
|
|
23222
23209
|
};
|
|
23223
23210
|
|
|
23224
|
-
var extractValuesFromCsvString = function extractValuesFromCsvString(csv) {
|
|
23225
|
-
var quoteRegEx = /(["'])(?:(?=(\\?))\2.)*?\1/gim;
|
|
23226
|
-
var matchedValues = csv.match(quoteRegEx) || [];
|
|
23227
|
-
var quotedValues = matchedValues.map(function (str) {
|
|
23228
|
-
return str.replace(/(["',])/g, "");
|
|
23229
|
-
});
|
|
23230
|
-
var values = Array.from(new Set(csv.replace(quoteRegEx, "").split(",").map(function (value) {
|
|
23231
|
-
return value.trim();
|
|
23232
|
-
}).filter(function (str) {
|
|
23233
|
-
return str.length > 0;
|
|
23234
|
-
}).concat(quotedValues)));
|
|
23235
|
-
return values;
|
|
23236
|
-
};
|
|
23237
|
-
|
|
23238
23211
|
var SelectControl = function SelectControl(props) {
|
|
23239
23212
|
// eslint-disable-next-line react/prop-types
|
|
23240
23213
|
var isFocused = props.isFocused;
|
|
@@ -23347,62 +23320,6 @@
|
|
|
23347
23320
|
var handleChange = React__default['default'].useCallback(function (option) {
|
|
23348
23321
|
onChange && onChange(extractValue(option, multiselect));
|
|
23349
23322
|
}, [multiselect, onChange]);
|
|
23350
|
-
var handlePaste = React__default['default'].useCallback(function (e) {
|
|
23351
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
23352
|
-
var options, currentRef, currentValue, clipboardData, values, notExistingOptions, pastedOptions, newValue;
|
|
23353
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
23354
|
-
while (1) {
|
|
23355
|
-
switch (_context.prev = _context.next) {
|
|
23356
|
-
case 0:
|
|
23357
|
-
e.preventDefault();
|
|
23358
|
-
options = optionsRef.current;
|
|
23359
|
-
currentRef = reactSelectRef.current;
|
|
23360
|
-
currentValue = currentRef.state.value || [];
|
|
23361
|
-
clipboardData = e.clipboardData.getData("text/plain") || "";
|
|
23362
|
-
values = extractValuesFromCsvString(clipboardData);
|
|
23363
|
-
notExistingOptions = [];
|
|
23364
|
-
pastedOptions = values.map(function (pastedOption) {
|
|
23365
|
-
var existingOption = options.find(function (option) {
|
|
23366
|
-
return option.label === pastedOption || option.value === pastedOption;
|
|
23367
|
-
});
|
|
23368
|
-
|
|
23369
|
-
if (existingOption) {
|
|
23370
|
-
return existingOption;
|
|
23371
|
-
}
|
|
23372
|
-
|
|
23373
|
-
notExistingOptions.push(pastedOption);
|
|
23374
|
-
return null;
|
|
23375
|
-
}).filter(Boolean).filter(function (pastedOption) {
|
|
23376
|
-
return (// ignoring already selected options
|
|
23377
|
-
currentValue.findIndex(function (option) {
|
|
23378
|
-
return pastedOption.value === option.value;
|
|
23379
|
-
}) === -1
|
|
23380
|
-
);
|
|
23381
|
-
});
|
|
23382
|
-
newValue = [].concat(currentValue, pastedOptions);
|
|
23383
|
-
currentRef.setState(function (prevState) {
|
|
23384
|
-
return Object.assign(Object.assign({}, prevState), {
|
|
23385
|
-
value: newValue,
|
|
23386
|
-
inputValue: notExistingOptions.join(", ")
|
|
23387
|
-
});
|
|
23388
|
-
});
|
|
23389
|
-
handleChange(newValue);
|
|
23390
|
-
|
|
23391
|
-
case 11:
|
|
23392
|
-
case "end":
|
|
23393
|
-
return _context.stop();
|
|
23394
|
-
}
|
|
23395
|
-
}
|
|
23396
|
-
}, _callee);
|
|
23397
|
-
}));
|
|
23398
|
-
}, []);
|
|
23399
|
-
|
|
23400
|
-
var _SelectInput = React__default['default'].useCallback(function (inputProps) {
|
|
23401
|
-
return /*#__PURE__*/React__default['default'].createElement(SelectInput, Object.assign({}, inputProps, multiselect ? {
|
|
23402
|
-
onPaste: handlePaste
|
|
23403
|
-
} : {}));
|
|
23404
|
-
}, [multiselect]);
|
|
23405
|
-
|
|
23406
23323
|
React__default['default'].useEffect(function () {
|
|
23407
23324
|
if (ref) {
|
|
23408
23325
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -23443,7 +23360,7 @@
|
|
|
23443
23360
|
DropdownIndicator: SelectDropdownIndicator,
|
|
23444
23361
|
SelectContainer: SelectContainer$1,
|
|
23445
23362
|
Menu: SelectMenu,
|
|
23446
|
-
Input:
|
|
23363
|
+
Input: SelectInput
|
|
23447
23364
|
}, components),
|
|
23448
23365
|
"aria-label": ariaLabel,
|
|
23449
23366
|
options: options,
|
package/dist/main.module.js
CHANGED
|
@@ -19,7 +19,6 @@ import deepEqual from 'deep-equal';
|
|
|
19
19
|
import createContext$1 from 'create-react-context';
|
|
20
20
|
import ReactResizeDetector from 'react-resize-detector';
|
|
21
21
|
import WindowedSelect, { components as components$1 } from 'react-windowed-select';
|
|
22
|
-
import regeneratorRuntime from 'regenerator-runtime';
|
|
23
22
|
import reactDom, { findDOMNode, createPortal } from 'react-dom';
|
|
24
23
|
import exenv from 'exenv';
|
|
25
24
|
import smoothscroll from 'smoothscroll-polyfill';
|
|
@@ -11725,16 +11724,6 @@ function __rest(s, e) {
|
|
|
11725
11724
|
t[p[i]] = s[p[i]];
|
|
11726
11725
|
}
|
|
11727
11726
|
return t;
|
|
11728
|
-
}
|
|
11729
|
-
|
|
11730
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
11731
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
11732
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
11733
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11734
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11735
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11736
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11737
|
-
});
|
|
11738
11727
|
}
|
|
11739
11728
|
|
|
11740
11729
|
var prefix = "random-id-";
|
|
@@ -22980,8 +22969,6 @@ var SelectOption = function SelectOption(props) {
|
|
|
22980
22969
|
}), /*#__PURE__*/React__default.createElement(components$1.Option, Object.assign({}, props)));
|
|
22981
22970
|
};
|
|
22982
22971
|
|
|
22983
|
-
var regenerator = regeneratorRuntime;
|
|
22984
|
-
|
|
22985
22972
|
var getBorderColor = function getBorderColor(_ref) {
|
|
22986
22973
|
var errored = _ref.errored,
|
|
22987
22974
|
disabled = _ref.disabled,
|
|
@@ -23195,20 +23182,6 @@ var customStyles = function customStyles(_ref4) {
|
|
|
23195
23182
|
};
|
|
23196
23183
|
};
|
|
23197
23184
|
|
|
23198
|
-
var extractValuesFromCsvString = function extractValuesFromCsvString(csv) {
|
|
23199
|
-
var quoteRegEx = /(["'])(?:(?=(\\?))\2.)*?\1/gim;
|
|
23200
|
-
var matchedValues = csv.match(quoteRegEx) || [];
|
|
23201
|
-
var quotedValues = matchedValues.map(function (str) {
|
|
23202
|
-
return str.replace(/(["',])/g, "");
|
|
23203
|
-
});
|
|
23204
|
-
var values = Array.from(new Set(csv.replace(quoteRegEx, "").split(",").map(function (value) {
|
|
23205
|
-
return value.trim();
|
|
23206
|
-
}).filter(function (str) {
|
|
23207
|
-
return str.length > 0;
|
|
23208
|
-
}).concat(quotedValues)));
|
|
23209
|
-
return values;
|
|
23210
|
-
};
|
|
23211
|
-
|
|
23212
23185
|
var SelectControl = function SelectControl(props) {
|
|
23213
23186
|
// eslint-disable-next-line react/prop-types
|
|
23214
23187
|
var isFocused = props.isFocused;
|
|
@@ -23321,62 +23294,6 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
23321
23294
|
var handleChange = React__default.useCallback(function (option) {
|
|
23322
23295
|
onChange && onChange(extractValue(option, multiselect));
|
|
23323
23296
|
}, [multiselect, onChange]);
|
|
23324
|
-
var handlePaste = React__default.useCallback(function (e) {
|
|
23325
|
-
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee() {
|
|
23326
|
-
var options, currentRef, currentValue, clipboardData, values, notExistingOptions, pastedOptions, newValue;
|
|
23327
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
23328
|
-
while (1) {
|
|
23329
|
-
switch (_context.prev = _context.next) {
|
|
23330
|
-
case 0:
|
|
23331
|
-
e.preventDefault();
|
|
23332
|
-
options = optionsRef.current;
|
|
23333
|
-
currentRef = reactSelectRef.current;
|
|
23334
|
-
currentValue = currentRef.state.value || [];
|
|
23335
|
-
clipboardData = e.clipboardData.getData("text/plain") || "";
|
|
23336
|
-
values = extractValuesFromCsvString(clipboardData);
|
|
23337
|
-
notExistingOptions = [];
|
|
23338
|
-
pastedOptions = values.map(function (pastedOption) {
|
|
23339
|
-
var existingOption = options.find(function (option) {
|
|
23340
|
-
return option.label === pastedOption || option.value === pastedOption;
|
|
23341
|
-
});
|
|
23342
|
-
|
|
23343
|
-
if (existingOption) {
|
|
23344
|
-
return existingOption;
|
|
23345
|
-
}
|
|
23346
|
-
|
|
23347
|
-
notExistingOptions.push(pastedOption);
|
|
23348
|
-
return null;
|
|
23349
|
-
}).filter(Boolean).filter(function (pastedOption) {
|
|
23350
|
-
return (// ignoring already selected options
|
|
23351
|
-
currentValue.findIndex(function (option) {
|
|
23352
|
-
return pastedOption.value === option.value;
|
|
23353
|
-
}) === -1
|
|
23354
|
-
);
|
|
23355
|
-
});
|
|
23356
|
-
newValue = [].concat(currentValue, pastedOptions);
|
|
23357
|
-
currentRef.setState(function (prevState) {
|
|
23358
|
-
return Object.assign(Object.assign({}, prevState), {
|
|
23359
|
-
value: newValue,
|
|
23360
|
-
inputValue: notExistingOptions.join(", ")
|
|
23361
|
-
});
|
|
23362
|
-
});
|
|
23363
|
-
handleChange(newValue);
|
|
23364
|
-
|
|
23365
|
-
case 11:
|
|
23366
|
-
case "end":
|
|
23367
|
-
return _context.stop();
|
|
23368
|
-
}
|
|
23369
|
-
}
|
|
23370
|
-
}, _callee);
|
|
23371
|
-
}));
|
|
23372
|
-
}, []);
|
|
23373
|
-
|
|
23374
|
-
var _SelectInput = React__default.useCallback(function (inputProps) {
|
|
23375
|
-
return /*#__PURE__*/React__default.createElement(SelectInput, Object.assign({}, inputProps, multiselect ? {
|
|
23376
|
-
onPaste: handlePaste
|
|
23377
|
-
} : {}));
|
|
23378
|
-
}, [multiselect]);
|
|
23379
|
-
|
|
23380
23297
|
React__default.useEffect(function () {
|
|
23381
23298
|
if (ref) {
|
|
23382
23299
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -23417,7 +23334,7 @@ var ReactSelect = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
23417
23334
|
DropdownIndicator: SelectDropdownIndicator,
|
|
23418
23335
|
SelectContainer: SelectContainer$1,
|
|
23419
23336
|
Menu: SelectMenu,
|
|
23420
|
-
Input:
|
|
23337
|
+
Input: SelectInput
|
|
23421
23338
|
}, components),
|
|
23422
23339
|
"aria-label": ariaLabel,
|
|
23423
23340
|
options: options,
|
|
@@ -108,5 +108,3 @@ export declare const UsingRefToControlFocus: {
|
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
110
|
export declare const WithCustomProps: () => JSX.Element;
|
|
111
|
-
export declare const PasteCsvValueInSelect: (props: any) => JSX.Element;
|
|
112
|
-
export declare const AddNewOptionOnInputChange: (props: any) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const extractValuesFromCsvString: (csv: string) => string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|