@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.
Files changed (125) hide show
  1. package/cjs/components/Pill.js +56 -49
  2. package/cjs/components/Pill.js.map +7 -0
  3. package/cjs/components/PillButton.js +54 -52
  4. package/cjs/components/PillButton.js.map +7 -0
  5. package/cjs/components/PillGroup.js +61 -53
  6. package/cjs/components/PillGroup.js.map +7 -0
  7. package/cjs/components/index.js +30 -17
  8. package/cjs/components/index.js.map +7 -0
  9. package/cjs/components/styled.js +228 -78
  10. package/cjs/components/styled.js.map +7 -0
  11. package/cjs/components/types/DropdownPill.js +79 -77
  12. package/cjs/components/types/DropdownPill.js.map +7 -0
  13. package/cjs/components/types/InputPill.js +58 -48
  14. package/cjs/components/types/InputPill.js.map +7 -0
  15. package/cjs/components/types/LabelPill.js +44 -38
  16. package/cjs/components/types/LabelPill.js.map +7 -0
  17. package/cjs/components/types/ReadOnlyPill.js +48 -43
  18. package/cjs/components/types/ReadOnlyPill.js.map +7 -0
  19. package/cjs/components/types/RemovablePill.js +60 -53
  20. package/cjs/components/types/RemovablePill.js.map +7 -0
  21. package/cjs/components/types/ValuePill.js +48 -43
  22. package/cjs/components/types/ValuePill.js.map +7 -0
  23. package/cjs/components/types/index.js +33 -19
  24. package/cjs/components/types/index.js.map +7 -0
  25. package/cjs/deprecated/DropdownPill.js +80 -101
  26. package/cjs/deprecated/DropdownPill.js.map +7 -0
  27. package/cjs/deprecated/InputPill.js +67 -69
  28. package/cjs/deprecated/InputPill.js.map +7 -0
  29. package/cjs/deprecated/LabeledDropdownPills.js +92 -96
  30. package/cjs/deprecated/LabeledDropdownPills.js.map +7 -0
  31. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +91 -94
  32. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
  33. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +106 -114
  34. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
  35. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +119 -127
  36. package/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
  37. package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +39 -15
  38. package/cjs/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
  39. package/cjs/deprecated/LabeledPills.js +65 -52
  40. package/cjs/deprecated/LabeledPills.js.map +7 -0
  41. package/cjs/deprecated/OverflowPill.js +59 -53
  42. package/cjs/deprecated/OverflowPill.js.map +7 -0
  43. package/cjs/deprecated/Pill.js +67 -82
  44. package/cjs/deprecated/Pill.js.map +7 -0
  45. package/cjs/deprecated/PillGroup.js +68 -68
  46. package/cjs/deprecated/PillGroup.js.map +7 -0
  47. package/cjs/deprecated/ReadOnlyPill.js +93 -94
  48. package/cjs/deprecated/ReadOnlyPill.js.map +7 -0
  49. package/cjs/deprecated/RemovablePill.js +61 -57
  50. package/cjs/deprecated/RemovablePill.js.map +7 -0
  51. package/cjs/deprecated/index.js +43 -33
  52. package/cjs/deprecated/index.js.map +7 -0
  53. package/cjs/index.d.js +27 -2
  54. package/cjs/index.d.js.map +7 -0
  55. package/cjs/index.js +37 -43
  56. package/cjs/index.js.map +7 -0
  57. package/cjs/props.js +72 -46
  58. package/cjs/props.js.map +7 -0
  59. package/cjs/utils.js +43 -25
  60. package/cjs/utils.js.map +7 -0
  61. package/esm/components/Pill.js +18 -31
  62. package/esm/components/Pill.js.map +7 -0
  63. package/esm/components/PillButton.js +22 -39
  64. package/esm/components/PillButton.js.map +7 -0
  65. package/esm/components/PillGroup.js +28 -38
  66. package/esm/components/PillGroup.js.map +7 -0
  67. package/esm/components/index.js +5 -3
  68. package/esm/components/index.js.map +7 -0
  69. package/esm/components/styled.js +205 -66
  70. package/esm/components/styled.js.map +7 -0
  71. package/esm/components/types/DropdownPill.js +50 -67
  72. package/esm/components/types/DropdownPill.js.map +7 -0
  73. package/esm/components/types/InputPill.js +25 -35
  74. package/esm/components/types/InputPill.js.map +7 -0
  75. package/esm/components/types/LabelPill.js +15 -29
  76. package/esm/components/types/LabelPill.js.map +7 -0
  77. package/esm/components/types/ReadOnlyPill.js +19 -34
  78. package/esm/components/types/ReadOnlyPill.js.map +7 -0
  79. package/esm/components/types/RemovablePill.js +31 -44
  80. package/esm/components/types/RemovablePill.js.map +7 -0
  81. package/esm/components/types/ValuePill.js +19 -34
  82. package/esm/components/types/ValuePill.js.map +7 -0
  83. package/esm/components/types/index.js +8 -6
  84. package/esm/components/types/index.js.map +7 -0
  85. package/esm/deprecated/DropdownPill.js +49 -86
  86. package/esm/deprecated/DropdownPill.js.map +7 -0
  87. package/esm/deprecated/InputPill.js +38 -59
  88. package/esm/deprecated/InputPill.js.map +7 -0
  89. package/esm/deprecated/LabeledDropdownPills.js +59 -81
  90. package/esm/deprecated/LabeledDropdownPills.js.map +7 -0
  91. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +60 -84
  92. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
  93. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +65 -94
  94. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
  95. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +79 -108
  96. package/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
  97. package/esm/deprecated/LabeledDropdownPillsTypes/utils.js +9 -10
  98. package/esm/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
  99. package/esm/deprecated/LabeledPills.js +34 -41
  100. package/esm/deprecated/LabeledPills.js.map +7 -0
  101. package/esm/deprecated/OverflowPill.js +25 -37
  102. package/esm/deprecated/OverflowPill.js.map +7 -0
  103. package/esm/deprecated/Pill.js +39 -71
  104. package/esm/deprecated/Pill.js.map +7 -0
  105. package/esm/deprecated/PillGroup.js +39 -56
  106. package/esm/deprecated/PillGroup.js.map +7 -0
  107. package/esm/deprecated/ReadOnlyPill.js +60 -79
  108. package/esm/deprecated/ReadOnlyPill.js.map +7 -0
  109. package/esm/deprecated/RemovablePill.js +30 -45
  110. package/esm/deprecated/RemovablePill.js.map +7 -0
  111. package/esm/deprecated/index.js +14 -8
  112. package/esm/deprecated/index.js.map +7 -0
  113. package/esm/index.d.js +2 -1
  114. package/esm/index.d.js.map +7 -0
  115. package/esm/index.js +8 -11
  116. package/esm/index.js.map +7 -0
  117. package/esm/props.js +42 -36
  118. package/esm/props.js.map +7 -0
  119. package/esm/utils.js +16 -23
  120. package/esm/utils.js.map +7 -0
  121. package/package.json +15 -15
  122. package/types/deprecated/LabeledDropdownPills.d.ts +1 -1
  123. package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +3 -1
  124. package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +3 -1
  125. package/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +1 -0
