@elliemae/ds-pills 2.2.0 → 2.3.0-alpha.3
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 +56 -49
- package/cjs/components/Pill.js.map +7 -0
- package/cjs/components/PillButton.js +54 -52
- package/cjs/components/PillButton.js.map +7 -0
- package/cjs/components/PillGroup.js +61 -53
- package/cjs/components/PillGroup.js.map +7 -0
- package/cjs/components/index.js +30 -17
- package/cjs/components/index.js.map +7 -0
- package/cjs/components/styled.js +228 -78
- package/cjs/components/styled.js.map +7 -0
- package/cjs/components/types/DropdownPill.js +79 -77
- package/cjs/components/types/DropdownPill.js.map +7 -0
- package/cjs/components/types/InputPill.js +58 -48
- package/cjs/components/types/InputPill.js.map +7 -0
- package/cjs/components/types/LabelPill.js +44 -38
- package/cjs/components/types/LabelPill.js.map +7 -0
- package/cjs/components/types/ReadOnlyPill.js +48 -43
- package/cjs/components/types/ReadOnlyPill.js.map +7 -0
- package/cjs/components/types/RemovablePill.js +60 -53
- package/cjs/components/types/RemovablePill.js.map +7 -0
- package/cjs/components/types/ValuePill.js +48 -43
- package/cjs/components/types/ValuePill.js.map +7 -0
- package/cjs/components/types/index.js +33 -19
- package/cjs/components/types/index.js.map +7 -0
- package/cjs/deprecated/DropdownPill.js +80 -101
- package/cjs/deprecated/DropdownPill.js.map +7 -0
- package/cjs/deprecated/InputPill.js +67 -69
- package/cjs/deprecated/InputPill.js.map +7 -0
- package/cjs/deprecated/LabeledDropdownPills.js +92 -96
- package/cjs/deprecated/LabeledDropdownPills.js.map +7 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +91 -94
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +106 -114
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +119 -127
- package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
- package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +39 -15
- package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
- package/cjs/deprecated/LabeledPills.js +65 -52
- package/cjs/deprecated/LabeledPills.js.map +7 -0
- package/cjs/deprecated/OverflowPill.js +59 -53
- package/cjs/deprecated/OverflowPill.js.map +7 -0
- package/cjs/deprecated/Pill.js +67 -82
- package/cjs/deprecated/Pill.js.map +7 -0
- package/cjs/deprecated/PillGroup.js +68 -68
- package/cjs/deprecated/PillGroup.js.map +7 -0
- package/cjs/deprecated/ReadOnlyPill.js +93 -94
- package/cjs/deprecated/ReadOnlyPill.js.map +7 -0
- package/cjs/deprecated/RemovablePill.js +61 -57
- package/cjs/deprecated/RemovablePill.js.map +7 -0
- package/cjs/deprecated/index.js +43 -33
- package/cjs/deprecated/index.js.map +7 -0
- package/cjs/index.d.js +27 -2
- package/cjs/index.d.js.map +7 -0
- package/cjs/index.js +37 -43
- package/cjs/index.js.map +7 -0
- package/cjs/props.js +72 -46
- package/cjs/props.js.map +7 -0
- package/cjs/utils.js +43 -25
- package/cjs/utils.js.map +7 -0
- package/esm/components/Pill.js +18 -31
- package/esm/components/Pill.js.map +7 -0
- package/esm/components/PillButton.js +22 -39
- package/esm/components/PillButton.js.map +7 -0
- package/esm/components/PillGroup.js +28 -38
- package/esm/components/PillGroup.js.map +7 -0
- package/esm/components/index.js +5 -3
- package/esm/components/index.js.map +7 -0
- package/esm/components/styled.js +205 -66
- package/esm/components/styled.js.map +7 -0
- package/esm/components/types/DropdownPill.js +50 -67
- package/esm/components/types/DropdownPill.js.map +7 -0
- package/esm/components/types/InputPill.js +25 -35
- package/esm/components/types/InputPill.js.map +7 -0
- package/esm/components/types/LabelPill.js +15 -29
- package/esm/components/types/LabelPill.js.map +7 -0
- package/esm/components/types/ReadOnlyPill.js +19 -34
- package/esm/components/types/ReadOnlyPill.js.map +7 -0
- package/esm/components/types/RemovablePill.js +31 -44
- package/esm/components/types/RemovablePill.js.map +7 -0
- package/esm/components/types/ValuePill.js +19 -34
- package/esm/components/types/ValuePill.js.map +7 -0
- package/esm/components/types/index.js +8 -6
- package/esm/components/types/index.js.map +7 -0
- package/esm/deprecated/DropdownPill.js +49 -86
- package/esm/deprecated/DropdownPill.js.map +7 -0
- package/esm/deprecated/InputPill.js +38 -59
- package/esm/deprecated/InputPill.js.map +7 -0
- package/esm/deprecated/LabeledDropdownPills.js +59 -81
- package/esm/deprecated/LabeledDropdownPills.js.map +7 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +60 -84
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +65 -94
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +79 -108
- package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
- package/esm/deprecated/LabeledDropdownPillsTypes/utils.js +9 -10
- package/esm/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
- package/esm/deprecated/LabeledPills.js +34 -41
- package/esm/deprecated/LabeledPills.js.map +7 -0
- package/esm/deprecated/OverflowPill.js +25 -37
- package/esm/deprecated/OverflowPill.js.map +7 -0
- package/esm/deprecated/Pill.js +39 -71
- package/esm/deprecated/Pill.js.map +7 -0
- package/esm/deprecated/PillGroup.js +39 -56
- package/esm/deprecated/PillGroup.js.map +7 -0
- package/esm/deprecated/ReadOnlyPill.js +60 -79
- package/esm/deprecated/ReadOnlyPill.js.map +7 -0
- package/esm/deprecated/RemovablePill.js +30 -45
- package/esm/deprecated/RemovablePill.js.map +7 -0
- package/esm/deprecated/index.js +14 -8
- package/esm/deprecated/index.js.map +7 -0
- package/esm/index.d.js +2 -1
- package/esm/index.d.js.map +7 -0
- package/esm/index.js +8 -11
- package/esm/index.js.map +7 -0
- package/esm/props.js +42 -36
- package/esm/props.js.map +7 -0
- package/esm/utils.js +16 -23
- package/esm/utils.js.map +7 -0
- package/package.json +15 -15
- package/types/deprecated/LabeledDropdownPills.d.ts +1 -1
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +3 -1
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +3 -1
- package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +1 -0
|
@@ -1,62 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
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;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useRef, useState, useEffect } from "react";
|
|
3
|
+
import { PropTypes, describe } from "react-desc";
|
|
4
|
+
import { useFocusGroupItem } from "@elliemae/ds-shared/FocusGroup/useFocusGroupItem";
|
|
5
|
+
import { DSTooltip } from "@elliemae/ds-tooltip";
|
|
6
|
+
import { Pill } from "./Pill";
|
|
7
|
+
function OverflowPill({ containerProps = {}, label = "", options = [] }) {
|
|
18
8
|
const ref = useRef(null);
|
|
19
9
|
const [tooltipIsOpen, setTooltipIsOpen] = useState(false);
|
|
20
|
-
const [tooltipText, setTooltipText] = useState(
|
|
10
|
+
const [tooltipText, setTooltipText] = useState("");
|
|
21
11
|
useEffect(() => {
|
|
22
|
-
let text =
|
|
23
|
-
options.forEach(option => {
|
|
12
|
+
let text = "";
|
|
13
|
+
options.forEach((option) => {
|
|
24
14
|
if (!tooltipText || option === options[0]) {
|
|
25
|
-
text =
|
|
15
|
+
text = `${option.label}`;
|
|
26
16
|
} else {
|
|
27
|
-
text = text.concat(
|
|
17
|
+
text = text.concat(`, ${option.label}`);
|
|
28
18
|
}
|
|
29
19
|
});
|
|
30
20
|
setTooltipText(text);
|
|
31
21
|
}, [options]);
|
|
32
22
|
useFocusGroupItem(ref);
|
|
33
|
-
return
|
|
23
|
+
return /* @__PURE__ */ React2.createElement(DSTooltip, {
|
|
34
24
|
isOpen: tooltipIsOpen,
|
|
35
25
|
title: tooltipText,
|
|
36
26
|
zIndex: 11,
|
|
37
|
-
triggerComponent:
|
|
27
|
+
triggerComponent: /* @__PURE__ */ React2.createElement(Pill, {
|
|
38
28
|
className: "overflow-pill",
|
|
39
|
-
containerProps
|
|
29
|
+
containerProps,
|
|
40
30
|
innerRef: ref,
|
|
41
|
-
label
|
|
31
|
+
label,
|
|
42
32
|
tabIndex: -1,
|
|
43
33
|
onMouseEnter: () => setTooltipIsOpen(true),
|
|
44
34
|
onMouseLeave: () => setTooltipIsOpen(false)
|
|
45
35
|
})
|
|
46
36
|
});
|
|
47
37
|
}
|
|
48
|
-
|
|
49
38
|
const props = {
|
|
50
|
-
|
|
51
|
-
|
|
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')
|
|
39
|
+
containerProps: PropTypes.object.description("props to inject to pill wrapper"),
|
|
40
|
+
label: PropTypes.string.isRequired.description("pill text label"),
|
|
41
|
+
options: PropTypes.array.description("overflow pills options")
|
|
58
42
|
};
|
|
43
|
+
OverflowPill.propTypes = props;
|
|
59
44
|
const DSOverflowPillWithSchema = describe(OverflowPill);
|
|
60
45
|
DSOverflowPillWithSchema.propTypes = props;
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
export {
|
|
47
|
+
DSOverflowPillWithSchema,
|
|
48
|
+
OverflowPill
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=OverflowPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/OverflowPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useRef, useState, useEffect } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';\nimport { DSTooltip } from '@elliemae/ds-tooltip';\nimport { Pill } from './Pill';\n\nfunction OverflowPill({ containerProps = {}, label = '', options = [] }) {\n const ref = useRef(null);\n const [tooltipIsOpen, setTooltipIsOpen] = useState(false);\n const [tooltipText, setTooltipText] = useState('');\n\n useEffect(() => {\n let text = '';\n options.forEach((option) => {\n if (!tooltipText || option === options[0]) {\n text = `${option.label}`;\n } else {\n text = text.concat(`, ${option.label}`);\n }\n });\n setTooltipText(text);\n }, [options]);\n\n useFocusGroupItem(ref);\n\n return (\n <DSTooltip\n isOpen={tooltipIsOpen}\n title={tooltipText}\n zIndex={11}\n triggerComponent={\n <Pill\n className=\"overflow-pill\"\n containerProps={containerProps}\n innerRef={ref}\n label={label}\n tabIndex={-1}\n onMouseEnter={() => setTooltipIsOpen(true)}\n onMouseLeave={() => setTooltipIsOpen(false)}\n />\n }\n />\n );\n}\n\nconst props = {\n /** props to inject to pill wrapper */\n containerProps: PropTypes.object.description(\n 'props to inject to pill wrapper',\n ),\n /** pill text label */\n label: PropTypes.string.isRequired.description('pill text label'),\n /** overflow pills options */\n options: PropTypes.array.description('overflow pills options'),\n};\n\nOverflowPill.propTypes = props;\nconst DSOverflowPillWithSchema = describe(OverflowPill);\nDSOverflowPillWithSchema.propTypes = props;\n\nexport { OverflowPill, DSOverflowPillWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA,sBAAsB,EAAE,iBAAiB,IAAI,QAAQ,IAAI,UAAU,MAAM;AACvE,QAAM,MAAM,OAAO;AACnB,QAAM,CAAC,eAAe,oBAAoB,SAAS;AACnD,QAAM,CAAC,aAAa,kBAAkB,SAAS;AAE/C,YAAU,MAAM;AACd,QAAI,OAAO;AACX,YAAQ,QAAQ,CAAC,WAAW;AAC1B,UAAI,CAAC,eAAe,WAAW,QAAQ,IAAI;AACzC,eAAO,GAAG,OAAO;AAAA,aACZ;AACL,eAAO,KAAK,OAAO,KAAK,OAAO;AAAA;AAAA;AAGnC,mBAAe;AAAA,KACd,CAAC;AAEJ,oBAAkB;AAElB,SACE,qCAAC,WAAD;AAAA,IACE,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,kBACE,qCAAC,MAAD;AAAA,MACE,WAAU;AAAA,MACV;AAAA,MACA,UAAU;AAAA,MACV;AAAA,MACA,UAAU;AAAA,MACV,cAAc,MAAM,iBAAiB;AAAA,MACrC,cAAc,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAO/C,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,UAAU,OAAO,YAC/B;AAAA,EAGF,OAAO,UAAU,OAAO,WAAW,YAAY;AAAA,EAE/C,SAAS,UAAU,MAAM,YAAY;AAAA;AAGvC,aAAa,YAAY;AACzB,MAAM,2BAA2B,SAAS;AAC1C,yBAAyB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/deprecated/Pill.js
CHANGED
|
@@ -1,76 +1,44 @@
|
|
|
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
|
-
variant
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
}));
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { PropTypes, describe } from "react-desc";
|
|
4
|
+
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
5
|
+
const pillBlockName = "pill";
|
|
6
|
+
const PillWrapper = aggregatedClasses("div")(pillBlockName, null, ({ size, variant }) => ({
|
|
7
|
+
[variant]: !!variant,
|
|
8
|
+
[size]: !!size
|
|
9
|
+
}));
|
|
10
|
+
const PillLabel = aggregatedClasses("span")(pillBlockName, "label");
|
|
11
|
+
const PillAddon = aggregatedClasses("div")(pillBlockName, "addon");
|
|
12
|
+
function Pill({
|
|
13
|
+
containerProps = {},
|
|
14
|
+
label = "",
|
|
15
|
+
leftAddon,
|
|
16
|
+
rightAddon,
|
|
17
|
+
variant = "value",
|
|
18
|
+
size = "m",
|
|
19
|
+
...otherProps
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ React2.createElement(PillWrapper, {
|
|
22
|
+
...containerProps,
|
|
23
|
+
classProps: { variant, size },
|
|
24
|
+
...otherProps
|
|
25
|
+
}, leftAddon && /* @__PURE__ */ React2.createElement(PillAddon, null, leftAddon), /* @__PURE__ */ React2.createElement(PillLabel, null, label), rightAddon && /* @__PURE__ */ React2.createElement(PillAddon, null, rightAddon));
|
|
52
26
|
}
|
|
53
|
-
|
|
54
27
|
const props = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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')
|
|
28
|
+
containerProps: PropTypes.object.description("props to inject to pill wrapper"),
|
|
29
|
+
label: PropTypes.string.isRequired.description("pill text label"),
|
|
30
|
+
size: PropTypes.oneOf(["m", "l"]).description("pill size"),
|
|
31
|
+
variant: PropTypes.oneOf(["value", "title"]).description("pill variant"),
|
|
32
|
+
leftAddon: PropTypes.node.description("addon component to left"),
|
|
33
|
+
rightAddon: PropTypes.node.description("addon component to right")
|
|
72
34
|
};
|
|
35
|
+
Pill.propTypes = props;
|
|
73
36
|
const DSPillWithSchema = describe(Pill);
|
|
74
37
|
DSPillWithSchema.propTypes = props;
|
|
75
|
-
|
|
76
|
-
export {
|
|
38
|
+
var Pill_default = Pill;
|
|
39
|
+
export {
|
|
40
|
+
DSPillWithSchema,
|
|
41
|
+
Pill,
|
|
42
|
+
Pill_default as default
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=Pill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/Pill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\n\nconst pillBlockName = 'pill';\n\nconst PillWrapper = aggregatedClasses('div')(\n pillBlockName,\n null,\n ({ size, variant }) => ({\n [variant]: !!variant,\n [size]: !!size,\n }),\n);\nconst PillLabel = aggregatedClasses('span')(pillBlockName, 'label');\nconst PillAddon = aggregatedClasses('div')(pillBlockName, 'addon');\n\nfunction Pill({\n containerProps = {},\n label = '',\n leftAddon,\n rightAddon,\n variant = 'value',\n size = 'm',\n ...otherProps\n}) {\n return (\n <PillWrapper\n {...containerProps}\n classProps={{ variant, size }}\n {...otherProps}\n >\n {leftAddon && <PillAddon>{leftAddon}</PillAddon>}\n <PillLabel>{label}</PillLabel>\n {rightAddon && <PillAddon>{rightAddon}</PillAddon>}\n </PillWrapper>\n );\n}\n\nconst props = {\n /** props to inject to pill wrapper */\n containerProps: PropTypes.object.description(\n 'props to inject to pill wrapper',\n ),\n /** pill text label */\n label: PropTypes.string.isRequired.description('pill text label'),\n /** pill size */\n size: PropTypes.oneOf(['m', 'l']).description('pill size'),\n /** pill variant */\n variant: PropTypes.oneOf(['value', 'title']).description('pill variant'),\n /** addon component to left */\n leftAddon: PropTypes.node.description('addon component to left'),\n /** addon component to right */\n rightAddon: PropTypes.node.description('addon component to right'),\n};\n\nPill.propTypes = props;\nconst DSPillWithSchema = describe(Pill);\nDSPillWithSchema.propTypes = props;\n\nexport { Pill, DSPillWithSchema };\nexport default Pill;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AAEA,MAAM,gBAAgB;AAEtB,MAAM,cAAc,kBAAkB,OACpC,eACA,MACA,CAAC,EAAE,MAAM,cAAe;AAAA,GACrB,UAAU,CAAC,CAAC;AAAA,GACZ,OAAO,CAAC,CAAC;AAAA;AAGd,MAAM,YAAY,kBAAkB,QAAQ,eAAe;AAC3D,MAAM,YAAY,kBAAkB,OAAO,eAAe;AAE1D,cAAc;AAAA,EACZ,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,KACJ;AAAA,GACF;AACD,SACE,qCAAC,aAAD;AAAA,OACM;AAAA,IACJ,YAAY,EAAE,SAAS;AAAA,OACnB;AAAA,KAEH,aAAa,qCAAC,WAAD,MAAY,YAC1B,qCAAC,WAAD,MAAY,QACX,cAAc,qCAAC,WAAD,MAAY;AAAA;AAKjC,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,UAAU,OAAO,YAC/B;AAAA,EAGF,OAAO,UAAU,OAAO,WAAW,YAAY;AAAA,EAE/C,MAAM,UAAU,MAAM,CAAC,KAAK,MAAM,YAAY;AAAA,EAE9C,SAAS,UAAU,MAAM,CAAC,SAAS,UAAU,YAAY;AAAA,EAEzD,WAAW,UAAU,KAAK,YAAY;AAAA,EAEtC,YAAY,UAAU,KAAK,YAAY;AAAA;AAGzC,KAAK,YAAY;AACjB,MAAM,mBAAmB,SAAS;AAClC,iBAAiB,YAAY;AAG7B,IAAO,eAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,60 +1,43 @@
|
|
|
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
|
-
|
|
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
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { describe, PropTypes } from "react-desc";
|
|
4
|
+
import { aggregatedClasses } from "@elliemae/ds-classnames";
|
|
5
|
+
import { FocusGroupProvider } from "@elliemae/ds-shared/FocusGroup/FocusGroupManager";
|
|
6
|
+
const pillGroupBlockName = "pill-group";
|
|
7
|
+
const Container = aggregatedClasses("div")(pillGroupBlockName);
|
|
8
|
+
const PillGroup = ({
|
|
9
|
+
containerProps = {},
|
|
10
|
+
onFocusNextGroup,
|
|
11
|
+
onFocusPreviousGroup,
|
|
12
|
+
onFocusGroupSet,
|
|
13
|
+
children
|
|
14
|
+
}) => /* @__PURE__ */ React2.createElement(FocusGroupProvider, {
|
|
15
|
+
keyBindings: {
|
|
16
|
+
Tab: "next"
|
|
17
|
+
},
|
|
18
|
+
onFocusGroupSet,
|
|
19
|
+
onFocusNextGroup,
|
|
20
|
+
onFocusPreviousGroup,
|
|
21
|
+
orientation: "horizontal"
|
|
22
|
+
}, /* @__PURE__ */ React2.createElement(Container, {
|
|
23
|
+
...containerProps
|
|
24
|
+
}, children));
|
|
41
25
|
const props = {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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')
|
|
26
|
+
containerProps: PropTypes.object.description("props injected to component wrapper"),
|
|
27
|
+
onFocusNextGroup: PropTypes.func.description("focus next group callback"),
|
|
28
|
+
onFocusPreviousGroup: PropTypes.func.description("focus prev group callback"),
|
|
29
|
+
onFocusGroupSet: PropTypes.func.description("focus group set callback"),
|
|
30
|
+
children: PropTypes.oneOfType([
|
|
31
|
+
PropTypes.arrayOf(PropTypes.node),
|
|
32
|
+
PropTypes.node
|
|
33
|
+
]).isRequired.description("pill components")
|
|
56
34
|
};
|
|
35
|
+
PillGroup.propTypes = props;
|
|
57
36
|
const DSPillGroupWithSchema = describe(PillGroup);
|
|
58
37
|
DSPillGroupWithSchema.propTypes = props;
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
export {
|
|
39
|
+
Container,
|
|
40
|
+
DSPillGroupWithSchema,
|
|
41
|
+
PillGroup
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=PillGroup.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/PillGroup.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, PropTypes } from 'react-desc';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { FocusGroupProvider } from '@elliemae/ds-shared/FocusGroup/FocusGroupManager';\n\nconst pillGroupBlockName = 'pill-group';\n\nexport const Container = aggregatedClasses('div')(pillGroupBlockName);\n\nconst PillGroup = ({\n containerProps = {},\n onFocusNextGroup,\n onFocusPreviousGroup,\n onFocusGroupSet,\n children,\n}) => (\n <FocusGroupProvider\n keyBindings={{\n Tab: 'next',\n }}\n onFocusGroupSet={onFocusGroupSet}\n onFocusNextGroup={onFocusNextGroup}\n onFocusPreviousGroup={onFocusPreviousGroup}\n orientation=\"horizontal\"\n >\n <Container {...containerProps}>{children}</Container>\n </FocusGroupProvider>\n);\n\nconst props = {\n /** props injected to component wrapper */\n containerProps: PropTypes.object.description(\n 'props injected to component wrapper',\n ),\n /** focus next group callback */\n onFocusNextGroup: PropTypes.func.description('focus next group callback'),\n /** focus prev group callback */\n onFocusPreviousGroup: PropTypes.func.description('focus prev group callback'),\n /** focus group set callback */\n onFocusGroupSet: PropTypes.func.description('focus group set callback'),\n /** pill components */\n children: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node,\n ]).isRequired.description('pill components'),\n};\n\nPillGroup.propTypes = props;\n\nconst DSPillGroupWithSchema = describe(PillGroup);\nDSPillGroupWithSchema.propTypes = props;\n\nexport { PillGroup, DSPillGroupWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAEA,MAAM,qBAAqB;AAEpB,MAAM,YAAY,kBAAkB,OAAO;AAElD,MAAM,YAAY,CAAC;AAAA,EACjB,iBAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MAEA,qCAAC,oBAAD;AAAA,EACE,aAAa;AAAA,IACX,KAAK;AAAA;AAAA,EAEP;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAY;AAAA,GAEZ,qCAAC,WAAD;AAAA,KAAe;AAAA,GAAiB;AAIpC,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,UAAU,OAAO,YAC/B;AAAA,EAGF,kBAAkB,UAAU,KAAK,YAAY;AAAA,EAE7C,sBAAsB,UAAU,KAAK,YAAY;AAAA,EAEjD,iBAAiB,UAAU,KAAK,YAAY;AAAA,EAE5C,UAAU,UAAU,UAAU;AAAA,IAC5B,UAAU,QAAQ,UAAU;AAAA,IAC5B,UAAU;AAAA,KACT,WAAW,YAAY;AAAA;AAG5B,UAAU,YAAY;AAEtB,MAAM,wBAAwB,SAAS;AACvC,sBAAsB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,90 +1,71 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
leftAddon,
|
|
17
|
-
modalTitle = '',
|
|
18
|
-
tooltipText = ''
|
|
19
|
-
} = _ref;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useRef, useState } from "react";
|
|
3
|
+
import { PropTypes, describe } from "react-desc";
|
|
4
|
+
import { InfoCircleSmall } from "@elliemae/ds-icons";
|
|
5
|
+
import { DSModal, MODAL_TYPE_V2 } from "@elliemae/ds-modal";
|
|
6
|
+
import { DSPopover } from "@elliemae/ds-popover";
|
|
7
|
+
import { Pill } from "./Pill";
|
|
8
|
+
const ReadOnlyPill = ({
|
|
9
|
+
containerProps = {},
|
|
10
|
+
modalContent = "",
|
|
11
|
+
label = "",
|
|
12
|
+
leftAddon,
|
|
13
|
+
modalTitle = "",
|
|
14
|
+
tooltipText = ""
|
|
15
|
+
}) => {
|
|
20
16
|
const ref = useRef(null);
|
|
21
17
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
22
18
|
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
|
|
23
|
-
|
|
24
19
|
const toggle = () => {
|
|
25
20
|
setIsModalOpen(!isModalOpen);
|
|
26
21
|
};
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
});
|
|
22
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(Pill, {
|
|
23
|
+
"data-testid": "read-only-pill",
|
|
24
|
+
className: "removable-pill",
|
|
25
|
+
containerProps,
|
|
26
|
+
innerRef: ref,
|
|
27
|
+
label,
|
|
28
|
+
leftAddon,
|
|
29
|
+
rightAddon: /* @__PURE__ */ React2.createElement(DSPopover, {
|
|
30
|
+
isOpen: tooltipText && isTooltipOpen,
|
|
31
|
+
content: tooltipText,
|
|
32
|
+
placement: "top",
|
|
33
|
+
showArrow: true,
|
|
34
|
+
renderTrigger: ({ ref: ref2 }) => /* @__PURE__ */ React2.createElement(InfoCircleSmall, {
|
|
35
|
+
role: "button",
|
|
36
|
+
"data-testid": "read-only-info-btn",
|
|
37
|
+
className: "remove-pill-button",
|
|
38
|
+
onClick: toggle,
|
|
39
|
+
onMouseEnter: () => setIsTooltipOpen(true),
|
|
40
|
+
onMouseLeave: () => setIsTooltipOpen(false),
|
|
41
|
+
color: ["brand-primary", "600"],
|
|
42
|
+
innerRef: ref2
|
|
43
|
+
})
|
|
44
|
+
}),
|
|
45
|
+
tabIndex: -1
|
|
46
|
+
}), /* @__PURE__ */ React2.createElement(DSModal, {
|
|
47
|
+
isOpen: isModalOpen,
|
|
48
|
+
showClose: true,
|
|
49
|
+
shouldCloseOnOverlayClick: true,
|
|
50
|
+
modalTitle,
|
|
51
|
+
modalType: MODAL_TYPE_V2.INFORMATION,
|
|
52
|
+
onClose: toggle,
|
|
53
|
+
version: 2
|
|
54
|
+
}, modalContent));
|
|
68
55
|
};
|
|
69
|
-
|
|
70
56
|
const props = {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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')
|
|
57
|
+
containerProps: PropTypes.object.description("props injected to component wrapper"),
|
|
58
|
+
label: PropTypes.string.isRequired.description("pill text label"),
|
|
59
|
+
leftAddon: PropTypes.node.description("addon component to left"),
|
|
60
|
+
modalContent: PropTypes.string.description("read only pill modal content"),
|
|
61
|
+
modalTitle: PropTypes.string.description("read only pill modal title"),
|
|
62
|
+
tooltipText: PropTypes.string.description("text to display in tooltip")
|
|
86
63
|
};
|
|
64
|
+
ReadOnlyPill.propTypes = props;
|
|
87
65
|
const DSReadOnlyPillWithSchema = describe(ReadOnlyPill);
|
|
88
66
|
DSReadOnlyPillWithSchema.propTypes = props;
|
|
89
|
-
|
|
90
|
-
|
|
67
|
+
export {
|
|
68
|
+
DSReadOnlyPillWithSchema,
|
|
69
|
+
ReadOnlyPill
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=ReadOnlyPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/ReadOnlyPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useRef, useState } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { InfoCircleSmall } from '@elliemae/ds-icons';\nimport { DSModal, MODAL_TYPE_V2 } from '@elliemae/ds-modal';\nimport { DSPopover } from '@elliemae/ds-popover';\nimport { Pill } from './Pill';\n\nconst ReadOnlyPill = ({\n containerProps = {},\n modalContent = '',\n label = '',\n leftAddon,\n modalTitle = '',\n tooltipText = '',\n}) => {\n const ref = useRef(null);\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [isTooltipOpen, setIsTooltipOpen] = useState(false);\n\n const toggle = () => {\n setIsModalOpen(!isModalOpen);\n };\n\n return (\n <>\n <Pill\n data-testid=\"read-only-pill\"\n className=\"removable-pill\"\n containerProps={containerProps}\n innerRef={ref}\n label={label}\n leftAddon={leftAddon}\n rightAddon={\n <DSPopover\n isOpen={tooltipText && isTooltipOpen}\n content={tooltipText}\n placement=\"top\"\n showArrow\n renderTrigger={({ ref }) => (\n <InfoCircleSmall\n role=\"button\"\n data-testid=\"read-only-info-btn\"\n className=\"remove-pill-button\"\n onClick={toggle}\n onMouseEnter={() => setIsTooltipOpen(true)}\n onMouseLeave={() => setIsTooltipOpen(false)}\n color={['brand-primary', '600']}\n innerRef={ref}\n />\n )}\n />\n }\n tabIndex={-1}\n />\n <DSModal\n isOpen={isModalOpen}\n showClose\n shouldCloseOnOverlayClick\n modalTitle={modalTitle}\n modalType={MODAL_TYPE_V2.INFORMATION}\n onClose={toggle}\n version={2}\n >\n {modalContent}\n </DSModal>\n </>\n );\n};\n\nconst props = {\n /** props injected to component wrapper */\n containerProps: PropTypes.object.description('props injected to component wrapper'),\n /** labeled pill text label */\n label: PropTypes.string.isRequired.description('pill text label'),\n /** addon component to left */\n leftAddon: PropTypes.node.description('addon component to left'),\n /** read only pill modal content */\n modalContent: PropTypes.string.description('read only pill modal content'),\n /** read only pill modal title */\n modalTitle: PropTypes.string.description('read only pill modal title'),\n tooltipText: PropTypes.string.description('text to display in tooltip'),\n};\n\nReadOnlyPill.propTypes = props;\n\nconst DSReadOnlyPillWithSchema = describe(ReadOnlyPill);\nDSReadOnlyPillWithSchema.propTypes = props;\n\nexport { ReadOnlyPill, DSReadOnlyPillWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,eAAe,CAAC;AAAA,EACpB,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,QAAQ;AAAA,EACR;AAAA,EACA,aAAa;AAAA,EACb,cAAc;AAAA,MACV;AACJ,QAAM,MAAM,OAAO;AACnB,QAAM,CAAC,aAAa,kBAAkB,SAAS;AAC/C,QAAM,CAAC,eAAe,oBAAoB,SAAS;AAEnD,QAAM,SAAS,MAAM;AACnB,mBAAe,CAAC;AAAA;AAGlB,SACE,4DACE,qCAAC,MAAD;AAAA,IACE,eAAY;AAAA,IACZ,WAAU;AAAA,IACV;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,YACE,qCAAC,WAAD;AAAA,MACE,QAAQ,eAAe;AAAA,MACvB,SAAS;AAAA,MACT,WAAU;AAAA,MACV,WAAS;AAAA,MACT,eAAe,CAAC,EAAE,gBAChB,qCAAC,iBAAD;AAAA,QACE,MAAK;AAAA,QACL,eAAY;AAAA,QACZ,WAAU;AAAA,QACV,SAAS;AAAA,QACT,cAAc,MAAM,iBAAiB;AAAA,QACrC,cAAc,MAAM,iBAAiB;AAAA,QACrC,OAAO,CAAC,iBAAiB;AAAA,QACzB,UAAU;AAAA;AAAA;AAAA,IAKlB,UAAU;AAAA,MAEZ,qCAAC,SAAD;AAAA,IACE,QAAQ;AAAA,IACR,WAAS;AAAA,IACT,2BAAyB;AAAA,IACzB;AAAA,IACA,WAAW,cAAc;AAAA,IACzB,SAAS;AAAA,IACT,SAAS;AAAA,KAER;AAAA;AAMT,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAE7C,OAAO,UAAU,OAAO,WAAW,YAAY;AAAA,EAE/C,WAAW,UAAU,KAAK,YAAY;AAAA,EAEtC,cAAc,UAAU,OAAO,YAAY;AAAA,EAE3C,YAAY,UAAU,OAAO,YAAY;AAAA,EACzC,aAAa,UAAU,OAAO,YAAY;AAAA;AAG5C,aAAa,YAAY;AAEzB,MAAM,2BAA2B,SAAS;AAC1C,yBAAyB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,38 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useRef } from
|
|
3
|
-
import { PropTypes, describe } from
|
|
4
|
-
import { isFunction } from
|
|
5
|
-
import { CloseXsmall } from
|
|
6
|
-
import useFocusGroupItem from
|
|
7
|
-
import { Pill } from
|
|
8
|
-
|
|
9
|
-
function RemovablePill(_ref) {
|
|
10
|
-
let {
|
|
11
|
-
containerProps = {},
|
|
12
|
-
label = '',
|
|
13
|
-
onRemove,
|
|
14
|
-
size = 'm',
|
|
15
|
-
leftAddon
|
|
16
|
-
} = _ref;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { 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";
|
|
8
|
+
function RemovablePill({ containerProps = {}, label = "", onRemove, size = "m", leftAddon }) {
|
|
17
9
|
const ref = useRef(null);
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
} = useFocusGroupItem(ref);
|
|
21
|
-
return /*#__PURE__*/_jsx(Pill, {
|
|
10
|
+
const { focusPrevious } = useFocusGroupItem(ref);
|
|
11
|
+
return /* @__PURE__ */ React2.createElement(Pill, {
|
|
22
12
|
className: "removable-pill",
|
|
23
13
|
"data-testid": "removable-pill",
|
|
24
|
-
containerProps
|
|
14
|
+
containerProps,
|
|
25
15
|
innerRef: ref,
|
|
26
|
-
size
|
|
27
|
-
label
|
|
28
|
-
leftAddon
|
|
29
|
-
onKeyDown: e => {
|
|
30
|
-
if (e.key ===
|
|
16
|
+
size,
|
|
17
|
+
label,
|
|
18
|
+
leftAddon,
|
|
19
|
+
onKeyDown: (e) => {
|
|
20
|
+
if (e.key === "Backspace" && isFunction(onRemove)) {
|
|
31
21
|
onRemove();
|
|
32
|
-
if (isFunction(focusPrevious))
|
|
22
|
+
if (isFunction(focusPrevious))
|
|
23
|
+
focusPrevious();
|
|
33
24
|
}
|
|
34
25
|
},
|
|
35
|
-
rightAddon:
|
|
26
|
+
rightAddon: /* @__PURE__ */ React2.createElement(CloseXsmall, {
|
|
36
27
|
role: "button",
|
|
37
28
|
"data-testid": "remove-pill-button",
|
|
38
29
|
className: "remove-pill-button",
|
|
@@ -41,24 +32,18 @@ function RemovablePill(_ref) {
|
|
|
41
32
|
tabIndex: -1
|
|
42
33
|
});
|
|
43
34
|
}
|
|
44
|
-
|
|
45
35
|
const props = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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')
|
|
36
|
+
containerProps: PropTypes.object.description("props injected to component wrapper"),
|
|
37
|
+
label: PropTypes.string.isRequired.description("pill text label"),
|
|
38
|
+
onRemove: PropTypes.func.description("remove click callback"),
|
|
39
|
+
size: PropTypes.oneOf(["m", "l"]).description("pill size"),
|
|
40
|
+
leftAddon: PropTypes.node.description("addon component to left")
|
|
60
41
|
};
|
|
42
|
+
RemovablePill.propTypes = props;
|
|
61
43
|
const DSRemovablePillWithSchema = describe(RemovablePill);
|
|
62
44
|
DSRemovablePillWithSchema.propTypes = props;
|
|
63
|
-
|
|
64
|
-
|
|
45
|
+
export {
|
|
46
|
+
DSRemovablePillWithSchema,
|
|
47
|
+
RemovablePill
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=RemovablePill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/RemovablePill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useRef } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { isFunction } from '@elliemae/ds-utilities';\nimport { CloseXsmall } from '@elliemae/ds-icons';\nimport { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';\nimport { Pill } from './Pill';\n\nfunction RemovablePill({ containerProps = {}, label = '', onRemove, size = 'm', leftAddon }) {\n const ref = useRef(null);\n const { focusPrevious } = useFocusGroupItem(ref);\n return (\n <Pill\n className=\"removable-pill\"\n data-testid=\"removable-pill\"\n containerProps={containerProps}\n innerRef={ref}\n size={size}\n label={label}\n leftAddon={leftAddon}\n onKeyDown={(e) => {\n if (e.key === 'Backspace' && isFunction(onRemove)) {\n onRemove();\n if (isFunction(focusPrevious)) focusPrevious();\n }\n }}\n rightAddon={\n <CloseXsmall role=\"button\" data-testid=\"remove-pill-button\" className=\"remove-pill-button\" onClick={onRemove} />\n }\n tabIndex={-1}\n />\n );\n}\n\nconst props = {\n /** props injected to component wrapper */\n containerProps: PropTypes.object.description('props injected to component wrapper'),\n /** labeled pill text label */\n label: PropTypes.string.isRequired.description('pill text label'),\n /** remove click callback */\n onRemove: PropTypes.func.description('remove click callback'),\n /** pill size */\n size: PropTypes.oneOf(['m', 'l']).description('pill size'),\n /** addon component to left */\n leftAddon: PropTypes.node.description('addon component to left'),\n};\n\nRemovablePill.propTypes = props;\nconst DSRemovablePillWithSchema = describe(RemovablePill);\nDSRemovablePillWithSchema.propTypes = props;\n\nexport { RemovablePill, DSRemovablePillWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA,uBAAuB,EAAE,iBAAiB,IAAI,QAAQ,IAAI,UAAU,OAAO,KAAK,aAAa;AAC3F,QAAM,MAAM,OAAO;AACnB,QAAM,EAAE,kBAAkB,kBAAkB;AAC5C,SACE,qCAAC,MAAD;AAAA,IACE,WAAU;AAAA,IACV,eAAY;AAAA,IACZ;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,CAAC,MAAM;AAChB,UAAI,EAAE,QAAQ,eAAe,WAAW,WAAW;AACjD;AACA,YAAI,WAAW;AAAgB;AAAA;AAAA;AAAA,IAGnC,YACE,qCAAC,aAAD;AAAA,MAAa,MAAK;AAAA,MAAS,eAAY;AAAA,MAAqB,WAAU;AAAA,MAAqB,SAAS;AAAA;AAAA,IAEtG,UAAU;AAAA;AAAA;AAKhB,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAE7C,OAAO,UAAU,OAAO,WAAW,YAAY;AAAA,EAE/C,UAAU,UAAU,KAAK,YAAY;AAAA,EAErC,MAAM,UAAU,MAAM,CAAC,KAAK,MAAM,YAAY;AAAA,EAE9C,WAAW,UAAU,KAAK,YAAY;AAAA;AAGxC,cAAc,YAAY;AAC1B,MAAM,4BAA4B,SAAS;AAC3C,0BAA0B,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|