@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
|
@@ -13,19 +13,20 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
|
|
14
14
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
15
|
|
|
16
|
-
function LabeledPills({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
function LabeledPills(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
children,
|
|
19
|
+
label = '',
|
|
20
|
+
leftAddon,
|
|
21
|
+
onFocusGroupSet,
|
|
22
|
+
onFocusNextGroup,
|
|
23
|
+
onFocusPreviousGroup
|
|
24
|
+
} = _ref;
|
|
25
|
+
return /*#__PURE__*/_jsx__default["default"](PillGroup.PillGroup, {
|
|
25
26
|
onFocusGroupSet: onFocusGroupSet,
|
|
26
27
|
onFocusNextGroup: onFocusNextGroup,
|
|
27
28
|
onFocusPreviousGroup: onFocusPreviousGroup
|
|
28
|
-
}, void 0, /*#__PURE__*/_jsx__default[
|
|
29
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
29
30
|
label: label,
|
|
30
31
|
leftAddon: leftAddon,
|
|
31
32
|
variant: "title",
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
|
|
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');
|
|
7
11
|
var reactDesc = require('react-desc');
|
|
8
12
|
var useFocusGroupItem = require('@elliemae/ds-shared/FocusGroup/useFocusGroupItem');
|
|
9
13
|
var DSTooltip = require('@elliemae/ds-tooltip');
|
|
@@ -15,31 +19,32 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
|
15
19
|
var useFocusGroupItem__default = /*#__PURE__*/_interopDefaultLegacy(useFocusGroupItem);
|
|
16
20
|
var DSTooltip__default = /*#__PURE__*/_interopDefaultLegacy(DSTooltip);
|
|
17
21
|
|
|
18
|
-
function OverflowPill({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const [
|
|
26
|
-
|
|
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(() => {
|
|
27
32
|
let text = '';
|
|
28
33
|
options.forEach(option => {
|
|
29
34
|
if (!tooltipText || option === options[0]) {
|
|
30
|
-
text =
|
|
35
|
+
text = "".concat(option.label);
|
|
31
36
|
} else {
|
|
32
|
-
text = text.concat(
|
|
37
|
+
text = text.concat(", ".concat(option.label));
|
|
33
38
|
}
|
|
34
39
|
});
|
|
35
40
|
setTooltipText(text);
|
|
36
41
|
}, [options]);
|
|
37
|
-
useFocusGroupItem__default[
|
|
38
|
-
return /*#__PURE__*/_jsx__default[
|
|
42
|
+
useFocusGroupItem__default["default"](ref);
|
|
43
|
+
return /*#__PURE__*/_jsx__default["default"](DSTooltip__default["default"], {
|
|
39
44
|
isOpen: tooltipIsOpen,
|
|
40
45
|
title: tooltipText,
|
|
41
46
|
zIndex: 11,
|
|
42
|
-
triggerComponent: /*#__PURE__*/_jsx__default[
|
|
47
|
+
triggerComponent: /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
43
48
|
className: "overflow-pill",
|
|
44
49
|
containerProps: containerProps,
|
|
45
50
|
innerRef: ref,
|
|
@@ -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 _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
6
11
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
7
12
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -20,19 +25,22 @@ const _excluded = ["containerProps", "label", "leftAddon", "rightAddon", "varian
|
|
|
20
25
|
|
|
21
26
|
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
27
|
|
|
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[
|
|
28
|
+
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
29
|
const pillBlockName = 'pill';
|
|
25
|
-
const PillWrapper = dsClassnames.aggregatedClasses('div')(pillBlockName, null,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const PillWrapper = dsClassnames.aggregatedClasses('div')(pillBlockName, null, _ref => {
|
|
31
|
+
let {
|
|
32
|
+
size,
|
|
33
|
+
variant
|
|
34
|
+
} = _ref;
|
|
35
|
+
return {
|
|
36
|
+
[variant]: !!variant,
|
|
37
|
+
[size]: !!size
|
|
38
|
+
};
|
|
39
|
+
});
|
|
32
40
|
const PillLabel = dsClassnames.aggregatedClasses('span')(pillBlockName, 'label');
|
|
33
41
|
const PillAddon = dsClassnames.aggregatedClasses('div')(pillBlockName, 'addon');
|
|
34
42
|
|
|
35
|
-
function Pill(
|
|
43
|
+
function Pill(_ref2) {
|
|
36
44
|
let {
|
|
37
45
|
containerProps = {},
|
|
38
46
|
label = '',
|
|
@@ -40,8 +48,8 @@ function Pill(_ref) {
|
|
|
40
48
|
rightAddon,
|
|
41
49
|
variant = 'value',
|
|
42
50
|
size = 'm'
|
|
43
|
-
} =
|
|
44
|
-
otherProps = _objectWithoutProperties__default[
|
|
51
|
+
} = _ref2,
|
|
52
|
+
otherProps = _objectWithoutProperties__default["default"](_ref2, _excluded);
|
|
45
53
|
|
|
46
54
|
return /*#__PURE__*/jsxRuntime.jsxs(PillWrapper, _objectSpread(_objectSpread(_objectSpread({}, containerProps), {}, {
|
|
47
55
|
classProps: {
|
|
@@ -49,7 +57,7 @@ function Pill(_ref) {
|
|
|
49
57
|
size
|
|
50
58
|
}
|
|
51
59
|
}, otherProps), {}, {
|
|
52
|
-
children: [leftAddon && /*#__PURE__*/_jsx__default[
|
|
60
|
+
children: [leftAddon && /*#__PURE__*/_jsx__default["default"](PillAddon, {}, void 0, leftAddon), /*#__PURE__*/_jsx__default["default"](PillLabel, {}, void 0, label), rightAddon && /*#__PURE__*/_jsx__default["default"](PillAddon, {}, void 0, rightAddon)]
|
|
53
61
|
}));
|
|
54
62
|
}
|
|
55
63
|
|
|
@@ -77,4 +85,4 @@ DSPillWithSchema.propTypes = props;
|
|
|
77
85
|
|
|
78
86
|
exports.DSPillWithSchema = DSPillWithSchema;
|
|
79
87
|
exports.Pill = Pill;
|
|
80
|
-
exports[
|
|
88
|
+
exports["default"] = Pill;
|
|
@@ -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
|
require('react');
|
|
@@ -18,27 +23,30 @@ var FocusGroupProvider__default = /*#__PURE__*/_interopDefaultLegacy(FocusGroupP
|
|
|
18
23
|
|
|
19
24
|
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; }
|
|
20
25
|
|
|
21
|
-
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[
|
|
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["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; }
|
|
22
27
|
const pillGroupBlockName = 'pill-group';
|
|
23
28
|
const Container = dsClassnames.aggregatedClasses('div')(pillGroupBlockName);
|
|
24
29
|
|
|
25
|
-
const PillGroup =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
30
|
+
const PillGroup = _ref => {
|
|
31
|
+
let {
|
|
32
|
+
containerProps = {},
|
|
33
|
+
onFocusNextGroup,
|
|
34
|
+
onFocusPreviousGroup,
|
|
35
|
+
onFocusGroupSet,
|
|
36
|
+
children
|
|
37
|
+
} = _ref;
|
|
38
|
+
return /*#__PURE__*/_jsx__default["default"](FocusGroupProvider__default["default"], {
|
|
39
|
+
keyBindings: {
|
|
40
|
+
Tab: 'next'
|
|
41
|
+
},
|
|
42
|
+
onFocusGroupSet: onFocusGroupSet,
|
|
43
|
+
onFocusNextGroup: onFocusNextGroup,
|
|
44
|
+
onFocusPreviousGroup: onFocusPreviousGroup,
|
|
45
|
+
orientation: "horizontal"
|
|
46
|
+
}, void 0, /*#__PURE__*/jsxRuntime.jsx(Container, _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
47
|
+
children: children
|
|
48
|
+
})));
|
|
49
|
+
};
|
|
42
50
|
|
|
43
51
|
const props = {
|
|
44
52
|
/** props injected to component wrapper */
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
var React = require('react');
|
|
7
8
|
var reactDesc = require('react-desc');
|
|
8
|
-
var
|
|
9
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
9
10
|
var DSModal = require('@elliemae/ds-modal');
|
|
10
11
|
var Popover = require('@elliemae/ds-popover');
|
|
11
12
|
var Pill = require('./Pill.js');
|
|
@@ -14,54 +15,57 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
14
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
16
|
|
|
16
17
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
-
var InfoCircleSmall__default = /*#__PURE__*/_interopDefaultLegacy(InfoCircleSmall);
|
|
18
18
|
var DSModal__default = /*#__PURE__*/_interopDefaultLegacy(DSModal);
|
|
19
19
|
var Popover__default = /*#__PURE__*/_interopDefaultLegacy(Popover);
|
|
20
20
|
|
|
21
|
-
const ReadOnlyPill =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const [
|
|
21
|
+
const ReadOnlyPill = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
containerProps = {},
|
|
24
|
+
modalContent = '',
|
|
25
|
+
label = '',
|
|
26
|
+
leftAddon,
|
|
27
|
+
modalTitle = '',
|
|
28
|
+
tooltipText = ''
|
|
29
|
+
} = _ref;
|
|
30
|
+
const ref = React.useRef(null);
|
|
31
|
+
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
32
|
+
const [isTooltipOpen, setIsTooltipOpen] = React.useState(false);
|
|
32
33
|
|
|
33
34
|
const toggle = () => {
|
|
34
35
|
setIsModalOpen(!isModalOpen);
|
|
35
36
|
};
|
|
36
37
|
|
|
37
38
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
38
|
-
children: [/*#__PURE__*/_jsx__default[
|
|
39
|
+
children: [/*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
39
40
|
"data-testid": "read-only-pill",
|
|
40
41
|
className: "removable-pill",
|
|
41
42
|
containerProps: containerProps,
|
|
42
43
|
innerRef: ref,
|
|
43
44
|
label: label,
|
|
44
45
|
leftAddon: leftAddon,
|
|
45
|
-
rightAddon: /*#__PURE__*/_jsx__default[
|
|
46
|
+
rightAddon: /*#__PURE__*/_jsx__default["default"](Popover__default["default"], {
|
|
46
47
|
isOpen: tooltipText && isTooltipOpen,
|
|
47
48
|
content: tooltipText,
|
|
48
49
|
placement: "top",
|
|
49
50
|
showArrow: true,
|
|
50
|
-
renderTrigger:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
renderTrigger: _ref2 => {
|
|
52
|
+
let {
|
|
53
|
+
ref
|
|
54
|
+
} = _ref2;
|
|
55
|
+
return /*#__PURE__*/_jsx__default["default"](dsIcons.InfoCircleSmall, {
|
|
56
|
+
role: "button",
|
|
57
|
+
"data-testid": "read-only-info-btn",
|
|
58
|
+
className: "remove-pill-button",
|
|
59
|
+
onClick: toggle,
|
|
60
|
+
onMouseEnter: () => setIsTooltipOpen(true),
|
|
61
|
+
onMouseLeave: () => setIsTooltipOpen(false),
|
|
62
|
+
color: ['brand-primary', '600'],
|
|
63
|
+
innerRef: ref
|
|
64
|
+
});
|
|
65
|
+
}
|
|
62
66
|
}),
|
|
63
67
|
tabIndex: -1
|
|
64
|
-
}), /*#__PURE__*/_jsx__default[
|
|
68
|
+
}), /*#__PURE__*/_jsx__default["default"](DSModal__default["default"], {
|
|
65
69
|
isOpen: isModalOpen,
|
|
66
70
|
showClose: true,
|
|
67
71
|
shouldCloseOnOverlayClick: true,
|
|
@@ -3,31 +3,31 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
var
|
|
6
|
+
var React = require('react');
|
|
7
7
|
var reactDesc = require('react-desc');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
8
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
9
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
10
10
|
var useFocusGroupItem = require('@elliemae/ds-shared/FocusGroup/useFocusGroupItem');
|
|
11
11
|
var Pill = require('./Pill.js');
|
|
12
12
|
|
|
13
13
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
14
|
|
|
15
15
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
16
|
-
var CloseXsmall__default = /*#__PURE__*/_interopDefaultLegacy(CloseXsmall);
|
|
17
16
|
var useFocusGroupItem__default = /*#__PURE__*/_interopDefaultLegacy(useFocusGroupItem);
|
|
18
17
|
|
|
19
|
-
function RemovablePill({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
function RemovablePill(_ref) {
|
|
19
|
+
let {
|
|
20
|
+
containerProps = {},
|
|
21
|
+
label = '',
|
|
22
|
+
onRemove,
|
|
23
|
+
size = 'm',
|
|
24
|
+
leftAddon
|
|
25
|
+
} = _ref;
|
|
26
|
+
const ref = React.useRef(null);
|
|
27
27
|
const {
|
|
28
28
|
focusPrevious
|
|
29
|
-
} = useFocusGroupItem__default[
|
|
30
|
-
return /*#__PURE__*/_jsx__default[
|
|
29
|
+
} = useFocusGroupItem__default["default"](ref);
|
|
30
|
+
return /*#__PURE__*/_jsx__default["default"](Pill.Pill, {
|
|
31
31
|
className: "removable-pill",
|
|
32
32
|
"data-testid": "removable-pill",
|
|
33
33
|
containerProps: containerProps,
|
|
@@ -36,12 +36,12 @@ function RemovablePill({
|
|
|
36
36
|
label: label,
|
|
37
37
|
leftAddon: leftAddon,
|
|
38
38
|
onKeyDown: e => {
|
|
39
|
-
if (e.key === 'Backspace' &&
|
|
39
|
+
if (e.key === 'Backspace' && dsUtilities.isFunction(onRemove)) {
|
|
40
40
|
onRemove();
|
|
41
|
-
if (
|
|
41
|
+
if (dsUtilities.isFunction(focusPrevious)) focusPrevious();
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
rightAddon: /*#__PURE__*/_jsx__default[
|
|
44
|
+
rightAddon: /*#__PURE__*/_jsx__default["default"](dsIcons.CloseXsmall, {
|
|
45
45
|
role: "button",
|
|
46
46
|
"data-testid": "remove-pill-button",
|
|
47
47
|
className: "remove-pill-button",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var Pill = require('./Pill.js');
|
|
6
|
+
var PillGroup = require('./PillGroup.js');
|
|
7
|
+
var LabeledDropdownPills = require('./LabeledDropdownPills.js');
|
|
8
|
+
var LabeledPills = require('./LabeledPills.js');
|
|
9
|
+
var DropdownPill = require('./DropdownPill.js');
|
|
10
|
+
var RemovablePill = require('./RemovablePill.js');
|
|
11
|
+
var ReadOnlyPill = require('./ReadOnlyPill.js');
|
|
12
|
+
var OverflowPill = require('./OverflowPill.js');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.DSPillWithSchema = Pill.DSPillWithSchema;
|
|
17
|
+
exports.Pill = Pill.Pill;
|
|
18
|
+
exports["default"] = Pill.Pill;
|
|
19
|
+
exports.Container = PillGroup.Container;
|
|
20
|
+
exports.DSPillGroupWithSchema = PillGroup.DSPillGroupWithSchema;
|
|
21
|
+
exports.PillGroup = PillGroup.PillGroup;
|
|
22
|
+
exports.DSLabeledDropdownPillsWithSchema = LabeledDropdownPills.DSLabeledDropdownPillsWithSchema;
|
|
23
|
+
exports.LabeledDropdownPills = LabeledDropdownPills.LabeledDropdownPills;
|
|
24
|
+
exports.DSLabeledPillsWithSchema = LabeledPills.DSLabeledPillsWithSchema;
|
|
25
|
+
exports.LabeledPills = LabeledPills.LabeledPills;
|
|
26
|
+
exports.DSDropdownPillWithSchema = DropdownPill.DSDropdownPillWithSchema;
|
|
27
|
+
exports.DropdownPill = DropdownPill.DropdownPill;
|
|
28
|
+
exports.DSRemovablePillWithSchema = RemovablePill.DSRemovablePillWithSchema;
|
|
29
|
+
exports.RemovablePill = RemovablePill.RemovablePill;
|
|
30
|
+
exports.DSReadOnlyPillWithSchema = ReadOnlyPill.DSReadOnlyPillWithSchema;
|
|
31
|
+
exports.ReadOnlyPill = ReadOnlyPill.ReadOnlyPill;
|
|
32
|
+
exports.DSOverflowPillWithSchema = OverflowPill.DSOverflowPillWithSchema;
|
|
33
|
+
exports.OverflowPill = OverflowPill.OverflowPill;
|
package/cjs/index.d.js
ADDED
package/cjs/index.js
CHANGED
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var Pill = require('./Pill.js');
|
|
6
|
-
var PillGroup = require('./PillGroup.js');
|
|
7
|
-
var LabeledDropdownPills = require('./LabeledDropdownPills.js');
|
|
8
|
-
var LabeledPills = require('./LabeledPills.js');
|
|
9
|
-
var DropdownPill = require('./DropdownPill.js');
|
|
10
|
-
var RemovablePill = require('./RemovablePill.js');
|
|
11
|
-
var ReadOnlyPill = require('./ReadOnlyPill.js');
|
|
12
|
-
var OverflowPill = require('./OverflowPill.js');
|
|
5
|
+
var Pill = require('./deprecated/Pill.js');
|
|
6
|
+
var PillGroup = require('./deprecated/PillGroup.js');
|
|
7
|
+
var LabeledDropdownPills = require('./deprecated/LabeledDropdownPills.js');
|
|
8
|
+
var LabeledPills = require('./deprecated/LabeledPills.js');
|
|
9
|
+
var DropdownPill = require('./deprecated/DropdownPill.js');
|
|
10
|
+
var RemovablePill = require('./deprecated/RemovablePill.js');
|
|
11
|
+
var ReadOnlyPill = require('./deprecated/ReadOnlyPill.js');
|
|
12
|
+
var OverflowPill = require('./deprecated/OverflowPill.js');
|
|
13
|
+
var Pill$1 = require('./components/Pill.js');
|
|
14
|
+
var PillGroup$1 = require('./components/PillGroup.js');
|
|
15
|
+
var PillButton = require('./components/PillButton.js');
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
exports.DSPillWithSchema = Pill.DSPillWithSchema;
|
|
17
20
|
exports.Pill = Pill.Pill;
|
|
18
|
-
exports
|
|
21
|
+
exports["default"] = Pill.Pill;
|
|
19
22
|
exports.Container = PillGroup.Container;
|
|
20
23
|
exports.DSPillGroupWithSchema = PillGroup.DSPillGroupWithSchema;
|
|
21
24
|
exports.PillGroup = PillGroup.PillGroup;
|
|
@@ -31,3 +34,10 @@ exports.DSReadOnlyPillWithSchema = ReadOnlyPill.DSReadOnlyPillWithSchema;
|
|
|
31
34
|
exports.ReadOnlyPill = ReadOnlyPill.ReadOnlyPill;
|
|
32
35
|
exports.DSOverflowPillWithSchema = OverflowPill.DSOverflowPillWithSchema;
|
|
33
36
|
exports.OverflowPill = OverflowPill.OverflowPill;
|
|
37
|
+
exports.DSPillV2 = Pill$1.DSPillV2;
|
|
38
|
+
exports.DSPillV2WithSchema = Pill$1.DSPillV2WithSchema;
|
|
39
|
+
exports.DSPillGroupV2 = PillGroup$1.DSPillGroupV2;
|
|
40
|
+
exports.DSPillGroupV2Context = PillGroup$1.DSPillGroupV2Context;
|
|
41
|
+
exports.DSPillGroupV2WithSchema = PillGroup$1.DSPillGroupV2WithSchema;
|
|
42
|
+
exports.DSPillButton = PillButton.DSPillButton;
|
|
43
|
+
exports.DSPillButtonWithSchema = PillButton.DSPillButtonWithSchema;
|
package/cjs/props.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var reactDesc = require('react-desc');
|
|
6
|
+
var dsForm = require('@elliemae/ds-form');
|
|
7
|
+
|
|
8
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
9
|
+
const pillTypes = reactDesc.PropTypes.oneOf(['label', 'value', 'input', 'dropdown', 'removable', 'readonly']);
|
|
10
|
+
const DSPillV2PropTypes = {
|
|
11
|
+
label: reactDesc.PropTypes.string.description('Label to show in the pill').isRequired,
|
|
12
|
+
type: pillTypes.description('The type of pill that you want to render').isRequired,
|
|
13
|
+
innerRef: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.object, reactDesc.PropTypes.func]).description('Reference to the focuseable internal element of each pill (remove icons, inputs, dropdown, etc.)').defaultValue(() => null),
|
|
14
|
+
size: reactDesc.PropTypes.oneOf(['s', 'm']).description('Vertical pill size').defaultValue('m'),
|
|
15
|
+
ariaLabel: reactDesc.PropTypes.string.description('Aria label for the pill. If not provided we will use the label').defaultValue(''),
|
|
16
|
+
labelTruncated: reactDesc.PropTypes.bool.description('Whether to truncate the pills label').defaultValue(true),
|
|
17
|
+
tooltipValue: reactDesc.PropTypes.string.description('String to show as a tooltip in the value pill').defaultValue(''),
|
|
18
|
+
iconLeft: reactDesc.PropTypes.node.description('A component to show int the left of a readonly pill').defaultValue(null),
|
|
19
|
+
iconRight: reactDesc.PropTypes.node.description('A component to show in the right of a readonly pill').defaultValue(null),
|
|
20
|
+
onRemove: reactDesc.PropTypes.func.description('Callback triggered when removing a pill with the close icon').defaultValue(() => null),
|
|
21
|
+
inputPlaceholder: reactDesc.PropTypes.string.description('Placeholder for the input pill').defaultValue(''),
|
|
22
|
+
onInputChange: reactDesc.PropTypes.func.description('Callback triggered when user provides input to the input pill').defaultValue(() => null),
|
|
23
|
+
onInputClear: reactDesc.PropTypes.func.description('Callback triggered when the user clears an input pill').defaultValue(() => null),
|
|
24
|
+
inputWidth: reactDesc.PropTypes.number.description('Width in pixels for the input tag in the input pill').defaultValue(150),
|
|
25
|
+
dropdownProps: reactDesc.PropTypes.object.description('Properties that will be used for the dropdown-menu').defaultValue({}),
|
|
26
|
+
onDropdownClick: reactDesc.PropTypes.func.description('Callback when dropdown button is clicked or pressed').defaultValue(() => null)
|
|
27
|
+
};
|
|
28
|
+
const DSPillButtonPropTypes = {
|
|
29
|
+
type: reactDesc.PropTypes.oneOf(['only', 'left', 'right']).description('The position in which this button will be placed. Only used for css styling internally').defaultValue('right'),
|
|
30
|
+
width: reactDesc.PropTypes.string.description('Width of the button').defaultValue('100%'),
|
|
31
|
+
height: reactDesc.PropTypes.string.description('Height of the button').defaultValue('100%')
|
|
32
|
+
};
|
|
33
|
+
const DSPillGroupPropTypes = {
|
|
34
|
+
width: reactDesc.PropTypes.string.description('Width of the group').defaultValue('fit-content'),
|
|
35
|
+
innerRef: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.object, reactDesc.PropTypes.func]).description('Reference to the pill group wrapper').defaultValue(() => null)
|
|
36
|
+
};
|
|
37
|
+
const DSPillV2DefaultProps = {
|
|
38
|
+
innerRef: () => null,
|
|
39
|
+
ariaLabel: '',
|
|
40
|
+
size: 'm',
|
|
41
|
+
labelTruncated: true,
|
|
42
|
+
tooltipValue: '',
|
|
43
|
+
iconLeft: null,
|
|
44
|
+
iconRight: null,
|
|
45
|
+
onRemove: () => null,
|
|
46
|
+
inputPlaceholder: '',
|
|
47
|
+
onInputChange: () => null,
|
|
48
|
+
onInputClear: () => null,
|
|
49
|
+
inputWidth: 72,
|
|
50
|
+
inputRender: dsForm.DSInput,
|
|
51
|
+
dropdownProps: {},
|
|
52
|
+
onDropdownClick: () => null
|
|
53
|
+
};
|
|
54
|
+
const DSPillButtonDefaultProps = {
|
|
55
|
+
type: 'right',
|
|
56
|
+
width: '100%',
|
|
57
|
+
height: '100%'
|
|
58
|
+
};
|
|
59
|
+
const DSPillGroupDefaultProps = {
|
|
60
|
+
width: 'fit-content',
|
|
61
|
+
innerRef: () => null
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
exports.DSPillButtonDefaultProps = DSPillButtonDefaultProps;
|
|
65
|
+
exports.DSPillButtonPropTypes = DSPillButtonPropTypes;
|
|
66
|
+
exports.DSPillGroupDefaultProps = DSPillGroupDefaultProps;
|
|
67
|
+
exports.DSPillGroupPropTypes = DSPillGroupPropTypes;
|
|
68
|
+
exports.DSPillV2DefaultProps = DSPillV2DefaultProps;
|
|
69
|
+
exports.DSPillV2PropTypes = DSPillV2PropTypes;
|
package/cjs/utils.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
6
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
8
|
+
|
|
9
|
+
const setMultipleRefs = function () {
|
|
10
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11
|
+
refs[_key] = arguments[_key];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return _ref => {
|
|
15
|
+
refs.forEach(ref => {
|
|
16
|
+
if (!ref || !_ref) return;
|
|
17
|
+
|
|
18
|
+
if (typeof ref === 'function') {
|
|
19
|
+
ref(_ref);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (ref) ref.current = _ref;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.setMultipleRefs = setMultipleRefs;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
+
import 'react';
|
|
8
|
+
import { describe } from 'react-desc';
|
|
9
|
+
import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
|
|
10
|
+
import { DSPillV2PropTypes, DSPillV2DefaultProps } from '../props.js';
|
|
11
|
+
import { DropdownPill } from './types/DropdownPill.js';
|
|
12
|
+
import { InputPill } from './types/InputPill.js';
|
|
13
|
+
import { LabelPill } from './types/LabelPill.js';
|
|
14
|
+
import { ReadOnlyPill } from './types/ReadOnlyPill.js';
|
|
15
|
+
import { RemovablePill } from './types/RemovablePill.js';
|
|
16
|
+
import { ValuePill } from './types/ValuePill.js';
|
|
17
|
+
import { jsx } from 'react/jsx-runtime';
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
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(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; }
|
|
22
|
+
const pillComponentGetter = {
|
|
23
|
+
dropdown: DropdownPill,
|
|
24
|
+
input: InputPill,
|
|
25
|
+
label: LabelPill,
|
|
26
|
+
readonly: ReadOnlyPill,
|
|
27
|
+
removable: RemovablePill,
|
|
28
|
+
value: ValuePill
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const DSPillV2 = props => {
|
|
32
|
+
const propsWithDefaults = useMemoMergePropsWithDefault(props, DSPillV2DefaultProps);
|
|
33
|
+
useValidateTypescriptPropTypes(propsWithDefaults, DSPillV2PropTypes);
|
|
34
|
+
const {
|
|
35
|
+
type
|
|
36
|
+
} = propsWithDefaults;
|
|
37
|
+
const PillComponent = pillComponentGetter[type];
|
|
38
|
+
return /*#__PURE__*/jsx(PillComponent, _objectSpread({}, propsWithDefaults));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const DSPillV2WithSchema = describe(DSPillV2).description('Pill');
|
|
42
|
+
DSPillV2WithSchema.propTypes = DSPillV2PropTypes;
|
|
43
|
+
|
|
44
|
+
export { DSPillV2, DSPillV2WithSchema };
|