@nulogy/components 8.4.6 → 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 +51 -129
- package/dist/main.module.js +47 -126
- package/dist/src/Select/Select.story.d.ts +0 -2
- package/dist/src/StatusIndicator/StatusIndicator.d.ts +10 -1
- package/dist/src/StatusIndicator/index.d.ts +2 -1
- package/dist/src/index.d.ts +2 -1
- package/package.json +1 -1
- package/dist/src/Select/selectHelpers.d.ts +0 -1
- package/dist/src/Select/selectHelpers.spec.d.ts +0 -1
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,
|
|
@@ -27665,44 +27582,48 @@
|
|
|
27665
27582
|
|
|
27666
27583
|
Table.SortingHeader = SortingColumnHeader;
|
|
27667
27584
|
|
|
27585
|
+
var StatusIndicatorValues = {
|
|
27586
|
+
neutral: "neutral",
|
|
27587
|
+
dark: "dark",
|
|
27588
|
+
danger: "danger",
|
|
27589
|
+
informative: "informative",
|
|
27590
|
+
success: "success",
|
|
27591
|
+
warning: "warning",
|
|
27592
|
+
quiet: "quiet"
|
|
27593
|
+
};
|
|
27594
|
+
|
|
27668
27595
|
var StatusIndicatorColours = function StatusIndicatorColours(theme) {
|
|
27669
|
-
|
|
27670
|
-
|
|
27671
|
-
|
|
27672
|
-
|
|
27673
|
-
|
|
27674
|
-
|
|
27675
|
-
|
|
27676
|
-
|
|
27677
|
-
|
|
27678
|
-
|
|
27679
|
-
|
|
27680
|
-
|
|
27681
|
-
|
|
27682
|
-
|
|
27683
|
-
|
|
27684
|
-
|
|
27685
|
-
|
|
27686
|
-
|
|
27687
|
-
|
|
27688
|
-
|
|
27689
|
-
|
|
27690
|
-
|
|
27691
|
-
|
|
27692
|
-
|
|
27693
|
-
|
|
27694
|
-
|
|
27695
|
-
|
|
27696
|
-
|
|
27697
|
-
|
|
27698
|
-
|
|
27699
|
-
|
|
27700
|
-
warning: {
|
|
27701
|
-
borderColor: theme.colors.yellow,
|
|
27702
|
-
backgroundColor: theme.colors.yellow,
|
|
27703
|
-
color: theme.colors.darkGrey
|
|
27704
|
-
}
|
|
27705
|
-
};
|
|
27596
|
+
var _ref;
|
|
27597
|
+
|
|
27598
|
+
return _ref = {}, _ref[StatusIndicatorValues.neutral] = {
|
|
27599
|
+
borderColor: theme.colors.lightGrey,
|
|
27600
|
+
backgroundColor: theme.colors.lightGrey,
|
|
27601
|
+
color: theme.colors.darkGrey
|
|
27602
|
+
}, _ref[StatusIndicatorValues.dark] = {
|
|
27603
|
+
borderColor: theme.colors.blackBlue,
|
|
27604
|
+
backgroundColor: theme.colors.blackBlue,
|
|
27605
|
+
color: theme.colors.white
|
|
27606
|
+
}, _ref[StatusIndicatorValues.quiet] = {
|
|
27607
|
+
borderColor: theme.colors.white,
|
|
27608
|
+
backgroundColor: theme.colors.white,
|
|
27609
|
+
color: theme.colors.darkGrey
|
|
27610
|
+
}, _ref[StatusIndicatorValues.danger] = {
|
|
27611
|
+
borderColor: theme.colors.red,
|
|
27612
|
+
backgroundColor: theme.colors.red,
|
|
27613
|
+
color: theme.colors.white
|
|
27614
|
+
}, _ref[StatusIndicatorValues.informative] = {
|
|
27615
|
+
borderColor: theme.colors.blue,
|
|
27616
|
+
backgroundColor: theme.colors.blue,
|
|
27617
|
+
color: theme.colors.white
|
|
27618
|
+
}, _ref[StatusIndicatorValues.success] = {
|
|
27619
|
+
borderColor: theme.colors.green,
|
|
27620
|
+
backgroundColor: theme.colors.green,
|
|
27621
|
+
color: theme.colors.white
|
|
27622
|
+
}, _ref[StatusIndicatorValues.warning] = {
|
|
27623
|
+
borderColor: theme.colors.yellow,
|
|
27624
|
+
backgroundColor: theme.colors.yellow,
|
|
27625
|
+
color: theme.colors.darkGrey
|
|
27626
|
+
}, _ref;
|
|
27706
27627
|
};
|
|
27707
27628
|
|
|
27708
27629
|
var getStatusIndicatorColours = function getStatusIndicatorColours(type, theme) {
|
|
@@ -27712,9 +27633,9 @@
|
|
|
27712
27633
|
var StatusIndicator = styled__default['default'].p.withConfig({
|
|
27713
27634
|
displayName: "StatusIndicator",
|
|
27714
27635
|
componentId: "sc-17eyafq-0"
|
|
27715
|
-
})(space, typography, flexbox, function (
|
|
27716
|
-
var theme =
|
|
27717
|
-
type =
|
|
27636
|
+
})(space, typography, flexbox, function (_ref2) {
|
|
27637
|
+
var theme = _ref2.theme,
|
|
27638
|
+
type = _ref2.type;
|
|
27718
27639
|
return Object.assign({
|
|
27719
27640
|
display: "inline-block",
|
|
27720
27641
|
fontWeight: theme.fontWeights.bold,
|
|
@@ -27724,7 +27645,7 @@
|
|
|
27724
27645
|
}, getStatusIndicatorColours(type, theme));
|
|
27725
27646
|
});
|
|
27726
27647
|
StatusIndicator.defaultProps = {
|
|
27727
|
-
type:
|
|
27648
|
+
type: StatusIndicatorValues.neutral,
|
|
27728
27649
|
mt: "0",
|
|
27729
27650
|
mr: "0",
|
|
27730
27651
|
mb: "0",
|
|
@@ -51397,6 +51318,7 @@
|
|
|
51397
51318
|
exports.SmallNavBar = SmallNavBar;
|
|
51398
51319
|
exports.SortingTable = SortingTable;
|
|
51399
51320
|
exports.StatusIndicator = StatusIndicator;
|
|
51321
|
+
exports.StatusIndicatorValues = StatusIndicatorValues;
|
|
51400
51322
|
exports.Summary = Summary;
|
|
51401
51323
|
exports.SummaryDivider = SummaryDivider;
|
|
51402
51324
|
exports.SummaryItem = SummaryItem;
|
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,
|
|
@@ -27639,44 +27556,48 @@ var Table = function Table(_a) {
|
|
|
27639
27556
|
|
|
27640
27557
|
Table.SortingHeader = SortingColumnHeader;
|
|
27641
27558
|
|
|
27559
|
+
var StatusIndicatorValues = {
|
|
27560
|
+
neutral: "neutral",
|
|
27561
|
+
dark: "dark",
|
|
27562
|
+
danger: "danger",
|
|
27563
|
+
informative: "informative",
|
|
27564
|
+
success: "success",
|
|
27565
|
+
warning: "warning",
|
|
27566
|
+
quiet: "quiet"
|
|
27567
|
+
};
|
|
27568
|
+
|
|
27642
27569
|
var StatusIndicatorColours = function StatusIndicatorColours(theme) {
|
|
27643
|
-
|
|
27644
|
-
|
|
27645
|
-
|
|
27646
|
-
|
|
27647
|
-
|
|
27648
|
-
|
|
27649
|
-
|
|
27650
|
-
|
|
27651
|
-
|
|
27652
|
-
|
|
27653
|
-
|
|
27654
|
-
|
|
27655
|
-
|
|
27656
|
-
|
|
27657
|
-
|
|
27658
|
-
|
|
27659
|
-
|
|
27660
|
-
|
|
27661
|
-
|
|
27662
|
-
|
|
27663
|
-
|
|
27664
|
-
|
|
27665
|
-
|
|
27666
|
-
|
|
27667
|
-
|
|
27668
|
-
|
|
27669
|
-
|
|
27670
|
-
|
|
27671
|
-
|
|
27672
|
-
|
|
27673
|
-
|
|
27674
|
-
warning: {
|
|
27675
|
-
borderColor: theme.colors.yellow,
|
|
27676
|
-
backgroundColor: theme.colors.yellow,
|
|
27677
|
-
color: theme.colors.darkGrey
|
|
27678
|
-
}
|
|
27679
|
-
};
|
|
27570
|
+
var _ref;
|
|
27571
|
+
|
|
27572
|
+
return _ref = {}, _ref[StatusIndicatorValues.neutral] = {
|
|
27573
|
+
borderColor: theme.colors.lightGrey,
|
|
27574
|
+
backgroundColor: theme.colors.lightGrey,
|
|
27575
|
+
color: theme.colors.darkGrey
|
|
27576
|
+
}, _ref[StatusIndicatorValues.dark] = {
|
|
27577
|
+
borderColor: theme.colors.blackBlue,
|
|
27578
|
+
backgroundColor: theme.colors.blackBlue,
|
|
27579
|
+
color: theme.colors.white
|
|
27580
|
+
}, _ref[StatusIndicatorValues.quiet] = {
|
|
27581
|
+
borderColor: theme.colors.white,
|
|
27582
|
+
backgroundColor: theme.colors.white,
|
|
27583
|
+
color: theme.colors.darkGrey
|
|
27584
|
+
}, _ref[StatusIndicatorValues.danger] = {
|
|
27585
|
+
borderColor: theme.colors.red,
|
|
27586
|
+
backgroundColor: theme.colors.red,
|
|
27587
|
+
color: theme.colors.white
|
|
27588
|
+
}, _ref[StatusIndicatorValues.informative] = {
|
|
27589
|
+
borderColor: theme.colors.blue,
|
|
27590
|
+
backgroundColor: theme.colors.blue,
|
|
27591
|
+
color: theme.colors.white
|
|
27592
|
+
}, _ref[StatusIndicatorValues.success] = {
|
|
27593
|
+
borderColor: theme.colors.green,
|
|
27594
|
+
backgroundColor: theme.colors.green,
|
|
27595
|
+
color: theme.colors.white
|
|
27596
|
+
}, _ref[StatusIndicatorValues.warning] = {
|
|
27597
|
+
borderColor: theme.colors.yellow,
|
|
27598
|
+
backgroundColor: theme.colors.yellow,
|
|
27599
|
+
color: theme.colors.darkGrey
|
|
27600
|
+
}, _ref;
|
|
27680
27601
|
};
|
|
27681
27602
|
|
|
27682
27603
|
var getStatusIndicatorColours = function getStatusIndicatorColours(type, theme) {
|
|
@@ -27686,9 +27607,9 @@ var getStatusIndicatorColours = function getStatusIndicatorColours(type, theme)
|
|
|
27686
27607
|
var StatusIndicator = styled.p.withConfig({
|
|
27687
27608
|
displayName: "StatusIndicator",
|
|
27688
27609
|
componentId: "sc-17eyafq-0"
|
|
27689
|
-
})(space, typography, flexbox, function (
|
|
27690
|
-
var theme =
|
|
27691
|
-
type =
|
|
27610
|
+
})(space, typography, flexbox, function (_ref2) {
|
|
27611
|
+
var theme = _ref2.theme,
|
|
27612
|
+
type = _ref2.type;
|
|
27692
27613
|
return Object.assign({
|
|
27693
27614
|
display: "inline-block",
|
|
27694
27615
|
fontWeight: theme.fontWeights.bold,
|
|
@@ -27698,7 +27619,7 @@ var StatusIndicator = styled.p.withConfig({
|
|
|
27698
27619
|
}, getStatusIndicatorColours(type, theme));
|
|
27699
27620
|
});
|
|
27700
27621
|
StatusIndicator.defaultProps = {
|
|
27701
|
-
type:
|
|
27622
|
+
type: StatusIndicatorValues.neutral,
|
|
27702
27623
|
mt: "0",
|
|
27703
27624
|
mr: "0",
|
|
27704
27625
|
mb: "0",
|
|
@@ -51295,4 +51216,4 @@ var SortingTable = function SortingTable(_a) {
|
|
|
51295
51216
|
}, props));
|
|
51296
51217
|
};
|
|
51297
51218
|
|
|
51298
|
-
export { ALL_NDS_LOCALES, Alert, AnimatedBox, ApplicationFrame, AsyncSelect, Box, BrandLogoContainer, NavBar as BrandedNavBar, Branding, Breadcrumbs, Button, ButtonGroup, Card, CardSet, Checkbox, CheckboxGroup, ControlIcon, DangerButton, DatePicker, DateRange, DesktopMenu, Divider, DropdownButton, DropdownItem, DropdownLink, DropdownMenu, DropdownText, EnvironmentBanner, Field, FieldLabel, Fieldset, Flex, Form, FormSection, Header, Heading1, Heading2, Heading3, Heading4, HelpText, Icon, IconicButton, InlineIcon, InlineValidation, Input$1 as Input, Link, List, ListItem, LoadingAnimation, MenuTrigger, Modal, NDSProvider, NavBar$1 as NavBar, NavBarBackground, Overlay, Page, Pagination, PrimaryButton, QuietButton, Radio, RadioGroup, RangeContainer, RequirementText, ReactSelect as Select, SelectClearIndicator, SelectContainer$1 as SelectContainer, SelectControl, SelectDropdownIndicator, SelectInput, SelectMenu, SelectMultiValue, SelectOption, Sidebar, SmallNavBar, SortingTable, StatusIndicator, Summary, SummaryDivider, SummaryItem, Switch, Switcher, Tab, Table, Tabs, Text, Textarea, TimePicker, TimeRange, Toast, ToggleComponent as Toggle, Tooltip, TruncatedText, addStyledProps, Theme as theme, useWindowDimensions };
|
|
51219
|
+
export { ALL_NDS_LOCALES, Alert, AnimatedBox, ApplicationFrame, AsyncSelect, Box, BrandLogoContainer, NavBar as BrandedNavBar, Branding, Breadcrumbs, Button, ButtonGroup, Card, CardSet, Checkbox, CheckboxGroup, ControlIcon, DangerButton, DatePicker, DateRange, DesktopMenu, Divider, DropdownButton, DropdownItem, DropdownLink, DropdownMenu, DropdownText, EnvironmentBanner, Field, FieldLabel, Fieldset, Flex, Form, FormSection, Header, Heading1, Heading2, Heading3, Heading4, HelpText, Icon, IconicButton, InlineIcon, InlineValidation, Input$1 as Input, Link, List, ListItem, LoadingAnimation, MenuTrigger, Modal, NDSProvider, NavBar$1 as NavBar, NavBarBackground, Overlay, Page, Pagination, PrimaryButton, QuietButton, Radio, RadioGroup, RangeContainer, RequirementText, ReactSelect as Select, SelectClearIndicator, SelectContainer$1 as SelectContainer, SelectControl, SelectDropdownIndicator, SelectInput, SelectMenu, SelectMultiValue, SelectOption, Sidebar, SmallNavBar, SortingTable, StatusIndicator, StatusIndicatorValues, Summary, SummaryDivider, SummaryItem, Switch, Switcher, Tab, Table, Tabs, Text, Textarea, TimePicker, TimeRange, Toast, ToggleComponent as Toggle, Tooltip, TruncatedText, addStyledProps, Theme as theme, useWindowDimensions };
|
|
@@ -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;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SpaceProps, TypographyProps, FlexboxProps } from "styled-system";
|
|
3
|
-
declare
|
|
3
|
+
export declare const StatusIndicatorValues: {
|
|
4
|
+
readonly neutral: "neutral";
|
|
5
|
+
readonly dark: "dark";
|
|
6
|
+
readonly danger: "danger";
|
|
7
|
+
readonly informative: "informative";
|
|
8
|
+
readonly success: "success";
|
|
9
|
+
readonly warning: "warning";
|
|
10
|
+
readonly quiet: "quiet";
|
|
11
|
+
};
|
|
12
|
+
export declare type StatusIndicatorType = typeof StatusIndicatorValues[keyof typeof StatusIndicatorValues];
|
|
4
13
|
declare type StatusIndicatorProps = SpaceProps & TypographyProps & FlexboxProps & {
|
|
5
14
|
type?: StatusIndicatorType;
|
|
6
15
|
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default as StatusIndicator } from "./StatusIndicator";
|
|
1
|
+
export { default as StatusIndicator, StatusIndicatorValues } from "./StatusIndicator";
|
|
2
|
+
export type { StatusIndicatorType } from "./StatusIndicator";
|
package/dist/src/index.d.ts
CHANGED
|
@@ -30,7 +30,8 @@ export { Tab, Tabs } from "./Tabs";
|
|
|
30
30
|
export { Switch, Switcher } from "./Switcher";
|
|
31
31
|
export { Table } from "./Table";
|
|
32
32
|
export type { TableProps, TableColumnType, TableRowType, TableCellInfoType } from "./Table";
|
|
33
|
-
export { StatusIndicator } from "./StatusIndicator";
|
|
33
|
+
export { StatusIndicator, StatusIndicatorValues } from "./StatusIndicator";
|
|
34
|
+
export type { StatusIndicatorType } from "./StatusIndicator";
|
|
34
35
|
export { Pagination } from "./Pagination";
|
|
35
36
|
export { DatePicker } from "./DatePicker";
|
|
36
37
|
export { DateRange } from "./DateRange";
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const extractValuesFromCsvString: (csv: string) => string[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|