@elliemae/ds-pills 2.0.0-alpha.1 → 2.0.0-alpha.13
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/cjs/components/Pill.js +53 -0
- package/cjs/components/PillButton.js +56 -0
- package/cjs/components/PillGroup.js +64 -0
- package/cjs/components/index.js +17 -0
- package/cjs/components/styled.js +85 -0
- package/cjs/components/types/DropdownPill.js +86 -0
- package/cjs/components/types/InputPill.js +74 -0
- package/cjs/components/types/LabelPill.js +46 -0
- package/cjs/components/types/ReadOnlyPill.js +50 -0
- package/cjs/components/types/RemovablePill.js +72 -0
- package/cjs/components/types/ValuePill.js +54 -0
- package/cjs/components/types/index.js +19 -0
- package/cjs/{DropdownPill.js → deprecated/DropdownPill.js} +16 -11
- package/cjs/{InputPill.js → deprecated/InputPill.js} +24 -20
- package/cjs/{LabeledDropdownPills.js → deprecated/LabeledDropdownPills.js} +8 -3
- package/cjs/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownCascadeMenuPill.js +25 -15
- package/cjs/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownMultiPill.js +28 -20
- package/cjs/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownSinglePill.js +29 -24
- package/cjs/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/utils.js +4 -2
- package/cjs/{LabeledPills.js → deprecated/LabeledPills.js} +11 -10
- package/cjs/{OverflowPill.js → deprecated/OverflowPill.js} +20 -15
- package/cjs/{Pill.js → deprecated/Pill.js} +21 -13
- package/cjs/{PillGroup.js → deprecated/PillGroup.js} +26 -18
- package/cjs/{ReadOnlyPill.js → deprecated/ReadOnlyPill.js} +33 -29
- package/cjs/{RemovablePill.js → deprecated/RemovablePill.js} +17 -17
- package/cjs/deprecated/index.js +33 -0
- package/cjs/index.d.js +2 -0
- package/cjs/index.js +19 -9
- package/cjs/props.js +69 -0
- package/cjs/utils.js +28 -0
- package/esm/components/Pill.js +44 -0
- package/esm/components/PillButton.js +46 -0
- package/esm/components/PillGroup.js +53 -0
- package/esm/components/index.js +3 -0
- package/esm/components/styled.js +67 -0
- package/esm/components/types/DropdownPill.js +76 -0
- package/esm/components/types/InputPill.js +65 -0
- package/esm/components/types/LabelPill.js +37 -0
- package/esm/components/types/ReadOnlyPill.js +41 -0
- package/esm/components/types/RemovablePill.js +63 -0
- package/esm/components/types/ValuePill.js +45 -0
- package/esm/components/types/index.js +6 -0
- package/esm/{DropdownPill.js → deprecated/DropdownPill.js} +7 -1
- package/esm/{InputPill.js → deprecated/InputPill.js} +18 -11
- package/esm/{LabeledDropdownPills.js → deprecated/LabeledDropdownPills.js} +5 -0
- package/esm/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownCascadeMenuPill.js +15 -5
- package/esm/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownMultiPill.js +10 -2
- package/esm/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownSinglePill.js +15 -8
- package/esm/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/utils.js +3 -1
- package/esm/{LabeledPills.js → deprecated/LabeledPills.js} +9 -8
- package/esm/{OverflowPill.js → deprecated/OverflowPill.js} +12 -7
- package/esm/{Pill.js → deprecated/Pill.js} +18 -10
- package/esm/{PillGroup.js → deprecated/PillGroup.js} +25 -17
- package/esm/{ReadOnlyPill.js → deprecated/ReadOnlyPill.js} +26 -21
- package/esm/{RemovablePill.js → deprecated/RemovablePill.js} +10 -9
- package/esm/deprecated/index.js +8 -0
- package/esm/index.d.js +1 -0
- package/esm/index.js +11 -8
- package/esm/props.js +60 -0
- package/esm/utils.js +24 -0
- package/package.json +120 -51
- package/types/components/Pill.d.ts +5 -0
- package/types/components/PillButton.d.ts +5 -0
- package/types/components/PillGroup.d.ts +13 -0
- package/types/components/index.d.ts +3 -0
- package/types/components/styled.d.ts +24 -0
- package/types/components/types/DropdownPill.d.ts +3 -0
- package/types/components/types/InputPill.d.ts +3 -0
- package/types/components/types/LabelPill.d.ts +3 -0
- package/types/components/types/ReadOnlyPill.d.ts +3 -0
- package/types/components/types/RemovablePill.d.ts +3 -0
- package/types/components/types/ValuePill.d.ts +3 -0
- package/types/components/types/index.d.ts +6 -0
- package/types/deprecated/DropdownPill.d.ts +75 -0
- package/types/{InputPill.d.ts → deprecated/InputPill.d.ts} +0 -0
- package/types/deprecated/LabeledDropdownPills.d.ts +93 -0
- package/types/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownCascadeMenuPill.d.ts +0 -0
- package/types/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownMultiPill.d.ts +0 -0
- package/types/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/LabeledDropdownSinglePill.d.ts +0 -0
- package/types/{LabeledDropdownPillsTypes → deprecated/LabeledDropdownPillsTypes}/utils.d.ts +1 -1
- package/types/deprecated/LabeledPills.d.ts +59 -0
- package/types/deprecated/OverflowPill.d.ts +37 -0
- package/types/deprecated/Pill.d.ts +67 -0
- package/types/deprecated/PillGroup.d.ts +56 -0
- package/types/deprecated/ReadOnlyPill.d.ts +63 -0
- package/types/deprecated/RemovablePill.d.ts +55 -0
- package/types/deprecated/index.d.ts +9 -0
- package/types/index.d.ts +3 -9
- package/types/props.d.ts +92 -0
- package/types/tests/DSPill.test.d.ts +1 -0
- package/types/tests/DSPillGroup.test.d.ts +1 -0
- package/types/tests/events/DSPill.events.keyboard.test.d.ts +1 -0
- package/types/tests/events/DSPill.events.test.d.ts +1 -0
- package/types/tests/events/DSPillGroup.events.keyboard.test.d.ts +1 -0
- package/types/tests/events/DSPillGroup.events.test.d.ts +1 -0
- package/types/utils.d.ts +4 -0
- package/cjs/package.json +0 -7
- package/esm/package.json +0 -7
- package/types/DropdownPill.d.ts +0 -31
- package/types/LabeledDropdownPills.d.ts +0 -37
- package/types/LabeledPills.d.ts +0 -27
- package/types/OverflowPill.d.ts +0 -18
- package/types/Pill.d.ts +0 -29
- package/types/PillGroup.d.ts +0 -25
- package/types/ReadOnlyPill.d.ts +0 -26
- package/types/RemovablePill.d.ts +0 -24
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
9
|
+
var React = require('react');
|
|
10
|
+
var DSTooltip = require('@elliemae/ds-tooltip');
|
|
11
|
+
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
12
|
+
var styled = require('../styled.js');
|
|
13
|
+
|
|
14
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
+
|
|
16
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
+
|
|
19
|
+
const ValuePill = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
20
|
+
let {
|
|
21
|
+
label,
|
|
22
|
+
size,
|
|
23
|
+
labelTruncated,
|
|
24
|
+
tooltipValue,
|
|
25
|
+
iconLeft,
|
|
26
|
+
ariaLabel
|
|
27
|
+
} = _ref;
|
|
28
|
+
const TextComponent = labelTruncated ? _ref2 => {
|
|
29
|
+
let {
|
|
30
|
+
children
|
|
31
|
+
} = _ref2;
|
|
32
|
+
return /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
33
|
+
value: children
|
|
34
|
+
});
|
|
35
|
+
} : React__default["default"].Fragment;
|
|
36
|
+
return /*#__PURE__*/_jsx__default["default"](styled.StyledValuePillWrapper, {
|
|
37
|
+
size: size,
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
className: "ds-pill-wrapper ds-pill-wrapper-value",
|
|
40
|
+
"data-testid": "ds-pill-wrapper",
|
|
41
|
+
"aria-label": ariaLabel || label,
|
|
42
|
+
cols: [iconLeft && 'min-content', 'auto'].filter(notFalse => notFalse),
|
|
43
|
+
gutter: "xxxs",
|
|
44
|
+
hasIcon: iconLeft !== null
|
|
45
|
+
}, void 0, iconLeft, tooltipValue !== '' ? /*#__PURE__*/_jsx__default["default"](DSTooltip.DSTooltipV2, {
|
|
46
|
+
title: tooltipValue,
|
|
47
|
+
triggerComponent: /*#__PURE__*/_jsx__default["default"](styled.StyledSpanWithTooltip, {
|
|
48
|
+
className: "ds-pill-tooltip-value",
|
|
49
|
+
tabIndex: 0
|
|
50
|
+
}, void 0, label)
|
|
51
|
+
}) : /*#__PURE__*/_jsx__default["default"](TextComponent, {}, void 0, label));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
exports.ValuePill = ValuePill;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DropdownPill = require('./DropdownPill.js');
|
|
6
|
+
var InputPill = require('./InputPill.js');
|
|
7
|
+
var LabelPill = require('./LabelPill.js');
|
|
8
|
+
var ReadOnlyPill = require('./ReadOnlyPill.js');
|
|
9
|
+
var RemovablePill = require('./RemovablePill.js');
|
|
10
|
+
var ValuePill = require('./ValuePill.js');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.DropdownPill = DropdownPill.DropdownPill;
|
|
15
|
+
exports.InputPill = InputPill.InputPill;
|
|
16
|
+
exports.LabelPill = LabelPill.LabelPill;
|
|
17
|
+
exports.ReadOnlyPill = ReadOnlyPill.ReadOnlyPill;
|
|
18
|
+
exports.RemovablePill = RemovablePill.RemovablePill;
|
|
19
|
+
exports.ValuePill = ValuePill.ValuePill;
|
|
@@ -5,10 +5,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
6
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
|
-
|
|
8
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
|
+
var React = require('react');
|
|
9
15
|
var reactDesc = require('react-desc');
|
|
10
16
|
var DSDropdownMenu = require('@elliemae/ds-dropdownmenu');
|
|
11
|
-
var
|
|
17
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
12
18
|
var useFocusGroupItem = require('@elliemae/ds-shared/FocusGroup/useFocusGroupItem');
|
|
13
19
|
var Pill = require('./Pill.js');
|
|
14
20
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -19,7 +25,6 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
19
25
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
26
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
21
27
|
var DSDropdownMenu__default = /*#__PURE__*/_interopDefaultLegacy(DSDropdownMenu);
|
|
22
|
-
var ChevronDown__default = /*#__PURE__*/_interopDefaultLegacy(ChevronDown);
|
|
23
28
|
var useFocusGroupItem__default = /*#__PURE__*/_interopDefaultLegacy(useFocusGroupItem);
|
|
24
29
|
|
|
25
30
|
var _ChevronDown;
|
|
@@ -28,7 +33,7 @@ const _excluded = ["containerProps", "label", "variant", "tabIndex", "closeMenuO
|
|
|
28
33
|
|
|
29
34
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
30
35
|
|
|
31
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
32
37
|
|
|
33
38
|
function DropdownPill(_ref) {
|
|
34
39
|
let {
|
|
@@ -40,14 +45,14 @@ function DropdownPill(_ref) {
|
|
|
40
45
|
maxWidth,
|
|
41
46
|
minWidth
|
|
42
47
|
} = _ref,
|
|
43
|
-
dropdownProps = _objectWithoutProperties__default[
|
|
48
|
+
dropdownProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
44
49
|
|
|
45
|
-
const ref =
|
|
46
|
-
const [chevronEl, chevronRef] =
|
|
50
|
+
const ref = React.useRef(null);
|
|
51
|
+
const [chevronEl, chevronRef] = React.useState();
|
|
47
52
|
const {
|
|
48
53
|
focusFirst
|
|
49
|
-
} = useFocusGroupItem__default[
|
|
50
|
-
return /*#__PURE__*/jsxRuntime.jsx(DSDropdownMenu__default[
|
|
54
|
+
} = useFocusGroupItem__default["default"](ref);
|
|
55
|
+
return /*#__PURE__*/jsxRuntime.jsx(DSDropdownMenu__default["default"], _objectSpread(_objectSpread({}, dropdownProps), {}, {
|
|
51
56
|
closeMenuOnItemSelection: closeMenuOnItemSelection,
|
|
52
57
|
maxWidth: maxWidth,
|
|
53
58
|
hideIfNotVisible: true,
|
|
@@ -58,7 +63,7 @@ function DropdownPill(_ref) {
|
|
|
58
63
|
minWidth: minWidth,
|
|
59
64
|
onClose: focusFirst,
|
|
60
65
|
referenceNode: chevronEl,
|
|
61
|
-
triggerComponent: /*#__PURE__*/_jsx__default[
|
|
66
|
+
triggerComponent: /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
62
67
|
"data-testid": "dropdown-pill",
|
|
63
68
|
className: "dropdown-pill",
|
|
64
69
|
containerProps: _objectSpread({
|
|
@@ -68,7 +73,7 @@ function DropdownPill(_ref) {
|
|
|
68
73
|
label: label,
|
|
69
74
|
rightAddon: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
70
75
|
ref: chevronRef,
|
|
71
|
-
children: _ChevronDown || (_ChevronDown = /*#__PURE__*/_jsx__default[
|
|
76
|
+
children: _ChevronDown || (_ChevronDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronDown, {
|
|
72
77
|
className: "dropdown-pill-chevron-down",
|
|
73
78
|
"data-testid": "dropdown-pill-button"
|
|
74
79
|
}))
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
11
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
12
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
8
13
|
require('react');
|
|
9
|
-
var
|
|
14
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
10
15
|
var dsClassnames = require('@elliemae/ds-classnames');
|
|
11
|
-
var
|
|
12
|
-
var DSInput = require('@elliemae/ds-form/Input');
|
|
16
|
+
var dsForm = require('@elliemae/ds-form');
|
|
13
17
|
var Pill = require('./Pill.js');
|
|
14
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
19
|
|
|
@@ -18,21 +22,21 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
18
22
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
23
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
20
24
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
21
|
-
var CloseXsmall__default = /*#__PURE__*/_interopDefaultLegacy(CloseXsmall);
|
|
22
|
-
var DSInputMask__default = /*#__PURE__*/_interopDefaultLegacy(DSInputMask);
|
|
23
|
-
var DSInput__default = /*#__PURE__*/_interopDefaultLegacy(DSInput);
|
|
24
25
|
|
|
25
26
|
const _excluded = ["containerProps", "placeholder", "onChange", "onRemove", "value", "type"];
|
|
26
27
|
|
|
27
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
28
29
|
|
|
29
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
30
|
-
const StyledInputPill = dsClassnames.aggregatedClasses(Pill.Pill)('input-pill', null,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
31
|
+
const StyledInputPill = dsClassnames.aggregatedClasses(Pill.Pill)('input-pill', null, _ref => {
|
|
32
|
+
let {
|
|
33
|
+
value
|
|
34
|
+
} = _ref;
|
|
35
|
+
return {
|
|
36
|
+
value
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
function InputPill(_ref2) {
|
|
36
40
|
let {
|
|
37
41
|
containerProps = {},
|
|
38
42
|
placeholder = 'Enter Value',
|
|
@@ -40,23 +44,23 @@ function InputPill(_ref) {
|
|
|
40
44
|
onRemove,
|
|
41
45
|
value,
|
|
42
46
|
type
|
|
43
|
-
} =
|
|
44
|
-
otherProps = _objectWithoutProperties__default[
|
|
47
|
+
} = _ref2,
|
|
48
|
+
otherProps = _objectWithoutProperties__default["default"](_ref2, _excluded);
|
|
45
49
|
|
|
46
|
-
let TypeOfInput =
|
|
50
|
+
let TypeOfInput = dsForm.DSInput; // TODO: implement the DSTimeInput, see how because it returns a moment()
|
|
47
51
|
// TODO: implement the DSDateInput
|
|
48
52
|
|
|
49
53
|
switch (type) {
|
|
50
54
|
case 'inputText':
|
|
51
|
-
TypeOfInput =
|
|
55
|
+
TypeOfInput = dsForm.DSInput;
|
|
52
56
|
break;
|
|
53
57
|
|
|
54
58
|
case 'inputMask':
|
|
55
|
-
TypeOfInput =
|
|
59
|
+
TypeOfInput = dsForm.DSInputMask;
|
|
56
60
|
break;
|
|
57
61
|
}
|
|
58
62
|
|
|
59
|
-
return /*#__PURE__*/_jsx__default[
|
|
63
|
+
return /*#__PURE__*/_jsx__default["default"](StyledInputPill, {
|
|
60
64
|
className: "input-pill",
|
|
61
65
|
classProps: {
|
|
62
66
|
value
|
|
@@ -68,7 +72,7 @@ function InputPill(_ref) {
|
|
|
68
72
|
placeholder: placeholder,
|
|
69
73
|
value: value
|
|
70
74
|
}, otherProps)),
|
|
71
|
-
rightAddon: value && /*#__PURE__*/_jsx__default[
|
|
75
|
+
rightAddon: value && /*#__PURE__*/_jsx__default["default"](dsIcons.CloseXsmall, {
|
|
72
76
|
className: "remove-pill-button",
|
|
73
77
|
"data-testid": "remove-pill-button",
|
|
74
78
|
onClick: onRemove
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
5
10
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
11
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
7
12
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -23,7 +28,7 @@ const _excluded = ["label", "value", "type", "onFocusNextGroup", "onFocusPreviou
|
|
|
23
28
|
|
|
24
29
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
25
30
|
|
|
26
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
27
32
|
const DropdownPills = {
|
|
28
33
|
single: LabeledDropdownSinglePill,
|
|
29
34
|
multi: LabeledDropdownMultiPill,
|
|
@@ -44,10 +49,10 @@ function LabeledDropdownPills(_ref) {
|
|
|
44
49
|
minWidth,
|
|
45
50
|
fixed
|
|
46
51
|
} = _ref,
|
|
47
|
-
menuProps = _objectWithoutProperties__default[
|
|
52
|
+
menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
48
53
|
|
|
49
54
|
const Component = createDropdownPill(type);
|
|
50
|
-
return /*#__PURE__*/_jsx__default[
|
|
55
|
+
return /*#__PURE__*/_jsx__default["default"](PillGroup.PillGroup, {
|
|
51
56
|
onFocusGroupSet: onFocusGroupSet,
|
|
52
57
|
onFocusNextGroup: onFocusNextGroup,
|
|
53
58
|
onFocusPreviousGroup: onFocusPreviousGroup
|
|
@@ -3,8 +3,16 @@
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
8
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
8
16
|
var PillGroup = require('../PillGroup.js');
|
|
9
17
|
var RemovablePill = require('../RemovablePill.js');
|
|
10
18
|
var DropdownPill = require('../DropdownPill.js');
|
|
@@ -20,7 +28,7 @@ const _excluded = ["label", "options", "value", "onChange", "onRemove", "value",
|
|
|
20
28
|
|
|
21
29
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
22
30
|
|
|
23
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
24
32
|
|
|
25
33
|
function renderMenuItems(options, factory) {
|
|
26
34
|
return options.map((option, index) => {
|
|
@@ -29,7 +37,7 @@ function renderMenuItems(options, factory) {
|
|
|
29
37
|
if (option.type === 'submenu') {
|
|
30
38
|
const SubmenuComponent = factory('submenu');
|
|
31
39
|
const ChildComponent = factory('selection-group');
|
|
32
|
-
return /*#__PURE__*/
|
|
40
|
+
return /*#__PURE__*/React.createElement(SubmenuComponent, _objectSpread(_objectSpread({}, option), {}, {
|
|
33
41
|
key: option.id,
|
|
34
42
|
item: option
|
|
35
43
|
}), /*#__PURE__*/jsxRuntime.jsx(ChildComponent, _objectSpread(_objectSpread({}, option), {}, {
|
|
@@ -41,7 +49,7 @@ function renderMenuItems(options, factory) {
|
|
|
41
49
|
})));
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
return /*#__PURE__*/
|
|
52
|
+
return /*#__PURE__*/React.createElement(ItemComponent, _objectSpread(_objectSpread({}, option), {}, {
|
|
45
53
|
key: option.id || index,
|
|
46
54
|
item: option
|
|
47
55
|
}));
|
|
@@ -68,19 +76,21 @@ function LabeledDropdownCascadeMenuPill(_ref) {
|
|
|
68
76
|
maxWidth,
|
|
69
77
|
minWidth
|
|
70
78
|
} = _ref,
|
|
71
|
-
menuProps = _objectWithoutProperties__default[
|
|
79
|
+
menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
72
80
|
|
|
73
81
|
const selectionId = Object.keys(selection)[0];
|
|
74
82
|
const selectionValues = selection[selectionId] || '';
|
|
75
83
|
const dropdownLabel = Array.isArray(selectionValues) ? getSubmenuOptionLabelById(options, selectionId) : selectionValues;
|
|
76
84
|
|
|
77
|
-
const handleSelectChange =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
const handleSelectChange = _ref2 => {
|
|
86
|
+
let {
|
|
87
|
+
item,
|
|
88
|
+
group
|
|
89
|
+
} = _ref2;
|
|
90
|
+
|
|
91
|
+
if (dsUtilities.isFunction(onChange)) {
|
|
82
92
|
const nextSelection = group ? {
|
|
83
|
-
[group.id]:
|
|
93
|
+
[group.id]: dsUtilities.addOrRemove([...(selection[group.id] || [])], item, o => o.id)
|
|
84
94
|
} : {
|
|
85
95
|
[item.id]: item.label
|
|
86
96
|
};
|
|
@@ -89,7 +99,7 @@ function LabeledDropdownCascadeMenuPill(_ref) {
|
|
|
89
99
|
};
|
|
90
100
|
|
|
91
101
|
const removeOption = option => {
|
|
92
|
-
if (
|
|
102
|
+
if (dsUtilities.isFunction(onChange)) {
|
|
93
103
|
const nextSelection = {
|
|
94
104
|
[selectionId]: selectionValues.filter(val => option.id !== val.id)
|
|
95
105
|
};
|
|
@@ -99,7 +109,7 @@ function LabeledDropdownCascadeMenuPill(_ref) {
|
|
|
99
109
|
onRemove(option);
|
|
100
110
|
};
|
|
101
111
|
|
|
102
|
-
return /*#__PURE__*/_jsx__default[
|
|
112
|
+
return /*#__PURE__*/_jsx__default["default"](PillGroup.PillGroup, {
|
|
103
113
|
onFocusGroupSet: onFocusGroupSet,
|
|
104
114
|
onFocusNextGroup: onFocusNextGroup,
|
|
105
115
|
onFocusPreviousGroup: onFocusPreviousGroup
|
|
@@ -115,7 +125,7 @@ function LabeledDropdownCascadeMenuPill(_ref) {
|
|
|
115
125
|
},
|
|
116
126
|
singleGroupSelection: true,
|
|
117
127
|
variant: "title"
|
|
118
|
-
})), Array.isArray(selectionValues) && selectionValues.map(option => /*#__PURE__*/_jsx__default[
|
|
128
|
+
})), Array.isArray(selectionValues) && selectionValues.map(option => /*#__PURE__*/_jsx__default["default"](RemovablePill.RemovablePill, {
|
|
119
129
|
label: option.label,
|
|
120
130
|
onRemove: () => removeOption(option)
|
|
121
131
|
}, option.id)));
|
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
-
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
|
+
var React = require('react');
|
|
7
15
|
var lodash = require('lodash');
|
|
8
|
-
var
|
|
16
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
9
17
|
var RemovablePill = require('../RemovablePill.js');
|
|
10
18
|
var Pill = require('../Pill.js');
|
|
11
19
|
var OverflowPill = require('../OverflowPill.js');
|
|
@@ -22,7 +30,7 @@ const _excluded = ["label", "options", "value", "onSelect", "onRemove", "onChang
|
|
|
22
30
|
|
|
23
31
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
24
32
|
|
|
25
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
33
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
26
34
|
function LabeledDropdownMultiPills(_ref) {
|
|
27
35
|
let {
|
|
28
36
|
label,
|
|
@@ -35,15 +43,15 @@ function LabeledDropdownMultiPills(_ref) {
|
|
|
35
43
|
maxWidth,
|
|
36
44
|
minWidth
|
|
37
45
|
} = _ref,
|
|
38
|
-
menuProps = _objectWithoutProperties__default[
|
|
46
|
+
menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
39
47
|
|
|
40
|
-
const [totalDefaultOptions, setTotalDefaultOptions] =
|
|
41
|
-
const [selectedOptions, setSelectedOptions] =
|
|
42
|
-
const [allOptions, setAllOptions] =
|
|
43
|
-
const [overflowOptions, setOverflowOptions] =
|
|
48
|
+
const [totalDefaultOptions, setTotalDefaultOptions] = React.useState(0);
|
|
49
|
+
const [selectedOptions, setSelectedOptions] = React.useState(value);
|
|
50
|
+
const [allOptions, setAllOptions] = React.useState(options);
|
|
51
|
+
const [overflowOptions, setOverflowOptions] = React.useState([]);
|
|
44
52
|
const overflowQuantity = 3;
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
React.useEffect(() => setSelectedOptions(value), [value]);
|
|
54
|
+
React.useEffect(() => {
|
|
47
55
|
const newOptions = allOptions.filter(option => option.fixedItem);
|
|
48
56
|
|
|
49
57
|
if (newOptions.length > 0) {
|
|
@@ -52,7 +60,7 @@ function LabeledDropdownMultiPills(_ref) {
|
|
|
52
60
|
|
|
53
61
|
setTotalDefaultOptions(newOptions.length);
|
|
54
62
|
}, []);
|
|
55
|
-
|
|
63
|
+
React.useEffect(() => {
|
|
56
64
|
if (totalDefaultOptions) {
|
|
57
65
|
const newOptions = allOptions.map(opt => {
|
|
58
66
|
if (selectedOptions.length <= totalDefaultOptions && lodash.find(selectedOptions, {
|
|
@@ -70,16 +78,16 @@ function LabeledDropdownMultiPills(_ref) {
|
|
|
70
78
|
setAllOptions(newOptions);
|
|
71
79
|
}
|
|
72
80
|
}, [onSelect, onRemove, selectedOptions]);
|
|
73
|
-
|
|
81
|
+
React.useEffect(() => {
|
|
74
82
|
if (selectedOptions.length > overflowQuantity) {
|
|
75
83
|
const overflow = selectedOptions.filter((val, index) => index >= overflowQuantity);
|
|
76
84
|
setOverflowOptions(overflow);
|
|
77
85
|
}
|
|
78
86
|
}, [selectedOptions]);
|
|
79
|
-
const selectOption =
|
|
87
|
+
const selectOption = React.useCallback(option => {
|
|
80
88
|
if (!option.fixedItem) {
|
|
81
|
-
if (
|
|
82
|
-
const nextValue =
|
|
89
|
+
if (dsUtilities.isFunction(onChange)) {
|
|
90
|
+
const nextValue = dsUtilities.addOrRemove(selectedOptions, option, item => item.id);
|
|
83
91
|
setSelectedOptions(nextValue);
|
|
84
92
|
onChange(nextValue);
|
|
85
93
|
}
|
|
@@ -87,9 +95,9 @@ function LabeledDropdownMultiPills(_ref) {
|
|
|
87
95
|
onSelect(option);
|
|
88
96
|
}
|
|
89
97
|
}, [selectedOptions]);
|
|
90
|
-
const removeOption =
|
|
98
|
+
const removeOption = React.useCallback(option => {
|
|
91
99
|
if (!option.fixedItem || selectedOptions.length > totalDefaultOptions) {
|
|
92
|
-
if (
|
|
100
|
+
if (dsUtilities.isFunction(onChange)) {
|
|
93
101
|
const nextValue = selectedOptions.filter(val => option.id !== val.id);
|
|
94
102
|
setSelectedOptions(nextValue);
|
|
95
103
|
onChange(nextValue);
|
|
@@ -128,15 +136,15 @@ function LabeledDropdownMultiPills(_ref) {
|
|
|
128
136
|
const TypeOfPill = typeOfPill();
|
|
129
137
|
|
|
130
138
|
if (index < overflowQuantity) {
|
|
131
|
-
return /*#__PURE__*/_jsx__default[
|
|
139
|
+
return /*#__PURE__*/_jsx__default["default"](TypeOfPill, {
|
|
132
140
|
label: option.label,
|
|
133
141
|
onRemove: () => removeOption(option)
|
|
134
142
|
}, option.id);
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
return null;
|
|
138
|
-
}), selectedOptions && selectedOptions.length > overflowQuantity && /*#__PURE__*/_jsx__default[
|
|
139
|
-
label:
|
|
146
|
+
}), selectedOptions && selectedOptions.length > overflowQuantity && /*#__PURE__*/_jsx__default["default"](OverflowPill.OverflowPill, {
|
|
147
|
+
label: "+ ".concat(selectedOptions.length - overflowQuantity),
|
|
140
148
|
options: overflowOptions
|
|
141
149
|
})]
|
|
142
150
|
});
|
|
@@ -3,10 +3,16 @@
|
|
|
3
3
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
4
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
5
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.find.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.find.js');
|
|
10
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
11
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
13
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
10
16
|
var DropdownPill = require('../DropdownPill.js');
|
|
11
17
|
var InputPill = require('../InputPill.js');
|
|
12
18
|
var Pill = require('../Pill.js');
|
|
@@ -19,8 +25,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
19
25
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
20
26
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
21
27
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
22
|
-
var usePrevious__default = /*#__PURE__*/_interopDefaultLegacy(usePrevious);
|
|
23
|
-
var useShouldRecalculate__default = /*#__PURE__*/_interopDefaultLegacy(useShouldRecalculate);
|
|
24
28
|
|
|
25
29
|
var _Pill;
|
|
26
30
|
|
|
@@ -29,7 +33,7 @@ const _excluded = ["label", "labelIsValue", "options", "value", "onSelect", "onC
|
|
|
29
33
|
|
|
30
34
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
31
35
|
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default[
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
33
37
|
function LabeledDropdownSinglePill(_ref) {
|
|
34
38
|
let {
|
|
35
39
|
label,
|
|
@@ -42,13 +46,13 @@ function LabeledDropdownSinglePill(_ref) {
|
|
|
42
46
|
minWidth,
|
|
43
47
|
fixed = false
|
|
44
48
|
} = _ref,
|
|
45
|
-
menuProps = _objectWithoutProperties__default[
|
|
49
|
+
menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
46
50
|
|
|
47
|
-
const [optionValue, setOptionValue] =
|
|
48
|
-
const prevOptions =
|
|
49
|
-
const areOptionsEqual =
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
const [optionValue, setOptionValue] = React.useState(value);
|
|
52
|
+
const prevOptions = dsUtilities.usePrevious(options);
|
|
53
|
+
const areOptionsEqual = dsUtilities.useShouldRecalculate(utils.hasOptionChanged(prevOptions, options));
|
|
54
|
+
React.useEffect(() => setOptionValue(value), [value]);
|
|
55
|
+
React.useEffect(() => {
|
|
52
56
|
const selectedValue = options.find(option => option.selected);
|
|
53
57
|
|
|
54
58
|
if (selectedValue) {
|
|
@@ -57,25 +61,26 @@ function LabeledDropdownSinglePill(_ref) {
|
|
|
57
61
|
setOptionValue(options[0]);
|
|
58
62
|
}
|
|
59
63
|
}, [areOptionsEqual]);
|
|
60
|
-
|
|
64
|
+
React.useLayoutEffect(() => {
|
|
61
65
|
if (optionValue) {
|
|
62
66
|
const selectedValue = options.find(option => option.id === optionValue.id);
|
|
63
67
|
setOptionValue(selectedValue);
|
|
64
68
|
}
|
|
65
69
|
}, [options]);
|
|
66
|
-
const selectOption =
|
|
67
|
-
if (
|
|
70
|
+
const selectOption = React.useCallback(option => {
|
|
71
|
+
if (dsUtilities.isFunction(onChange)) {
|
|
68
72
|
onChange(option);
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
setOptionValue(option);
|
|
72
76
|
onSelect(option);
|
|
73
77
|
}, [onChange, onSelect]);
|
|
74
|
-
const onChangeInputValue =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
const onChangeInputValue = React.useCallback(_ref2 => {
|
|
79
|
+
let {
|
|
80
|
+
target: {
|
|
81
|
+
value: inputValue
|
|
82
|
+
}
|
|
83
|
+
} = _ref2;
|
|
79
84
|
const {
|
|
80
85
|
onChangeInput
|
|
81
86
|
} = optionValue;
|
|
@@ -104,11 +109,11 @@ function LabeledDropdownSinglePill(_ref) {
|
|
|
104
109
|
input,
|
|
105
110
|
onChangeInput
|
|
106
111
|
} = option,
|
|
107
|
-
otherProps = _objectWithoutProperties__default[
|
|
112
|
+
otherProps = _objectWithoutProperties__default["default"](option, _excluded2);
|
|
108
113
|
|
|
109
114
|
let SelectedPill;
|
|
110
115
|
|
|
111
|
-
if (
|
|
116
|
+
if (dsUtilities.isString(input)) {
|
|
112
117
|
SelectedPill = InputPill.InputPill;
|
|
113
118
|
} else if (fixed) {
|
|
114
119
|
SelectedPill = Pill.Pill;
|
|
@@ -127,7 +132,7 @@ function LabeledDropdownSinglePill(_ref) {
|
|
|
127
132
|
const renderSelection = () => {
|
|
128
133
|
if (!labelIsValue) {
|
|
129
134
|
if (optionValue) return renderPill(optionValue, fixed);
|
|
130
|
-
return _Pill || (_Pill = /*#__PURE__*/_jsx__default[
|
|
135
|
+
return _Pill || (_Pill = /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
131
136
|
label: "-"
|
|
132
137
|
}));
|
|
133
138
|
}
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
7
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
6
8
|
var lodash = require('lodash');
|
|
7
9
|
|
|
8
10
|
const hasOptionChanged = (prevOptions, options) => {
|
|
9
11
|
if (prevOptions && options) {
|
|
10
12
|
const prevOptionsOmited = prevOptions.map(option => lodash.omit(option, ['input', 'onChangeInput', 'mask']));
|
|
11
13
|
const optionsOmited = options.map(option => lodash.omit(option, ['input', 'onChangeInput', 'mask']));
|
|
12
|
-
return
|
|
14
|
+
return dsUtilities.isEqual(prevOptionsOmited, optionsOmited);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
return false;
|