@elliemae/ds-legacy-pills 1.0.0-rc.1
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/dist/cjs/deprecated/DropdownPill.js +103 -0
- package/dist/cjs/deprecated/DropdownPill.js.map +7 -0
- package/dist/cjs/deprecated/InputPill.js +87 -0
- package/dist/cjs/deprecated/InputPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPills.js +112 -0
- package/dist/cjs/deprecated/LabeledDropdownPills.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +134 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +154 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +169 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +45 -0
- package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
- package/dist/cjs/deprecated/LabeledPills.js +86 -0
- package/dist/cjs/deprecated/LabeledPills.js.map +7 -0
- package/dist/cjs/deprecated/OverflowPill.js +93 -0
- package/dist/cjs/deprecated/OverflowPill.js.map +7 -0
- package/dist/cjs/deprecated/Pill.js +83 -0
- package/dist/cjs/deprecated/Pill.js.map +7 -0
- package/dist/cjs/deprecated/PillGroup.js +74 -0
- package/dist/cjs/deprecated/PillGroup.js.map +7 -0
- package/dist/cjs/deprecated/ReadOnlyPill.js +124 -0
- package/dist/cjs/deprecated/ReadOnlyPill.js.map +7 -0
- package/dist/cjs/deprecated/RemovablePill.js +86 -0
- package/dist/cjs/deprecated/RemovablePill.js.map +7 -0
- package/dist/cjs/deprecated/index.js +45 -0
- package/dist/cjs/deprecated/index.js.map +7 -0
- package/dist/cjs/index.js +39 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +7 -0
- package/dist/esm/deprecated/DropdownPill.js +73 -0
- package/dist/esm/deprecated/DropdownPill.js.map +7 -0
- package/dist/esm/deprecated/InputPill.js +57 -0
- package/dist/esm/deprecated/InputPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPills.js +82 -0
- package/dist/esm/deprecated/LabeledDropdownPills.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +104 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +124 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +139 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js +15 -0
- package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
- package/dist/esm/deprecated/LabeledPills.js +56 -0
- package/dist/esm/deprecated/LabeledPills.js.map +7 -0
- package/dist/esm/deprecated/OverflowPill.js +63 -0
- package/dist/esm/deprecated/OverflowPill.js.map +7 -0
- package/dist/esm/deprecated/Pill.js +53 -0
- package/dist/esm/deprecated/Pill.js.map +7 -0
- package/dist/esm/deprecated/PillGroup.js +44 -0
- package/dist/esm/deprecated/PillGroup.js.map +7 -0
- package/dist/esm/deprecated/ReadOnlyPill.js +94 -0
- package/dist/esm/deprecated/ReadOnlyPill.js.map +7 -0
- package/dist/esm/deprecated/RemovablePill.js +56 -0
- package/dist/esm/deprecated/RemovablePill.js.map +7 -0
- package/dist/esm/deprecated/index.js +14 -0
- package/dist/esm/deprecated/index.js.map +7 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +7 -0
- package/dist/types/deprecated/DropdownPill.d.ts +40 -0
- package/dist/types/deprecated/InputPill.d.ts +9 -0
- package/dist/types/deprecated/LabeledDropdownPills.d.ts +52 -0
- package/dist/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +16 -0
- package/dist/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +13 -0
- package/dist/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +28 -0
- package/dist/types/deprecated/LabeledDropdownPillsTypes/utils.d.ts +1 -0
- package/dist/types/deprecated/LabeledPills.d.ts +38 -0
- package/dist/types/deprecated/OverflowPill.d.ts +26 -0
- package/dist/types/deprecated/Pill.d.ts +37 -0
- package/dist/types/deprecated/PillGroup.d.ts +32 -0
- package/dist/types/deprecated/ReadOnlyPill.d.ts +33 -0
- package/dist/types/deprecated/RemovablePill.d.ts +34 -0
- package/dist/types/deprecated/index.d.ts +9 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +195 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DropdownPill_exports = {};
|
|
30
|
+
__export(DropdownPill_exports, {
|
|
31
|
+
DSDropdownPillWithSchema: () => DSDropdownPillWithSchema,
|
|
32
|
+
DropdownPill: () => DropdownPill
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(DropdownPill_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_ds_legacy_props_helpers = require("@elliemae/ds-legacy-props-helpers");
|
|
39
|
+
var import_ds_legacy_dropdownmenu = require("@elliemae/ds-legacy-dropdownmenu");
|
|
40
|
+
var import_ds_legacy_icons = require("@elliemae/ds-legacy-icons");
|
|
41
|
+
var import_ds_legacy_shared = require("@elliemae/ds-legacy-shared");
|
|
42
|
+
var import_Pill = require("./Pill.js");
|
|
43
|
+
const DropdownPill = ({
|
|
44
|
+
containerProps = {},
|
|
45
|
+
label = "",
|
|
46
|
+
variant,
|
|
47
|
+
tabIndex = -1,
|
|
48
|
+
closeMenuOnItemSelection = false,
|
|
49
|
+
maxWidth,
|
|
50
|
+
minWidth,
|
|
51
|
+
...dropdownProps
|
|
52
|
+
}) => {
|
|
53
|
+
const ref = (0, import_react.useRef)(null);
|
|
54
|
+
const [chevronEl, chevronRef] = (0, import_react.useState)();
|
|
55
|
+
const { focusFirst } = (0, import_ds_legacy_shared.useFocusGroupItem)(ref);
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
import_ds_legacy_dropdownmenu.DSDropdownMenu,
|
|
58
|
+
{
|
|
59
|
+
...dropdownProps,
|
|
60
|
+
closeMenuOnItemSelection,
|
|
61
|
+
maxWidth,
|
|
62
|
+
hideIfNotVisible: true,
|
|
63
|
+
menuProps: { className: "dropdown-pill-menu", zIndex: 100 },
|
|
64
|
+
minWidth,
|
|
65
|
+
onClose: focusFirst,
|
|
66
|
+
referenceNode: chevronEl,
|
|
67
|
+
triggerComponent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
68
|
+
import_Pill.Pill,
|
|
69
|
+
{
|
|
70
|
+
"data-testid": "dropdown-pill",
|
|
71
|
+
className: "dropdown-pill",
|
|
72
|
+
containerProps: { role: "listbox", ...containerProps },
|
|
73
|
+
innerRef: ref,
|
|
74
|
+
label,
|
|
75
|
+
rightAddon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: chevronRef, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_legacy_icons.ChevronDown, { className: "dropdown-pill-chevron-down", "data-testid": "dropdown-pill-button" }) }),
|
|
76
|
+
tabIndex,
|
|
77
|
+
variant
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
const props = {
|
|
84
|
+
/** props injected to component wrapper */
|
|
85
|
+
containerProps: import_ds_legacy_props_helpers.PropTypes.object.description("props injected to component wrapper"),
|
|
86
|
+
/** labeled pill text label */
|
|
87
|
+
label: import_ds_legacy_props_helpers.PropTypes.string.isRequired.description("pill text label"),
|
|
88
|
+
/** pill variant */
|
|
89
|
+
variant: import_ds_legacy_props_helpers.PropTypes.oneOf(["value", "title"]).description("pill variant"),
|
|
90
|
+
/** html focus border */
|
|
91
|
+
tabIndex: import_ds_legacy_props_helpers.PropTypes.number.description("html focus order"),
|
|
92
|
+
/** close menu on item selection */
|
|
93
|
+
closeMenuOnItemSelection: import_ds_legacy_props_helpers.PropTypes.bool.description("close menu on item selection"),
|
|
94
|
+
/** pill max width */
|
|
95
|
+
maxWidth: import_ds_legacy_props_helpers.PropTypes.oneOfType([import_ds_legacy_props_helpers.PropTypes.string, import_ds_legacy_props_helpers.PropTypes.number]).description("pill max width"),
|
|
96
|
+
/** pill min width */
|
|
97
|
+
minWidth: import_ds_legacy_props_helpers.PropTypes.oneOfType([import_ds_legacy_props_helpers.PropTypes.string, import_ds_legacy_props_helpers.PropTypes.number]).description("pill min width")
|
|
98
|
+
};
|
|
99
|
+
DropdownPill.propTypes = props;
|
|
100
|
+
DropdownPill.displayName = "DropdownPill";
|
|
101
|
+
const DSDropdownPillWithSchema = (0, import_ds_legacy_props_helpers.describe)(DropdownPill);
|
|
102
|
+
DSDropdownPillWithSchema.propTypes = props;
|
|
103
|
+
//# sourceMappingURL=DropdownPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/deprecated/DropdownPill.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport React, { useRef, useState } from 'react';\nimport { PropTypes, describe } from '@elliemae/ds-legacy-props-helpers';\nimport { DSDropdownMenu } from '@elliemae/ds-legacy-dropdownmenu';\nimport { ChevronDown } from '@elliemae/ds-legacy-icons';\nimport { useFocusGroupItem } from '@elliemae/ds-legacy-shared';\nimport { Pill } from './Pill.js';\n\nconst 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;\nDropdownPill.displayName = 'DropdownPill';\nconst DSDropdownPillWithSchema = describe(DropdownPill);\nDSDropdownPillWithSchema.propTypes = props;\n\nexport { DropdownPill, DSDropdownPillWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2CT;AAvCd,mBAAwC;AACxC,qCAAoC;AACpC,oCAA+B;AAC/B,6BAA4B;AAC5B,8BAAkC;AAClC,kBAAqB;AAErB,MAAM,eAAe,CAAC;AAAA,EACpB,iBAAiB,CAAC;AAAA,EAClB,QAAQ;AAAA,EACR;AAAA,EACA,WAAW;AAAA,EACX,2BAA2B;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,UAAM,qBAAO,IAAI;AACvB,QAAM,CAAC,WAAW,UAAU,QAAI,uBAAS;AACzC,QAAM,EAAE,WAAW,QAAI,2CAAkB,GAAG;AAC5C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,kBAAgB;AAAA,MAChB,WAAW,EAAE,WAAW,sBAAsB,QAAQ,IAAI;AAAA,MAC1D;AAAA,MACA,SAAS;AAAA,MACT,eAAe;AAAA,MACf,kBACE;AAAA,QAAC;AAAA;AAAA,UACC,eAAY;AAAA,UACZ,WAAU;AAAA,UACV,gBAAgB,EAAE,MAAM,WAAW,GAAG,eAAe;AAAA,UACrD,UAAU;AAAA,UACV;AAAA,UACA,YACE,4CAAC,SAAI,KAAK,YACR,sDAAC,sCAAY,WAAU,8BAA6B,eAAY,wBAAuB,GACzF;AAAA,UAEF;AAAA,UACA;AAAA;AAAA,MACF;AAAA;AAAA,EAEJ;AAEJ;AAEA,MAAM,QAAQ;AAAA;AAAA,EAEZ,gBAAgB,yCAAU,OAAO,YAAY,qCAAqC;AAAA;AAAA,EAElF,OAAO,yCAAU,OAAO,WAAW,YAAY,iBAAiB;AAAA;AAAA,EAEhE,SAAS,yCAAU,MAAM,CAAC,SAAS,OAAO,CAAC,EAAE,YAAY,cAAc;AAAA;AAAA,EAEvE,UAAU,yCAAU,OAAO,YAAY,kBAAkB;AAAA;AAAA,EAEzD,0BAA0B,yCAAU,KAAK,YAAY,8BAA8B;AAAA;AAAA,EAEnF,UAAU,yCAAU,UAAU,CAAC,yCAAU,QAAQ,yCAAU,MAAM,CAAC,EAAE,YAAY,gBAAgB;AAAA;AAAA,EAEhG,UAAU,yCAAU,UAAU,CAAC,yCAAU,QAAQ,yCAAU,MAAM,CAAC,EAAE,YAAY,gBAAgB;AAClG;AAEA,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,+BAA2B,yCAAS,YAAY;AACtD,yBAAyB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var InputPill_exports = {};
|
|
30
|
+
__export(InputPill_exports, {
|
|
31
|
+
InputPill: () => InputPill
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(InputPill_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_ds_legacy_utilities = require("@elliemae/ds-legacy-utilities");
|
|
37
|
+
var import_ds_legacy_icons = require("@elliemae/ds-legacy-icons");
|
|
38
|
+
var import_ds_legacy_classnames = require("@elliemae/ds-legacy-classnames");
|
|
39
|
+
var import_ds_legacy_form = require("@elliemae/ds-legacy-form");
|
|
40
|
+
var import_Pill = require("./Pill.js");
|
|
41
|
+
const StyledInputPill = (0, import_ds_legacy_classnames.aggregatedClasses)(import_Pill.Pill)("input-pill", null, ({ value }) => ({
|
|
42
|
+
value
|
|
43
|
+
}));
|
|
44
|
+
const InputPill = ({
|
|
45
|
+
containerProps = {},
|
|
46
|
+
placeholder = "Enter Value",
|
|
47
|
+
onChange = () => {
|
|
48
|
+
},
|
|
49
|
+
onRemove,
|
|
50
|
+
value,
|
|
51
|
+
type,
|
|
52
|
+
...otherProps
|
|
53
|
+
}) => {
|
|
54
|
+
(0, import_ds_legacy_utilities.useDeprecateComponent)({ componentName: "ds-pills", version: "TBD Date: 2023 Q3" });
|
|
55
|
+
let TypeOfInput = import_ds_legacy_form.DSInput;
|
|
56
|
+
switch (type) {
|
|
57
|
+
case "inputText":
|
|
58
|
+
TypeOfInput = import_ds_legacy_form.DSInput;
|
|
59
|
+
break;
|
|
60
|
+
case "inputMask":
|
|
61
|
+
TypeOfInput = import_ds_legacy_form.DSInputMask;
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
67
|
+
StyledInputPill,
|
|
68
|
+
{
|
|
69
|
+
className: "input-pill",
|
|
70
|
+
classProps: { value },
|
|
71
|
+
containerProps,
|
|
72
|
+
label: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
TypeOfInput,
|
|
74
|
+
{
|
|
75
|
+
"data-testid": "input-pill",
|
|
76
|
+
onChange,
|
|
77
|
+
placeholder,
|
|
78
|
+
value,
|
|
79
|
+
...otherProps
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
rightAddon: value && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_legacy_icons.CloseXsmall, { className: "remove-pill-button", "data-testid": "remove-pill-button", onClick: onRemove }),
|
|
83
|
+
tabIndex: -1
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=InputPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/deprecated/InputPill.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport React from 'react';\nimport { useDeprecateComponent } from '@elliemae/ds-legacy-utilities';\n\nimport { CloseXsmall } from '@elliemae/ds-legacy-icons';\nimport { aggregatedClasses } from '@elliemae/ds-legacy-classnames';\nimport { DSInput, DSInputMask } from '@elliemae/ds-legacy-form';\nimport { Pill } from './Pill.js';\n\nconst StyledInputPill = aggregatedClasses(Pill)('input-pill', null, ({ value }) => ({\n value,\n}));\n\nexport const InputPill = ({\n containerProps = {},\n placeholder = 'Enter Value',\n onChange = () => {},\n onRemove,\n value,\n type,\n ...otherProps\n}) => {\n useDeprecateComponent({ componentName: 'ds-pills', version: 'TBD Date: 2023 Q3' });\n\n let TypeOfInput = DSInput;\n // TODO: implement the DSTimeInput, see how because it returns a moment()\n // TODO: implement the DSDateInput\n switch (type) {\n case 'inputText':\n TypeOfInput = DSInput;\n break;\n case 'inputMask':\n TypeOfInput = DSInputMask;\n break;\n default:\n break;\n }\n\n return (\n <StyledInputPill\n className=\"input-pill\"\n classProps={{ value }}\n containerProps={containerProps}\n label={\n <TypeOfInput\n data-testid=\"input-pill\"\n onChange={onChange}\n placeholder={placeholder}\n value={value}\n {...otherProps}\n />\n }\n rightAddon={\n value && <CloseXsmall className=\"remove-pill-button\" data-testid=\"remove-pill-button\" onClick={onRemove} />\n }\n tabIndex={-1}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD+Cf;AA1CR,iCAAsC;AAEtC,6BAA4B;AAC5B,kCAAkC;AAClC,4BAAqC;AACrC,kBAAqB;AAErB,MAAM,sBAAkB,+CAAkB,gBAAI,EAAE,cAAc,MAAM,CAAC,EAAE,MAAM,OAAO;AAAA,EAClF;AACF,EAAE;AAEK,MAAM,YAAY,CAAC;AAAA,EACxB,iBAAiB,CAAC;AAAA,EAClB,cAAc;AAAA,EACd,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,wDAAsB,EAAE,eAAe,YAAY,SAAS,oBAAoB,CAAC;AAEjF,MAAI,cAAc;AAGlB,UAAQ,MAAM;AAAA,IACZ,KAAK;AACH,oBAAc;AACd;AAAA,IACF,KAAK;AACH,oBAAc;AACd;AAAA,IACF;AACE;AAAA,EACJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,YAAY,EAAE,MAAM;AAAA,MACpB;AAAA,MACA,OACE;AAAA,QAAC;AAAA;AAAA,UACC,eAAY;AAAA,UACZ;AAAA,UACA;AAAA,UACA;AAAA,UACC,GAAG;AAAA;AAAA,MACN;AAAA,MAEF,YACE,SAAS,4CAAC,sCAAY,WAAU,sBAAqB,eAAY,sBAAqB,SAAS,UAAU;AAAA,MAE3G,UAAU;AAAA;AAAA,EACZ;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var LabeledDropdownPills_exports = {};
|
|
30
|
+
__export(LabeledDropdownPills_exports, {
|
|
31
|
+
DSLabeledDropdownPillsWithSchema: () => DSLabeledDropdownPillsWithSchema,
|
|
32
|
+
LabeledDropdownPills: () => LabeledDropdownPills
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(LabeledDropdownPills_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_ds_legacy_utilities = require("@elliemae/ds-legacy-utilities");
|
|
38
|
+
var import_ds_legacy_props_helpers = require("@elliemae/ds-legacy-props-helpers");
|
|
39
|
+
var import_PillGroup = require("./PillGroup.js");
|
|
40
|
+
var import_LabeledDropdownSinglePill = require("./LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js");
|
|
41
|
+
var import_LabeledDropdownMultiPill = require("./LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js");
|
|
42
|
+
var import_LabeledDropdownCascadeMenuPill = require("./LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js");
|
|
43
|
+
const DropdownPills = {
|
|
44
|
+
single: import_LabeledDropdownSinglePill.LabeledDropdownSinglePill,
|
|
45
|
+
multi: import_LabeledDropdownMultiPill.LabeledDropdownMultiPills,
|
|
46
|
+
cascaded: import_LabeledDropdownCascadeMenuPill.LabeledDropdownCascadeMenuPill
|
|
47
|
+
};
|
|
48
|
+
const createDropdownPill = (type) => DropdownPills[type] || DropdownPills.single;
|
|
49
|
+
const LabeledDropdownPills = ({
|
|
50
|
+
label = "",
|
|
51
|
+
value,
|
|
52
|
+
type,
|
|
53
|
+
onFocusNextGroup,
|
|
54
|
+
onFocusPreviousGroup,
|
|
55
|
+
onFocusGroupSet,
|
|
56
|
+
maxWidth,
|
|
57
|
+
minWidth,
|
|
58
|
+
fixed,
|
|
59
|
+
className,
|
|
60
|
+
...menuProps
|
|
61
|
+
}) => {
|
|
62
|
+
const Component = createDropdownPill(type);
|
|
63
|
+
(0, import_ds_legacy_utilities.useDeprecateComponent)({ componentName: "ds-pills", version: "TBD Date: 2023 Q3" });
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
65
|
+
import_PillGroup.PillGroup,
|
|
66
|
+
{
|
|
67
|
+
onFocusGroupSet,
|
|
68
|
+
onFocusNextGroup,
|
|
69
|
+
onFocusPreviousGroup,
|
|
70
|
+
containerProps: { className },
|
|
71
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ...menuProps, label, maxWidth, minWidth, value, fixed })
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
const props = {
|
|
76
|
+
/** pill type */
|
|
77
|
+
type: import_ds_legacy_props_helpers.PropTypes.oneOf(["single", "multi", "cascaded"]).description("pill type"),
|
|
78
|
+
/** focus next group callback */
|
|
79
|
+
onFocusNextGroup: import_ds_legacy_props_helpers.PropTypes.func.description("focus next group callback"),
|
|
80
|
+
/** focus prev group callback */
|
|
81
|
+
onFocusPreviousGroup: import_ds_legacy_props_helpers.PropTypes.func.description("focus prev group callback"),
|
|
82
|
+
/** focus group set callback */
|
|
83
|
+
onFocusGroupSet: import_ds_legacy_props_helpers.PropTypes.func.description("focus group set callback"),
|
|
84
|
+
/** pill max width */
|
|
85
|
+
maxWidth: import_ds_legacy_props_helpers.PropTypes.oneOfType([import_ds_legacy_props_helpers.PropTypes.string, import_ds_legacy_props_helpers.PropTypes.number]).description("pill max width"),
|
|
86
|
+
/** pill min width */
|
|
87
|
+
minWidth: import_ds_legacy_props_helpers.PropTypes.oneOfType([import_ds_legacy_props_helpers.PropTypes.string, import_ds_legacy_props_helpers.PropTypes.number]).description("pill min width"),
|
|
88
|
+
/** fixed pill */
|
|
89
|
+
fixed: import_ds_legacy_props_helpers.PropTypes.bool.description("fixed pill"),
|
|
90
|
+
/** pill label text */
|
|
91
|
+
label: import_ds_legacy_props_helpers.PropTypes.string.isRequired.description("pill label text"),
|
|
92
|
+
/** additional className */
|
|
93
|
+
className: import_ds_legacy_props_helpers.PropTypes.string.description("Additional className"),
|
|
94
|
+
/** pill value */
|
|
95
|
+
value: import_ds_legacy_props_helpers.PropTypes.oneOfType([
|
|
96
|
+
import_ds_legacy_props_helpers.PropTypes.arrayOf(
|
|
97
|
+
import_ds_legacy_props_helpers.PropTypes.shape({
|
|
98
|
+
id: import_ds_legacy_props_helpers.PropTypes.string,
|
|
99
|
+
label: import_ds_legacy_props_helpers.PropTypes.string
|
|
100
|
+
})
|
|
101
|
+
),
|
|
102
|
+
import_ds_legacy_props_helpers.PropTypes.shape({
|
|
103
|
+
id: import_ds_legacy_props_helpers.PropTypes.string,
|
|
104
|
+
label: import_ds_legacy_props_helpers.PropTypes.string
|
|
105
|
+
})
|
|
106
|
+
]).description("pill value")
|
|
107
|
+
};
|
|
108
|
+
LabeledDropdownPills.propTypes = props;
|
|
109
|
+
LabeledDropdownPills.displayName = "LabeledDropdownPills";
|
|
110
|
+
const DSLabeledDropdownPillsWithSchema = (0, import_ds_legacy_props_helpers.describe)(LabeledDropdownPills);
|
|
111
|
+
DSLabeledDropdownPillsWithSchema.propTypes = props;
|
|
112
|
+
//# sourceMappingURL=LabeledDropdownPills.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/deprecated/LabeledDropdownPills.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport React from 'react';\nimport { useDeprecateComponent } from '@elliemae/ds-legacy-utilities';\nimport { PropTypes, describe } from '@elliemae/ds-legacy-props-helpers';\nimport { PillGroup } from './PillGroup.js';\nimport { LabeledDropdownSinglePill } from './LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js';\nimport { LabeledDropdownMultiPills } from './LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js';\nimport { LabeledDropdownCascadeMenuPill } from './LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js';\n\nconst DropdownPills = {\n single: LabeledDropdownSinglePill,\n multi: LabeledDropdownMultiPills,\n cascaded: LabeledDropdownCascadeMenuPill,\n};\n\nconst createDropdownPill = (type) => DropdownPills[type] || DropdownPills.single;\n\nconst LabeledDropdownPills = ({\n label = '',\n value,\n type,\n onFocusNextGroup,\n onFocusPreviousGroup,\n onFocusGroupSet,\n maxWidth,\n minWidth,\n fixed,\n className,\n ...menuProps\n}) => {\n const Component = createDropdownPill(type);\n useDeprecateComponent({ componentName: 'ds-pills', version: 'TBD Date: 2023 Q3' });\n\n return (\n <PillGroup\n onFocusGroupSet={onFocusGroupSet}\n onFocusNextGroup={onFocusNextGroup}\n onFocusPreviousGroup={onFocusPreviousGroup}\n containerProps={{ className }}\n >\n <Component {...menuProps} label={label} maxWidth={maxWidth} minWidth={minWidth} value={value} fixed={fixed} />\n </PillGroup>\n );\n};\n\nconst props = {\n /** pill type */\n type: PropTypes.oneOf(['single', 'multi', 'cascaded']).description('pill type'),\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 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 /** fixed pill */\n fixed: PropTypes.bool.description('fixed pill'),\n /** pill label text */\n label: PropTypes.string.isRequired.description('pill label text'),\n /** additional className */\n className: PropTypes.string.description('Additional className'),\n /** pill value */\n value: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n label: PropTypes.string,\n }),\n ),\n PropTypes.shape({\n id: PropTypes.string,\n label: PropTypes.string,\n }),\n ]).description('pill value'),\n};\n\nLabeledDropdownPills.propTypes = props;\nLabeledDropdownPills.displayName = 'LabeledDropdownPills';\nconst DSLabeledDropdownPillsWithSchema = describe(LabeledDropdownPills);\nDSLabeledDropdownPillsWithSchema.propTypes = props;\n\nexport { LabeledDropdownPills, DSLabeledDropdownPillsWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2CjB;AAtCN,iCAAsC;AACtC,qCAAoC;AACpC,uBAA0B;AAC1B,uCAA0C;AAC1C,sCAA0C;AAC1C,4CAA+C;AAE/C,MAAM,gBAAgB;AAAA,EACpB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AACZ;AAEA,MAAM,qBAAqB,CAAC,SAAS,cAAc,IAAI,KAAK,cAAc;AAE1E,MAAM,uBAAuB,CAAC;AAAA,EAC5B,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,YAAY,mBAAmB,IAAI;AACzC,wDAAsB,EAAE,eAAe,YAAY,SAAS,oBAAoB,CAAC;AAEjF,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAgB,EAAE,UAAU;AAAA,MAE5B,sDAAC,aAAW,GAAG,WAAW,OAAc,UAAoB,UAAoB,OAAc,OAAc;AAAA;AAAA,EAC9G;AAEJ;AAEA,MAAM,QAAQ;AAAA;AAAA,EAEZ,MAAM,yCAAU,MAAM,CAAC,UAAU,SAAS,UAAU,CAAC,EAAE,YAAY,WAAW;AAAA;AAAA,EAE9E,kBAAkB,yCAAU,KAAK,YAAY,2BAA2B;AAAA;AAAA,EAExE,sBAAsB,yCAAU,KAAK,YAAY,2BAA2B;AAAA;AAAA,EAE5E,iBAAiB,yCAAU,KAAK,YAAY,0BAA0B;AAAA;AAAA,EAEtE,UAAU,yCAAU,UAAU,CAAC,yCAAU,QAAQ,yCAAU,MAAM,CAAC,EAAE,YAAY,gBAAgB;AAAA;AAAA,EAEhG,UAAU,yCAAU,UAAU,CAAC,yCAAU,QAAQ,yCAAU,MAAM,CAAC,EAAE,YAAY,gBAAgB;AAAA;AAAA,EAEhG,OAAO,yCAAU,KAAK,YAAY,YAAY;AAAA;AAAA,EAE9C,OAAO,yCAAU,OAAO,WAAW,YAAY,iBAAiB;AAAA;AAAA,EAEhE,WAAW,yCAAU,OAAO,YAAY,sBAAsB;AAAA;AAAA,EAE9D,OAAO,yCAAU,UAAU;AAAA,IACzB,yCAAU;AAAA,MACR,yCAAU,MAAM;AAAA,QACd,IAAI,yCAAU;AAAA,QACd,OAAO,yCAAU;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,IACA,yCAAU,MAAM;AAAA,MACd,IAAI,yCAAU;AAAA,MACd,OAAO,yCAAU;AAAA,IACnB,CAAC;AAAA,EACH,CAAC,EAAE,YAAY,YAAY;AAC7B;AAEA,qBAAqB,YAAY;AACjC,qBAAqB,cAAc;AACnC,MAAM,uCAAmC,yCAAS,oBAAoB;AACtE,iCAAiC,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var LabeledDropdownCascadeMenuPill_exports = {};
|
|
30
|
+
__export(LabeledDropdownCascadeMenuPill_exports, {
|
|
31
|
+
LabeledDropdownCascadeMenuPill: () => LabeledDropdownCascadeMenuPill,
|
|
32
|
+
default: () => LabeledDropdownCascadeMenuPill_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(LabeledDropdownCascadeMenuPill_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_ds_legacy_utilities = require("@elliemae/ds-legacy-utilities");
|
|
39
|
+
var import_PillGroup = require("../PillGroup.js");
|
|
40
|
+
var import_RemovablePill = require("../RemovablePill.js");
|
|
41
|
+
var import_DropdownPill = require("../DropdownPill.js");
|
|
42
|
+
function renderMenuItems(options, factory) {
|
|
43
|
+
return options.map((option, index) => {
|
|
44
|
+
const ItemComponent = factory("radio");
|
|
45
|
+
if (option.type === "submenu") {
|
|
46
|
+
const SubmenuComponent = factory("submenu");
|
|
47
|
+
const ChildComponent = factory("selection-group");
|
|
48
|
+
return /* @__PURE__ */ (0, import_react.createElement)(SubmenuComponent, { ...option, key: option.id, item: option }, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
|
+
ChildComponent,
|
|
50
|
+
{
|
|
51
|
+
...option,
|
|
52
|
+
id: option.id,
|
|
53
|
+
item: option,
|
|
54
|
+
items: option.items,
|
|
55
|
+
itemValueAccessor: (item) => item,
|
|
56
|
+
multi: true
|
|
57
|
+
}
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ (0, import_react.createElement)(ItemComponent, { ...option, key: option.id || index, item: option });
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const getSubmenuOptionLabelById = (options, id) => {
|
|
64
|
+
const index = options.findIndex((option) => option.id === id);
|
|
65
|
+
return index ? options[index].label : "";
|
|
66
|
+
};
|
|
67
|
+
const LabeledDropdownCascadeMenuPill = ({
|
|
68
|
+
label,
|
|
69
|
+
options,
|
|
70
|
+
value: optionValue,
|
|
71
|
+
onChange,
|
|
72
|
+
onRemove,
|
|
73
|
+
value: selection = {},
|
|
74
|
+
placeholder = "---",
|
|
75
|
+
onFocusNextGroup,
|
|
76
|
+
onFocusPreviousGroup,
|
|
77
|
+
onFocusGroupSet,
|
|
78
|
+
maxWidth,
|
|
79
|
+
minWidth,
|
|
80
|
+
...menuProps
|
|
81
|
+
}) => {
|
|
82
|
+
const selectionId = Object.keys(selection)[0];
|
|
83
|
+
const selectionValues = selection[selectionId] || "";
|
|
84
|
+
const dropdownLabel = Array.isArray(selectionValues) ? getSubmenuOptionLabelById(options, selectionId) : selectionValues;
|
|
85
|
+
const handleSelectChange = ({ item, group }) => {
|
|
86
|
+
if ((0, import_ds_legacy_utilities.isFunction)(onChange)) {
|
|
87
|
+
const nextSelection = group ? {
|
|
88
|
+
[group.id]: (0, import_ds_legacy_utilities.addOrRemove)([...selection[group.id] || []], item, (o) => o.id)
|
|
89
|
+
} : {
|
|
90
|
+
[item.id]: item.label
|
|
91
|
+
};
|
|
92
|
+
onChange(nextSelection);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
const removeOption = (option) => {
|
|
96
|
+
if ((0, import_ds_legacy_utilities.isFunction)(onChange)) {
|
|
97
|
+
const nextSelection = {
|
|
98
|
+
[selectionId]: selectionValues.filter((val) => option.id !== val.id)
|
|
99
|
+
};
|
|
100
|
+
onChange(nextSelection);
|
|
101
|
+
}
|
|
102
|
+
onRemove(option);
|
|
103
|
+
};
|
|
104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
105
|
+
import_PillGroup.PillGroup,
|
|
106
|
+
{
|
|
107
|
+
onFocusGroupSet,
|
|
108
|
+
onFocusNextGroup,
|
|
109
|
+
onFocusPreviousGroup,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
+
import_DropdownPill.DropdownPill,
|
|
113
|
+
{
|
|
114
|
+
...menuProps,
|
|
115
|
+
itemsRenderer: renderMenuItems,
|
|
116
|
+
label: dropdownLabel || placeholder,
|
|
117
|
+
maxWidth,
|
|
118
|
+
minWidth,
|
|
119
|
+
onSelectChange: handleSelectChange,
|
|
120
|
+
options,
|
|
121
|
+
selection: {
|
|
122
|
+
[selectionId]: Array.isArray(selectionValues) ? selectionValues.map((v) => v.id) : selectionValues
|
|
123
|
+
},
|
|
124
|
+
singleGroupSelection: true,
|
|
125
|
+
variant: "title"
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
Array.isArray(selectionValues) && selectionValues.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_RemovablePill.RemovablePill, { label: option.label, onRemove: () => removeOption(option) }, option.id))
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
var LabeledDropdownCascadeMenuPill_default = LabeledDropdownCascadeMenuPill;
|
|
134
|
+
//# sourceMappingURL=LabeledDropdownCascadeMenuPill.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable eslint-comments/no-unlimited-disable */\n/* eslint-disable */\n// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport React from 'react';\nimport { isFunction, addOrRemove } from '@elliemae/ds-legacy-utilities';\nimport { PillGroup } from '../PillGroup.js';\nimport { RemovablePill } from '../RemovablePill.js';\nimport { DropdownPill } from '../DropdownPill.js';\n\nfunction renderMenuItems(options, factory) {\n return options.map((option, index) => {\n const ItemComponent = factory('radio');\n\n if (option.type === 'submenu') {\n const SubmenuComponent = factory('submenu');\n const ChildComponent = factory('selection-group');\n return (\n <SubmenuComponent {...option} key={option.id} item={option}>\n <ChildComponent\n {...option}\n id={option.id}\n item={option}\n items={option.items}\n itemValueAccessor={(item) => item}\n multi\n />\n </SubmenuComponent>\n );\n }\n\n return <ItemComponent {...option} key={option.id || index} item={option} />;\n });\n}\n\nconst getSubmenuOptionLabelById = (options, id) => {\n const index = options.findIndex((option) => option.id === id);\n return index ? options[index].label : '';\n};\n\nconst LabeledDropdownCascadeMenuPill = ({\n label,\n options,\n value: optionValue,\n onChange,\n onRemove,\n value: selection = {},\n placeholder = '---',\n onFocusNextGroup,\n onFocusPreviousGroup,\n onFocusGroupSet,\n maxWidth,\n minWidth,\n ...menuProps\n}) => {\n const selectionId = Object.keys(selection)[0];\n const selectionValues = selection[selectionId] || '';\n const dropdownLabel = Array.isArray(selectionValues)\n ? getSubmenuOptionLabelById(options, selectionId)\n : selectionValues;\n\n const handleSelectChange = ({ item, group }) => {\n if (isFunction(onChange)) {\n const nextSelection = group\n ? {\n [group.id]: addOrRemove([...(selection[group.id] || [])], item, (o) => o.id),\n }\n : {\n [item.id]: item.label,\n };\n onChange(nextSelection);\n }\n };\n\n const removeOption = (option) => {\n if (isFunction(onChange)) {\n const nextSelection = {\n [selectionId]: selectionValues.filter((val) => option.id !== val.id),\n };\n onChange(nextSelection);\n }\n onRemove(option);\n };\n\n return (\n <PillGroup\n onFocusGroupSet={onFocusGroupSet}\n onFocusNextGroup={onFocusNextGroup}\n onFocusPreviousGroup={onFocusPreviousGroup}\n >\n <DropdownPill\n {...menuProps}\n itemsRenderer={renderMenuItems}\n label={dropdownLabel || placeholder}\n maxWidth={maxWidth}\n minWidth={minWidth}\n onSelectChange={handleSelectChange}\n options={options}\n selection={{\n [selectionId]: Array.isArray(selectionValues) ? selectionValues.map((v) => v.id) : selectionValues,\n }}\n singleGroupSelection\n variant=\"title\"\n />\n {Array.isArray(selectionValues) &&\n selectionValues.map((option) => (\n <RemovablePill key={option.id} label={option.label} onRemove={() => removeOption(option)} />\n ))}\n </PillGroup>\n );\n};\n\nexport { LabeledDropdownCascadeMenuPill };\nexport default LabeledDropdownCascadeMenuPill;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBb;AADF;AAbR,iCAAwC;AACxC,uBAA0B;AAC1B,2BAA8B;AAC9B,0BAA6B;AAE7B,SAAS,gBAAgB,SAAS,SAAS;AACzC,SAAO,QAAQ,IAAI,CAAC,QAAQ,UAAU;AACpC,UAAM,gBAAgB,QAAQ,OAAO;AAErC,QAAI,OAAO,SAAS,WAAW;AAC7B,YAAM,mBAAmB,QAAQ,SAAS;AAC1C,YAAM,iBAAiB,QAAQ,iBAAiB;AAChD,aACE,gDAAC,oBAAkB,GAAG,QAAQ,KAAK,OAAO,IAAI,MAAM,UAClD;AAAA,QAAC;AAAA;AAAA,UACE,GAAG;AAAA,UACJ,IAAI,OAAO;AAAA,UACX,MAAM;AAAA,UACN,OAAO,OAAO;AAAA,UACd,mBAAmB,CAAC,SAAS;AAAA,UAC7B,OAAK;AAAA;AAAA,MACP,CACF;AAAA,IAEJ;AAEA,WAAO,gDAAC,iBAAe,GAAG,QAAQ,KAAK,OAAO,MAAM,OAAO,MAAM,QAAQ;AAAA,EAC3E,CAAC;AACH;AAEA,MAAM,4BAA4B,CAAC,SAAS,OAAO;AACjD,QAAM,QAAQ,QAAQ,UAAU,CAAC,WAAW,OAAO,OAAO,EAAE;AAC5D,SAAO,QAAQ,QAAQ,KAAK,EAAE,QAAQ;AACxC;AAEA,MAAM,iCAAiC,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,OAAO,YAAY,CAAC;AAAA,EACpB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,cAAc,OAAO,KAAK,SAAS,EAAE,CAAC;AAC5C,QAAM,kBAAkB,UAAU,WAAW,KAAK;AAClD,QAAM,gBAAgB,MAAM,QAAQ,eAAe,IAC/C,0BAA0B,SAAS,WAAW,IAC9C;AAEJ,QAAM,qBAAqB,CAAC,EAAE,MAAM,MAAM,MAAM;AAC9C,YAAI,uCAAW,QAAQ,GAAG;AACxB,YAAM,gBAAgB,QAClB;AAAA,QACE,CAAC,MAAM,EAAE,OAAG,wCAAY,CAAC,GAAI,UAAU,MAAM,EAAE,KAAK,CAAC,CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE;AAAA,MAC7E,IACA;AAAA,QACE,CAAC,KAAK,EAAE,GAAG,KAAK;AAAA,MAClB;AACJ,eAAS,aAAa;AAAA,IACxB;AAAA,EACF;AAEA,QAAM,eAAe,CAAC,WAAW;AAC/B,YAAI,uCAAW,QAAQ,GAAG;AACxB,YAAM,gBAAgB;AAAA,QACpB,CAAC,WAAW,GAAG,gBAAgB,OAAO,CAAC,QAAQ,OAAO,OAAO,IAAI,EAAE;AAAA,MACrE;AACA,eAAS,aAAa;AAAA,IACxB;AACA,aAAS,MAAM;AAAA,EACjB;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACE,GAAG;AAAA,YACJ,eAAe;AAAA,YACf,OAAO,iBAAiB;AAAA,YACxB;AAAA,YACA;AAAA,YACA,gBAAgB;AAAA,YAChB;AAAA,YACA,WAAW;AAAA,cACT,CAAC,WAAW,GAAG,MAAM,QAAQ,eAAe,IAAI,gBAAgB,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI;AAAA,YACrF;AAAA,YACA,sBAAoB;AAAA,YACpB,SAAQ;AAAA;AAAA,QACV;AAAA,QACC,MAAM,QAAQ,eAAe,KAC5B,gBAAgB,IAAI,CAAC,WACnB,4CAAC,sCAA8B,OAAO,OAAO,OAAO,UAAU,MAAM,aAAa,MAAM,KAAnE,OAAO,EAA+D,CAC3F;AAAA;AAAA;AAAA,EACL;AAEJ;AAGA,IAAO,yCAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var LabeledDropdownMultiPill_exports = {};
|
|
30
|
+
__export(LabeledDropdownMultiPill_exports, {
|
|
31
|
+
LabeledDropdownMultiPills: () => LabeledDropdownMultiPills,
|
|
32
|
+
default: () => LabeledDropdownMultiPill_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(LabeledDropdownMultiPill_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_react = require("react");
|
|
38
|
+
var import_lodash = require("lodash");
|
|
39
|
+
var import_ds_legacy_utilities = require("@elliemae/ds-legacy-utilities");
|
|
40
|
+
var import_RemovablePill = require("../RemovablePill.js");
|
|
41
|
+
var import_Pill = require("../Pill.js");
|
|
42
|
+
var import_OverflowPill = require("../OverflowPill.js");
|
|
43
|
+
var import_DropdownPill = require("../DropdownPill.js");
|
|
44
|
+
const LabeledDropdownMultiPills = ({
|
|
45
|
+
label,
|
|
46
|
+
options = [],
|
|
47
|
+
value = [],
|
|
48
|
+
onSelect = () => null,
|
|
49
|
+
onRemove = () => null,
|
|
50
|
+
onChange,
|
|
51
|
+
// if this is defined, then it's calculating the next result onSelect or onRemove
|
|
52
|
+
maxWidth,
|
|
53
|
+
minWidth,
|
|
54
|
+
...menuProps
|
|
55
|
+
}) => {
|
|
56
|
+
const [totalDefaultOptions, setTotalDefaultOptions] = (0, import_react.useState)(0);
|
|
57
|
+
const [selectedOptions, setSelectedOptions] = (0, import_react.useState)(value);
|
|
58
|
+
const [allOptions, setAllOptions] = (0, import_react.useState)(options);
|
|
59
|
+
const [overflowOptions, setOverflowOptions] = (0, import_react.useState)([]);
|
|
60
|
+
const overflowQuantity = 3;
|
|
61
|
+
(0, import_react.useEffect)(() => setSelectedOptions(value), [value]);
|
|
62
|
+
(0, import_react.useEffect)(() => {
|
|
63
|
+
const newOptions = allOptions.filter((option) => option.fixedItem);
|
|
64
|
+
if (newOptions.length > 0) {
|
|
65
|
+
setSelectedOptions(newOptions);
|
|
66
|
+
}
|
|
67
|
+
setTotalDefaultOptions(newOptions.length);
|
|
68
|
+
}, []);
|
|
69
|
+
(0, import_react.useEffect)(() => {
|
|
70
|
+
if (totalDefaultOptions) {
|
|
71
|
+
const newOptions = allOptions.map((opt) => {
|
|
72
|
+
if (selectedOptions.length <= totalDefaultOptions && (0, import_lodash.find)(selectedOptions, { id: opt.id })) {
|
|
73
|
+
return { ...opt, fixedItem: true };
|
|
74
|
+
}
|
|
75
|
+
return { ...opt, fixedItem: false };
|
|
76
|
+
});
|
|
77
|
+
setAllOptions(newOptions);
|
|
78
|
+
}
|
|
79
|
+
}, [onSelect, onRemove, selectedOptions]);
|
|
80
|
+
(0, import_react.useEffect)(() => {
|
|
81
|
+
if (selectedOptions.length > overflowQuantity) {
|
|
82
|
+
const overflow = selectedOptions.filter((val, index) => index >= overflowQuantity);
|
|
83
|
+
setOverflowOptions(overflow);
|
|
84
|
+
}
|
|
85
|
+
}, [selectedOptions]);
|
|
86
|
+
const selectOption = (0, import_react.useCallback)(
|
|
87
|
+
(option) => {
|
|
88
|
+
if (!option.fixedItem) {
|
|
89
|
+
if ((0, import_ds_legacy_utilities.isFunction)(onChange)) {
|
|
90
|
+
const nextValue = (0, import_ds_legacy_utilities.addOrRemove)(selectedOptions, option, (item) => item.id);
|
|
91
|
+
setSelectedOptions(nextValue);
|
|
92
|
+
onChange(nextValue);
|
|
93
|
+
}
|
|
94
|
+
onSelect(option);
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
[selectedOptions]
|
|
98
|
+
);
|
|
99
|
+
const removeOption = (0, import_react.useCallback)(
|
|
100
|
+
(option) => {
|
|
101
|
+
if (!option.fixedItem || selectedOptions.length > totalDefaultOptions) {
|
|
102
|
+
if ((0, import_ds_legacy_utilities.isFunction)(onChange)) {
|
|
103
|
+
const nextValue = selectedOptions.filter((val) => option.id !== val.id);
|
|
104
|
+
setSelectedOptions(nextValue);
|
|
105
|
+
onChange(nextValue);
|
|
106
|
+
}
|
|
107
|
+
onRemove(option);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
[selectedOptions]
|
|
111
|
+
);
|
|
112
|
+
const typeOfPill = () => {
|
|
113
|
+
if (selectedOptions.length > totalDefaultOptions) {
|
|
114
|
+
return import_RemovablePill.RemovablePill;
|
|
115
|
+
}
|
|
116
|
+
return import_Pill.Pill;
|
|
117
|
+
};
|
|
118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
import_DropdownPill.DropdownPill,
|
|
121
|
+
{
|
|
122
|
+
...menuProps,
|
|
123
|
+
focusOnOpen: false,
|
|
124
|
+
label,
|
|
125
|
+
maxWidth,
|
|
126
|
+
minWidth,
|
|
127
|
+
onSelectMenuItem: selectOption,
|
|
128
|
+
options: [
|
|
129
|
+
{
|
|
130
|
+
...menuProps,
|
|
131
|
+
type: "SelectionGroup",
|
|
132
|
+
id: "multi-selection-views",
|
|
133
|
+
multi: true,
|
|
134
|
+
items: allOptions
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
selection: {
|
|
138
|
+
"multi-selection-views": selectedOptions ? selectedOptions.map((o) => o.id) : ""
|
|
139
|
+
},
|
|
140
|
+
variant: "title"
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
selectedOptions && selectedOptions.map((option, index) => {
|
|
144
|
+
const TypeOfPill = typeOfPill();
|
|
145
|
+
if (index < overflowQuantity) {
|
|
146
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TypeOfPill, { label: option.label, onRemove: () => removeOption(option) }, option.id);
|
|
147
|
+
}
|
|
148
|
+
return null;
|
|
149
|
+
}),
|
|
150
|
+
selectedOptions && selectedOptions.length > overflowQuantity && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_OverflowPill.OverflowPill, { label: `+ ${selectedOptions.length - overflowQuantity}`, options: overflowOptions })
|
|
151
|
+
] });
|
|
152
|
+
};
|
|
153
|
+
var LabeledDropdownMultiPill_default = LabeledDropdownMultiPills;
|
|
154
|
+
//# sourceMappingURL=LabeledDropdownMultiPill.js.map
|