@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,50 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { uid } from
|
|
4
|
-
import { CloseXsmall } from
|
|
5
|
-
import { SimpleTruncatedTooltipText } from
|
|
6
|
-
import { StyledRemovablePillWrapper } from
|
|
7
|
-
import { DSPillGroupV2Context } from
|
|
8
|
-
import { DSPillButton } from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import React, { useContext, useMemo, useCallback } from 'react';
|
|
3
|
+
import { uid } from 'uid';
|
|
4
|
+
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
5
|
+
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
6
|
+
import { StyledRemovablePillWrapper } from '../styled.js';
|
|
7
|
+
import { DSPillGroupV2Context } from '../PillGroup.js';
|
|
8
|
+
import { DSPillButton } from '../PillButton.js';
|
|
9
|
+
|
|
10
|
+
const RemovablePill = /*#__PURE__*/React.memo(_ref => {
|
|
11
|
+
let {
|
|
12
|
+
label,
|
|
13
|
+
size,
|
|
14
|
+
labelTruncated,
|
|
15
|
+
onRemove,
|
|
16
|
+
innerRef,
|
|
17
|
+
ariaLabel
|
|
18
|
+
} = _ref;
|
|
19
|
+
const {
|
|
20
|
+
onKeyboardRemove
|
|
21
|
+
} = useContext(DSPillGroupV2Context);
|
|
22
|
+
const pillUid = useMemo(() => "ds-pill-".concat(uid()), []);
|
|
23
|
+
const TextComponent = labelTruncated ? _ref2 => {
|
|
24
|
+
let {
|
|
25
|
+
children
|
|
26
|
+
} = _ref2;
|
|
27
|
+
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
28
|
+
value: children
|
|
29
|
+
});
|
|
30
|
+
} : React.Fragment;
|
|
31
|
+
const onKeyDown = useCallback(e => {
|
|
32
|
+
if (['Enter', 'Space'].includes(e.code)) {
|
|
17
33
|
e.preventDefault();
|
|
18
|
-
if (onKeyboardRemove)
|
|
19
|
-
onKeyboardRemove(pillUid);
|
|
34
|
+
if (onKeyboardRemove) onKeyboardRemove(pillUid);
|
|
20
35
|
onRemove(e);
|
|
21
36
|
}
|
|
22
37
|
}, [onKeyboardRemove, onRemove, pillUid]);
|
|
23
|
-
return
|
|
24
|
-
size,
|
|
25
|
-
cols: [
|
|
38
|
+
return /*#__PURE__*/_jsx(StyledRemovablePillWrapper, {
|
|
39
|
+
size: size,
|
|
40
|
+
cols: ['auto', '24px'],
|
|
26
41
|
gutter: "2px",
|
|
27
42
|
alignItems: "center",
|
|
28
43
|
justifyItems: "center",
|
|
29
44
|
className: "ds-pill-wrapper ds-pill-wrapper-removable",
|
|
30
45
|
"data-testid": "ds-pill-wrapper",
|
|
31
46
|
"aria-label": ariaLabel || label
|
|
32
|
-
},
|
|
47
|
+
}, void 0, /*#__PURE__*/_jsx(TextComponent, {}, void 0, label), /*#__PURE__*/_jsx(DSPillButton, {
|
|
33
48
|
className: "ds-pill-focus-point",
|
|
34
49
|
id: pillUid,
|
|
35
50
|
"data-testid": "ds-pill-close-icon",
|
|
36
|
-
innerRef,
|
|
51
|
+
innerRef: innerRef,
|
|
37
52
|
onClick: onRemove,
|
|
38
|
-
onKeyDown,
|
|
39
|
-
"aria-label":
|
|
53
|
+
onKeyDown: onKeyDown,
|
|
54
|
+
"aria-label": "Remove ".concat(label),
|
|
40
55
|
type: "right"
|
|
41
|
-
},
|
|
56
|
+
}, void 0, /*#__PURE__*/_jsx(CloseXsmall, {
|
|
42
57
|
width: 22.65,
|
|
43
58
|
height: 22.65,
|
|
44
|
-
color: [
|
|
59
|
+
color: ['brand-primary', '700']
|
|
45
60
|
})));
|
|
46
61
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=RemovablePill.js.map
|
|
62
|
+
|
|
63
|
+
export { RemovablePill };
|
|
@@ -1,30 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
4
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { DSTooltipV2 } from '@elliemae/ds-tooltip';
|
|
7
|
+
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
8
|
+
import { StyledValuePillWrapper, StyledSpanWithTooltip } from '../styled.js';
|
|
9
|
+
|
|
10
|
+
const ValuePill = /*#__PURE__*/React.memo(_ref => {
|
|
11
|
+
let {
|
|
12
|
+
label,
|
|
11
13
|
size,
|
|
14
|
+
labelTruncated,
|
|
15
|
+
tooltipValue,
|
|
16
|
+
iconLeft,
|
|
17
|
+
ariaLabel
|
|
18
|
+
} = _ref;
|
|
19
|
+
const TextComponent = labelTruncated ? _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
children
|
|
22
|
+
} = _ref2;
|
|
23
|
+
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
24
|
+
value: children
|
|
25
|
+
});
|
|
26
|
+
} : React.Fragment;
|
|
27
|
+
return /*#__PURE__*/_jsx(StyledValuePillWrapper, {
|
|
28
|
+
size: size,
|
|
12
29
|
alignItems: "center",
|
|
13
30
|
className: "ds-pill-wrapper ds-pill-wrapper-value",
|
|
14
31
|
"data-testid": "ds-pill-wrapper",
|
|
15
32
|
"aria-label": ariaLabel || label,
|
|
16
|
-
cols: [iconLeft &&
|
|
33
|
+
cols: [iconLeft && 'min-content', 'auto'].filter(notFalse => notFalse),
|
|
17
34
|
gutter: "xxxs",
|
|
18
35
|
hasIcon: iconLeft !== null
|
|
19
|
-
}, iconLeft, tooltipValue !==
|
|
36
|
+
}, void 0, iconLeft, tooltipValue !== '' ? /*#__PURE__*/_jsx(DSTooltipV2, {
|
|
20
37
|
title: tooltipValue,
|
|
21
|
-
triggerComponent:
|
|
38
|
+
triggerComponent: /*#__PURE__*/_jsx(StyledSpanWithTooltip, {
|
|
22
39
|
className: "ds-pill-tooltip-value",
|
|
23
40
|
tabIndex: 0
|
|
24
|
-
}, label)
|
|
25
|
-
}) :
|
|
41
|
+
}, void 0, label)
|
|
42
|
+
}) : /*#__PURE__*/_jsx(TextComponent, {}, void 0, label));
|
|
26
43
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
30
|
-
//# sourceMappingURL=ValuePill.js.map
|
|
44
|
+
|
|
45
|
+
export { ValuePill };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export * from "./ValuePill";
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { DropdownPill } from './DropdownPill.js';
|
|
2
|
+
export { InputPill } from './InputPill.js';
|
|
3
|
+
export { LabelPill } from './LabelPill.js';
|
|
4
|
+
export { ReadOnlyPill } from './ReadOnlyPill.js';
|
|
5
|
+
export { RemovablePill } from './RemovablePill.js';
|
|
6
|
+
export { ValuePill } from './ValuePill.js';
|
|
@@ -1,63 +1,100 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
5
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
10
|
+
import { useRef, useState } from 'react';
|
|
11
|
+
import { PropTypes, describe } from 'react-desc';
|
|
12
|
+
import DSDropdownMenu from '@elliemae/ds-dropdownmenu';
|
|
13
|
+
import { ChevronDown } from '@elliemae/ds-icons';
|
|
14
|
+
import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
|
|
15
|
+
import { Pill } from './Pill.js';
|
|
16
|
+
import { jsx } from 'react/jsx-runtime';
|
|
17
|
+
|
|
18
|
+
var _ChevronDown;
|
|
19
|
+
|
|
20
|
+
const _excluded = ["containerProps", "label", "variant", "tabIndex", "closeMenuOnItemSelection", "maxWidth", "minWidth"];
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function DropdownPill(_ref) {
|
|
27
|
+
let {
|
|
28
|
+
containerProps = {},
|
|
29
|
+
label = '',
|
|
30
|
+
variant,
|
|
31
|
+
tabIndex = -1,
|
|
32
|
+
closeMenuOnItemSelection = false,
|
|
33
|
+
maxWidth,
|
|
34
|
+
minWidth
|
|
35
|
+
} = _ref,
|
|
36
|
+
dropdownProps = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
|
|
18
38
|
const ref = useRef(null);
|
|
19
39
|
const [chevronEl, chevronRef] = useState();
|
|
20
|
-
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
const {
|
|
41
|
+
focusFirst
|
|
42
|
+
} = useFocusGroupItem(ref);
|
|
43
|
+
return /*#__PURE__*/jsx(DSDropdownMenu, _objectSpread(_objectSpread({}, dropdownProps), {}, {
|
|
44
|
+
closeMenuOnItemSelection: closeMenuOnItemSelection,
|
|
45
|
+
maxWidth: maxWidth,
|
|
25
46
|
hideIfNotVisible: true,
|
|
26
|
-
menuProps: {
|
|
27
|
-
|
|
47
|
+
menuProps: {
|
|
48
|
+
className: 'dropdown-pill-menu',
|
|
49
|
+
zIndex: 100
|
|
50
|
+
},
|
|
51
|
+
minWidth: minWidth,
|
|
28
52
|
onClose: focusFirst,
|
|
29
53
|
referenceNode: chevronEl,
|
|
30
|
-
triggerComponent:
|
|
54
|
+
triggerComponent: /*#__PURE__*/_jsx(Pill, {
|
|
31
55
|
"data-testid": "dropdown-pill",
|
|
32
56
|
className: "dropdown-pill",
|
|
33
|
-
containerProps: {
|
|
57
|
+
containerProps: _objectSpread({
|
|
58
|
+
role: 'listbox'
|
|
59
|
+
}, containerProps),
|
|
34
60
|
innerRef: ref,
|
|
35
|
-
label,
|
|
36
|
-
rightAddon:
|
|
37
|
-
ref: chevronRef
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
61
|
+
label: label,
|
|
62
|
+
rightAddon: /*#__PURE__*/jsx("div", {
|
|
63
|
+
ref: chevronRef,
|
|
64
|
+
children: _ChevronDown || (_ChevronDown = /*#__PURE__*/_jsx(ChevronDown, {
|
|
65
|
+
className: "dropdown-pill-chevron-down",
|
|
66
|
+
"data-testid": "dropdown-pill-button"
|
|
67
|
+
}))
|
|
68
|
+
}),
|
|
69
|
+
tabIndex: tabIndex,
|
|
70
|
+
variant: variant
|
|
44
71
|
})
|
|
45
|
-
});
|
|
72
|
+
}));
|
|
46
73
|
}
|
|
74
|
+
|
|
47
75
|
const props = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
76
|
+
/** props injected to component wrapper */
|
|
77
|
+
containerProps: PropTypes.object.description('props injected to component wrapper'),
|
|
78
|
+
|
|
79
|
+
/** labeled pill text label */
|
|
80
|
+
label: PropTypes.string.isRequired.description('pill text label'),
|
|
81
|
+
|
|
82
|
+
/** pill variant */
|
|
83
|
+
variant: PropTypes.oneOf(['value', 'title']).description('pill variant'),
|
|
84
|
+
|
|
85
|
+
/** html focus border */
|
|
86
|
+
tabIndex: PropTypes.number.description('html focus order'),
|
|
87
|
+
|
|
88
|
+
/** close menu on item selection */
|
|
89
|
+
closeMenuOnItemSelection: PropTypes.bool.description('close menu on item selection'),
|
|
90
|
+
|
|
91
|
+
/** pill max width */
|
|
92
|
+
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill max width'),
|
|
93
|
+
|
|
94
|
+
/** pill min width */
|
|
95
|
+
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill min width')
|
|
55
96
|
};
|
|
56
|
-
DropdownPill.propTypes = props;
|
|
57
97
|
const DSDropdownPillWithSchema = describe(DropdownPill);
|
|
58
98
|
DSDropdownPillWithSchema.propTypes = props;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
DropdownPill
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=DropdownPill.js.map
|
|
99
|
+
|
|
100
|
+
export { DSDropdownPillWithSchema, DropdownPill };
|
|
@@ -1,45 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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 _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import 'react';
|
|
10
|
+
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
11
|
+
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
12
|
+
import { DSInput, DSInputMask } from '@elliemae/ds-form';
|
|
13
|
+
import { Pill } from './Pill.js';
|
|
14
|
+
import { jsx } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
const _excluded = ["containerProps", "placeholder", "onChange", "onRemove", "value", "type"];
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
const StyledInputPill = aggregatedClasses(Pill)('input-pill', null, _ref => {
|
|
22
|
+
let {
|
|
23
|
+
value
|
|
24
|
+
} = _ref;
|
|
25
|
+
return {
|
|
26
|
+
value
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
function InputPill(_ref2) {
|
|
30
|
+
let {
|
|
31
|
+
containerProps = {},
|
|
32
|
+
placeholder = 'Enter Value',
|
|
33
|
+
onChange = () => {},
|
|
34
|
+
onRemove,
|
|
35
|
+
value,
|
|
36
|
+
type
|
|
37
|
+
} = _ref2,
|
|
38
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded);
|
|
39
|
+
|
|
40
|
+
let TypeOfInput = DSInput; // TODO: implement the DSTimeInput, see how because it returns a moment()
|
|
41
|
+
// TODO: implement the DSDateInput
|
|
42
|
+
|
|
21
43
|
switch (type) {
|
|
22
|
-
case
|
|
44
|
+
case 'inputText':
|
|
23
45
|
TypeOfInput = DSInput;
|
|
24
46
|
break;
|
|
25
|
-
|
|
47
|
+
|
|
48
|
+
case 'inputMask':
|
|
26
49
|
TypeOfInput = DSInputMask;
|
|
27
50
|
break;
|
|
28
|
-
default:
|
|
29
|
-
break;
|
|
30
51
|
}
|
|
31
|
-
|
|
52
|
+
|
|
53
|
+
return /*#__PURE__*/_jsx(StyledInputPill, {
|
|
32
54
|
className: "input-pill",
|
|
33
|
-
classProps: {
|
|
34
|
-
|
|
35
|
-
|
|
55
|
+
classProps: {
|
|
56
|
+
value
|
|
57
|
+
},
|
|
58
|
+
containerProps: containerProps,
|
|
59
|
+
label: /*#__PURE__*/jsx(TypeOfInput, _objectSpread({
|
|
36
60
|
"data-testid": "input-pill",
|
|
37
|
-
onChange,
|
|
38
|
-
placeholder,
|
|
39
|
-
value
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
rightAddon: value && /* @__PURE__ */ React2.createElement(CloseXsmall, {
|
|
61
|
+
onChange: onChange,
|
|
62
|
+
placeholder: placeholder,
|
|
63
|
+
value: value
|
|
64
|
+
}, otherProps)),
|
|
65
|
+
rightAddon: value && /*#__PURE__*/_jsx(CloseXsmall, {
|
|
43
66
|
className: "remove-pill-button",
|
|
44
67
|
"data-testid": "remove-pill-button",
|
|
45
68
|
onClick: onRemove
|
|
@@ -47,7 +70,5 @@ function InputPill({
|
|
|
47
70
|
tabIndex: -1
|
|
48
71
|
});
|
|
49
72
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
53
|
-
//# sourceMappingURL=InputPill.js.map
|
|
73
|
+
|
|
74
|
+
export { InputPill };
|
|
@@ -1,73 +1,95 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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 _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
9
|
+
import 'react';
|
|
10
|
+
import { PropTypes, describe } from 'react-desc';
|
|
11
|
+
import { PillGroup } from './PillGroup.js';
|
|
12
|
+
import LabeledDropdownSinglePill from './LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js';
|
|
13
|
+
import LabeledDropdownMultiPills from './LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js';
|
|
14
|
+
import LabeledDropdownCascadeMenuPill from './LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js';
|
|
15
|
+
import { jsx } from 'react/jsx-runtime';
|
|
16
|
+
|
|
17
|
+
const _excluded = ["label", "value", "type", "onFocusNextGroup", "onFocusPreviousGroup", "onFocusGroupSet", "maxWidth", "minWidth", "fixed"];
|
|
18
|
+
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
8
22
|
const DropdownPills = {
|
|
9
23
|
single: LabeledDropdownSinglePill,
|
|
10
24
|
multi: LabeledDropdownMultiPills,
|
|
11
25
|
cascaded: LabeledDropdownCascadeMenuPill
|
|
12
26
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
maxWidth,
|
|
22
|
-
minWidth,
|
|
23
|
-
fixed,
|
|
24
|
-
...menuProps
|
|
25
|
-
}) {
|
|
26
|
-
const Component = createDropdownPill(type);
|
|
27
|
-
return /* @__PURE__ */ React2.createElement(PillGroup, {
|
|
28
|
-
onFocusGroupSet,
|
|
27
|
+
|
|
28
|
+
const createDropdownPill = type => DropdownPills[type] || DropdownPills.single;
|
|
29
|
+
|
|
30
|
+
function LabeledDropdownPills(_ref) {
|
|
31
|
+
let {
|
|
32
|
+
label = '',
|
|
33
|
+
value,
|
|
34
|
+
type,
|
|
29
35
|
onFocusNextGroup,
|
|
30
|
-
onFocusPreviousGroup
|
|
31
|
-
|
|
32
|
-
...menuProps,
|
|
33
|
-
label,
|
|
36
|
+
onFocusPreviousGroup,
|
|
37
|
+
onFocusGroupSet,
|
|
34
38
|
maxWidth,
|
|
35
39
|
minWidth,
|
|
36
|
-
value,
|
|
37
40
|
fixed
|
|
38
|
-
}
|
|
41
|
+
} = _ref,
|
|
42
|
+
menuProps = _objectWithoutProperties(_ref, _excluded);
|
|
43
|
+
|
|
44
|
+
const Component = createDropdownPill(type);
|
|
45
|
+
return /*#__PURE__*/_jsx(PillGroup, {
|
|
46
|
+
onFocusGroupSet: onFocusGroupSet,
|
|
47
|
+
onFocusNextGroup: onFocusNextGroup,
|
|
48
|
+
onFocusPreviousGroup: onFocusPreviousGroup
|
|
49
|
+
}, void 0, /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, menuProps), {}, {
|
|
50
|
+
label: label,
|
|
51
|
+
maxWidth: maxWidth,
|
|
52
|
+
minWidth: minWidth,
|
|
53
|
+
value: value,
|
|
54
|
+
fixed: fixed
|
|
55
|
+
})));
|
|
39
56
|
}
|
|
57
|
+
|
|
40
58
|
const props = {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
/** pill type */
|
|
60
|
+
type: PropTypes.oneOf(['single', 'multi', 'cascaded']).description('pill type'),
|
|
61
|
+
|
|
62
|
+
/** focus next group callback */
|
|
63
|
+
onFocusNextGroup: PropTypes.func.description('focus next group callback'),
|
|
64
|
+
|
|
65
|
+
/** focus prev group callback */
|
|
66
|
+
onFocusPreviousGroup: PropTypes.func.description('focus prev group callback'),
|
|
67
|
+
|
|
68
|
+
/** focus group set callback */
|
|
69
|
+
onFocusGroupSet: PropTypes.func.description('focus group set callback'),
|
|
70
|
+
|
|
71
|
+
/** pill max width */
|
|
72
|
+
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill max width'),
|
|
73
|
+
|
|
74
|
+
/** pill min width */
|
|
75
|
+
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill min width'),
|
|
76
|
+
|
|
77
|
+
/** fixed pill */
|
|
78
|
+
fixed: PropTypes.bool.description('fixed pill'),
|
|
79
|
+
|
|
80
|
+
/** pill label text */
|
|
81
|
+
label: PropTypes.string.isRequired.description('pill label text'),
|
|
82
|
+
|
|
83
|
+
/** pill value */
|
|
84
|
+
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({
|
|
85
|
+
id: PropTypes.string,
|
|
86
|
+
label: PropTypes.string
|
|
87
|
+
})), PropTypes.shape({
|
|
88
|
+
id: PropTypes.string,
|
|
89
|
+
label: PropTypes.string
|
|
90
|
+
})]).description('pill value')
|
|
65
91
|
};
|
|
66
|
-
LabeledDropdownPills.propTypes = props;
|
|
67
92
|
const DSLabeledDropdownPillsWithSchema = describe(LabeledDropdownPills);
|
|
68
93
|
DSLabeledDropdownPillsWithSchema.propTypes = props;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
LabeledDropdownPills
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=LabeledDropdownPills.js.map
|
|
94
|
+
|
|
95
|
+
export { DSLabeledDropdownPillsWithSchema, LabeledDropdownPills };
|