@elliemae/ds-pills 2.2.0-alpha.2 → 2.2.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/components/PillGroup.d.ts +1 -1
- package/types/deprecated/DropdownPill.d.ts +1 -10
- package/types/deprecated/LabeledDropdownPills.d.ts +1 -12
- 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/types/deprecated/LabeledPills.d.ts +1 -8
- package/types/deprecated/OverflowPill.d.ts +1 -5
- package/types/deprecated/Pill.d.ts +1 -9
- package/types/deprecated/PillGroup.d.ts +1 -7
- package/types/deprecated/ReadOnlyPill.d.ts +1 -8
- package/types/deprecated/RemovablePill.d.ts +1 -7
- 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,46 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { PropTypes, describe } from
|
|
4
|
-
import { PillGroup } from
|
|
5
|
-
import { RemovablePill } from
|
|
6
|
-
import { Pill } from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
onFocusPreviousGroup
|
|
14
|
-
}) {
|
|
15
|
-
return /* @__PURE__ */ React2.createElement(PillGroup, {
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'react';
|
|
3
|
+
import { PropTypes, describe } from 'react-desc';
|
|
4
|
+
import { PillGroup } from './PillGroup.js';
|
|
5
|
+
import { RemovablePill } from './RemovablePill.js';
|
|
6
|
+
import { Pill } from './Pill.js';
|
|
7
|
+
|
|
8
|
+
function LabeledPills(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
label = '',
|
|
12
|
+
leftAddon,
|
|
16
13
|
onFocusGroupSet,
|
|
17
14
|
onFocusNextGroup,
|
|
18
15
|
onFocusPreviousGroup
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/_jsx(PillGroup, {
|
|
18
|
+
onFocusGroupSet: onFocusGroupSet,
|
|
19
|
+
onFocusNextGroup: onFocusNextGroup,
|
|
20
|
+
onFocusPreviousGroup: onFocusPreviousGroup
|
|
21
|
+
}, void 0, /*#__PURE__*/_jsx(Pill, {
|
|
22
|
+
label: label,
|
|
23
|
+
leftAddon: leftAddon,
|
|
22
24
|
variant: "title",
|
|
23
25
|
"data-testid": "pill-title"
|
|
24
26
|
}), children);
|
|
25
27
|
}
|
|
28
|
+
|
|
26
29
|
const props = {
|
|
27
|
-
|
|
30
|
+
/** labeled pill text label */
|
|
31
|
+
label: PropTypes.string.isRequired.description('pill text label'),
|
|
32
|
+
|
|
33
|
+
/** pill to add the label to */
|
|
28
34
|
children: PropTypes.arrayOf(PropTypes.shape({
|
|
29
|
-
type: PropTypes.oneOf([
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
type: PropTypes.oneOf([PropTypes.instanceOf(Pill), PropTypes.instanceOf(RemovablePill)])
|
|
36
|
+
})).isRequired.description('pill to add the label to'),
|
|
37
|
+
|
|
38
|
+
/** addon component to left */
|
|
39
|
+
leftAddon: PropTypes.node.description('addon component to left'),
|
|
40
|
+
|
|
41
|
+
/** focus next group callback */
|
|
42
|
+
onFocusNextGroup: PropTypes.func.description('focus next group callback'),
|
|
43
|
+
|
|
44
|
+
/** focus prev group callback */
|
|
45
|
+
onFocusPreviousGroup: PropTypes.func.description('focus prev group callback'),
|
|
46
|
+
|
|
47
|
+
/** focus group set callback */
|
|
48
|
+
onFocusGroupSet: PropTypes.func.description('focus group set callback')
|
|
38
49
|
};
|
|
39
|
-
LabeledPills.propTypes = props;
|
|
40
50
|
const DSLabeledPillsWithSchema = describe(LabeledPills);
|
|
41
51
|
DSLabeledPillsWithSchema.propTypes = props;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
LabeledPills
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=LabeledPills.js.map
|
|
52
|
+
|
|
53
|
+
export { DSLabeledPillsWithSchema, LabeledPills };
|
|
@@ -1,50 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
+
import { useRef, useState, useEffect } from 'react';
|
|
7
|
+
import { PropTypes, describe } from 'react-desc';
|
|
8
|
+
import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
|
|
9
|
+
import DSTooltip from '@elliemae/ds-tooltip';
|
|
10
|
+
import { Pill } from './Pill.js';
|
|
11
|
+
|
|
12
|
+
function OverflowPill(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
containerProps = {},
|
|
15
|
+
label = '',
|
|
16
|
+
options = []
|
|
17
|
+
} = _ref;
|
|
8
18
|
const ref = useRef(null);
|
|
9
19
|
const [tooltipIsOpen, setTooltipIsOpen] = useState(false);
|
|
10
|
-
const [tooltipText, setTooltipText] = useState(
|
|
20
|
+
const [tooltipText, setTooltipText] = useState('');
|
|
11
21
|
useEffect(() => {
|
|
12
|
-
let text =
|
|
13
|
-
options.forEach(
|
|
22
|
+
let text = '';
|
|
23
|
+
options.forEach(option => {
|
|
14
24
|
if (!tooltipText || option === options[0]) {
|
|
15
|
-
text =
|
|
25
|
+
text = "".concat(option.label);
|
|
16
26
|
} else {
|
|
17
|
-
text = text.concat(
|
|
27
|
+
text = text.concat(", ".concat(option.label));
|
|
18
28
|
}
|
|
19
29
|
});
|
|
20
30
|
setTooltipText(text);
|
|
21
31
|
}, [options]);
|
|
22
32
|
useFocusGroupItem(ref);
|
|
23
|
-
return
|
|
33
|
+
return /*#__PURE__*/_jsx(DSTooltip, {
|
|
24
34
|
isOpen: tooltipIsOpen,
|
|
25
35
|
title: tooltipText,
|
|
26
36
|
zIndex: 11,
|
|
27
|
-
triggerComponent:
|
|
37
|
+
triggerComponent: /*#__PURE__*/_jsx(Pill, {
|
|
28
38
|
className: "overflow-pill",
|
|
29
|
-
containerProps,
|
|
39
|
+
containerProps: containerProps,
|
|
30
40
|
innerRef: ref,
|
|
31
|
-
label,
|
|
41
|
+
label: label,
|
|
32
42
|
tabIndex: -1,
|
|
33
43
|
onMouseEnter: () => setTooltipIsOpen(true),
|
|
34
44
|
onMouseLeave: () => setTooltipIsOpen(false)
|
|
35
45
|
})
|
|
36
46
|
});
|
|
37
47
|
}
|
|
48
|
+
|
|
38
49
|
const props = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
/** props to inject to pill wrapper */
|
|
51
|
+
containerProps: PropTypes.object.description('props to inject to pill wrapper'),
|
|
52
|
+
|
|
53
|
+
/** pill text label */
|
|
54
|
+
label: PropTypes.string.isRequired.description('pill text label'),
|
|
55
|
+
|
|
56
|
+
/** overflow pills options */
|
|
57
|
+
options: PropTypes.array.description('overflow pills options')
|
|
42
58
|
};
|
|
43
|
-
OverflowPill.propTypes = props;
|
|
44
59
|
const DSOverflowPillWithSchema = describe(OverflowPill);
|
|
45
60
|
DSOverflowPillWithSchema.propTypes = props;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
OverflowPill
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=OverflowPill.js.map
|
|
61
|
+
|
|
62
|
+
export { DSOverflowPillWithSchema, OverflowPill };
|
package/esm/deprecated/Pill.js
CHANGED
|
@@ -1,44 +1,76 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import 'react';
|
|
10
|
+
import { PropTypes, describe } from 'react-desc';
|
|
11
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
12
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
const _excluded = ["containerProps", "label", "leftAddon", "rightAddon", "variant", "size"];
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
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(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; }
|
|
19
|
+
const pillBlockName = 'pill';
|
|
20
|
+
const PillWrapper = aggregatedClasses('div')(pillBlockName, null, _ref => {
|
|
21
|
+
let {
|
|
22
|
+
size,
|
|
23
|
+
variant
|
|
24
|
+
} = _ref;
|
|
25
|
+
return {
|
|
26
|
+
[variant]: !!variant,
|
|
27
|
+
[size]: !!size
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
const PillLabel = aggregatedClasses('span')(pillBlockName, 'label');
|
|
31
|
+
const PillAddon = aggregatedClasses('div')(pillBlockName, 'addon');
|
|
32
|
+
|
|
33
|
+
function Pill(_ref2) {
|
|
34
|
+
let {
|
|
35
|
+
containerProps = {},
|
|
36
|
+
label = '',
|
|
37
|
+
leftAddon,
|
|
38
|
+
rightAddon,
|
|
39
|
+
variant = 'value',
|
|
40
|
+
size = 'm'
|
|
41
|
+
} = _ref2,
|
|
42
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded);
|
|
43
|
+
|
|
44
|
+
return /*#__PURE__*/jsxs(PillWrapper, _objectSpread(_objectSpread(_objectSpread({}, containerProps), {}, {
|
|
45
|
+
classProps: {
|
|
46
|
+
variant,
|
|
47
|
+
size
|
|
48
|
+
}
|
|
49
|
+
}, otherProps), {}, {
|
|
50
|
+
children: [leftAddon && /*#__PURE__*/_jsx(PillAddon, {}, void 0, leftAddon), /*#__PURE__*/_jsx(PillLabel, {}, void 0, label), rightAddon && /*#__PURE__*/_jsx(PillAddon, {}, void 0, rightAddon)]
|
|
51
|
+
}));
|
|
26
52
|
}
|
|
53
|
+
|
|
27
54
|
const props = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
55
|
+
/** props to inject to pill wrapper */
|
|
56
|
+
containerProps: PropTypes.object.description('props to inject to pill wrapper'),
|
|
57
|
+
|
|
58
|
+
/** pill text label */
|
|
59
|
+
label: PropTypes.string.isRequired.description('pill text label'),
|
|
60
|
+
|
|
61
|
+
/** pill size */
|
|
62
|
+
size: PropTypes.oneOf(['m', 'l']).description('pill size'),
|
|
63
|
+
|
|
64
|
+
/** pill variant */
|
|
65
|
+
variant: PropTypes.oneOf(['value', 'title']).description('pill variant'),
|
|
66
|
+
|
|
67
|
+
/** addon component to left */
|
|
68
|
+
leftAddon: PropTypes.node.description('addon component to left'),
|
|
69
|
+
|
|
70
|
+
/** addon component to right */
|
|
71
|
+
rightAddon: PropTypes.node.description('addon component to right')
|
|
34
72
|
};
|
|
35
|
-
Pill.propTypes = props;
|
|
36
73
|
const DSPillWithSchema = describe(Pill);
|
|
37
74
|
DSPillWithSchema.propTypes = props;
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
DSPillWithSchema,
|
|
41
|
-
Pill,
|
|
42
|
-
Pill_default as default
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=Pill.js.map
|
|
75
|
+
|
|
76
|
+
export { DSPillWithSchema, Pill, Pill as default };
|
|
@@ -1,43 +1,60 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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 _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
7
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
8
|
+
import 'react';
|
|
9
|
+
import { PropTypes, describe } from 'react-desc';
|
|
10
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
11
|
+
import FocusGroupProvider from '@elliemae/ds-shared/FocusGroup/FocusGroupManager';
|
|
12
|
+
import { jsx } from 'react/jsx-runtime';
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
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(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; }
|
|
17
|
+
const pillGroupBlockName = 'pill-group';
|
|
18
|
+
const Container = aggregatedClasses('div')(pillGroupBlockName);
|
|
19
|
+
|
|
20
|
+
const PillGroup = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
containerProps = {},
|
|
23
|
+
onFocusNextGroup,
|
|
24
|
+
onFocusPreviousGroup,
|
|
25
|
+
onFocusGroupSet,
|
|
26
|
+
children
|
|
27
|
+
} = _ref;
|
|
28
|
+
return /*#__PURE__*/_jsx(FocusGroupProvider, {
|
|
29
|
+
keyBindings: {
|
|
30
|
+
Tab: 'next'
|
|
31
|
+
},
|
|
32
|
+
onFocusGroupSet: onFocusGroupSet,
|
|
33
|
+
onFocusNextGroup: onFocusNextGroup,
|
|
34
|
+
onFocusPreviousGroup: onFocusPreviousGroup,
|
|
35
|
+
orientation: "horizontal"
|
|
36
|
+
}, void 0, /*#__PURE__*/jsx(Container, _objectSpread(_objectSpread({}, containerProps), {}, {
|
|
37
|
+
children: children
|
|
38
|
+
})));
|
|
39
|
+
};
|
|
40
|
+
|
|
25
41
|
const props = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
/** props injected to component wrapper */
|
|
43
|
+
containerProps: PropTypes.object.description('props injected to component wrapper'),
|
|
44
|
+
|
|
45
|
+
/** focus next group callback */
|
|
46
|
+
onFocusNextGroup: PropTypes.func.description('focus next group callback'),
|
|
47
|
+
|
|
48
|
+
/** focus prev group callback */
|
|
49
|
+
onFocusPreviousGroup: PropTypes.func.description('focus prev group callback'),
|
|
50
|
+
|
|
51
|
+
/** focus group set callback */
|
|
52
|
+
onFocusGroupSet: PropTypes.func.description('focus group set callback'),
|
|
53
|
+
|
|
54
|
+
/** pill components */
|
|
55
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired.description('pill components')
|
|
34
56
|
};
|
|
35
|
-
PillGroup.propTypes = props;
|
|
36
57
|
const DSPillGroupWithSchema = describe(PillGroup);
|
|
37
58
|
DSPillGroupWithSchema.propTypes = props;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
DSPillGroupWithSchema,
|
|
41
|
-
PillGroup
|
|
42
|
-
};
|
|
43
|
-
//# sourceMappingURL=PillGroup.js.map
|
|
59
|
+
|
|
60
|
+
export { Container, DSPillGroupWithSchema, PillGroup };
|
|
@@ -1,71 +1,90 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
import { PropTypes, describe } from 'react-desc';
|
|
5
|
+
import { InfoCircleSmall } from '@elliemae/ds-icons';
|
|
6
|
+
import DSModal, { MODAL_TYPE_V2 } from '@elliemae/ds-modal';
|
|
7
|
+
import Popover from '@elliemae/ds-popover';
|
|
8
|
+
import { Pill } from './Pill.js';
|
|
9
|
+
import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
const ReadOnlyPill = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
containerProps = {},
|
|
14
|
+
modalContent = '',
|
|
15
|
+
label = '',
|
|
16
|
+
leftAddon,
|
|
17
|
+
modalTitle = '',
|
|
18
|
+
tooltipText = ''
|
|
19
|
+
} = _ref;
|
|
16
20
|
const ref = useRef(null);
|
|
17
21
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
18
22
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
23
|
+
|
|
19
24
|
const toggle = () => {
|
|
20
25
|
setIsModalOpen(!isModalOpen);
|
|
21
26
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
27
|
+
|
|
28
|
+
return /*#__PURE__*/jsxs(Fragment, {
|
|
29
|
+
children: [/*#__PURE__*/_jsx(Pill, {
|
|
30
|
+
"data-testid": "read-only-pill",
|
|
31
|
+
className: "removable-pill",
|
|
32
|
+
containerProps: containerProps,
|
|
33
|
+
innerRef: ref,
|
|
34
|
+
label: label,
|
|
35
|
+
leftAddon: leftAddon,
|
|
36
|
+
rightAddon: /*#__PURE__*/_jsx(Popover, {
|
|
37
|
+
isOpen: tooltipText && isTooltipOpen,
|
|
38
|
+
content: tooltipText,
|
|
39
|
+
placement: "top",
|
|
40
|
+
showArrow: true,
|
|
41
|
+
renderTrigger: _ref2 => {
|
|
42
|
+
let {
|
|
43
|
+
ref
|
|
44
|
+
} = _ref2;
|
|
45
|
+
return /*#__PURE__*/_jsx(InfoCircleSmall, {
|
|
46
|
+
role: "button",
|
|
47
|
+
"data-testid": "read-only-info-btn",
|
|
48
|
+
className: "remove-pill-button",
|
|
49
|
+
onClick: toggle,
|
|
50
|
+
onMouseEnter: () => setIsTooltipOpen(true),
|
|
51
|
+
onMouseLeave: () => setIsTooltipOpen(false),
|
|
52
|
+
color: ['brand-primary', '600'],
|
|
53
|
+
innerRef: ref
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
tabIndex: -1
|
|
58
|
+
}), /*#__PURE__*/_jsx(DSModal, {
|
|
59
|
+
isOpen: isModalOpen,
|
|
60
|
+
showClose: true,
|
|
61
|
+
shouldCloseOnOverlayClick: true,
|
|
62
|
+
modalTitle: modalTitle,
|
|
63
|
+
modalType: MODAL_TYPE_V2.INFORMATION,
|
|
64
|
+
onClose: toggle,
|
|
65
|
+
version: 2
|
|
66
|
+
}, void 0, modalContent)]
|
|
67
|
+
});
|
|
55
68
|
};
|
|
69
|
+
|
|
56
70
|
const props = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
/** props injected to component wrapper */
|
|
72
|
+
containerProps: PropTypes.object.description('props injected to component wrapper'),
|
|
73
|
+
|
|
74
|
+
/** labeled pill text label */
|
|
75
|
+
label: PropTypes.string.isRequired.description('pill text label'),
|
|
76
|
+
|
|
77
|
+
/** addon component to left */
|
|
78
|
+
leftAddon: PropTypes.node.description('addon component to left'),
|
|
79
|
+
|
|
80
|
+
/** read only pill modal content */
|
|
81
|
+
modalContent: PropTypes.string.description('read only pill modal content'),
|
|
82
|
+
|
|
83
|
+
/** read only pill modal title */
|
|
84
|
+
modalTitle: PropTypes.string.description('read only pill modal title'),
|
|
85
|
+
tooltipText: PropTypes.string.description('text to display in tooltip')
|
|
63
86
|
};
|
|
64
|
-
ReadOnlyPill.propTypes = props;
|
|
65
87
|
const DSReadOnlyPillWithSchema = describe(ReadOnlyPill);
|
|
66
88
|
DSReadOnlyPillWithSchema.propTypes = props;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
ReadOnlyPill
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=ReadOnlyPill.js.map
|
|
89
|
+
|
|
90
|
+
export { DSReadOnlyPillWithSchema, ReadOnlyPill };
|
|
@@ -1,29 +1,38 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { PropTypes, describe } from
|
|
4
|
-
import { isFunction } from
|
|
5
|
-
import { CloseXsmall } from
|
|
6
|
-
import
|
|
7
|
-
import { Pill } from
|
|
8
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { PropTypes, describe } from 'react-desc';
|
|
4
|
+
import { isFunction } from '@elliemae/ds-utilities';
|
|
5
|
+
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
6
|
+
import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
|
|
7
|
+
import { Pill } from './Pill.js';
|
|
8
|
+
|
|
9
|
+
function RemovablePill(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
containerProps = {},
|
|
12
|
+
label = '',
|
|
13
|
+
onRemove,
|
|
14
|
+
size = 'm',
|
|
15
|
+
leftAddon
|
|
16
|
+
} = _ref;
|
|
9
17
|
const ref = useRef(null);
|
|
10
|
-
const {
|
|
11
|
-
|
|
18
|
+
const {
|
|
19
|
+
focusPrevious
|
|
20
|
+
} = useFocusGroupItem(ref);
|
|
21
|
+
return /*#__PURE__*/_jsx(Pill, {
|
|
12
22
|
className: "removable-pill",
|
|
13
23
|
"data-testid": "removable-pill",
|
|
14
|
-
containerProps,
|
|
24
|
+
containerProps: containerProps,
|
|
15
25
|
innerRef: ref,
|
|
16
|
-
size,
|
|
17
|
-
label,
|
|
18
|
-
leftAddon,
|
|
19
|
-
onKeyDown:
|
|
20
|
-
if (e.key ===
|
|
26
|
+
size: size,
|
|
27
|
+
label: label,
|
|
28
|
+
leftAddon: leftAddon,
|
|
29
|
+
onKeyDown: e => {
|
|
30
|
+
if (e.key === 'Backspace' && isFunction(onRemove)) {
|
|
21
31
|
onRemove();
|
|
22
|
-
if (isFunction(focusPrevious))
|
|
23
|
-
focusPrevious();
|
|
32
|
+
if (isFunction(focusPrevious)) focusPrevious();
|
|
24
33
|
}
|
|
25
34
|
},
|
|
26
|
-
rightAddon:
|
|
35
|
+
rightAddon: /*#__PURE__*/_jsx(CloseXsmall, {
|
|
27
36
|
role: "button",
|
|
28
37
|
"data-testid": "remove-pill-button",
|
|
29
38
|
className: "remove-pill-button",
|
|
@@ -32,18 +41,24 @@ function RemovablePill({ containerProps = {}, label = "", onRemove, size = "m",
|
|
|
32
41
|
tabIndex: -1
|
|
33
42
|
});
|
|
34
43
|
}
|
|
44
|
+
|
|
35
45
|
const props = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
/** props injected to component wrapper */
|
|
47
|
+
containerProps: PropTypes.object.description('props injected to component wrapper'),
|
|
48
|
+
|
|
49
|
+
/** labeled pill text label */
|
|
50
|
+
label: PropTypes.string.isRequired.description('pill text label'),
|
|
51
|
+
|
|
52
|
+
/** remove click callback */
|
|
53
|
+
onRemove: PropTypes.func.description('remove click callback'),
|
|
54
|
+
|
|
55
|
+
/** pill size */
|
|
56
|
+
size: PropTypes.oneOf(['m', 'l']).description('pill size'),
|
|
57
|
+
|
|
58
|
+
/** addon component to left */
|
|
59
|
+
leftAddon: PropTypes.node.description('addon component to left')
|
|
41
60
|
};
|
|
42
|
-
RemovablePill.propTypes = props;
|
|
43
61
|
const DSRemovablePillWithSchema = describe(RemovablePill);
|
|
44
62
|
DSRemovablePillWithSchema.propTypes = props;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
RemovablePill
|
|
48
|
-
};
|
|
49
|
-
//# sourceMappingURL=RemovablePill.js.map
|
|
63
|
+
|
|
64
|
+
export { DSRemovablePillWithSchema, RemovablePill };
|