@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.
Files changed (78) hide show
  1. package/dist/cjs/deprecated/DropdownPill.js +103 -0
  2. package/dist/cjs/deprecated/DropdownPill.js.map +7 -0
  3. package/dist/cjs/deprecated/InputPill.js +87 -0
  4. package/dist/cjs/deprecated/InputPill.js.map +7 -0
  5. package/dist/cjs/deprecated/LabeledDropdownPills.js +112 -0
  6. package/dist/cjs/deprecated/LabeledDropdownPills.js.map +7 -0
  7. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +134 -0
  8. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
  9. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +154 -0
  10. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
  11. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +169 -0
  12. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
  13. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js +45 -0
  14. package/dist/cjs/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
  15. package/dist/cjs/deprecated/LabeledPills.js +86 -0
  16. package/dist/cjs/deprecated/LabeledPills.js.map +7 -0
  17. package/dist/cjs/deprecated/OverflowPill.js +93 -0
  18. package/dist/cjs/deprecated/OverflowPill.js.map +7 -0
  19. package/dist/cjs/deprecated/Pill.js +83 -0
  20. package/dist/cjs/deprecated/Pill.js.map +7 -0
  21. package/dist/cjs/deprecated/PillGroup.js +74 -0
  22. package/dist/cjs/deprecated/PillGroup.js.map +7 -0
  23. package/dist/cjs/deprecated/ReadOnlyPill.js +124 -0
  24. package/dist/cjs/deprecated/ReadOnlyPill.js.map +7 -0
  25. package/dist/cjs/deprecated/RemovablePill.js +86 -0
  26. package/dist/cjs/deprecated/RemovablePill.js.map +7 -0
  27. package/dist/cjs/deprecated/index.js +45 -0
  28. package/dist/cjs/deprecated/index.js.map +7 -0
  29. package/dist/cjs/index.js +39 -0
  30. package/dist/cjs/index.js.map +7 -0
  31. package/dist/cjs/package.json +7 -0
  32. package/dist/esm/deprecated/DropdownPill.js +73 -0
  33. package/dist/esm/deprecated/DropdownPill.js.map +7 -0
  34. package/dist/esm/deprecated/InputPill.js +57 -0
  35. package/dist/esm/deprecated/InputPill.js.map +7 -0
  36. package/dist/esm/deprecated/LabeledDropdownPills.js +82 -0
  37. package/dist/esm/deprecated/LabeledDropdownPills.js.map +7 -0
  38. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js +104 -0
  39. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.js.map +7 -0
  40. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js +124 -0
  41. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.js.map +7 -0
  42. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js +139 -0
  43. package/dist/esm/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.js.map +7 -0
  44. package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js +15 -0
  45. package/dist/esm/deprecated/LabeledDropdownPillsTypes/utils.js.map +7 -0
  46. package/dist/esm/deprecated/LabeledPills.js +56 -0
  47. package/dist/esm/deprecated/LabeledPills.js.map +7 -0
  48. package/dist/esm/deprecated/OverflowPill.js +63 -0
  49. package/dist/esm/deprecated/OverflowPill.js.map +7 -0
  50. package/dist/esm/deprecated/Pill.js +53 -0
  51. package/dist/esm/deprecated/Pill.js.map +7 -0
  52. package/dist/esm/deprecated/PillGroup.js +44 -0
  53. package/dist/esm/deprecated/PillGroup.js.map +7 -0
  54. package/dist/esm/deprecated/ReadOnlyPill.js +94 -0
  55. package/dist/esm/deprecated/ReadOnlyPill.js.map +7 -0
  56. package/dist/esm/deprecated/RemovablePill.js +56 -0
  57. package/dist/esm/deprecated/RemovablePill.js.map +7 -0
  58. package/dist/esm/deprecated/index.js +14 -0
  59. package/dist/esm/deprecated/index.js.map +7 -0
  60. package/dist/esm/index.js +8 -0
  61. package/dist/esm/index.js.map +7 -0
  62. package/dist/esm/package.json +7 -0
  63. package/dist/types/deprecated/DropdownPill.d.ts +40 -0
  64. package/dist/types/deprecated/InputPill.d.ts +9 -0
  65. package/dist/types/deprecated/LabeledDropdownPills.d.ts +52 -0
  66. package/dist/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownCascadeMenuPill.d.ts +16 -0
  67. package/dist/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.d.ts +13 -0
  68. package/dist/types/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.d.ts +28 -0
  69. package/dist/types/deprecated/LabeledDropdownPillsTypes/utils.d.ts +1 -0
  70. package/dist/types/deprecated/LabeledPills.d.ts +38 -0
  71. package/dist/types/deprecated/OverflowPill.d.ts +26 -0
  72. package/dist/types/deprecated/Pill.d.ts +37 -0
  73. package/dist/types/deprecated/PillGroup.d.ts +32 -0
  74. package/dist/types/deprecated/ReadOnlyPill.d.ts +33 -0
  75. package/dist/types/deprecated/RemovablePill.d.ts +34 -0
  76. package/dist/types/deprecated/index.d.ts +9 -0
  77. package/dist/types/index.d.ts +3 -0
  78. package/package.json +195 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/deprecated/LabeledDropdownPillsTypes/LabeledDropdownMultiPill.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, { useState, useEffect, useCallback } from 'react';\nimport { find } from 'lodash';\nimport { isFunction, addOrRemove } from '@elliemae/ds-legacy-utilities';\nimport { RemovablePill } from '../RemovablePill.js';\nimport { Pill } from '../Pill.js';\nimport { OverflowPill } from '../OverflowPill.js';\nimport { DropdownPill } from '../DropdownPill.js';\n\nconst LabeledDropdownMultiPills = ({\n label,\n options = [],\n value = [],\n onSelect = () => null,\n onRemove = () => null,\n onChange, // if this is defined, then it's calculating the next result onSelect or onRemove\n maxWidth,\n minWidth,\n ...menuProps\n}) => {\n const [totalDefaultOptions, setTotalDefaultOptions] = useState(0);\n const [selectedOptions, setSelectedOptions] = useState(value);\n const [allOptions, setAllOptions] = useState(options);\n const [overflowOptions, setOverflowOptions] = useState([]);\n\n const overflowQuantity = 3;\n\n useEffect(() => setSelectedOptions(value), [value]);\n\n useEffect(() => {\n const newOptions = allOptions.filter((option) => option.fixedItem);\n if (newOptions.length > 0) {\n setSelectedOptions(newOptions);\n }\n setTotalDefaultOptions(newOptions.length);\n }, []);\n\n useEffect(() => {\n if (totalDefaultOptions) {\n const newOptions = allOptions.map((opt) => {\n if (selectedOptions.length <= totalDefaultOptions && find(selectedOptions, { id: opt.id })) {\n return { ...opt, fixedItem: true };\n }\n return { ...opt, fixedItem: false };\n });\n\n setAllOptions(newOptions);\n }\n }, [onSelect, onRemove, selectedOptions]);\n\n useEffect(() => {\n if (selectedOptions.length > overflowQuantity) {\n const overflow = selectedOptions.filter((val, index) => index >= overflowQuantity);\n setOverflowOptions(overflow);\n }\n }, [selectedOptions]);\n\n const selectOption = useCallback(\n (option) => {\n if (!option.fixedItem) {\n if (isFunction(onChange)) {\n const nextValue = addOrRemove(selectedOptions, option, (item) => item.id);\n setSelectedOptions(nextValue);\n onChange(nextValue);\n }\n onSelect(option);\n }\n },\n [selectedOptions],\n );\n\n const removeOption = useCallback(\n (option) => {\n if (!option.fixedItem || selectedOptions.length > totalDefaultOptions) {\n if (isFunction(onChange)) {\n const nextValue = selectedOptions.filter((val) => option.id !== val.id);\n setSelectedOptions(nextValue);\n onChange(nextValue);\n }\n onRemove(option);\n }\n },\n [selectedOptions],\n );\n\n const typeOfPill = () => {\n if (selectedOptions.length > totalDefaultOptions) {\n return RemovablePill;\n }\n\n return Pill;\n };\n\n return (\n <>\n <DropdownPill\n {...menuProps}\n focusOnOpen={false}\n label={label}\n maxWidth={maxWidth}\n minWidth={minWidth}\n onSelectMenuItem={selectOption}\n options={[\n {\n ...menuProps,\n type: 'SelectionGroup',\n id: 'multi-selection-views',\n multi: true,\n items: allOptions,\n },\n ]}\n selection={{\n 'multi-selection-views': selectedOptions ? selectedOptions.map((o) => o.id) : '',\n }}\n variant=\"title\"\n />\n {selectedOptions &&\n selectedOptions.map((option, index) => {\n const TypeOfPill = typeOfPill();\n if (index < overflowQuantity) {\n return <TypeOfPill key={option.id} label={option.label} onRemove={() => removeOption(option)} />;\n }\n return null;\n })}\n {selectedOptions && selectedOptions.length > overflowQuantity && (\n <OverflowPill label={`+ ${selectedOptions.length - overflowQuantity}`} options={overflowOptions} />\n )}\n </>\n );\n};\n\nexport { LabeledDropdownMultiPills };\nexport default LabeledDropdownMultiPills;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiGnB;AA7FJ,mBAAwD;AACxD,oBAAqB;AACrB,iCAAwC;AACxC,2BAA8B;AAC9B,kBAAqB;AACrB,0BAA6B;AAC7B,0BAA6B;AAE7B,MAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA,UAAU,CAAC;AAAA,EACX,QAAQ,CAAC;AAAA,EACT,WAAW,MAAM;AAAA,EACjB,WAAW,MAAM;AAAA,EACjB;AAAA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,qBAAqB,sBAAsB,QAAI,uBAAS,CAAC;AAChE,QAAM,CA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EJ;AAGA,IAAO,mCAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,169 @@
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 LabeledDropdownSinglePill_exports = {};
30
+ __export(LabeledDropdownSinglePill_exports, {
31
+ LabeledDropdownSinglePill: () => LabeledDropdownSinglePill,
32
+ default: () => LabeledDropdownSinglePill_default
33
+ });
34
+ module.exports = __toCommonJS(LabeledDropdownSinglePill_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_prop_types = __toESM(require("prop-types"));
39
+ var import_ds_legacy_utilities = require("@elliemae/ds-legacy-utilities");
40
+ var import_DropdownPill = require("../DropdownPill.js");
41
+ var import_InputPill = require("../InputPill.js");
42
+ var import_Pill = require("../Pill.js");
43
+ var import_RemovablePill = require("../RemovablePill.js");
44
+ var import_utils = require("./utils.js");
45
+ const LabeledDropdownSinglePill = ({
46
+ label,
47
+ labelIsValue = false,
48
+ options,
49
+ value,
50
+ onSelect = () => null,
51
+ onChange,
52
+ maxWidth,
53
+ minWidth,
54
+ fixed = false,
55
+ ...menuProps
56
+ }) => {
57
+ const [optionValue, setOptionValue] = (0, import_react.useState)(value);
58
+ const prevOptions = (0, import_ds_legacy_utilities.usePrevious)(options);
59
+ const areOptionsEqual = (0, import_ds_legacy_utilities.useShouldRecalculate)((0, import_utils.hasOptionChanged)(prevOptions, options));
60
+ (0, import_react.useEffect)(() => setOptionValue(value), [value]);
61
+ (0, import_react.useEffect)(() => {
62
+ const selectedValue = options.find((option) => option.selected);
63
+ if (selectedValue) {
64
+ setOptionValue(selectedValue);
65
+ } else if (!selectedValue) {
66
+ setOptionValue(options[0]);
67
+ }
68
+ }, [areOptionsEqual]);
69
+ (0, import_react.useLayoutEffect)(() => {
70
+ if (optionValue) {
71
+ const selectedValue = options.find((option) => option.id === optionValue.id);
72
+ setOptionValue(selectedValue);
73
+ }
74
+ }, [options]);
75
+ const selectOption = (0, import_react.useCallback)(
76
+ (option) => {
77
+ if ((0, import_ds_legacy_utilities.isFunction)(onChange)) {
78
+ onChange(option);
79
+ }
80
+ setOptionValue(option);
81
+ onSelect(option);
82
+ },
83
+ [onChange, onSelect]
84
+ );
85
+ const onChangeInputValue = (0, import_react.useCallback)(
86
+ ({ target: { value: inputValue } }) => {
87
+ const { onChangeInput } = optionValue;
88
+ onChangeInput && onChangeInput(inputValue);
89
+ },
90
+ [optionValue]
91
+ );
92
+ const removeOption = (removedOption) => {
93
+ const { onRemove } = menuProps;
94
+ const { onChangeInput } = optionValue;
95
+ setOptionValue(null);
96
+ onChangeInput && onChangeInput("");
97
+ const newOption = { ...removedOption, input: "" };
98
+ onRemove && onRemove(newOption, removedOption);
99
+ };
100
+ const renderPill = (option, fixed2) => {
101
+ const { input, onChangeInput, ...otherProps } = option;
102
+ let SelectedPill;
103
+ if ((0, import_ds_legacy_utilities.isString)(input)) {
104
+ SelectedPill = import_InputPill.InputPill;
105
+ } else if (fixed2) {
106
+ SelectedPill = import_Pill.Pill;
107
+ } else {
108
+ SelectedPill = import_RemovablePill.RemovablePill;
109
+ }
110
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
111
+ SelectedPill,
112
+ {
113
+ label: option.label,
114
+ onChange: onChangeInputValue,
115
+ onRemove: (e) => removeOption(option, e),
116
+ value: input,
117
+ ...otherProps
118
+ },
119
+ option.id
120
+ );
121
+ };
122
+ const renderSelection = () => {
123
+ if (!labelIsValue) {
124
+ if (optionValue)
125
+ return renderPill(optionValue, fixed);
126
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Pill.Pill, { label: "-" });
127
+ }
128
+ };
129
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
130
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
131
+ import_DropdownPill.DropdownPill,
132
+ {
133
+ ...menuProps,
134
+ label: !labelIsValue ? label : optionValue?.label,
135
+ maxWidth,
136
+ minWidth,
137
+ onSelectMenuItem: selectOption,
138
+ options: [
139
+ {
140
+ ...menuProps,
141
+ type: "SelectionGroup",
142
+ id: "multi-selection-views",
143
+ multi: false,
144
+ items: options,
145
+ closeOnClick: true
146
+ }
147
+ ],
148
+ selection: {
149
+ "multi-selection-views": optionValue ? [optionValue?.id] : ""
150
+ },
151
+ variant: "title"
152
+ }
153
+ ),
154
+ renderSelection()
155
+ ] });
156
+ };
157
+ LabeledDropdownSinglePill.propTypes = {
158
+ label: import_prop_types.default.string,
159
+ labelIsValue: import_prop_types.default.bool,
160
+ options: import_prop_types.default.array,
161
+ value: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.number]),
162
+ onSelect: import_prop_types.default.func,
163
+ onChange: import_prop_types.default.func,
164
+ maxWidth: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.number]),
165
+ minWidth: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.number]),
166
+ fixed: import_prop_types.default.bool
167
+ };
168
+ var LabeledDropdownSinglePill_default = LabeledDropdownSinglePill;
169
+ //# sourceMappingURL=LabeledDropdownSinglePill.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/deprecated/LabeledDropdownPillsTypes/LabeledDropdownSinglePill.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, { useCallback, useState, useEffect, useLayoutEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { isFunction, isString, useShouldRecalculate, usePrevious } from '@elliemae/ds-legacy-utilities';\nimport { DropdownPill } from '../DropdownPill.js';\nimport { InputPill } from '../InputPill.js';\nimport { Pill } from '../Pill.js';\nimport { RemovablePill } from '../RemovablePill.js';\nimport { hasOptionChanged } from './utils.js';\n\nconst LabeledDropdownSinglePill = ({\n label,\n labelIsValue = false,\n options,\n value,\n onSelect = () => null,\n onChange,\n maxWidth,\n minWidth,\n fixed = false,\n ...menuProps\n}) => {\n const [optionValue, setOptionValue] = useState(value);\n const prevOptions = usePrevious(options);\n const areOptionsEqual = useShouldRecalculate(hasOptionChanged(prevOptions, options));\n\n useEffect(() => setOptionValue(value), [value]);\n\n useEffect(() => {\n const selectedValue = options.find((option) => option.selected);\n\n if (selectedValue) {\n setOptionValue(selectedValue);\n } else if (!selectedValue) {\n setOptionValue(options[0]);\n }\n }, [areOptionsEqual]);\n\n useLayoutEffect(() => {\n if (optionValue) {\n const selectedValue = options.find((option) => option.id === optionValue.id);\n setOptionValue(selectedValue);\n }\n }, [options]);\n\n const selectOption = useCallback(\n (option) => {\n if (isFunction(onChange)) {\n onChange(option);\n }\n setOptionValue(option);\n onSelect(option);\n },\n [onChange, onSelect],\n );\n\n const onChangeInputValue = useCallback(\n ({ target: { value: inputValue } }) => {\n const { onChangeInput } = optionValue;\n\n onChangeInput && onChangeInput(inputValue);\n },\n [optionValue],\n );\n\n const removeOption = (removedOption) => {\n const { onRemove } = menuProps;\n const { onChangeInput } = optionValue;\n setOptionValue(null);\n onChangeInput && onChangeInput('');\n const newOption = { ...removedOption, input: '' };\n onRemove && onRemove(newOption, removedOption);\n };\n\n const renderPill = (option, fixed) => {\n const { input, onChangeInput, ...otherProps } = option;\n let SelectedPill;\n if (isString(input)) {\n SelectedPill = InputPill;\n } else if (fixed) {\n SelectedPill = Pill;\n } else {\n SelectedPill = RemovablePill;\n }\n\n return (\n <SelectedPill\n key={option.id}\n label={option.label}\n onChange={onChangeInputValue}\n onRemove={(e) => removeOption(option, e)}\n value={input}\n {...otherProps}\n />\n );\n };\n\n const renderSelection = () => {\n if (!labelIsValue) {\n if (optionValue) return renderPill(optionValue, fixed);\n return <Pill label=\"-\" />;\n }\n };\n\n return (\n <>\n <DropdownPill\n {...menuProps}\n label={!labelIsValue ? label : optionValue?.label}\n maxWidth={maxWidth}\n minWidth={minWidth}\n onSelectMenuItem={selectOption}\n options={[\n {\n ...menuProps,\n type: 'SelectionGroup',\n id: 'multi-selection-views',\n multi: false,\n items: options,\n closeOnClick: true,\n },\n ]}\n selection={{\n 'multi-selection-views': optionValue ? [optionValue?.id] : '',\n }}\n variant=\"title\"\n />\n {renderSelection()}\n </>\n );\n};\n\nLabeledDropdownSinglePill.propTypes = {\n label: PropTypes.string,\n labelIsValue: PropTypes.bool,\n options: PropTypes.array,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n onSelect: PropTypes.func,\n onChange: PropTypes.func,\n maxWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n minWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n fixed: PropTypes.bool,\n};\n\nexport { LabeledDropdownSinglePill };\nexport default LabeledDropdownSinglePill;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADyFjB;AArFN,mBAAyE;AACzE,wBAAsB;AACtB,iCAAwE;AACxE,0BAA6B;AAC7B,uBAA0B;AAC1B,kBAAqB;AACrB,2BAA8B;AAC9B,mBAAiC;AAEjC,MAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA,WAAW,MAAM;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,GAAG;AACL,MAAM;AACJ,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,KAAK;AACpD,QAAM,kBAAc,wCAAY,OAAO;AACvC,QAAM,sBAAkB,qDAAqB,+BAAiB,aAAa,OAAO,CAAC;AAEnF,8BAAU,MAAM,eAAe,KAAK,GAAG,CAAC,KAAK,CAAC;AAE9C,8BAAU,MAAM;AACd,UAAM,gBAAgB,QAAQ,KAAK,CAAC,WAAW,OAAO,QAAQ;AAE9D,QAAI,eAAe;AACjB,qBAAe,aAAa;AAAA,IAC9B,WAAW,CAAC,eAAe;AACzB,qBAAe,QAAQ,CAAC,CAAC;AAAA,IAC3B;AAAA,EACF,GAAG,CAAC,eAAe,CAAC;AAEpB,oCAAgB,MAAM;AACpB,QAAI,aAAa;AACf,YAAM,gBAAgB,QAAQ,KAAK,CAAC,WAAW,OAAO,OAAO,YAAY,EAAE;AAC3E,qBAAe,aAAa;AAAA,IAC9B;AAAA,EACF,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,mBAAe;AAAA,IACnB,CAAC,WAAW;AACV,cAAI,uCAAW,QAAQ,GAAG;AACxB,iBAAS,MAAM;AAAA,MACjB;AAC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AA,QAClB,SAAS;AAAA,UACP;AAAA,YACE,GAAG;AAAA,YACH,MAAM;AAAA,YACN,IAAI;AAAA,YACJ,OAAO;AAAA,YACP,OAAO;AAAA,YACP,cAAc;AAAA,UAChB;AAAA,QACF;AAAA,QACA,WAAW;AAAA,UACT,yBAAyB,cAAc,CAAC,aAAa,EAAE,IAAI;AAAA,QAC7D;AAAA,QACA,SAAQ;AAAA;AAAA,IACV;AAAA,IACC,gBAAgB;AAAA,KACnB;AAEJ;AAEA,0BAA0B,YAAY;AAAA,EACpC,OAAO,kBAAAC,QAAU;AAAA,EACjB,cAAc,kBAAAA,QAAU;AAAA,EACxB,SAAS,kBAAAA,QAAU;AAAA,EACnB,OAAO,kBAAAA,QAAU,UAAU,CAAC,kBAAAA,QAAU,QAAQ,kBAAAA,QAAU,MAAM,CAAC;AAAA,EAC/D,UAAU,kBAAAA,QAAU;AAAA,EACpB,UAAU,kBAAAA,QAAU;AAAA,EACpB,UAAU,kBAAAA,QAAU,UAAU,CAAC,kBAAAA,QAAU,QAAQ,kBAAAA,QAAU,MAAM,CAAC;AAAA,EAClE,UAAU,kBAAAA,QAAU,UAAU,CAAC,kBAAAA,QAAU,QAAQ,kBAAAA,QAAU,MAAM,CAAC;AAAA,EAClE,OAAO,kBAAAA,QAAU;AACnB;AAGA,IAAO,oCAAQ;",
6
+ "names": ["fixed", "PropTypes"]
7
+ }
@@ -0,0 +1,45 @@
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 utils_exports = {};
30
+ __export(utils_exports, {
31
+ hasOptionChanged: () => hasOptionChanged
32
+ });
33
+ module.exports = __toCommonJS(utils_exports);
34
+ var React = __toESM(require("react"));
35
+ var import_ds_legacy_utilities = require("@elliemae/ds-legacy-utilities");
36
+ var import_lodash = require("lodash");
37
+ const hasOptionChanged = (prevOptions, options) => {
38
+ if (prevOptions && options) {
39
+ const prevOptionsOmited = prevOptions.map((option) => (0, import_lodash.omit)(option, ["input", "onChangeInput", "mask"]));
40
+ const optionsOmited = options.map((option) => (0, import_lodash.omit)(option, ["input", "onChangeInput", "mask"]));
41
+ return (0, import_ds_legacy_utilities.isEqual)(prevOptionsOmited, optionsOmited);
42
+ }
43
+ return false;
44
+ };
45
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/deprecated/LabeledDropdownPillsTypes/utils.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 { isEqual } from '@elliemae/ds-legacy-utilities';\nimport { omit } from 'lodash';\n\nexport const hasOptionChanged = (prevOptions, options) => {\n if (prevOptions && options) {\n const prevOptionsOmited = prevOptions.map((option) => omit(option, ['input', 'onChangeInput', 'mask']));\n const optionsOmited = options.map((option) => omit(option, ['input', 'onChangeInput', 'mask']));\n\n return isEqual(prevOptionsOmited, optionsOmited);\n }\n\n return false;\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADIvB,iCAAwB;AACxB,oBAAqB;AAEd,MAAM,mBAAmB,CAAC,aAAa,YAAY;AACxD,MAAI,eAAe,SAAS;AAC1B,UAAM,oBAAoB,YAAY,IAAI,CAAC,eAAW,oBAAK,QAAQ,CAAC,SAAS,iBAAiB,MAAM,CAAC,CAAC;AACtG,UAAM,gBAAgB,QAAQ,IAAI,CAAC,eAAW,oBAAK,QAAQ,CAAC,SAAS,iBAAiB,MAAM,CAAC,CAAC;AAE9F,eAAO,oCAAQ,mBAAmB,aAAa;AAAA,EACjD;AAEA,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,86 @@
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 LabeledPills_exports = {};
30
+ __export(LabeledPills_exports, {
31
+ DSLabeledPillsWithSchema: () => DSLabeledPillsWithSchema,
32
+ LabeledPills: () => LabeledPills
33
+ });
34
+ module.exports = __toCommonJS(LabeledPills_exports);
35
+ var React = __toESM(require("react"));
36
+ var import_jsx_runtime = require("react/jsx-runtime");
37
+ var import_ds_legacy_props_helpers = require("@elliemae/ds-legacy-props-helpers");
38
+ var import_PillGroup = require("./PillGroup.js");
39
+ var import_RemovablePill = require("./RemovablePill.js");
40
+ var import_Pill = require("./Pill.js");
41
+ const LabeledPills = ({
42
+ children,
43
+ label = "",
44
+ leftAddon,
45
+ onFocusGroupSet,
46
+ onFocusNextGroup,
47
+ onFocusPreviousGroup,
48
+ className
49
+ }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
50
+ import_PillGroup.PillGroup,
51
+ {
52
+ onFocusGroupSet,
53
+ onFocusNextGroup,
54
+ onFocusPreviousGroup,
55
+ containerProps: { className },
56
+ children: [
57
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Pill.Pill, { label, leftAddon, variant: "title", "data-testid": "pill-title" }),
58
+ children
59
+ ]
60
+ }
61
+ );
62
+ const props = {
63
+ /** labeled pill text label */
64
+ label: import_ds_legacy_props_helpers.PropTypes.string.isRequired.description("pill text label"),
65
+ /** pill to add the label to */
66
+ children: import_ds_legacy_props_helpers.PropTypes.arrayOf(
67
+ import_ds_legacy_props_helpers.PropTypes.shape({
68
+ type: import_ds_legacy_props_helpers.PropTypes.oneOf([import_ds_legacy_props_helpers.PropTypes.instanceOf(import_Pill.Pill), import_ds_legacy_props_helpers.PropTypes.instanceOf(import_RemovablePill.RemovablePill)])
69
+ })
70
+ ).isRequired.description("pill to add the label to"),
71
+ /** addon component to left */
72
+ leftAddon: import_ds_legacy_props_helpers.PropTypes.node.description("addon component to left"),
73
+ /** focus next group callback */
74
+ onFocusNextGroup: import_ds_legacy_props_helpers.PropTypes.func.description("focus next group callback"),
75
+ /** focus prev group callback */
76
+ onFocusPreviousGroup: import_ds_legacy_props_helpers.PropTypes.func.description("focus prev group callback"),
77
+ /** focus group set callback */
78
+ onFocusGroupSet: import_ds_legacy_props_helpers.PropTypes.func.description("focus group set callback"),
79
+ /** additional className */
80
+ className: import_ds_legacy_props_helpers.PropTypes.string.description("Additional className")
81
+ };
82
+ LabeledPills.propTypes = props;
83
+ LabeledPills.displayName = "LabeledPills";
84
+ const DSLabeledPillsWithSchema = (0, import_ds_legacy_props_helpers.describe)(LabeledPills);
85
+ DSLabeledPillsWithSchema.propTypes = props;
86
+ //# sourceMappingURL=LabeledPills.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/deprecated/LabeledPills.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 { PropTypes, describe } from '@elliemae/ds-legacy-props-helpers';\nimport { PillGroup } from './PillGroup.js';\nimport { RemovablePill } from './RemovablePill.js';\nimport { Pill } from './Pill.js';\n\nconst LabeledPills = ({\n children,\n label = '',\n leftAddon,\n onFocusGroupSet,\n onFocusNextGroup,\n onFocusPreviousGroup,\n className,\n}) => (\n <PillGroup\n onFocusGroupSet={onFocusGroupSet}\n onFocusNextGroup={onFocusNextGroup}\n onFocusPreviousGroup={onFocusPreviousGroup}\n containerProps={{ className }}\n >\n <Pill label={label} leftAddon={leftAddon} variant=\"title\" data-testid=\"pill-title\" />\n {children}\n </PillGroup>\n);\n\nconst props = {\n /** labeled pill text label */\n label: PropTypes.string.isRequired.description('pill text label'),\n /** pill to add the label to */\n children: PropTypes.arrayOf(\n PropTypes.shape({\n type: PropTypes.oneOf([PropTypes.instanceOf(Pill), PropTypes.instanceOf(RemovablePill)]),\n }),\n ).isRequired.description('pill to add the label to'),\n /** addon component to left */\n leftAddon: PropTypes.node.description('addon component to left'),\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 /** additional className */\n className: PropTypes.string.description('Additional className'),\n};\n\nLabeledPills.propTypes = props;\nLabeledPills.displayName = 'LabeledPills';\nconst DSLabeledPillsWithSchema = describe(LabeledPills);\nDSLabeledPillsWithSchema.propTypes = props;\n\nexport { LabeledPills, DSLabeledPillsWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmBrB;AAdF,qCAAoC;AACpC,uBAA0B;AAC1B,2BAA8B;AAC9B,kBAAqB;AAErB,MAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MACE;AAAA,EAAC;AAAA;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,IACA,gBAAgB,EAAE,UAAU;AAAA,IAE5B;AAAA,kDAAC,oBAAK,OAAc,WAAsB,SAAQ,SAAQ,eAAY,cAAa;AAAA,MAClF;AAAA;AAAA;AACH;AAGF,MAAM,QAAQ;AAAA;AAAA,EAEZ,OAAO,yCAAU,OAAO,WAAW,YAAY,iBAAiB;AAAA;AAAA,EAEhE,UAAU,yCAAU;AAAA,IAClB,yCAAU,MAAM;AAAA,MACd,MAAM,yCAAU,MAAM,CAAC,yCAAU,WAAW,gBAAI,GAAG,yCAAU,WAAW,kCAAa,CAAC,CAAC;AAAA,IACzF,CAAC;AAAA,EACH,EAAE,WAAW,YAAY,0BAA0B;AAAA;AAAA,EAEnD,WAAW,yCAAU,KAAK,YAAY,yBAAyB;AAAA;AAAA,EAE/D,kBAAkB,yCAAU,KAAK,YAAY,2BAA2B;AAAA;AAAA,EAExE,sBAAsB,yCAAU,KAAK,YAAY,2BAA2B;AAAA;AAAA,EAE5E,iBAAiB,yCAAU,KAAK,YAAY,0BAA0B;AAAA;AAAA,EAEtE,WAAW,yCAAU,OAAO,YAAY,sBAAsB;AAChE;AAEA,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,+BAA2B,yCAAS,YAAY;AACtD,yBAAyB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,93 @@
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 OverflowPill_exports = {};
30
+ __export(OverflowPill_exports, {
31
+ DSOverflowPillWithSchema: () => DSOverflowPillWithSchema,
32
+ OverflowPill: () => OverflowPill
33
+ });
34
+ module.exports = __toCommonJS(OverflowPill_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_shared = require("@elliemae/ds-legacy-shared");
40
+ var import_ds_legacy_tooltip = require("@elliemae/ds-legacy-tooltip");
41
+ var import_Pill = require("./Pill.js");
42
+ const OverflowPill = ({ containerProps = {}, label = "", options = [], className = "" }) => {
43
+ const ref = (0, import_react.useRef)(null);
44
+ const [tooltipIsOpen, setTooltipIsOpen] = (0, import_react.useState)(false);
45
+ const [tooltipText, setTooltipText] = (0, import_react.useState)("");
46
+ (0, import_react.useEffect)(() => {
47
+ let text = "";
48
+ options.forEach((option) => {
49
+ if (!tooltipText || option === options[0]) {
50
+ text = `${option.label}`;
51
+ } else {
52
+ text = text.concat(`, ${option.label}`);
53
+ }
54
+ });
55
+ setTooltipText(text);
56
+ }, [options]);
57
+ (0, import_ds_legacy_shared.useFocusGroupItem)(ref);
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
+ import_ds_legacy_tooltip.DSTooltip,
60
+ {
61
+ isOpen: tooltipIsOpen,
62
+ title: tooltipText,
63
+ zIndex: 11,
64
+ triggerComponent: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
65
+ import_Pill.Pill,
66
+ {
67
+ className: `${"overflow-pill"} ${className}`,
68
+ containerProps,
69
+ innerRef: ref,
70
+ label,
71
+ tabIndex: -1,
72
+ onMouseEnter: () => setTooltipIsOpen(true),
73
+ onMouseLeave: () => setTooltipIsOpen(false)
74
+ }
75
+ )
76
+ }
77
+ );
78
+ };
79
+ const props = {
80
+ /** props to inject to pill wrapper */
81
+ containerProps: import_ds_legacy_props_helpers.PropTypes.object.description("props to inject to pill wrapper"),
82
+ /** pill text label */
83
+ label: import_ds_legacy_props_helpers.PropTypes.string.isRequired.description("pill text label"),
84
+ /** overflow pills options */
85
+ options: import_ds_legacy_props_helpers.PropTypes.array.description("overflow pills options"),
86
+ /** additional className */
87
+ className: import_ds_legacy_props_helpers.PropTypes.string.description("Additional className")
88
+ };
89
+ OverflowPill.propTypes = props;
90
+ OverflowPill.displayName = "OverflowPill";
91
+ const DSOverflowPillWithSchema = (0, import_ds_legacy_props_helpers.describe)(OverflowPill);
92
+ DSOverflowPillWithSchema.propTypes = props;
93
+ //# sourceMappingURL=OverflowPill.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/deprecated/OverflowPill.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, useEffect } from 'react';\nimport { PropTypes, describe } from '@elliemae/ds-legacy-props-helpers';\nimport { useFocusGroupItem } from '@elliemae/ds-legacy-shared';\nimport { DSTooltip } from '@elliemae/ds-legacy-tooltip';\nimport { Pill } from './Pill.js';\n\nconst OverflowPill = ({ containerProps = {}, label = '', options = [], className = '' }) => {\n const ref = useRef(null);\n const [tooltipIsOpen, setTooltipIsOpen] = useState(false);\n const [tooltipText, setTooltipText] = useState('');\n\n useEffect(() => {\n let text = '';\n options.forEach((option) => {\n if (!tooltipText || option === options[0]) {\n text = `${option.label}`;\n } else {\n text = text.concat(`, ${option.label}`);\n }\n });\n setTooltipText(text);\n }, [options]);\n\n useFocusGroupItem(ref);\n\n return (\n <DSTooltip\n isOpen={tooltipIsOpen}\n title={tooltipText}\n zIndex={11}\n triggerComponent={\n <Pill\n className={`${'overflow-pill'} ${className}`}\n containerProps={containerProps}\n innerRef={ref}\n label={label}\n tabIndex={-1}\n onMouseEnter={() => setTooltipIsOpen(true)}\n onMouseLeave={() => setTooltipIsOpen(false)}\n />\n }\n />\n );\n};\n\nconst props = {\n /** props to inject to pill wrapper */\n containerProps: PropTypes.object.description('props to inject to pill wrapper'),\n /** pill text label */\n label: PropTypes.string.isRequired.description('pill text label'),\n /** overflow pills options */\n options: PropTypes.array.description('overflow pills options'),\n /** additional className */\n className: PropTypes.string.description('Additional className'),\n};\n\nOverflowPill.propTypes = props;\nOverflowPill.displayName = 'OverflowPill';\nconst DSOverflowPillWithSchema = describe(OverflowPill);\nDSOverflowPillWithSchema.propTypes = props;\n\nexport { OverflowPill, DSOverflowPillWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmCf;AA/BR,mBAAmD;AACnD,qCAAoC;AACpC,8BAAkC;AAClC,+BAA0B;AAC1B,kBAAqB;AAErB,MAAM,eAAe,CAAC,EAAE,iBAAiB,CAAC,GAAG,QAAQ,IAAI,UAAU,CAAC,GAAG,YAAY,GAAG,MAAM;AAC1F,QAAM,UAAM,qBAAO,IAAI;AACvB,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAS,KAAK;AACxD,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,EAAE;AAEjD,8BAAU,MAAM;AACd,QAAI,OAAO;AACX,YAAQ,QAAQ,CAAC,WAAW;AAC1B,UAAI,CAAC,eAAe,WAAW,QAAQ,CAAC,GAAG;AACzC,eAAO,GAAG,OAAO;AAAA,MACnB,OAAO;AACL,eAAO,KAAK,OAAO,KAAK,OAAO,OAAO;AAAA,MACxC;AAAA,IACF,CAAC;AACD,mBAAe,IAAI;AAAA,EACrB,GAAG,CAAC,OAAO,CAAC;AAEZ,iDAAkB,GAAG;AAErB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,kBACE;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,GAAG,mBAAmB;AAAA,UACjC;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA,UAAU;AAAA,UACV,cAAc,MAAM,iBAAiB,IAAI;AAAA,UACzC,cAAc,MAAM,iBAAiB,KAAK;AAAA;AAAA,MAC5C;AAAA;AAAA,EAEJ;AAEJ;AAEA,MAAM,QAAQ;AAAA;AAAA,EAEZ,gBAAgB,yCAAU,OAAO,YAAY,iCAAiC;AAAA;AAAA,EAE9E,OAAO,yCAAU,OAAO,WAAW,YAAY,iBAAiB;AAAA;AAAA,EAEhE,SAAS,yCAAU,MAAM,YAAY,wBAAwB;AAAA;AAAA,EAE7D,WAAW,yCAAU,OAAO,YAAY,sBAAsB;AAChE;AAEA,aAAa,YAAY;AACzB,aAAa,cAAc;AAC3B,MAAM,+BAA2B,yCAAS,YAAY;AACtD,yBAAyB,YAAY;",
6
+ "names": []
7
+ }
@@ -0,0 +1,83 @@
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 Pill_exports = {};
30
+ __export(Pill_exports, {
31
+ DSPillWithSchema: () => DSPillWithSchema,
32
+ Pill: () => Pill,
33
+ default: () => Pill_default
34
+ });
35
+ module.exports = __toCommonJS(Pill_exports);
36
+ var React = __toESM(require("react"));
37
+ var import_jsx_runtime = require("react/jsx-runtime");
38
+ var import_ds_legacy_utilities = require("@elliemae/ds-legacy-utilities");
39
+ var import_ds_legacy_props_helpers = require("@elliemae/ds-legacy-props-helpers");
40
+ var import_ds_legacy_classnames = require("@elliemae/ds-legacy-classnames");
41
+ const pillBlockName = "pill";
42
+ const PillWrapper = (0, import_ds_legacy_classnames.aggregatedClasses)("div")(pillBlockName, null, ({ size, variant }) => ({
43
+ [variant]: !!variant,
44
+ [size]: !!size
45
+ }));
46
+ const PillLabel = (0, import_ds_legacy_classnames.aggregatedClasses)("span")(pillBlockName, "label");
47
+ const PillAddon = (0, import_ds_legacy_classnames.aggregatedClasses)("div")(pillBlockName, "addon");
48
+ const Pill = ({
49
+ containerProps = {},
50
+ label = "",
51
+ leftAddon,
52
+ rightAddon,
53
+ variant = "value",
54
+ size = "m",
55
+ ...otherProps
56
+ }) => {
57
+ (0, import_ds_legacy_utilities.useDeprecateComponent)({ componentName: "ds-pills", version: "TBD Date: 2023 Q3" });
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(PillWrapper, { ...containerProps, classProps: { variant, size }, ...otherProps, children: [
59
+ leftAddon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillAddon, { children: leftAddon }),
60
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillLabel, { children: label }),
61
+ rightAddon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PillAddon, { children: rightAddon })
62
+ ] });
63
+ };
64
+ const props = {
65
+ /** props to inject to pill wrapper */
66
+ containerProps: import_ds_legacy_props_helpers.PropTypes.object.description("props to inject to pill wrapper"),
67
+ /** pill text label */
68
+ label: import_ds_legacy_props_helpers.PropTypes.string.isRequired.description("pill text label"),
69
+ /** pill size */
70
+ size: import_ds_legacy_props_helpers.PropTypes.oneOf(["m", "l"]).description("pill size"),
71
+ /** pill variant */
72
+ variant: import_ds_legacy_props_helpers.PropTypes.oneOf(["value", "title"]).description("pill variant"),
73
+ /** addon component to left */
74
+ leftAddon: import_ds_legacy_props_helpers.PropTypes.node.description("addon component to left"),
75
+ /** addon component to right */
76
+ rightAddon: import_ds_legacy_props_helpers.PropTypes.node.description("addon component to right")
77
+ };
78
+ Pill.propTypes = props;
79
+ Pill.displayName = "Pill";
80
+ const DSPillWithSchema = (0, import_ds_legacy_props_helpers.describe)(Pill);
81
+ DSPillWithSchema.propTypes = props;
82
+ var Pill_default = Pill;
83
+ //# sourceMappingURL=Pill.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/deprecated/Pill.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 { aggregatedClasses } from '@elliemae/ds-legacy-classnames';\n\nconst pillBlockName = 'pill';\n\nconst PillWrapper = aggregatedClasses('div')(pillBlockName, null, ({ size, variant }) => ({\n [variant]: !!variant,\n [size]: !!size,\n}));\nconst PillLabel = aggregatedClasses('span')(pillBlockName, 'label');\nconst PillAddon = aggregatedClasses('div')(pillBlockName, 'addon');\n\nconst Pill = ({\n containerProps = {},\n label = '',\n leftAddon,\n rightAddon,\n variant = 'value',\n size = 'm',\n ...otherProps\n}) => {\n useDeprecateComponent({ componentName: 'ds-pills', version: 'TBD Date: 2023 Q3' });\n\n return (\n <PillWrapper {...containerProps} classProps={{ variant, size }} {...otherProps}>\n {leftAddon && <PillAddon>{leftAddon}</PillAddon>}\n <PillLabel>{label}</PillLabel>\n {rightAddon && <PillAddon>{rightAddon}</PillAddon>}\n </PillWrapper>\n );\n};\n\nconst props = {\n /** props to inject to pill wrapper */\n containerProps: PropTypes.object.description('props to inject to pill wrapper'),\n /** pill text label */\n label: PropTypes.string.isRequired.description('pill text label'),\n /** pill size */\n size: PropTypes.oneOf(['m', 'l']).description('pill size'),\n /** pill variant */\n variant: PropTypes.oneOf(['value', 'title']).description('pill variant'),\n /** addon component to left */\n leftAddon: PropTypes.node.description('addon component to left'),\n /** addon component to right */\n rightAddon: PropTypes.node.description('addon component to right'),\n};\n\nPill.propTypes = props;\nPill.displayName = 'Pill';\nconst DSPillWithSchema = describe(Pill);\nDSPillWithSchema.propTypes = props;\n\nexport { Pill, DSPillWithSchema };\nexport default Pill;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD8BnB;AAzBJ,iCAAsC;AACtC,qCAAoC;AACpC,kCAAkC;AAElC,MAAM,gBAAgB;AAEtB,MAAM,kBAAc,+CAAkB,KAAK,EAAE,eAAe,MAAM,CAAC,EAAE,MAAM,QAAQ,OAAO;AA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