@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,43 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const InputPill = /*#__PURE__*/React.memo(_ref => {
|
|
11
|
-
let {
|
|
12
|
-
label,
|
|
13
|
-
size,
|
|
14
|
-
inputPlaceholder,
|
|
15
|
-
inputWidth,
|
|
16
|
-
inputRender,
|
|
17
|
-
onInputChange,
|
|
18
|
-
onInputClear,
|
|
19
|
-
innerRef
|
|
20
|
-
} = _ref;
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useCallback, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { uid } from "uid";
|
|
4
|
+
import { CloseXsmall } from "@elliemae/ds-icons";
|
|
5
|
+
import { StyledInputPillWrapper } from "../styled";
|
|
6
|
+
import { setMultipleRefs } from "../../utils";
|
|
7
|
+
import { DSPillButton } from "../PillButton";
|
|
8
|
+
const InputPill = React2.memo(({ label, size, inputPlaceholder, inputWidth, inputRender, onInputChange, onInputClear, innerRef }) => {
|
|
21
9
|
const ref = useRef(null);
|
|
22
10
|
const InputComponent = useMemo(() => inputRender, [inputRender]);
|
|
23
|
-
const pillUid = useMemo(() =>
|
|
24
|
-
const onCloseIconClick = useCallback(e => {
|
|
25
|
-
if ([
|
|
11
|
+
const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
|
|
12
|
+
const onCloseIconClick = useCallback((e) => {
|
|
13
|
+
if ([void 0, "Enter", "Space"].includes(e.code)) {
|
|
26
14
|
e.preventDefault();
|
|
27
15
|
onInputClear(e);
|
|
28
16
|
ref.current.focus();
|
|
29
17
|
}
|
|
30
18
|
}, [onInputClear]);
|
|
31
19
|
const [inputHasFocus, setInputHasFocus] = useState(false);
|
|
32
|
-
return
|
|
33
|
-
size
|
|
20
|
+
return /* @__PURE__ */ React2.createElement(StyledInputPillWrapper, {
|
|
21
|
+
size,
|
|
34
22
|
className: "ds-pill-wrapper",
|
|
35
23
|
"data-testid": "ds-pill-wrapper",
|
|
36
|
-
cols: label ===
|
|
37
|
-
inputWidth
|
|
24
|
+
cols: label === "" ? ["auto"] : ["auto", "24px"],
|
|
25
|
+
inputWidth,
|
|
38
26
|
value: label,
|
|
39
|
-
inputHasFocus
|
|
40
|
-
},
|
|
27
|
+
inputHasFocus
|
|
28
|
+
}, /* @__PURE__ */ React2.createElement(InputComponent, {
|
|
41
29
|
id: pillUid,
|
|
42
30
|
className: "ds-pill-focus-point",
|
|
43
31
|
"data-testid": "ds-pill-input",
|
|
@@ -48,18 +36,20 @@ const InputPill = /*#__PURE__*/React.memo(_ref => {
|
|
|
48
36
|
onFocus: () => setInputHasFocus(true),
|
|
49
37
|
onBlur: () => setInputHasFocus(false),
|
|
50
38
|
disableTooltip: false
|
|
51
|
-
}), label !==
|
|
39
|
+
}), label !== "" && /* @__PURE__ */ React2.createElement(DSPillButton, {
|
|
52
40
|
id: pillUid,
|
|
53
41
|
"data-testid": "ds-pill-clear-icon",
|
|
54
|
-
innerRef
|
|
42
|
+
innerRef,
|
|
55
43
|
onClick: onCloseIconClick,
|
|
56
44
|
onKeyDown: onCloseIconClick,
|
|
57
45
|
"aria-label": "Clear input",
|
|
58
46
|
type: "right"
|
|
59
|
-
},
|
|
47
|
+
}, /* @__PURE__ */ React2.createElement(CloseXsmall, {
|
|
60
48
|
size: "s",
|
|
61
|
-
color: [
|
|
49
|
+
color: ["brand-primary", "700"]
|
|
62
50
|
})));
|
|
63
51
|
});
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
export {
|
|
53
|
+
InputPill
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=InputPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/InputPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useCallback, useMemo, useRef, useState } from 'react';\nimport { uid } from 'uid';\nimport { CloseXsmall } from '@elliemae/ds-icons';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledInputPillWrapper } from '../styled';\nimport { setMultipleRefs } from '../../utils';\nimport { DSPillButton } from '../PillButton';\n\nexport const InputPill = React.memo<DSPillProps>(\n ({ label, size, inputPlaceholder, inputWidth, inputRender, onInputChange, onInputClear, innerRef }) => {\n const ref = useRef<HTMLElement>(null);\n\n const InputComponent = useMemo(() => inputRender, [inputRender]);\n\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n\n const onCloseIconClick: React.MouseEventHandler & React.KeyboardEventHandler = useCallback(\n (e) => {\n if ([undefined, 'Enter', 'Space'].includes(e.code)) {\n e.preventDefault();\n onInputClear(e);\n ref.current.focus();\n }\n },\n [onInputClear],\n );\n\n const [inputHasFocus, setInputHasFocus] = useState(false);\n\n return (\n <StyledInputPillWrapper\n size={size}\n className=\"ds-pill-wrapper\"\n data-testid=\"ds-pill-wrapper\"\n cols={label === '' ? ['auto'] : ['auto', '24px']}\n inputWidth={inputWidth}\n value={label}\n inputHasFocus={inputHasFocus}\n >\n <InputComponent\n id={pillUid}\n className=\"ds-pill-focus-point\"\n data-testid=\"ds-pill-input\"\n innerRef={setMultipleRefs(ref, innerRef)}\n value={label}\n onChange={onInputChange}\n placeholder={inputPlaceholder}\n onFocus={() => setInputHasFocus(true)}\n onBlur={() => setInputHasFocus(false)}\n disableTooltip={false}\n />\n {label !== '' && (\n <DSPillButton\n id={pillUid}\n data-testid=\"ds-pill-clear-icon\"\n innerRef={innerRef}\n onClick={onCloseIconClick}\n onKeyDown={onCloseIconClick}\n aria-label=\"Clear input\"\n type=\"right\"\n >\n <CloseXsmall size=\"s\" color={['brand-primary', '700']} />\n </DSPillButton>\n )}\n </StyledInputPillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AAEA;AACA;AACA;AAEO,MAAM,YAAY,OAAM,KAC7B,CAAC,EAAE,OAAO,MAAM,kBAAkB,YAAY,aAAa,eAAe,cAAc,eAAe;AACrG,QAAM,MAAM,OAAoB;AAEhC,QAAM,iBAAiB,QAAQ,MAAM,aAAa,CAAC;AAEnD,QAAM,UAAU,QAAQ,MAAM,WAAW,SAAS;AAElD,QAAM,mBAAyE,YAC7E,CAAC,MAAM;AACL,QAAI,CAAC,QAAW,SAAS,SAAS,SAAS,EAAE,OAAO;AAClD,QAAE;AACF,mBAAa;AACb,UAAI,QAAQ;AAAA;AAAA,KAGhB,CAAC;AAGH,QAAM,CAAC,eAAe,oBAAoB,SAAS;AAEnD,SACE,qCAAC,wBAAD;AAAA,IACE;AAAA,IACA,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,MAAM,UAAU,KAAK,CAAC,UAAU,CAAC,QAAQ;AAAA,IACzC;AAAA,IACA,OAAO;AAAA,IACP;AAAA,KAEA,qCAAC,gBAAD;AAAA,IACE,IAAI;AAAA,IACJ,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,UAAU,gBAAgB,KAAK;AAAA,IAC/B,OAAO;AAAA,IACP,UAAU;AAAA,IACV,aAAa;AAAA,IACb,SAAS,MAAM,iBAAiB;AAAA,IAChC,QAAQ,MAAM,iBAAiB;AAAA,IAC/B,gBAAgB;AAAA,MAEjB,UAAU,MACT,qCAAC,cAAD;AAAA,IACE,IAAI;AAAA,IACJ,eAAY;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,IACT,WAAW;AAAA,IACX,cAAW;AAAA,IACX,MAAK;AAAA,KAEL,qCAAC,aAAD;AAAA,IAAa,MAAK;AAAA,IAAI,OAAO,CAAC,iBAAiB;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,37 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
let {
|
|
11
|
-
label,
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
4
|
+
import { StyledLabelPillWrapper } from "../styled";
|
|
5
|
+
const LabelPill = React2.memo(({ label, size, labelTruncated, iconLeft, ariaLabel }) => {
|
|
6
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
7
|
+
value: children
|
|
8
|
+
}) : React2.Fragment;
|
|
9
|
+
return /* @__PURE__ */ React2.createElement(StyledLabelPillWrapper, {
|
|
12
10
|
size,
|
|
13
|
-
labelTruncated,
|
|
14
|
-
iconLeft,
|
|
15
|
-
ariaLabel
|
|
16
|
-
} = _ref;
|
|
17
|
-
const TextComponent = labelTruncated ? _ref2 => {
|
|
18
|
-
let {
|
|
19
|
-
children
|
|
20
|
-
} = _ref2;
|
|
21
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
22
|
-
value: children
|
|
23
|
-
});
|
|
24
|
-
} : React.Fragment;
|
|
25
|
-
return /*#__PURE__*/_jsx(StyledLabelPillWrapper, {
|
|
26
|
-
size: size,
|
|
27
11
|
alignItems: "center",
|
|
28
12
|
className: "ds-pill-wrapper ds-pill-wrapper-label",
|
|
29
13
|
"data-testid": "ds-pill-wrapper",
|
|
30
14
|
"aria-label": ariaLabel || label,
|
|
31
|
-
cols: [iconLeft &&
|
|
15
|
+
cols: [iconLeft && "min-content", "auto"].filter((notFalse) => notFalse),
|
|
32
16
|
gutter: "xxxs",
|
|
33
17
|
hasIcon: iconLeft !== null
|
|
34
|
-
},
|
|
18
|
+
}, iconLeft, /* @__PURE__ */ React2.createElement(TextComponent, null, label));
|
|
35
19
|
});
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
export {
|
|
21
|
+
LabelPill
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=LabelPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/LabelPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledLabelPillWrapper } from '../styled';\n\nexport const LabelPill = React.memo<DSPillProps>(({ label, size, labelTruncated, iconLeft, ariaLabel }) => {\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n return (\n <StyledLabelPillWrapper\n size={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-label\"\n data-testid=\"ds-pill-wrapper\"\n aria-label={ariaLabel || label}\n cols={[iconLeft && 'min-content', 'auto'].filter((notFalse) => notFalse)}\n gutter=\"xxxs\"\n hasIcon={iconLeft !== null}\n >\n {iconLeft}\n <TextComponent>{label}</TextComponent>\n </StyledLabelPillWrapper>\n );\n});\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AAEA;AAEO,MAAM,YAAY,OAAM,KAAkB,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,gBAAgB;AACzG,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AACV,SACE,qCAAC,wBAAD;AAAA,IACE;AAAA,IACA,YAAW;AAAA,IACX,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,cAAY,aAAa;AAAA,IACzB,MAAM,CAAC,YAAY,eAAe,QAAQ,OAAO,CAAC,aAAa;AAAA,IAC/D,QAAO;AAAA,IACP,SAAS,aAAa;AAAA,KAErB,UACD,qCAAC,eAAD,MAAgB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,41 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
4
|
+
import { StyledReadonlyPillWrapper } from "../styled";
|
|
5
|
+
const ReadOnlyPill = React2.memo(({ label, size, labelTruncated, iconLeft, iconRight, ariaLabel }) => {
|
|
6
|
+
const hasIconLeft = iconLeft !== null || iconRight !== null && label === "";
|
|
7
|
+
const hasIconRight = iconRight !== null || iconLeft !== null && label === "";
|
|
8
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
9
|
+
value: children
|
|
10
|
+
}) : React2.Fragment;
|
|
11
|
+
return /* @__PURE__ */ React2.createElement(StyledReadonlyPillWrapper, {
|
|
12
12
|
size,
|
|
13
|
-
labelTruncated,
|
|
14
|
-
iconLeft,
|
|
15
|
-
iconRight,
|
|
16
|
-
ariaLabel
|
|
17
|
-
} = _ref;
|
|
18
|
-
const hasIconLeft = iconLeft !== null || iconRight !== null && label === '';
|
|
19
|
-
const hasIconRight = iconRight !== null || iconLeft !== null && label === '';
|
|
20
|
-
const TextComponent = labelTruncated ? _ref2 => {
|
|
21
|
-
let {
|
|
22
|
-
children
|
|
23
|
-
} = _ref2;
|
|
24
|
-
return /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
25
|
-
value: children
|
|
26
|
-
});
|
|
27
|
-
} : React.Fragment;
|
|
28
|
-
return /*#__PURE__*/_jsx(StyledReadonlyPillWrapper, {
|
|
29
|
-
size: size,
|
|
30
13
|
alignItems: "center",
|
|
31
14
|
className: "ds-pill-wrapper ds-pill-wrapper-readonly",
|
|
32
15
|
"data-testid": "ds-pill-wrapper",
|
|
33
16
|
"aria-label": ariaLabel || label,
|
|
34
|
-
cols: [iconLeft &&
|
|
17
|
+
cols: [iconLeft && "min-content", label && "auto", iconRight && "min-content"].filter((notFalse) => notFalse),
|
|
35
18
|
gutter: "xxxs",
|
|
36
|
-
hasIconRight
|
|
37
|
-
hasIconLeft
|
|
38
|
-
},
|
|
19
|
+
hasIconRight,
|
|
20
|
+
hasIconLeft
|
|
21
|
+
}, iconLeft, label ? /* @__PURE__ */ React2.createElement(TextComponent, null, label) : null, iconRight);
|
|
39
22
|
});
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
export {
|
|
24
|
+
ReadOnlyPill
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=ReadOnlyPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/ReadOnlyPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable complexity */\n/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledReadonlyPillWrapper } from '../styled';\n\nexport const ReadOnlyPill = React.memo<DSPillProps>(\n ({ label, size, labelTruncated, iconLeft, iconRight, ariaLabel }) => {\n const hasIconLeft = iconLeft !== null || (iconRight !== null && label === '');\n const hasIconRight = iconRight !== null || (iconLeft !== null && label === '');\n\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n\n return (\n <StyledReadonlyPillWrapper\n size={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-readonly\"\n data-testid=\"ds-pill-wrapper\"\n aria-label={ariaLabel || label}\n cols={[iconLeft && 'min-content', label && 'auto', iconRight && 'min-content'].filter((notFalse) => notFalse)}\n gutter=\"xxxs\"\n hasIconRight={hasIconRight}\n hasIconLeft={hasIconLeft}\n >\n {iconLeft}\n {label ? <TextComponent>{label}</TextComponent> : null}\n {iconRight}\n </StyledReadonlyPillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AACA;AAEA;AAEO,MAAM,eAAe,OAAM,KAChC,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,WAAW,gBAAgB;AACnE,QAAM,cAAc,aAAa,QAAS,cAAc,QAAQ,UAAU;AAC1E,QAAM,eAAe,cAAc,QAAS,aAAa,QAAQ,UAAU;AAE3E,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AAEV,SACE,qCAAC,2BAAD;AAAA,IACE;AAAA,IACA,YAAW;AAAA,IACX,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,cAAY,aAAa;AAAA,IACzB,MAAM,CAAC,YAAY,eAAe,SAAS,QAAQ,aAAa,eAAe,OAAO,CAAC,aAAa;AAAA,IACpG,QAAO;AAAA,IACP;AAAA,IACA;AAAA,KAEC,UACA,QAAQ,qCAAC,eAAD,MAAgB,SAAyB,MACjD;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,63 +1,50 @@
|
|
|
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
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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)) {
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useCallback, useContext, useMemo } 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";
|
|
7
|
+
import { DSPillGroupV2Context } from "../PillGroup";
|
|
8
|
+
import { DSPillButton } from "../PillButton";
|
|
9
|
+
const RemovablePill = React2.memo(({ label, size, labelTruncated, onRemove, innerRef, ariaLabel }) => {
|
|
10
|
+
const { onKeyboardRemove } = useContext(DSPillGroupV2Context);
|
|
11
|
+
const pillUid = useMemo(() => `ds-pill-${uid()}`, []);
|
|
12
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
13
|
+
value: children
|
|
14
|
+
}) : React2.Fragment;
|
|
15
|
+
const onKeyDown = useCallback((e) => {
|
|
16
|
+
if (["Enter", "Space"].includes(e.code)) {
|
|
33
17
|
e.preventDefault();
|
|
34
|
-
if (onKeyboardRemove)
|
|
18
|
+
if (onKeyboardRemove)
|
|
19
|
+
onKeyboardRemove(pillUid);
|
|
35
20
|
onRemove(e);
|
|
36
21
|
}
|
|
37
22
|
}, [onKeyboardRemove, onRemove, pillUid]);
|
|
38
|
-
return
|
|
39
|
-
size
|
|
40
|
-
cols: [
|
|
23
|
+
return /* @__PURE__ */ React2.createElement(StyledRemovablePillWrapper, {
|
|
24
|
+
size,
|
|
25
|
+
cols: ["auto", "24px"],
|
|
41
26
|
gutter: "2px",
|
|
42
27
|
alignItems: "center",
|
|
43
28
|
justifyItems: "center",
|
|
44
29
|
className: "ds-pill-wrapper ds-pill-wrapper-removable",
|
|
45
30
|
"data-testid": "ds-pill-wrapper",
|
|
46
31
|
"aria-label": ariaLabel || label
|
|
47
|
-
},
|
|
32
|
+
}, /* @__PURE__ */ React2.createElement(TextComponent, null, label), /* @__PURE__ */ React2.createElement(DSPillButton, {
|
|
48
33
|
className: "ds-pill-focus-point",
|
|
49
34
|
id: pillUid,
|
|
50
35
|
"data-testid": "ds-pill-close-icon",
|
|
51
|
-
innerRef
|
|
36
|
+
innerRef,
|
|
52
37
|
onClick: onRemove,
|
|
53
|
-
onKeyDown
|
|
54
|
-
"aria-label":
|
|
38
|
+
onKeyDown,
|
|
39
|
+
"aria-label": `Remove ${label}`,
|
|
55
40
|
type: "right"
|
|
56
|
-
},
|
|
41
|
+
}, /* @__PURE__ */ React2.createElement(CloseXsmall, {
|
|
57
42
|
width: 22.65,
|
|
58
43
|
height: 22.65,
|
|
59
|
-
color: [
|
|
44
|
+
color: ["brand-primary", "700"]
|
|
60
45
|
})));
|
|
61
46
|
});
|
|
62
|
-
|
|
63
|
-
|
|
47
|
+
export {
|
|
48
|
+
RemovablePill
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=RemovablePill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/RemovablePill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useCallback, useContext, useMemo } from 'react';\nimport { uid } from 'uid';\nimport { CloseXsmall } from '@elliemae/ds-icons';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledRemovablePillWrapper } from '../styled';\nimport { DSPillGroupV2Context } from '../PillGroup';\nimport { DSPillButton } from '../PillButton';\n\nexport const RemovablePill = React.memo<DSPillProps>(\n ({ label, size, labelTruncated, onRemove, innerRef, ariaLabel }) => {\n const { onKeyboardRemove } = useContext(DSPillGroupV2Context);\n const pillUid = useMemo(() => `ds-pill-${uid()}`, []);\n\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n\n const onKeyDown: React.MouseEventHandler & React.KeyboardEventHandler = useCallback(\n (e) => {\n if (['Enter', 'Space'].includes(e.code)) {\n e.preventDefault();\n if (onKeyboardRemove) onKeyboardRemove(pillUid);\n onRemove(e);\n }\n },\n [onKeyboardRemove, onRemove, pillUid],\n );\n\n return (\n <StyledRemovablePillWrapper\n size={size}\n cols={['auto', '24px']}\n gutter=\"2px\"\n alignItems=\"center\"\n justifyItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-removable\"\n data-testid=\"ds-pill-wrapper\"\n aria-label={ariaLabel || label}\n >\n <TextComponent>{label}</TextComponent>\n <DSPillButton\n className=\"ds-pill-focus-point\"\n id={pillUid}\n data-testid=\"ds-pill-close-icon\"\n innerRef={innerRef}\n onClick={onRemove}\n onKeyDown={onKeyDown}\n aria-label={`Remove ${label}`}\n type=\"right\"\n >\n <CloseXsmall width={22.65} height={22.65} color={['brand-primary', '700']} />\n </DSPillButton>\n </StyledRemovablePillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEO,MAAM,gBAAgB,OAAM,KACjC,CAAC,EAAE,OAAO,MAAM,gBAAgB,UAAU,UAAU,gBAAgB;AAClE,QAAM,EAAE,qBAAqB,WAAW;AACxC,QAAM,UAAU,QAAQ,MAAM,WAAW,SAAS;AAElD,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AAEV,QAAM,YAAkE,YACtE,CAAC,MAAM;AACL,QAAI,CAAC,SAAS,SAAS,SAAS,EAAE,OAAO;AACvC,QAAE;AACF,UAAI;AAAkB,yBAAiB;AACvC,eAAS;AAAA;AAAA,KAGb,CAAC,kBAAkB,UAAU;AAG/B,SACE,qCAAC,4BAAD;AAAA,IACE;AAAA,IACA,MAAM,CAAC,QAAQ;AAAA,IACf,QAAO;AAAA,IACP,YAAW;AAAA,IACX,cAAa;AAAA,IACb,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,cAAY,aAAa;AAAA,KAEzB,qCAAC,eAAD,MAAgB,QAChB,qCAAC,cAAD;AAAA,IACE,WAAU;AAAA,IACV,IAAI;AAAA,IACJ,eAAY;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,cAAY,UAAU;AAAA,IACtB,MAAK;AAAA,KAEL,qCAAC,aAAD;AAAA,IAAa,OAAO;AAAA,IAAO,QAAQ;AAAA,IAAO,OAAO,CAAC,iBAAiB;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,45 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
let {
|
|
12
|
-
label,
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { DSTooltipV2 } from "@elliemae/ds-tooltip";
|
|
4
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
5
|
+
import { StyledSpanWithTooltip, StyledValuePillWrapper } from "../styled";
|
|
6
|
+
const ValuePill = React2.memo(({ label, size, labelTruncated, tooltipValue, iconLeft, ariaLabel }) => {
|
|
7
|
+
const TextComponent = labelTruncated ? ({ children }) => /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
8
|
+
value: children
|
|
9
|
+
}) : React2.Fragment;
|
|
10
|
+
return /* @__PURE__ */ React2.createElement(StyledValuePillWrapper, {
|
|
13
11
|
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,
|
|
29
12
|
alignItems: "center",
|
|
30
13
|
className: "ds-pill-wrapper ds-pill-wrapper-value",
|
|
31
14
|
"data-testid": "ds-pill-wrapper",
|
|
32
15
|
"aria-label": ariaLabel || label,
|
|
33
|
-
cols: [iconLeft &&
|
|
16
|
+
cols: [iconLeft && "min-content", "auto"].filter((notFalse) => notFalse),
|
|
34
17
|
gutter: "xxxs",
|
|
35
18
|
hasIcon: iconLeft !== null
|
|
36
|
-
},
|
|
19
|
+
}, iconLeft, tooltipValue !== "" ? /* @__PURE__ */ React2.createElement(DSTooltipV2, {
|
|
37
20
|
title: tooltipValue,
|
|
38
|
-
triggerComponent:
|
|
21
|
+
triggerComponent: /* @__PURE__ */ React2.createElement(StyledSpanWithTooltip, {
|
|
39
22
|
className: "ds-pill-tooltip-value",
|
|
40
23
|
tabIndex: 0
|
|
41
|
-
},
|
|
42
|
-
}) :
|
|
24
|
+
}, label)
|
|
25
|
+
}) : /* @__PURE__ */ React2.createElement(TextComponent, null, label));
|
|
43
26
|
});
|
|
44
|
-
|
|
45
|
-
|
|
27
|
+
export {
|
|
28
|
+
ValuePill
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=ValuePill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/ValuePill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React from 'react';\nimport { DSTooltipV2 } from '@elliemae/ds-tooltip';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSPillProps } from '../../index.d';\nimport { StyledSpanWithTooltip, StyledValuePillWrapper } from '../styled';\n\nexport const ValuePill = React.memo<DSPillProps>(\n ({ label, size, labelTruncated, tooltipValue, iconLeft, ariaLabel }) => {\n const TextComponent = labelTruncated\n ? ({ children }) => <SimpleTruncatedTooltipText value={children} />\n : React.Fragment;\n\n return (\n <StyledValuePillWrapper\n size={size}\n alignItems=\"center\"\n className=\"ds-pill-wrapper ds-pill-wrapper-value\"\n data-testid=\"ds-pill-wrapper\"\n aria-label={ariaLabel || label}\n cols={[iconLeft && 'min-content', 'auto'].filter((notFalse) => notFalse)}\n gutter=\"xxxs\"\n hasIcon={iconLeft !== null}\n >\n {iconLeft}\n {tooltipValue !== '' ? (\n <DSTooltipV2\n title={tooltipValue}\n triggerComponent={\n <StyledSpanWithTooltip className=\"ds-pill-tooltip-value\" tabIndex={0}>\n {label}\n </StyledSpanWithTooltip>\n }\n />\n ) : (\n <TextComponent>{label}</TextComponent>\n )}\n </StyledValuePillWrapper>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "AAAA;ACCA;AACA;AACA;AAEA;AAEO,MAAM,YAAY,OAAM,KAC7B,CAAC,EAAE,OAAO,MAAM,gBAAgB,cAAc,UAAU,gBAAgB;AACtE,QAAM,gBAAgB,iBAClB,CAAC,EAAE,eAAe,qCAAC,4BAAD;AAAA,IAA4B,OAAO;AAAA,OACrD,OAAM;AAEV,SACE,qCAAC,wBAAD;AAAA,IACE;AAAA,IACA,YAAW;AAAA,IACX,WAAU;AAAA,IACV,eAAY;AAAA,IACZ,cAAY,aAAa;AAAA,IACzB,MAAM,CAAC,YAAY,eAAe,QAAQ,OAAO,CAAC,aAAa;AAAA,IAC/D,QAAO;AAAA,IACP,SAAS,aAAa;AAAA,KAErB,UACA,iBAAiB,KAChB,qCAAC,aAAD;AAAA,IACE,OAAO;AAAA,IACP,kBACE,qCAAC,uBAAD;AAAA,MAAuB,WAAU;AAAA,MAAwB,UAAU;AAAA,OAChE;AAAA,OAKP,qCAAC,eAAD,MAAgB;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export * from "./DropdownPill";
|
|
3
|
+
export * from "./InputPill";
|
|
4
|
+
export * from "./LabelPill";
|
|
5
|
+
export * from "./ReadOnlyPill";
|
|
6
|
+
export * from "./RemovablePill";
|
|
7
|
+
export * from "./ValuePill";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/components/types/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DropdownPill';\nexport * from './InputPill';\nexport * from './LabelPill';\nexport * from './ReadOnlyPill';\nexport * from './RemovablePill';\nexport * from './ValuePill';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,100 +1,63 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useRef, useState } from "react";
|
|
3
|
+
import { PropTypes, describe } from "react-desc";
|
|
4
|
+
import { DSDropdownMenu } from "@elliemae/ds-dropdownmenu";
|
|
5
|
+
import { ChevronDown } from "@elliemae/ds-icons";
|
|
6
|
+
import { useFocusGroupItem } from "@elliemae/ds-shared/FocusGroup/useFocusGroupItem";
|
|
7
|
+
import { Pill } from "./Pill";
|
|
8
|
+
function DropdownPill({
|
|
9
|
+
containerProps = {},
|
|
10
|
+
label = "",
|
|
11
|
+
variant,
|
|
12
|
+
tabIndex = -1,
|
|
13
|
+
closeMenuOnItemSelection = false,
|
|
14
|
+
maxWidth,
|
|
15
|
+
minWidth,
|
|
16
|
+
...dropdownProps
|
|
17
|
+
}) {
|
|
38
18
|
const ref = useRef(null);
|
|
39
19
|
const [chevronEl, chevronRef] = useState();
|
|
40
|
-
const {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
maxWidth: maxWidth,
|
|
20
|
+
const { focusFirst } = useFocusGroupItem(ref);
|
|
21
|
+
return /* @__PURE__ */ React2.createElement(DSDropdownMenu, {
|
|
22
|
+
...dropdownProps,
|
|
23
|
+
closeMenuOnItemSelection,
|
|
24
|
+
maxWidth,
|
|
46
25
|
hideIfNotVisible: true,
|
|
47
|
-
menuProps: {
|
|
48
|
-
|
|
49
|
-
zIndex: 100
|
|
50
|
-
},
|
|
51
|
-
minWidth: minWidth,
|
|
26
|
+
menuProps: { className: "dropdown-pill-menu", zIndex: 100 },
|
|
27
|
+
minWidth,
|
|
52
28
|
onClose: focusFirst,
|
|
53
29
|
referenceNode: chevronEl,
|
|
54
|
-
triggerComponent:
|
|
30
|
+
triggerComponent: /* @__PURE__ */ React2.createElement(Pill, {
|
|
55
31
|
"data-testid": "dropdown-pill",
|
|
56
32
|
className: "dropdown-pill",
|
|
57
|
-
containerProps:
|
|
58
|
-
role: 'listbox'
|
|
59
|
-
}, containerProps),
|
|
33
|
+
containerProps: { role: "listbox", ...containerProps },
|
|
60
34
|
innerRef: ref,
|
|
61
|
-
label
|
|
62
|
-
rightAddon:
|
|
63
|
-
ref: chevronRef
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
variant: variant
|
|
35
|
+
label,
|
|
36
|
+
rightAddon: /* @__PURE__ */ React2.createElement("div", {
|
|
37
|
+
ref: chevronRef
|
|
38
|
+
}, /* @__PURE__ */ React2.createElement(ChevronDown, {
|
|
39
|
+
className: "dropdown-pill-chevron-down",
|
|
40
|
+
"data-testid": "dropdown-pill-button"
|
|
41
|
+
})),
|
|
42
|
+
tabIndex,
|
|
43
|
+
variant
|
|
71
44
|
})
|
|
72
|
-
})
|
|
45
|
+
});
|
|
73
46
|
}
|
|
74
|
-
|
|
75
47
|
const props = {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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')
|
|
48
|
+
containerProps: PropTypes.object.description("props injected to component wrapper"),
|
|
49
|
+
label: PropTypes.string.isRequired.description("pill text label"),
|
|
50
|
+
variant: PropTypes.oneOf(["value", "title"]).description("pill variant"),
|
|
51
|
+
tabIndex: PropTypes.number.description("html focus order"),
|
|
52
|
+
closeMenuOnItemSelection: PropTypes.bool.description("close menu on item selection"),
|
|
53
|
+
maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("pill max width"),
|
|
54
|
+
minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description("pill min width")
|
|
96
55
|
};
|
|
56
|
+
DropdownPill.propTypes = props;
|
|
97
57
|
const DSDropdownPillWithSchema = describe(DropdownPill);
|
|
98
58
|
DSDropdownPillWithSchema.propTypes = props;
|
|
99
|
-
|
|
100
|
-
|
|
59
|
+
export {
|
|
60
|
+
DSDropdownPillWithSchema,
|
|
61
|
+
DropdownPill
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=DropdownPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/DropdownPill.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useRef, useState } from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { DSDropdownMenu } from '@elliemae/ds-dropdownmenu';\nimport { ChevronDown } from '@elliemae/ds-icons';\nimport { useFocusGroupItem } from '@elliemae/ds-shared/FocusGroup/useFocusGroupItem';\nimport { Pill } from './Pill';\n\nfunction DropdownPill({\n containerProps = {},\n label = '',\n variant,\n tabIndex = -1,\n closeMenuOnItemSelection = false,\n maxWidth,\n minWidth,\n ...dropdownProps\n}) {\n const ref = useRef(null);\n const [chevronEl, chevronRef] = useState();\n const { focusFirst } = useFocusGroupItem(ref);\n return (\n <DSDropdownMenu\n {...dropdownProps}\n closeMenuOnItemSelection={closeMenuOnItemSelection}\n maxWidth={maxWidth}\n hideIfNotVisible\n menuProps={{ className: 'dropdown-pill-menu', zIndex: 100 }}\n minWidth={minWidth}\n onClose={focusFirst}\n referenceNode={chevronEl}\n triggerComponent={\n <Pill\n data-testid=\"dropdown-pill\"\n className=\"dropdown-pill\"\n containerProps={{ role: 'listbox', ...containerProps }}\n innerRef={ref}\n label={label}\n rightAddon={\n <div ref={chevronRef}>\n <ChevronDown className=\"dropdown-pill-chevron-down\" data-testid=\"dropdown-pill-button\" />\n </div>\n }\n tabIndex={tabIndex}\n variant={variant}\n />\n }\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 /** pill variant */\n variant: PropTypes.oneOf(['value', 'title']).description('pill variant'),\n /** html focus border */\n tabIndex: PropTypes.number.description('html focus order'),\n /** close menu on item selection */\n closeMenuOnItemSelection: PropTypes.bool.description('close menu on item selection'),\n /** pill max width */\n maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill max width'),\n /** pill min width */\n minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill min width'),\n};\n\nDropdownPill.propTypes = props;\nconst DSDropdownPillWithSchema = describe(DropdownPill);\nDSDropdownPillWithSchema.propTypes = props;\n\nexport { DropdownPill, DSDropdownPillWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAEA,sBAAsB;AAAA,EACpB,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR;AAAA,EACA,WAAW;AAAA,EACX,2BAA2B;AAAA,EAC3B;AAAA,EACA;AAAA,KACG;AAAA,GACF;AACD,QAAM,MAAM,OAAO;AACnB,QAAM,CAAC,WAAW,cAAc;AAChC,QAAM,EAAE,eAAe,kBAAkB;AACzC,SACE,qCAAC,gBAAD;AAAA,OACM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,kBAAgB;AAAA,IAChB,WAAW,EAAE,WAAW,sBAAsB,QAAQ;AAAA,IACtD;AAAA,IACA,SAAS;AAAA,IACT,eAAe;AAAA,IACf,kBACE,qCAAC,MAAD;AAAA,MACE,eAAY;AAAA,MACZ,WAAU;AAAA,MACV,gBAAgB,EAAE,MAAM,cAAc;AAAA,MACtC,UAAU;AAAA,MACV;AAAA,MACA,YACE,qCAAC,OAAD;AAAA,QAAK,KAAK;AAAA,SACR,qCAAC,aAAD;AAAA,QAAa,WAAU;AAAA,QAA6B,eAAY;AAAA;AAAA,MAGpE;AAAA,MACA;AAAA;AAAA;AAAA;AAOV,MAAM,QAAQ;AAAA,EAEZ,gBAAgB,UAAU,OAAO,YAAY;AAAA,EAE7C,OAAO,UAAU,OAAO,WAAW,YAAY;AAAA,EAE/C,SAAS,UAAU,MAAM,CAAC,SAAS,UAAU,YAAY;AAAA,EAEzD,UAAU,UAAU,OAAO,YAAY;AAAA,EAEvC,0BAA0B,UAAU,KAAK,YAAY;AAAA,EAErD,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA,EAEhF,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,SAAS,YAAY;AAAA;AAGlF,aAAa,YAAY;AACzB,MAAM,2BAA2B,SAAS;AAC1C,yBAAyB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|