@@ -1,68 +1,45 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _jsx from '@babel/runtime/helpers/esm/jsx';
7
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
- import 'react';
10
- import { CloseXsmall } from '@elliemae/ds-icons';
11
- import { aggregatedClasses } from '@elliemae/ds-classnames';
12
- import { DSInput, DSInputMask } from '@elliemae/ds-form';
13
- import { Pill } from './Pill.js';
14
- import { jsx } from 'react/jsx-runtime';
15
-
16
- const _excluded = ["containerProps", "placeholder", "onChange", "onRemove", "value", "type"];
17
-
18
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19
-
20
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
- const StyledInputPill = aggregatedClasses(Pill)('input-pill', null, _ref => {
22
- let {
23
- value
24
- } = _ref;
25
- return {
26
- value
27
- };
28
- });
29
- function InputPill(_ref2) {
30
- let {
31
- containerProps = {},
32
- placeholder = 'Enter Value',
33
- onChange = () => {},
34
- onRemove,
35
- value,
36
- type
37
- } = _ref2,
38
- otherProps = _objectWithoutProperties(_ref2, _excluded);
39
-
40
- let TypeOfInput = DSInput; // TODO: implement the DSTimeInput, see how because it returns a moment()
41
- // TODO: implement the DSDateInput
42
-
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { CloseXsmall } from "@elliemae/ds-icons";
4
+ import { aggregatedClasses } from "@elliemae/ds-classnames";
5
+ import { DSInput, DSInputMask } from "@elliemae/ds-form";
6
+ import { Pill } from "./Pill";
7
+ const StyledInputPill = aggregatedClasses(Pill)("input-pill", null, ({ value }) => ({
8
+ value
9
+ }));
10
+ function InputPill({
11
+ containerProps = {},
12
+ placeholder = "Enter Value",
13
+ onChange = () => {
14
+ },
15
+ onRemove,
16
+ value,
17
+ type,
18
+ ...otherProps
19
+ }) {
20
+ let TypeOfInput = DSInput;
43
21
  switch (type) {
44
- case 'inputText':
22
+ case "inputText":
45
23
  TypeOfInput = DSInput;
46
24
  break;
47
-
48
- case 'inputMask':
25
+ case "inputMask":
49
26
  TypeOfInput = DSInputMask;
50
27
  break;
28
+ default:
29
+ break;
51
30
  }
52
-
53
- return /*#__PURE__*/_jsx(StyledInputPill, {
31
+ return /* @__PURE__ */ React2.createElement(StyledInputPill, {
54
32
  className: "input-pill",
55
- classProps: {
56
- value
57
- },
58
- containerProps: containerProps,
59
- label: /*#__PURE__*/jsx(TypeOfInput, _objectSpread({
33
+ classProps: { value },
34
+ containerProps,
35
+ label: /* @__PURE__ */ React2.createElement(TypeOfInput, {
60
36
  "data-testid": "input-pill",
61
- onChange: onChange,
62
- placeholder: placeholder,
63
- value: value
64
- }, otherProps)),
65
- rightAddon: value && /*#__PURE__*/_jsx(CloseXsmall, {
37
+ onChange,
38
+ placeholder,
39
+ value,
40
+ ...otherProps
41
+ }),
42
+ rightAddon: value && /* @__PURE__ */ React2.createElement(CloseXsmall, {
66
43
  className: "remove-pill-button",
67
44
  "data-testid": "remove-pill-button",
68
45
  onClick: onRemove
@@ -70,5 +47,7 @@ function InputPill(_ref2) {
70
47
  tabIndex: -1
71
48
  });
72
49
  }
73
-
74
- export { InputPill };
50
+ export {
51
+ InputPill
52
+ };
53
+ //# sourceMappingURL=InputPill.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/InputPill.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { CloseXsmall } from '@elliemae/ds-icons';\nimport { aggregatedClasses } from '@elliemae/ds-classnames';\nimport { DSInput, DSInputMask } from '@elliemae/ds-form';\nimport { Pill } from './Pill';\n\nconst StyledInputPill = aggregatedClasses(Pill)('input-pill', null, ({ value }) => ({\n value,\n}));\n\nexport function InputPill({\n containerProps = {},\n placeholder = 'Enter Value',\n onChange = () => {},\n onRemove,\n value,\n type,\n ...otherProps\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"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA,MAAM,kBAAkB,kBAAkB,MAAM,cAAc,MAAM,CAAC,EAAE,YAAa;AAAA,EAClF;AAAA;AAGK,mBAAmB;AAAA,EACxB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,WAAW,MAAM;AAAA;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,GACF;AACD,MAAI,cAAc;AAGlB,UAAQ;AAAA,SACD;AACH,oBAAc;AACd;AAAA,SACG;AACH,oBAAc;AACd;AAAA;AAEA;AAAA;AAGJ,SACE,qCAAC,iBAAD;AAAA,IACE,WAAU;AAAA,IACV,YAAY,EAAE;AAAA,IACd;AAAA,IACA,OACE,qCAAC,aAAD;AAAA,MACE,eAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,SACI;AAAA;AAAA,IAGR,YACE,SAAS,qCAAC,aAAD;AAAA,MAAa,WAAU;AAAA,MAAqB,eAAY;AAAA,MAAqB,SAAS;AAAA;AAAA,IAEjG,UAAU;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -1,95 +1,73 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _jsx from '@babel/runtime/helpers/esm/jsx';
7
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
- import 'react';
10
- import { PropTypes, describe } from 'react-desc';
11
- import { PillGroup } from './PillGroup.js';
12
- import LabeledDropdownSinglePill from './LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js';
13
- import LabeledDropdownMultiPills from './LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js';
14
- import LabeledDropdownCascadeMenuPill from './LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js';
15
- import { jsx } from 'react/jsx-runtime';
16
-
17
- const _excluded = ["label", "value", "type", "onFocusNextGroup", "onFocusPreviousGroup", "onFocusGroupSet", "maxWidth", "minWidth", "fixed"];
18
-
19
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
-
21
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { PropTypes, describe } from "react-desc";
4
+ import { PillGroup } from "./PillGroup";
5
+ import { LabeledDropdownSinglePill } from "./LabeledDropdownPillsTypes/LabeledDropdownSinglePill";
6
+ import { LabeledDropdownMultiPills } from "./LabeledDropdownPillsTypes/LabeledDropdownMultiPill";
7
+ import { LabeledDropdownCascadeMenuPill } from "./LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill";
22
8
  const DropdownPills = {
23
9
  single: LabeledDropdownSinglePill,
24
10
  multi: LabeledDropdownMultiPills,
25
11
  cascaded: LabeledDropdownCascadeMenuPill
26
12
  };
27
-
28
- const createDropdownPill = type => DropdownPills[type] || DropdownPills.single;
29
-
30
- function LabeledDropdownPills(_ref) {
31
- let {
32
- label = '',
33
- value,
34
- type,
35
- onFocusNextGroup,
36
- onFocusPreviousGroup,
13
+ const createDropdownPill = (type) => DropdownPills[type] || DropdownPills.single;
14
+ function LabeledDropdownPills({
15
+ label = "",
16
+ value,
17
+ type,
18
+ onFocusNextGroup,
19
+ onFocusPreviousGroup,
20
+ onFocusGroupSet,
21
+ maxWidth,
22
+ minWidth,
23
+ fixed,
24
+ ...menuProps
25
+ }) {
26
+ const Component = createDropdownPill(type);
27
+ return /* @__PURE__ */ React2.createElement(PillGroup, {
37
28
  onFocusGroupSet,
29
+ onFocusNextGroup,
30
+ onFocusPreviousGroup
31
+ }, /* @__PURE__ */ React2.createElement(Component, {
32
+ ...menuProps,
33
+ label,
38
34
  maxWidth,
39
35
  minWidth,
36
+ value,
40
37
  fixed
41
- } = _ref,
42
- menuProps = _objectWithoutProperties(_ref, _excluded);
43
-
44
- const Component = createDropdownPill(type);
45
- return /*#__PURE__*/_jsx(PillGroup, {
46
- onFocusGroupSet: onFocusGroupSet,
47
- onFocusNextGroup: onFocusNextGroup,
48
- onFocusPreviousGroup: onFocusPreviousGroup
49
- }, void 0, /*#__PURE__*/jsx(Component, _objectSpread(_objectSpread({}, menuProps), {}, {
50
- label: label,
51
- maxWidth: maxWidth,
52
- minWidth: minWidth,
53
- value: value,
54
- fixed: fixed
55
- })));
38
+ }));
56
39
  }
57
-
58
40
  const props = {
59
- /** pill type */
60
- type: PropTypes.oneOf(['single', 'multi', 'cascaded']).description('pill type'),
61
-
62
- /** focus next group callback */
63
- onFocusNextGroup: PropTypes.func.description('focus next group callback'),
64
-
65
- /** focus prev group callback */
66
- onFocusPreviousGroup: PropTypes.func.description('focus prev group callback'),
67
-
68
- /** focus group set callback */
69
- onFocusGroupSet: PropTypes.func.description('focus group set callback'),
70
-
71
- /** pill max width */
72
- maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill max width'),
73
-
74
- /** pill min width */
75
- minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).description('pill min width'),
76
-
77
- /** fixed pill */
78
- fixed: PropTypes.bool.description('fixed pill'),
79
-
80
- /** pill label text */
81
- label: PropTypes.string.isRequired.description('pill label text'),
82
-
83
- /** pill value */
84
- value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({
85
- id: PropTypes.string,
86
- label: PropTypes.string
87
- })), PropTypes.shape({
88
- id: PropTypes.string,
89
- label: PropTypes.string
90
- })]).description('pill value')
41
+ type: PropTypes.oneOf(["single", "multi", "cascaded"]).description("pill type"),
42
+ onFocusNextGroup: PropTypes.func.description("focus next group callback"),
43
+ onFocusPreviousGroup: PropTypes.func.description("focus prev group callback"),
44
+ onFocusGroupSet: PropTypes.func.description("focus group set callback"),
45
+ maxWidth: PropTypes.oneOfType([
46
+ PropTypes.string,
47
+ PropTypes.number
48
+ ]).description("pill max width"),
49
+ minWidth: PropTypes.oneOfType([
50
+ PropTypes.string,
51
+ PropTypes.number
52
+ ]).description("pill min width"),
53
+ fixed: PropTypes.bool.description("fixed pill"),
54
+ label: PropTypes.string.isRequired.description("pill label text"),
55
+ value: PropTypes.oneOfType([
56
+ PropTypes.arrayOf(PropTypes.shape({
57
+ id: PropTypes.string,
58
+ label: PropTypes.string
59
+ })),
60
+ PropTypes.shape({
61
+ id: PropTypes.string,
62
+ label: PropTypes.string
63
+ })
64
+ ]).description("pill value")
91
65
  };
66
+ LabeledDropdownPills.propTypes = props;
92
67
  const DSLabeledDropdownPillsWithSchema = describe(LabeledDropdownPills);
93
68
  DSLabeledDropdownPillsWithSchema.propTypes = props;
94
-
95
- export { DSLabeledDropdownPillsWithSchema, LabeledDropdownPills };
69
+ export {
70
+ DSLabeledDropdownPillsWithSchema,
71
+ LabeledDropdownPills
72
+ };
73
+ //# sourceMappingURL=LabeledDropdownPills.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/deprecated/LabeledDropdownPills.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React from 'react';\nimport { PropTypes, describe } from 'react-desc';\nimport { PillGroup } from './PillGroup';\nimport { LabeledDropdownSinglePill } from './LabeledDropdownPillsTypes/LabeledDropdownSinglePill';\nimport { LabeledDropdownMultiPills } from './LabeledDropdownPillsTypes/LabeledDropdownMultiPill';\nimport { LabeledDropdownCascadeMenuPill } from './LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill';\n\nconst DropdownPills = {\n single: LabeledDropdownSinglePill,\n multi: LabeledDropdownMultiPills,\n cascaded: LabeledDropdownCascadeMenuPill,\n};\n\nconst createDropdownPill = (type) =>\n DropdownPills[type] || DropdownPills.single;\n\nfunction LabeledDropdownPills({\n label = '',\n value,\n type,\n onFocusNextGroup,\n onFocusPreviousGroup,\n onFocusGroupSet,\n maxWidth,\n minWidth,\n fixed,\n ...menuProps\n}) {\n const Component = createDropdownPill(type);\n\n return (\n <PillGroup\n onFocusGroupSet={onFocusGroupSet}\n onFocusNextGroup={onFocusNextGroup}\n onFocusPreviousGroup={onFocusPreviousGroup}\n >\n <Component\n {...menuProps}\n label={label}\n maxWidth={maxWidth}\n minWidth={minWidth}\n value={value}\n fixed={fixed}\n />\n </PillGroup>\n );\n}\n\nconst props = {\n /** pill type */\n type: PropTypes.oneOf(['single', 'multi', 'cascaded']).description(\n 'pill type',\n ),\n /** focus next group callback */\n onFocusNextGroup: PropTypes.func.description('focus next group callback'),\n /** focus prev group callback */\n onFocusPreviousGroup: PropTypes.func.description('focus prev group callback'),\n /** focus group set callback */\n onFocusGroupSet: PropTypes.func.description('focus group set callback'),\n /** pill max width */\n maxWidth: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.number,\n ]).description('pill max width'),\n /** pill min width */\n minWidth: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.number,\n ]).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 /** 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;\nconst DSLabeledDropdownPillsWithSchema = describe(LabeledDropdownPills);\nDSLabeledDropdownPillsWithSchema.propTypes = props;\n\nexport { LabeledDropdownPills, DSLabeledDropdownPillsWithSchema };\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAM,gBAAgB;AAAA,EACpB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,UAAU;AAAA;AAGZ,MAAM,qBAAqB,CAAC,SAC1B,cAAc,SAAS,cAAc;AAEvC,8BAA8B;AAAA,EAC5B,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,GACF;AACD,QAAM,YAAY,mBAAmB;AAErC,SACE,qCAAC,WAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,KAEA,qCAAC,WAAD;AAAA,OACM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAMR,MAAM,QAAQ;AAAA,EAEZ,MAAM,UAAU,MAAM,CAAC,UAAU,SAAS,aAAa,YACrD;AAAA,EAGF,kBAAkB,UAAU,KAAK,YAAY;AAAA,EAE7C,sBAAsB,UAAU,KAAK,YAAY;AAAA,EAEjD,iBAAiB,UAAU,KAAK,YAAY;AAAA,EAE5C,UAAU,UAAU,UAAU;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU;AAAA,KACT,YAAY;AAAA,EAEf,UAAU,UAAU,UAAU;AAAA,IAC5B,UAAU;AAAA,IACV,UAAU;AAAA,KACT,YAAY;AAAA,EAEf,OAAO,UAAU,KAAK,YAAY;AAAA,EAElC,OAAO,UAAU,OAAO,WAAW,YAAY;AAAA,EAE/C,OAAO,UAAU,UAAU;AAAA,IACzB,UAAU,QACR,UAAU,MAAM;AAAA,MACd,IAAI,UAAU;AAAA,MACd,OAAO,UAAU;AAAA;AAAA,IAGrB,UAAU,MAAM;AAAA,MACd,IAAI,UAAU;AAAA,MACd,OAAO,UAAU;AAAA;AAAA,KAElB,YAAY;AAAA;AAGjB,qBAAqB,YAAY;AACjC,MAAM,mCAAmC,SAAS;AAClD,iCAAiC,YAAY;",
6
+ "names": []
7
+ }
@@ -1,126 +1,102 @@
1
- import 'core-js/modules/esnext.async-iterator.for-each.js';
2
- import 'core-js/modules/esnext.iterator.for-each.js';
3
- import _jsx from '@babel/runtime/helpers/esm/jsx';
4
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
5
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
6
- import 'core-js/modules/esnext.async-iterator.map.js';
7
- import 'core-js/modules/esnext.iterator.map.js';
8
- import 'core-js/modules/web.dom-collections.iterator.js';
9
- import 'core-js/modules/esnext.async-iterator.filter.js';
10
- import 'core-js/modules/esnext.iterator.constructor.js';
11
- import 'core-js/modules/esnext.iterator.filter.js';
12
- import { createElement } from 'react';
13
- import { isFunction, addOrRemove } from '@elliemae/ds-utilities';
14
- import { PillGroup } from '../PillGroup.js';
15
- import { RemovablePill } from '../RemovablePill.js';
16
- import { DropdownPill } from '../DropdownPill.js';
17
- import { jsx } from 'react/jsx-runtime';
18
-
19
- const _excluded = ["label", "options", "value", "onChange", "onRemove", "value", "placeholder", "onFocusNextGroup", "onFocusPreviousGroup", "onFocusGroupSet", "maxWidth", "minWidth"];
20
-
21
- 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; }
22
-
23
- 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; }
24
-
1
+ import * as React from "react";
2
+ import React2 from "react";
3
+ import { isFunction, addOrRemove } from "@elliemae/ds-utilities";
4
+ import { PillGroup } from "../PillGroup";
5
+ import { RemovablePill } from "../RemovablePill";
6
+ import { DropdownPill } from "../DropdownPill";
25
7
  function renderMenuItems(options, factory) {
26
8
  return options.map((option, index) => {
27
- const ItemComponent = factory('radio');
28
-
29
- if (option.type === 'submenu') {
30
- const SubmenuComponent = factory('submenu');
31
- const ChildComponent = factory('selection-group');
32
- return /*#__PURE__*/createElement(SubmenuComponent, _objectSpread(_objectSpread({}, option), {}, {
9
+ const ItemComponent = factory("radio");
10
+ if (option.type === "submenu") {
11
+ const SubmenuComponent = factory("submenu");
12
+ const ChildComponent = factory("selection-group");
13
+ return /* @__PURE__ */ React2.createElement(SubmenuComponent, {
14
+ ...option,
33
15
  key: option.id,
34
16
  item: option
35
- }), /*#__PURE__*/jsx(ChildComponent, _objectSpread(_objectSpread({}, option), {}, {
17
+ }, /* @__PURE__ */ React2.createElement(ChildComponent, {
18
+ ...option,
36
19
  id: option.id,
37
20
  item: option,
38
21
  items: option.items,
39
- itemValueAccessor: item => item,
22
+ itemValueAccessor: (item) => item,
40
23
  multi: true
41
- })));
24
+ }));
42
25
  }
43
-
44
- return /*#__PURE__*/createElement(ItemComponent, _objectSpread(_objectSpread({}, option), {}, {
26
+ return /* @__PURE__ */ React2.createElement(ItemComponent, {
27
+ ...option,
45
28
  key: option.id || index,
46
29
  item: option
47
- }));
30
+ });
48
31
  });
49
32
  }
50
-
51
33
  const getSubmenuOptionLabelById = (options, id) => {
52
- const index = options.findIndex(option => option.id === id);
53
- return index ? options[index].label : '';
34
+ const index = options.findIndex((option) => option.id === id);
35
+ return index ? options[index].label : "";
54
36
  };
55
-
56
- function LabeledDropdownCascadeMenuPill(_ref) {
57
- let {
58
- label,
59
- options,
60
- value: optionValue,
61
- onChange,
62
- onRemove,
63
- value: selection = {},
64
- placeholder = '---',
65
- onFocusNextGroup,
66
- onFocusPreviousGroup,
67
- onFocusGroupSet,
68
- maxWidth,
69
- minWidth
70
- } = _ref,
71
- menuProps = _objectWithoutProperties(_ref, _excluded);
72
-
37
+ function LabeledDropdownCascadeMenuPill({
38
+ label,
39
+ options,
40
+ value: optionValue,
41
+ onChange,
42
+ onRemove,
43
+ value: selection = {},
44
+ placeholder = "---",
45
+ onFocusNextGroup,
46
+ onFocusPreviousGroup,
47
+ onFocusGroupSet,
48
+ maxWidth,
49
+ minWidth,
50
+ ...menuProps
51
+ }) {
73
52
  const selectionId = Object.keys(selection)[0];
74
- const selectionValues = selection[selectionId] || '';
53
+ const selectionValues = selection[selectionId] || "";
75
54
  const dropdownLabel = Array.isArray(selectionValues) ? getSubmenuOptionLabelById(options, selectionId) : selectionValues;
76
-
77
- const handleSelectChange = _ref2 => {
78
- let {
79
- item,
80
- group
81
- } = _ref2;
82
-
55
+ const handleSelectChange = ({ item, group }) => {
83
56
  if (isFunction(onChange)) {
84
57
  const nextSelection = group ? {
85
- [group.id]: addOrRemove([...(selection[group.id] || [])], item, o => o.id)
58
+ [group.id]: addOrRemove([...selection[group.id] || []], item, (o) => o.id)
86
59
  } : {
87
60
  [item.id]: item.label
88
61
  };
89
62
  onChange(nextSelection);
90
63
  }
91
64
  };
92
-
93
- const removeOption = option => {
65
+ const removeOption = (option) => {
94
66
  if (isFunction(onChange)) {
95
67
  const nextSelection = {
96
- [selectionId]: selectionValues.filter(val => option.id !== val.id)
68
+ [selectionId]: selectionValues.filter((val) => option.id !== val.id)
97
69
  };
98
70
  onChange(nextSelection);
99
71
  }
100
-
101
72
  onRemove(option);
102
73
  };
103
-
104
- return /*#__PURE__*/_jsx(PillGroup, {
105
- onFocusGroupSet: onFocusGroupSet,
106
- onFocusNextGroup: onFocusNextGroup,
107
- onFocusPreviousGroup: onFocusPreviousGroup
108
- }, void 0, /*#__PURE__*/jsx(DropdownPill, _objectSpread(_objectSpread({}, menuProps), {}, {
74
+ return /* @__PURE__ */ React2.createElement(PillGroup, {
75
+ onFocusGroupSet,
76
+ onFocusNextGroup,
77
+ onFocusPreviousGroup
78
+ }, /* @__PURE__ */ React2.createElement(DropdownPill, {
79
+ ...menuProps,
109
80
  itemsRenderer: renderMenuItems,
110
81
  label: dropdownLabel || placeholder,
111
- maxWidth: maxWidth,
112
- minWidth: minWidth,
82
+ maxWidth,
83
+ minWidth,
113
84
  onSelectChange: handleSelectChange,
114
- options: options,
85
+ options,
115
86
  selection: {
116
- [selectionId]: Array.isArray(selectionValues) ? selectionValues.map(v => v.id) : selectionValues
87
+ [selectionId]: Array.isArray(selectionValues) ? selectionValues.map((v) => v.id) : selectionValues
117
88
  },
118
89
  singleGroupSelection: true,
119
90
  variant: "title"
120
- })), Array.isArray(selectionValues) && selectionValues.map(option => /*#__PURE__*/_jsx(RemovablePill, {
91
+ }), Array.isArray(selectionValues) && selectionValues.map((option) => /* @__PURE__ */ React2.createElement(RemovablePill, {
92
+ key: option.id,
121
93
  label: option.label,
122
94
  onRemove: () => removeOption(option)
123
- }, option.id)));
95
+ })));
124
96
  }
125
-
126
- export { LabeledDropdownCascadeMenuPill as default };
97
+ var LabeledDropdownCascadeMenuPill_default = LabeledDropdownCascadeMenuPill;
98
+ export {
99
+ LabeledDropdownCascadeMenuPill,
100
+ LabeledDropdownCascadeMenuPill_default as default
101
+ };
102
+ //# sourceMappingURL=LabeledDropdownCascadeMenuPill.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { isFunction, addOrRemove } from '@elliemae/ds-utilities';\nimport { PillGroup } from '../PillGroup';\nimport { RemovablePill } from '../RemovablePill';\nimport { DropdownPill } from '../DropdownPill';\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\nfunction 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;"],
5
+ "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA,yBAAyB,SAAS,SAAS;AACzC,SAAO,QAAQ,IAAI,CAAC,QAAQ,UAAU;AACpC,UAAM,gBAAgB,QAAQ;AAE9B,QAAI,OAAO,SAAS,WAAW;AAC7B,YAAM,mBAAmB,QAAQ;AACjC,YAAM,iBAAiB,QAAQ;AAC/B,aACE,qCAAC,kBAAD;AAAA,WAAsB;AAAA,QAAQ,KAAK,OAAO;AAAA,QAAI,MAAM;AAAA,SAClD,qCAAC,gBAAD;AAAA,WACM;AAAA,QACJ,IAAI,OAAO;AAAA,QACX,MAAM;AAAA,QACN,OAAO,OAAO;AAAA,QACd,mBAAmB,CAAC,SAAS;AAAA,QAC7B,OAAK;AAAA;AAAA;AAMb,WAAO,qCAAC,eAAD;AAAA,SAAmB;AAAA,MAAQ,KAAK,OAAO,MAAM;AAAA,MAAO,MAAM;AAAA;AAAA;AAAA;AAIrE,MAAM,4BAA4B,CAAC,SAAS,OAAO;AACjD,QAAM,QAAQ,QAAQ,UAAU,CAAC,WAAW,OAAO,OAAO;AAC1D,SAAO,QAAQ,QAAQ,OAAO,QAAQ;AAAA;AAGxC,wCAAwC;AAAA,EACtC;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,OAAO,YAAY;AAAA,EACnB,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,KACG;AAAA,GACF;AACD,QAAM,cAAc,OAAO,KAAK,WAAW;AAC3C,QAAM,kBAAkB,UAAU,gBAAgB;AAClD,QAAM,gBAAgB,MAAM,QAAQ,mBAChC,0BAA0B,SAAS,eACnC;AAEJ,QAAM,qBAAqB,CAAC,EAAE,MAAM,YAAY;AAC9C,QAAI,WAAW,WAAW;AACxB,YAAM,gBAAgB,QAClB;AAAA,SACG,MAAM,KAAK,YAAY,CAAC,GAAI,UAAU,MAAM,OAAO,KAAM,MAAM,CAAC,MAAM,EAAE;AAAA,UAE3E;AAAA,SACG,KAAK,KAAK,KAAK;AAAA;AAEtB,eAAS;AAAA;AAAA;AAIb,QAAM,eAAe,CAAC,WAAW;AAC/B,QAAI,WAAW,WAAW;AACxB,YAAM,gBAAgB;AAAA,SACnB,cAAc,gBAAgB,OAAO,CAAC,QAAQ,OAAO,OAAO,IAAI;AAAA;AAEnE,eAAS;AAAA;AAEX,aAAS;AAAA;AAGX,SACE,qCAAC,WAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,KAEA,qCAAC,cAAD;AAAA,OACM;AAAA,IACJ,eAAe;AAAA,IACf,OAAO,iBAAiB;AAAA,IACxB;AAAA,IACA;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA,WAAW;AAAA,OACR,cAAc,MAAM,QAAQ,mBAAmB,gBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM;AAAA;AAAA,IAErF,sBAAoB;AAAA,IACpB,SAAQ;AAAA,MAET,MAAM,QAAQ,oBACb,gBAAgB,IAAI,CAAC,WACnB,qCAAC,eAAD;AAAA,IAAe,KAAK,OAAO;AAAA,IAAI,OAAO,OAAO;AAAA,IAAO,UAAU,MAAM,aAAa;AAAA;AAAA;AAO3F,IAAO,yCAAQ;",
6
+ "names": []
7
+ }