@elliemae/ds-pills 2.2.0-alpha.3 → 2.2.0-next.2
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 +49 -56
- package/cjs/components/PillButton.js +52 -54
- package/cjs/components/PillGroup.js +53 -61
- package/cjs/components/index.js +17 -30
- package/cjs/components/styled.js +78 -228
- package/cjs/components/types/DropdownPill.js +77 -79
- package/cjs/components/types/InputPill.js +48 -58
- package/cjs/components/types/LabelPill.js +38 -44
- package/cjs/components/types/ReadOnlyPill.js +43 -48
- package/cjs/components/types/RemovablePill.js +53 -60
- package/cjs/components/types/ValuePill.js +43 -48
- package/cjs/components/types/index.js +19 -33
- package/cjs/deprecated/DropdownPill.js +101 -80
- package/cjs/deprecated/InputPill.js +69 -67
- package/cjs/deprecated/LabeledDropdownPills.js +96 -92
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +94 -91
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +114 -106
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +127 -119
- package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +15 -39
- package/cjs/deprecated/LabeledPills.js +52 -65
- package/cjs/deprecated/OverflowPill.js +53 -59
- package/cjs/deprecated/Pill.js +82 -67
- package/cjs/deprecated/PillGroup.js +68 -68
- package/cjs/deprecated/ReadOnlyPill.js +94 -93
- package/cjs/deprecated/RemovablePill.js +57 -61
- package/cjs/deprecated/index.js +33 -43
- package/cjs/index.d.js +2 -27
- package/cjs/index.js +43 -37
- package/cjs/props.js +46 -72
- package/cjs/utils.js +25 -43
- package/esm/components/Pill.js +31 -18
- package/esm/components/PillButton.js +39 -22
- package/esm/components/PillGroup.js +38 -28
- package/esm/components/index.js +3 -5
- package/esm/components/styled.js +66 -205
- package/esm/components/types/DropdownPill.js +67 -50
- package/esm/components/types/InputPill.js +35 -25
- package/esm/components/types/LabelPill.js +29 -15
- package/esm/components/types/ReadOnlyPill.js +34 -19
- package/esm/components/types/RemovablePill.js +44 -31
- package/esm/components/types/ValuePill.js +34 -19
- package/esm/components/types/index.js +6 -8
- package/esm/deprecated/DropdownPill.js +86 -49
- package/esm/deprecated/InputPill.js +59 -38
- package/esm/deprecated/LabeledDropdownPills.js +81 -59
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +84 -60
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +94 -65
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +108 -79
- package/esm/deprecated/LabeledDropdownPillsTypes/utils.js +10 -9
- package/esm/deprecated/LabeledPills.js +41 -34
- package/esm/deprecated/OverflowPill.js +37 -25
- package/esm/deprecated/Pill.js +71 -39
- package/esm/deprecated/PillGroup.js +56 -39
- package/esm/deprecated/ReadOnlyPill.js +79 -60
- package/esm/deprecated/RemovablePill.js +45 -30
- package/esm/deprecated/index.js +8 -14
- package/esm/index.d.js +1 -2
- package/esm/index.js +11 -8
- package/esm/props.js +36 -42
- package/esm/utils.js +23 -16
- package/package.json +15 -15
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +1 -3
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +1 -3
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +0 -1
- package/cjs/components/Pill.js.map +0 -7
- package/cjs/components/PillButton.js.map +0 -7
- package/cjs/components/PillGroup.js.map +0 -7
- package/cjs/components/index.js.map +0 -7
- package/cjs/components/styled.js.map +0 -7
- package/cjs/components/types/DropdownPill.js.map +0 -7
- package/cjs/components/types/InputPill.js.map +0 -7
- package/cjs/components/types/LabelPill.js.map +0 -7
- package/cjs/components/types/ReadOnlyPill.js.map +0 -7
- package/cjs/components/types/RemovablePill.js.map +0 -7
- package/cjs/components/types/ValuePill.js.map +0 -7
- package/cjs/components/types/index.js.map +0 -7
- package/cjs/deprecated/DropdownPill.js.map +0 -7
- package/cjs/deprecated/InputPill.js.map +0 -7
- package/cjs/deprecated/LabeledDropdownPills.js.map +0 -7
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +0 -7
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +0 -7
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +0 -7
- package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js.map +0 -7
- package/cjs/deprecated/LabeledPills.js.map +0 -7
- package/cjs/deprecated/OverflowPill.js.map +0 -7
- package/cjs/deprecated/Pill.js.map +0 -7
- package/cjs/deprecated/PillGroup.js.map +0 -7
- package/cjs/deprecated/ReadOnlyPill.js.map +0 -7
- package/cjs/deprecated/RemovablePill.js.map +0 -7
- package/cjs/deprecated/index.js.map +0 -7
- package/cjs/index.d.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/props.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/esm/components/Pill.js.map +0 -7
- package/esm/components/PillButton.js.map +0 -7
- package/esm/components/PillGroup.js.map +0 -7
- package/esm/components/index.js.map +0 -7
- package/esm/components/styled.js.map +0 -7
- package/esm/components/types/DropdownPill.js.map +0 -7
- package/esm/components/types/InputPill.js.map +0 -7
- package/esm/components/types/LabelPill.js.map +0 -7
- package/esm/components/types/ReadOnlyPill.js.map +0 -7
- package/esm/components/types/RemovablePill.js.map +0 -7
- package/esm/components/types/ValuePill.js.map +0 -7
- package/esm/components/types/index.js.map +0 -7
- package/esm/deprecated/DropdownPill.js.map +0 -7
- package/esm/deprecated/InputPill.js.map +0 -7
- package/esm/deprecated/LabeledDropdownPills.js.map +0 -7
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +0 -7
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +0 -7
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +0 -7
- package/esm/deprecated/LabeledDropdownPillsTypes/utils.js.map +0 -7
- package/esm/deprecated/LabeledPills.js.map +0 -7
- package/esm/deprecated/OverflowPill.js.map +0 -7
- package/esm/deprecated/Pill.js.map +0 -7
- package/esm/deprecated/PillGroup.js.map +0 -7
- package/esm/deprecated/ReadOnlyPill.js.map +0 -7
- package/esm/deprecated/RemovablePill.js.map +0 -7
- package/esm/deprecated/index.js.map +0 -7
- package/esm/index.d.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/props.js.map +0 -7
- package/esm/utils.js.map +0 -7
|
@@ -1,154 +1,162 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(0, import_react.useEffect)(() => {
|
|
59
|
-
const selectedValue = options.find((option) => option.selected);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
5
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
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');
|
|
16
|
+
var DropdownPill = require('../DropdownPill.js');
|
|
17
|
+
var InputPill = require('../InputPill.js');
|
|
18
|
+
var Pill = require('../Pill.js');
|
|
19
|
+
var RemovablePill = require('../RemovablePill.js');
|
|
20
|
+
var utils = require('./utils.js');
|
|
21
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
22
|
+
|
|
23
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
|
+
|
|
25
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
26
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
27
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
28
|
+
|
|
29
|
+
var _Pill;
|
|
30
|
+
|
|
31
|
+
const _excluded = ["label", "labelIsValue", "options", "value", "onSelect", "onChange", "maxWidth", "minWidth", "fixed"],
|
|
32
|
+
_excluded2 = ["input", "onChangeInput"];
|
|
33
|
+
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
+
function LabeledDropdownSinglePill(_ref) {
|
|
38
|
+
let {
|
|
39
|
+
label,
|
|
40
|
+
labelIsValue = false,
|
|
41
|
+
options,
|
|
42
|
+
value,
|
|
43
|
+
onSelect = () => null,
|
|
44
|
+
onChange,
|
|
45
|
+
maxWidth,
|
|
46
|
+
minWidth,
|
|
47
|
+
fixed = false
|
|
48
|
+
} = _ref,
|
|
49
|
+
menuProps = _objectWithoutProperties__default["default"](_ref, _excluded);
|
|
50
|
+
|
|
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(() => {
|
|
56
|
+
const selectedValue = options.find(option => option.selected);
|
|
57
|
+
|
|
60
58
|
if (selectedValue) {
|
|
61
59
|
setOptionValue(selectedValue);
|
|
62
60
|
} else if (!selectedValue) {
|
|
63
61
|
setOptionValue(options[0]);
|
|
64
62
|
}
|
|
65
63
|
}, [areOptionsEqual]);
|
|
66
|
-
|
|
64
|
+
React.useLayoutEffect(() => {
|
|
67
65
|
if (optionValue) {
|
|
68
|
-
const selectedValue = options.find(
|
|
66
|
+
const selectedValue = options.find(option => option.id === optionValue.id);
|
|
69
67
|
setOptionValue(selectedValue);
|
|
70
68
|
}
|
|
71
69
|
}, [options]);
|
|
72
|
-
const selectOption =
|
|
73
|
-
if (
|
|
70
|
+
const selectOption = React.useCallback(option => {
|
|
71
|
+
if (dsUtilities.isFunction(onChange)) {
|
|
74
72
|
onChange(option);
|
|
75
73
|
}
|
|
74
|
+
|
|
76
75
|
setOptionValue(option);
|
|
77
76
|
onSelect(option);
|
|
78
77
|
}, [onChange, onSelect]);
|
|
79
|
-
const onChangeInputValue =
|
|
80
|
-
|
|
78
|
+
const onChangeInputValue = React.useCallback(_ref2 => {
|
|
79
|
+
let {
|
|
80
|
+
target: {
|
|
81
|
+
value: inputValue
|
|
82
|
+
}
|
|
83
|
+
} = _ref2;
|
|
84
|
+
const {
|
|
85
|
+
onChangeInput
|
|
86
|
+
} = optionValue;
|
|
81
87
|
onChangeInput && onChangeInput(inputValue);
|
|
82
88
|
}, [optionValue]);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const {
|
|
89
|
+
|
|
90
|
+
const removeOption = removedOption => {
|
|
91
|
+
const {
|
|
92
|
+
onRemove
|
|
93
|
+
} = menuProps;
|
|
94
|
+
const {
|
|
95
|
+
onChangeInput
|
|
96
|
+
} = optionValue;
|
|
86
97
|
setOptionValue(null);
|
|
87
|
-
onChangeInput && onChangeInput(
|
|
88
|
-
|
|
98
|
+
onChangeInput && onChangeInput('');
|
|
99
|
+
|
|
100
|
+
const newOption = _objectSpread(_objectSpread({}, removedOption), {}, {
|
|
101
|
+
input: ''
|
|
102
|
+
});
|
|
103
|
+
|
|
89
104
|
onRemove && onRemove(newOption, removedOption);
|
|
90
105
|
};
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
|
|
107
|
+
const renderPill = (option, fixed) => {
|
|
108
|
+
const {
|
|
109
|
+
input,
|
|
110
|
+
onChangeInput
|
|
111
|
+
} = option,
|
|
112
|
+
otherProps = _objectWithoutProperties__default["default"](option, _excluded2);
|
|
113
|
+
|
|
93
114
|
let SelectedPill;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
115
|
+
|
|
116
|
+
if (dsUtilities.isString(input)) {
|
|
117
|
+
SelectedPill = InputPill.InputPill;
|
|
118
|
+
} else if (fixed) {
|
|
119
|
+
SelectedPill = Pill.Pill;
|
|
98
120
|
} else {
|
|
99
|
-
SelectedPill =
|
|
121
|
+
SelectedPill = RemovablePill.RemovablePill;
|
|
100
122
|
}
|
|
101
|
-
|
|
102
|
-
|
|
123
|
+
|
|
124
|
+
return /*#__PURE__*/jsxRuntime.jsx(SelectedPill, _objectSpread({
|
|
103
125
|
label: option.label,
|
|
104
126
|
onChange: onChangeInputValue,
|
|
105
|
-
onRemove:
|
|
106
|
-
value: input
|
|
107
|
-
|
|
108
|
-
});
|
|
127
|
+
onRemove: e => removeOption(option),
|
|
128
|
+
value: input
|
|
129
|
+
}, otherProps), option.id);
|
|
109
130
|
};
|
|
131
|
+
|
|
110
132
|
const renderSelection = () => {
|
|
111
133
|
if (!labelIsValue) {
|
|
112
|
-
if (optionValue)
|
|
113
|
-
|
|
114
|
-
return /* @__PURE__ */ import_react.default.createElement(import_Pill.Pill, {
|
|
134
|
+
if (optionValue) return renderPill(optionValue, fixed);
|
|
135
|
+
return _Pill || (_Pill = /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
115
136
|
label: "-"
|
|
116
|
-
});
|
|
137
|
+
}));
|
|
117
138
|
}
|
|
118
139
|
};
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
id: "multi-selection-views",
|
|
140
|
+
|
|
141
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
142
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DropdownPill.DropdownPill, _objectSpread(_objectSpread({}, menuProps), {}, {
|
|
143
|
+
label: !labelIsValue ? label : optionValue === null || optionValue === void 0 ? void 0 : optionValue.label,
|
|
144
|
+
maxWidth: maxWidth,
|
|
145
|
+
minWidth: minWidth,
|
|
146
|
+
onSelectMenuItem: selectOption,
|
|
147
|
+
options: [_objectSpread(_objectSpread({}, menuProps), {}, {
|
|
148
|
+
type: 'SelectionGroup',
|
|
149
|
+
id: 'multi-selection-views',
|
|
130
150
|
multi: false,
|
|
131
151
|
items: options,
|
|
132
152
|
closeOnClick: true
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
153
|
+
})],
|
|
154
|
+
selection: {
|
|
155
|
+
'multi-selection-views': optionValue ? [optionValue === null || optionValue === void 0 ? void 0 : optionValue.id] : ''
|
|
156
|
+
},
|
|
157
|
+
variant: "title"
|
|
158
|
+
})), renderSelection()]
|
|
159
|
+
});
|
|
140
160
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
labelIsValue: import_prop_types.default.bool,
|
|
144
|
-
options: import_prop_types.default.array,
|
|
145
|
-
value: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.number]),
|
|
146
|
-
onSelect: import_prop_types.default.func,
|
|
147
|
-
onChange: import_prop_types.default.func,
|
|
148
|
-
maxWidth: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.number]),
|
|
149
|
-
minWidth: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.number]),
|
|
150
|
-
fixed: import_prop_types.default.bool
|
|
151
|
-
};
|
|
152
|
-
var LabeledDropdownSinglePill_default = LabeledDropdownSinglePill;
|
|
153
|
-
module.exports = __toCommonJS(LabeledDropdownSinglePill_exports);
|
|
154
|
-
//# sourceMappingURL=LabeledDropdownSinglePill.js.map
|
|
161
|
+
|
|
162
|
+
module.exports = LabeledDropdownSinglePill;
|
|
@@ -1,44 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
30
|
-
hasOptionChanged: () => hasOptionChanged
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
var import_ds_utilities = __toESM(require("@elliemae/ds-utilities"));
|
|
34
|
-
var import_lodash = __toESM(require("lodash"));
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
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');
|
|
8
|
+
var lodash = require('lodash');
|
|
9
|
+
|
|
35
10
|
const hasOptionChanged = (prevOptions, options) => {
|
|
36
11
|
if (prevOptions && options) {
|
|
37
|
-
const prevOptionsOmited = prevOptions.map(
|
|
38
|
-
const optionsOmited = options.map(
|
|
39
|
-
return
|
|
12
|
+
const prevOptionsOmited = prevOptions.map(option => lodash.omit(option, ['input', 'onChangeInput', 'mask']));
|
|
13
|
+
const optionsOmited = options.map(option => lodash.omit(option, ['input', 'onChangeInput', 'mask']));
|
|
14
|
+
return dsUtilities.isEqual(prevOptionsOmited, optionsOmited);
|
|
40
15
|
}
|
|
16
|
+
|
|
41
17
|
return false;
|
|
42
18
|
};
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
|
|
20
|
+
exports.hasOptionChanged = hasOptionChanged;
|
|
@@ -1,75 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var LabeledPills_exports = {};
|
|
29
|
-
__export(LabeledPills_exports, {
|
|
30
|
-
DSLabeledPillsWithSchema: () => DSLabeledPillsWithSchema,
|
|
31
|
-
LabeledPills: () => LabeledPills
|
|
32
|
-
});
|
|
33
|
-
var React = __toESM(require("react"));
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_react_desc = __toESM(require("react-desc"));
|
|
36
|
-
var import_PillGroup = __toESM(require("./PillGroup"));
|
|
37
|
-
var import_RemovablePill = __toESM(require("./RemovablePill"));
|
|
38
|
-
var import_Pill = __toESM(require("./Pill"));
|
|
39
|
-
function LabeledPills({
|
|
40
|
-
children,
|
|
41
|
-
label = "",
|
|
42
|
-
leftAddon,
|
|
43
|
-
onFocusGroupSet,
|
|
44
|
-
onFocusNextGroup,
|
|
45
|
-
onFocusPreviousGroup
|
|
46
|
-
}) {
|
|
47
|
-
return /* @__PURE__ */ import_react.default.createElement(import_PillGroup.PillGroup, {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('react');
|
|
7
|
+
var reactDesc = require('react-desc');
|
|
8
|
+
var PillGroup = require('./PillGroup.js');
|
|
9
|
+
var RemovablePill = require('./RemovablePill.js');
|
|
10
|
+
var Pill = require('./Pill.js');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
+
|
|
16
|
+
function LabeledPills(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
label = '',
|
|
20
|
+
leftAddon,
|
|
48
21
|
onFocusGroupSet,
|
|
49
22
|
onFocusNextGroup,
|
|
50
23
|
onFocusPreviousGroup
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
24
|
+
} = _ref;
|
|
25
|
+
return /*#__PURE__*/_jsx__default["default"](PillGroup.PillGroup, {
|
|
26
|
+
onFocusGroupSet: onFocusGroupSet,
|
|
27
|
+
onFocusNextGroup: onFocusNextGroup,
|
|
28
|
+
onFocusPreviousGroup: onFocusPreviousGroup
|
|
29
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
30
|
+
label: label,
|
|
31
|
+
leftAddon: leftAddon,
|
|
54
32
|
variant: "title",
|
|
55
33
|
"data-testid": "pill-title"
|
|
56
34
|
}), children);
|
|
57
35
|
}
|
|
36
|
+
|
|
58
37
|
const props = {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
])
|
|
65
|
-
})).isRequired.description(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
38
|
+
/** labeled pill text label */
|
|
39
|
+
label: reactDesc.PropTypes.string.isRequired.description('pill text label'),
|
|
40
|
+
|
|
41
|
+
/** pill to add the label to */
|
|
42
|
+
children: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.shape({
|
|
43
|
+
type: reactDesc.PropTypes.oneOf([reactDesc.PropTypes.instanceOf(Pill.Pill), reactDesc.PropTypes.instanceOf(RemovablePill.RemovablePill)])
|
|
44
|
+
})).isRequired.description('pill to add the label to'),
|
|
45
|
+
|
|
46
|
+
/** addon component to left */
|
|
47
|
+
leftAddon: reactDesc.PropTypes.node.description('addon component to left'),
|
|
48
|
+
|
|
49
|
+
/** focus next group callback */
|
|
50
|
+
onFocusNextGroup: reactDesc.PropTypes.func.description('focus next group callback'),
|
|
51
|
+
|
|
52
|
+
/** focus prev group callback */
|
|
53
|
+
onFocusPreviousGroup: reactDesc.PropTypes.func.description('focus prev group callback'),
|
|
54
|
+
|
|
55
|
+
/** focus group set callback */
|
|
56
|
+
onFocusGroupSet: reactDesc.PropTypes.func.description('focus group set callback')
|
|
70
57
|
};
|
|
71
|
-
|
|
72
|
-
const DSLabeledPillsWithSchema = (0, import_react_desc.describe)(LabeledPills);
|
|
58
|
+
const DSLabeledPillsWithSchema = reactDesc.describe(LabeledPills);
|
|
73
59
|
DSLabeledPillsWithSchema.propTypes = props;
|
|
74
|
-
|
|
75
|
-
|
|
60
|
+
|
|
61
|
+
exports.DSLabeledPillsWithSchema = DSLabeledPillsWithSchema;
|
|
62
|
+
exports.LabeledPills = LabeledPills;
|
|
@@ -1,79 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
|
-
var import_react_desc = __toESM(require("react-desc"));
|
|
36
|
-
var import_useFocusGroupItem = __toESM(require("@elliemae/ds-shared/FocusGroup/useFocusGroupItem"));
|
|
37
|
-
var import_ds_tooltip = __toESM(require("@elliemae/ds-tooltip"));
|
|
38
|
-
var import_Pill = __toESM(require("./Pill"));
|
|
39
|
-
function OverflowPill({ containerProps = {}, label = "", options = [] }) {
|
|
40
|
-
const ref = (0, import_react.useRef)(null);
|
|
41
|
-
const [tooltipIsOpen, setTooltipIsOpen] = (0, import_react.useState)(false);
|
|
42
|
-
const [tooltipText, setTooltipText] = (0, import_react.useState)("");
|
|
43
|
-
(0, import_react.useEffect)(() => {
|
|
44
|
-
let text = "";
|
|
45
|
-
options.forEach((option) => {
|
|
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/web.dom-collections.iterator.js');
|
|
7
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
9
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
10
|
+
var React = require('react');
|
|
11
|
+
var reactDesc = require('react-desc');
|
|
12
|
+
var useFocusGroupItem = require('@elliemae/ds-shared/FocusGroup/useFocusGroupItem');
|
|
13
|
+
var DSTooltip = require('@elliemae/ds-tooltip');
|
|
14
|
+
var Pill = require('./Pill.js');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
|
+
var useFocusGroupItem__default = /*#__PURE__*/_interopDefaultLegacy(useFocusGroupItem);
|
|
20
|
+
var DSTooltip__default = /*#__PURE__*/_interopDefaultLegacy(DSTooltip);
|
|
21
|
+
|
|
22
|
+
function OverflowPill(_ref) {
|
|
23
|
+
let {
|
|
24
|
+
containerProps = {},
|
|
25
|
+
label = '',
|
|
26
|
+
options = []
|
|
27
|
+
} = _ref;
|
|
28
|
+
const ref = React.useRef(null);
|
|
29
|
+
const [tooltipIsOpen, setTooltipIsOpen] = React.useState(false);
|
|
30
|
+
const [tooltipText, setTooltipText] = React.useState('');
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
let text = '';
|
|
33
|
+
options.forEach(option => {
|
|
46
34
|
if (!tooltipText || option === options[0]) {
|
|
47
|
-
text =
|
|
35
|
+
text = "".concat(option.label);
|
|
48
36
|
} else {
|
|
49
|
-
text = text.concat(
|
|
37
|
+
text = text.concat(", ".concat(option.label));
|
|
50
38
|
}
|
|
51
39
|
});
|
|
52
40
|
setTooltipText(text);
|
|
53
41
|
}, [options]);
|
|
54
|
-
(
|
|
55
|
-
return
|
|
42
|
+
useFocusGroupItem__default["default"](ref);
|
|
43
|
+
return /*#__PURE__*/_jsx__default["default"](DSTooltip__default["default"], {
|
|
56
44
|
isOpen: tooltipIsOpen,
|
|
57
45
|
title: tooltipText,
|
|
58
46
|
zIndex: 11,
|
|
59
|
-
triggerComponent:
|
|
47
|
+
triggerComponent: /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
60
48
|
className: "overflow-pill",
|
|
61
|
-
containerProps,
|
|
49
|
+
containerProps: containerProps,
|
|
62
50
|
innerRef: ref,
|
|
63
|
-
label,
|
|
51
|
+
label: label,
|
|
64
52
|
tabIndex: -1,
|
|
65
53
|
onMouseEnter: () => setTooltipIsOpen(true),
|
|
66
54
|
onMouseLeave: () => setTooltipIsOpen(false)
|
|
67
55
|
})
|
|
68
56
|
});
|
|
69
57
|
}
|
|
58
|
+
|
|
70
59
|
const props = {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
/** props to inject to pill wrapper */
|
|
61
|
+
containerProps: reactDesc.PropTypes.object.description('props to inject to pill wrapper'),
|
|
62
|
+
|
|
63
|
+
/** pill text label */
|
|
64
|
+
label: reactDesc.PropTypes.string.isRequired.description('pill text label'),
|
|
65
|
+
|
|
66
|
+
/** overflow pills options */
|
|
67
|
+
options: reactDesc.PropTypes.array.description('overflow pills options')
|
|
74
68
|
};
|
|
75
|
-
|
|
76
|
-
const DSOverflowPillWithSchema = (0, import_react_desc.describe)(OverflowPill);
|
|
69
|
+
const DSOverflowPillWithSchema = reactDesc.describe(OverflowPill);
|
|
77
70
|
DSOverflowPillWithSchema.propTypes = props;
|
|
78
|
-
|
|
79
|
-
|
|
71
|
+
|
|
72
|
+
exports.DSOverflowPillWithSchema = DSOverflowPillWithSchema;
|
|
73
|
+
exports.OverflowPill = OverflowPill;
|