@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
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
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.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
12
|
import { useState, useEffect, useCallback } from 'react';
|
|
5
13
|
import { find } from 'lodash';
|
|
6
|
-
import { isFunction, addOrRemove } from '@elliemae/ds-utilities
|
|
14
|
+
import { isFunction, addOrRemove } from '@elliemae/ds-utilities';
|
|
7
15
|
import { RemovablePill } from '../RemovablePill.js';
|
|
8
16
|
import { Pill } from '../Pill.js';
|
|
9
17
|
import { OverflowPill } from '../OverflowPill.js';
|
|
@@ -128,7 +136,7 @@ function LabeledDropdownMultiPills(_ref) {
|
|
|
128
136
|
|
|
129
137
|
return null;
|
|
130
138
|
}), selectedOptions && selectedOptions.length > overflowQuantity && /*#__PURE__*/_jsx(OverflowPill, {
|
|
131
|
-
label:
|
|
139
|
+
label: "+ ".concat(selectedOptions.length - overflowQuantity),
|
|
132
140
|
options: overflowOptions
|
|
133
141
|
})]
|
|
134
142
|
});
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
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.find.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
7
|
+
import 'core-js/modules/esnext.iterator.find.js';
|
|
8
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
9
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
10
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
11
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
12
|
import { useState, useEffect, useLayoutEffect, useCallback } from 'react';
|
|
5
|
-
import usePrevious from '@elliemae/ds-utilities
|
|
6
|
-
import useShouldRecalculate from '@elliemae/ds-utilities/hooks/useShouldRecalculate';
|
|
7
|
-
import { isFunction, isString } from '@elliemae/ds-utilities/utils';
|
|
13
|
+
import { usePrevious, useShouldRecalculate, isFunction, isString } from '@elliemae/ds-utilities';
|
|
8
14
|
import { DropdownPill } from '../DropdownPill.js';
|
|
9
15
|
import { InputPill } from '../InputPill.js';
|
|
10
16
|
import { Pill } from '../Pill.js';
|
|
@@ -61,11 +67,12 @@ function LabeledDropdownSinglePill(_ref) {
|
|
|
61
67
|
setOptionValue(option);
|
|
62
68
|
onSelect(option);
|
|
63
69
|
}, [onChange, onSelect]);
|
|
64
|
-
const onChangeInputValue = useCallback(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
const onChangeInputValue = useCallback(_ref2 => {
|
|
71
|
+
let {
|
|
72
|
+
target: {
|
|
73
|
+
value: inputValue
|
|
74
|
+
}
|
|
75
|
+
} = _ref2;
|
|
69
76
|
const {
|
|
70
77
|
onChangeInput
|
|
71
78
|
} = optionValue;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
3
|
+
import { isEqual } from '@elliemae/ds-utilities';
|
|
2
4
|
import { omit } from 'lodash';
|
|
3
5
|
|
|
4
6
|
const hasOptionChanged = (prevOptions, options) => {
|
|
@@ -5,14 +5,15 @@ import { PillGroup } from './PillGroup.js';
|
|
|
5
5
|
import { RemovablePill } from './RemovablePill.js';
|
|
6
6
|
import { Pill } from './Pill.js';
|
|
7
7
|
|
|
8
|
-
function LabeledPills({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
function LabeledPills(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
children,
|
|
11
|
+
label = '',
|
|
12
|
+
leftAddon,
|
|
13
|
+
onFocusGroupSet,
|
|
14
|
+
onFocusNextGroup,
|
|
15
|
+
onFocusPreviousGroup
|
|
16
|
+
} = _ref;
|
|
16
17
|
return /*#__PURE__*/_jsx(PillGroup, {
|
|
17
18
|
onFocusGroupSet: onFocusGroupSet,
|
|
18
19
|
onFocusNextGroup: onFocusNextGroup,
|
|
@@ -1,15 +1,20 @@
|
|
|
1
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';
|
|
2
6
|
import { useRef, useState, useEffect } from 'react';
|
|
3
7
|
import { PropTypes, describe } from 'react-desc';
|
|
4
8
|
import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
|
|
5
9
|
import DSTooltip from '@elliemae/ds-tooltip';
|
|
6
10
|
import { Pill } from './Pill.js';
|
|
7
11
|
|
|
8
|
-
function OverflowPill({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
function OverflowPill(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
containerProps = {},
|
|
15
|
+
label = '',
|
|
16
|
+
options = []
|
|
17
|
+
} = _ref;
|
|
13
18
|
const ref = useRef(null);
|
|
14
19
|
const [tooltipIsOpen, setTooltipIsOpen] = useState(false);
|
|
15
20
|
const [tooltipText, setTooltipText] = useState('');
|
|
@@ -17,9 +22,9 @@ function OverflowPill({
|
|
|
17
22
|
let text = '';
|
|
18
23
|
options.forEach(option => {
|
|
19
24
|
if (!tooltipText || option === options[0]) {
|
|
20
|
-
text =
|
|
25
|
+
text = "".concat(option.label);
|
|
21
26
|
} else {
|
|
22
|
-
text = text.concat(
|
|
27
|
+
text = text.concat(", ".concat(option.label));
|
|
23
28
|
}
|
|
24
29
|
});
|
|
25
30
|
setTooltipText(text);
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
@@ -12,17 +17,20 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
17
|
|
|
13
18
|
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; }
|
|
14
19
|
const pillBlockName = 'pill';
|
|
15
|
-
const PillWrapper = aggregatedClasses('div')(pillBlockName, null,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
});
|
|
22
30
|
const PillLabel = aggregatedClasses('span')(pillBlockName, 'label');
|
|
23
31
|
const PillAddon = aggregatedClasses('div')(pillBlockName, 'addon');
|
|
24
32
|
|
|
25
|
-
function Pill(
|
|
33
|
+
function Pill(_ref2) {
|
|
26
34
|
let {
|
|
27
35
|
containerProps = {},
|
|
28
36
|
label = '',
|
|
@@ -30,8 +38,8 @@ function Pill(_ref) {
|
|
|
30
38
|
rightAddon,
|
|
31
39
|
variant = 'value',
|
|
32
40
|
size = 'm'
|
|
33
|
-
} =
|
|
34
|
-
otherProps = _objectWithoutProperties(
|
|
41
|
+
} = _ref2,
|
|
42
|
+
otherProps = _objectWithoutProperties(_ref2, _excluded);
|
|
35
43
|
|
|
36
44
|
return /*#__PURE__*/jsxs(PillWrapper, _objectSpread(_objectSpread(_objectSpread({}, containerProps), {}, {
|
|
37
45
|
classProps: {
|
|
@@ -1,3 +1,8 @@
|
|
|
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';
|
|
1
6
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
7
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
3
8
|
import 'react';
|
|
@@ -12,23 +17,26 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
12
17
|
const pillGroupBlockName = 'pill-group';
|
|
13
18
|
const Container = aggregatedClasses('div')(pillGroupBlockName);
|
|
14
19
|
|
|
15
|
-
const PillGroup =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
})
|
|
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
|
+
};
|
|
32
40
|
|
|
33
41
|
const props = {
|
|
34
42
|
/** props injected to component wrapper */
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
3
|
import { useRef, useState } from 'react';
|
|
3
4
|
import { PropTypes, describe } from 'react-desc';
|
|
4
|
-
import InfoCircleSmall from '@elliemae/ds-icons
|
|
5
|
+
import { InfoCircleSmall } from '@elliemae/ds-icons';
|
|
5
6
|
import DSModal, { MODAL_TYPE_V2 } from '@elliemae/ds-modal';
|
|
6
7
|
import Popover from '@elliemae/ds-popover';
|
|
7
8
|
import { Pill } from './Pill.js';
|
|
8
9
|
import { jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
10
|
|
|
10
|
-
const ReadOnlyPill =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const ReadOnlyPill = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
containerProps = {},
|
|
14
|
+
modalContent = '',
|
|
15
|
+
label = '',
|
|
16
|
+
leftAddon,
|
|
17
|
+
modalTitle = '',
|
|
18
|
+
tooltipText = ''
|
|
19
|
+
} = _ref;
|
|
18
20
|
const ref = useRef(null);
|
|
19
21
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
20
22
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
@@ -36,18 +38,21 @@ const ReadOnlyPill = ({
|
|
|
36
38
|
content: tooltipText,
|
|
37
39
|
placement: "top",
|
|
38
40
|
showArrow: true,
|
|
39
|
-
renderTrigger:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
}
|
|
51
56
|
}),
|
|
52
57
|
tabIndex: -1
|
|
53
58
|
}), /*#__PURE__*/_jsx(DSModal, {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import { PropTypes, describe } from 'react-desc';
|
|
4
|
-
import { isFunction } from '@elliemae/ds-utilities
|
|
5
|
-
import CloseXsmall from '@elliemae/ds-icons
|
|
4
|
+
import { isFunction } from '@elliemae/ds-utilities';
|
|
5
|
+
import { CloseXsmall } from '@elliemae/ds-icons';
|
|
6
6
|
import useFocusGroupItem from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';
|
|
7
7
|
import { Pill } from './Pill.js';
|
|
8
8
|
|
|
9
|
-
function RemovablePill({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
function RemovablePill(_ref) {
|
|
10
|
+
let {
|
|
11
|
+
containerProps = {},
|
|
12
|
+
label = '',
|
|
13
|
+
onRemove,
|
|
14
|
+
size = 'm',
|
|
15
|
+
leftAddon
|
|
16
|
+
} = _ref;
|
|
16
17
|
const ref = useRef(null);
|
|
17
18
|
const {
|
|
18
19
|
focusPrevious
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { DSPillWithSchema, Pill, Pill as default } from './Pill.js';
|
|
2
|
+
export { Container, DSPillGroupWithSchema, PillGroup } from './PillGroup.js';
|
|
3
|
+
export { DSLabeledDropdownPillsWithSchema, LabeledDropdownPills } from './LabeledDropdownPills.js';
|
|
4
|
+
export { DSLabeledPillsWithSchema, LabeledPills } from './LabeledPills.js';
|
|
5
|
+
export { DSDropdownPillWithSchema, DropdownPill } from './DropdownPill.js';
|
|
6
|
+
export { DSRemovablePillWithSchema, RemovablePill } from './RemovablePill.js';
|
|
7
|
+
export { DSReadOnlyPillWithSchema, ReadOnlyPill } from './ReadOnlyPill.js';
|
|
8
|
+
export { DSOverflowPillWithSchema, OverflowPill } from './OverflowPill.js';
|
package/esm/index.d.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export { DSPillWithSchema, Pill, Pill as default } from './Pill.js';
|
|
2
|
-
export { Container, DSPillGroupWithSchema, PillGroup } from './PillGroup.js';
|
|
3
|
-
export { DSLabeledDropdownPillsWithSchema, LabeledDropdownPills } from './LabeledDropdownPills.js';
|
|
4
|
-
export { DSLabeledPillsWithSchema, LabeledPills } from './LabeledPills.js';
|
|
5
|
-
export { DSDropdownPillWithSchema, DropdownPill } from './DropdownPill.js';
|
|
6
|
-
export { DSRemovablePillWithSchema, RemovablePill } from './RemovablePill.js';
|
|
7
|
-
export { DSReadOnlyPillWithSchema, ReadOnlyPill } from './ReadOnlyPill.js';
|
|
8
|
-
export { DSOverflowPillWithSchema, OverflowPill } from './OverflowPill.js';
|
|
1
|
+
export { DSPillWithSchema, Pill, Pill as default } from './deprecated/Pill.js';
|
|
2
|
+
export { Container, DSPillGroupWithSchema, PillGroup } from './deprecated/PillGroup.js';
|
|
3
|
+
export { DSLabeledDropdownPillsWithSchema, LabeledDropdownPills } from './deprecated/LabeledDropdownPills.js';
|
|
4
|
+
export { DSLabeledPillsWithSchema, LabeledPills } from './deprecated/LabeledPills.js';
|
|
5
|
+
export { DSDropdownPillWithSchema, DropdownPill } from './deprecated/DropdownPill.js';
|
|
6
|
+
export { DSRemovablePillWithSchema, RemovablePill } from './deprecated/RemovablePill.js';
|
|
7
|
+
export { DSReadOnlyPillWithSchema, ReadOnlyPill } from './deprecated/ReadOnlyPill.js';
|
|
8
|
+
export { DSOverflowPillWithSchema, OverflowPill } from './deprecated/OverflowPill.js';
|
|
9
|
+
export { DSPillV2, DSPillV2WithSchema } from './components/Pill.js';
|
|
10
|
+
export { DSPillGroupV2, DSPillGroupV2Context, DSPillGroupV2WithSchema } from './components/PillGroup.js';
|
|
11
|
+
export { DSPillButton, DSPillButtonWithSchema } from './components/PillButton.js';
|
package/esm/props.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
import { DSInput } from '@elliemae/ds-form';
|
|
3
|
+
|
|
4
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
|
5
|
+
const pillTypes = PropTypes.oneOf(['label', 'value', 'input', 'dropdown', 'removable', 'readonly']);
|
|
6
|
+
const DSPillV2PropTypes = {
|
|
7
|
+
label: PropTypes.string.description('Label to show in the pill').isRequired,
|
|
8
|
+
type: pillTypes.description('The type of pill that you want to render').isRequired,
|
|
9
|
+
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Reference to the focuseable internal element of each pill (remove icons, inputs, dropdown, etc.)').defaultValue(() => null),
|
|
10
|
+
size: PropTypes.oneOf(['s', 'm']).description('Vertical pill size').defaultValue('m'),
|
|
11
|
+
ariaLabel: PropTypes.string.description('Aria label for the pill. If not provided we will use the label').defaultValue(''),
|
|
12
|
+
labelTruncated: PropTypes.bool.description('Whether to truncate the pills label').defaultValue(true),
|
|
13
|
+
tooltipValue: PropTypes.string.description('String to show as a tooltip in the value pill').defaultValue(''),
|
|
14
|
+
iconLeft: PropTypes.node.description('A component to show int the left of a readonly pill').defaultValue(null),
|
|
15
|
+
iconRight: PropTypes.node.description('A component to show in the right of a readonly pill').defaultValue(null),
|
|
16
|
+
onRemove: PropTypes.func.description('Callback triggered when removing a pill with the close icon').defaultValue(() => null),
|
|
17
|
+
inputPlaceholder: PropTypes.string.description('Placeholder for the input pill').defaultValue(''),
|
|
18
|
+
onInputChange: PropTypes.func.description('Callback triggered when user provides input to the input pill').defaultValue(() => null),
|
|
19
|
+
onInputClear: PropTypes.func.description('Callback triggered when the user clears an input pill').defaultValue(() => null),
|
|
20
|
+
inputWidth: PropTypes.number.description('Width in pixels for the input tag in the input pill').defaultValue(150),
|
|
21
|
+
dropdownProps: PropTypes.object.description('Properties that will be used for the dropdown-menu').defaultValue({}),
|
|
22
|
+
onDropdownClick: PropTypes.func.description('Callback when dropdown button is clicked or pressed').defaultValue(() => null)
|
|
23
|
+
};
|
|
24
|
+
const DSPillButtonPropTypes = {
|
|
25
|
+
type: PropTypes.oneOf(['only', 'left', 'right']).description('The position in which this button will be placed. Only used for css styling internally').defaultValue('right'),
|
|
26
|
+
width: PropTypes.string.description('Width of the button').defaultValue('100%'),
|
|
27
|
+
height: PropTypes.string.description('Height of the button').defaultValue('100%')
|
|
28
|
+
};
|
|
29
|
+
const DSPillGroupPropTypes = {
|
|
30
|
+
width: PropTypes.string.description('Width of the group').defaultValue('fit-content'),
|
|
31
|
+
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func]).description('Reference to the pill group wrapper').defaultValue(() => null)
|
|
32
|
+
};
|
|
33
|
+
const DSPillV2DefaultProps = {
|
|
34
|
+
innerRef: () => null,
|
|
35
|
+
ariaLabel: '',
|
|
36
|
+
size: 'm',
|
|
37
|
+
labelTruncated: true,
|
|
38
|
+
tooltipValue: '',
|
|
39
|
+
iconLeft: null,
|
|
40
|
+
iconRight: null,
|
|
41
|
+
onRemove: () => null,
|
|
42
|
+
inputPlaceholder: '',
|
|
43
|
+
onInputChange: () => null,
|
|
44
|
+
onInputClear: () => null,
|
|
45
|
+
inputWidth: 72,
|
|
46
|
+
inputRender: DSInput,
|
|
47
|
+
dropdownProps: {},
|
|
48
|
+
onDropdownClick: () => null
|
|
49
|
+
};
|
|
50
|
+
const DSPillButtonDefaultProps = {
|
|
51
|
+
type: 'right',
|
|
52
|
+
width: '100%',
|
|
53
|
+
height: '100%'
|
|
54
|
+
};
|
|
55
|
+
const DSPillGroupDefaultProps = {
|
|
56
|
+
width: 'fit-content',
|
|
57
|
+
innerRef: () => null
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { DSPillButtonDefaultProps, DSPillButtonPropTypes, DSPillGroupDefaultProps, DSPillGroupPropTypes, DSPillV2DefaultProps, DSPillV2PropTypes };
|
package/esm/utils.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
2
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
4
|
+
|
|
5
|
+
const setMultipleRefs = function () {
|
|
6
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7
|
+
refs[_key] = arguments[_key];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return _ref => {
|
|
11
|
+
refs.forEach(ref => {
|
|
12
|
+
if (!ref || !_ref) return;
|
|
13
|
+
|
|
14
|
+
if (typeof ref === 'function') {
|
|
15
|
+
ref(_ref);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (ref) ref.current = _ref;
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { setMultipleRefs };
|