@bigbinary/neeto-molecules 3.16.91 → 3.16.93
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/Rename.js
CHANGED
|
@@ -121,7 +121,7 @@ var Editor = function Editor(_ref) {
|
|
|
121
121
|
});
|
|
122
122
|
};
|
|
123
123
|
|
|
124
|
-
var css = ":root{--neeto-molecules-rename-font-size:var(--neeto-ui-text-sm);--neeto-molecules-rename-font-weight:600;--neeto-molecules-rename-letter-spacing:0;--neeto-molecules-rename-line-height:1.2;--neeto-molecules-rename-min-width:7.5rem;--neeto-molecules-rename-color:var(--neeto-ui-black)}.neeto-molecules-rename-common-styles,.neeto-molecules-rename__input .neeto-ui-input input,.neeto-molecules-rename__input-width-maker,.neeto-molecules-rename__text{color:rgb(var(--neeto-ui-black));font-size:var(--neeto-ui-text-sm)!important;font-size:var(--neeto-molecules-rename-font-size)!important;font-weight:600;font-weight:var(--neeto-molecules-rename-font-weight);letter-spacing:0;letter-spacing:var(--neeto-molecules-rename-letter-spacing);line-height:1.2;line-height:var(--neeto-molecules-rename-line-height);margin:0}.neeto-molecules-rename__input{height:100%;margin:0;max-width:100%;min-width:0;position:relative;transition:width .2s ease-in-out;width:100%}.neeto-molecules-rename__input .neeto-ui-input{height:100%}.neeto-molecules-rename__input .neeto-ui-input .neeto-ui-input__suffix{margin-right:0!important}.neeto-molecules-rename__input .neeto-ui-input input{min-width:0}.neeto-molecules-rename__text{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-white));border-radius:var(--neeto-ui-rounded);cursor:pointer;max-width:28rem;padding:.5rem;transition:var(--neeto-ui-transition)}.neeto-molecules-rename__display-text:hover{border:thin solid rgb(var(--neeto-ui-gray-400))}.neeto-molecules-rename__input-width-maker{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-white));border-radius:var(--neeto-ui-rounded);cursor:pointer;display:inline-flex;margin-right:4.25rem;max-width:100%;min-width:7.5rem;overflow:hidden;padding:.5rem;position:relative;transition:var(--neeto-ui-transition);visibility:hidden;white-space:nowrap}.neeto-molecules-rename-breadcrumbs{margin-bottom:0}.neeto-molecules-rename-breadcrumbs .neeto-molecules-breadcrumb a{display:flex}";
|
|
124
|
+
var css = ":root{--neeto-molecules-rename-font-size:var(--neeto-ui-text-sm);--neeto-molecules-rename-font-weight:600;--neeto-molecules-rename-letter-spacing:0;--neeto-molecules-rename-line-height:1.2;--neeto-molecules-rename-min-width:7.5rem;--neeto-molecules-rename-color:var(--neeto-ui-black)}.neeto-molecules-rename-common-styles,.neeto-molecules-rename__input .neeto-ui-input input,.neeto-molecules-rename__input-width-maker,.neeto-molecules-rename__text{color:rgb(var(--neeto-ui-black));font-size:var(--neeto-ui-text-sm)!important;font-size:var(--neeto-molecules-rename-font-size)!important;font-weight:600;font-weight:var(--neeto-molecules-rename-font-weight);letter-spacing:0;letter-spacing:var(--neeto-molecules-rename-letter-spacing);line-height:1.2;line-height:var(--neeto-molecules-rename-line-height);margin:0}.neeto-molecules-rename__input{height:100%;margin:0;max-width:100%;min-width:0;position:relative;transition:width .2s ease-in-out;width:100%}.neeto-molecules-rename__input .neeto-ui-input__label-wrapper .neeto-ui-input__max-length{font-size:10px;position:absolute;right:0;top:0;transform:translateY(-100%)}.neeto-molecules-rename__input .neeto-ui-input{height:100%}.neeto-molecules-rename__input .neeto-ui-input .neeto-ui-input__suffix{margin-right:0!important}.neeto-molecules-rename__input .neeto-ui-input input{min-width:0}.neeto-molecules-rename__text{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-white));border-radius:var(--neeto-ui-rounded);cursor:pointer;max-width:28rem;padding:.5rem;transition:var(--neeto-ui-transition)}.neeto-molecules-rename__display-text:hover{border:thin solid rgb(var(--neeto-ui-gray-400))}.neeto-molecules-rename__input-width-maker{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-white));border-radius:var(--neeto-ui-rounded);cursor:pointer;display:inline-flex;margin-right:4.25rem;max-width:100%;min-width:7.5rem;overflow:hidden;padding:.5rem;position:relative;transition:var(--neeto-ui-transition);visibility:hidden;white-space:nowrap}.neeto-molecules-rename-breadcrumbs{margin-bottom:0}.neeto-molecules-rename-breadcrumbs .neeto-molecules-breadcrumb a{display:flex}";
|
|
125
125
|
n(css,{});
|
|
126
126
|
|
|
127
127
|
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
package/dist/StatusDropdown.js
CHANGED
|
@@ -57,10 +57,22 @@ var Target = function Target(_ref) {
|
|
|
57
57
|
t = _useTranslation.t;
|
|
58
58
|
var targetClassName = "neeto-ui-rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--".concat(color || "waiting");
|
|
59
59
|
var isOptionSelected = !isNil(value);
|
|
60
|
-
|
|
60
|
+
var handleClearClick = function handleClearClick(event) {
|
|
61
|
+
onClear();
|
|
62
|
+
event.stopPropagation();
|
|
63
|
+
};
|
|
64
|
+
var handleClearKeyDown = function handleClearKeyDown(event) {
|
|
65
|
+
if (!(event.key === "Enter" || event.key === " ")) return;
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
handleClearClick(event);
|
|
68
|
+
};
|
|
69
|
+
return /*#__PURE__*/jsxs("button", {
|
|
70
|
+
"aria-haspopup": "listbox",
|
|
61
71
|
className: targetClassName,
|
|
62
72
|
"data-cy": dataCy,
|
|
63
73
|
"data-testid": "status-dropdown",
|
|
74
|
+
type: "button",
|
|
75
|
+
"aria-label": isOptionSelected ? "Selected: ".concat(label) : placeholder || t("neetoMolecules.statusDropdown.placeholder"),
|
|
64
76
|
children: [isOptionSelected ? /*#__PURE__*/jsx(Typography, {
|
|
65
77
|
className: "inline",
|
|
66
78
|
style: "body2",
|
|
@@ -69,19 +81,22 @@ var Target = function Target(_ref) {
|
|
|
69
81
|
className: "neeto-ui-text-gray-600 inline",
|
|
70
82
|
style: "body2",
|
|
71
83
|
children: placeholder || t("neetoMolecules.statusDropdown.placeholder")
|
|
72
|
-
}), /*#__PURE__*/jsxs("
|
|
84
|
+
}), /*#__PURE__*/jsxs("span", {
|
|
73
85
|
className: "inline-flex items-center gap-1",
|
|
74
|
-
children: [isClearable && isOptionSelected && /*#__PURE__*/jsx("
|
|
86
|
+
children: [isClearable && isOptionSelected && /*#__PURE__*/jsx("span", {
|
|
87
|
+
"aria-label": t("neetoMolecules.statusDropdown.clear"),
|
|
88
|
+
className: "cursor-pointer",
|
|
75
89
|
"data-cy": "status-dropdown-clear-button",
|
|
76
90
|
"data-testid": "status-dropdown-clear-button",
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
role: "button",
|
|
92
|
+
tabIndex: 0,
|
|
93
|
+
onClick: handleClearClick,
|
|
94
|
+
onKeyDown: handleClearKeyDown,
|
|
81
95
|
children: /*#__PURE__*/jsx(Close, {
|
|
82
96
|
size: ICON_SIZE
|
|
83
97
|
})
|
|
84
98
|
}), /*#__PURE__*/jsx(Down, {
|
|
99
|
+
"aria-hidden": "true",
|
|
85
100
|
size: ICON_SIZE
|
|
86
101
|
})]
|
|
87
102
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusDropdown.js","sources":["../src/components/StatusDropdown/Menu.jsx","../src/components/StatusDropdown/constants.js","../src/components/StatusDropdown/Target.jsx","../src/components/StatusDropdown/index.jsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { hyphenate } from \"neetocist\";\nimport { Dropdown } from \"neetoui\";\n\nconst { Menu: NeetoUIMenu, MenuItem } = Dropdown;\n\nconst Menu = ({\n onItemClick,\n options,\n shouldShowAllOptions = false,\n hiddenStatuses = [],\n}) => {\n const allowedOptions = shouldShowAllOptions\n ? options\n : options.filter(status => !hiddenStatuses.includes(status.value));\n\n return (\n <NeetoUIMenu data-testid=\"status-dropdown-menu\">\n {allowedOptions?.map(option => (\n <MenuItem.Button\n className={`status-dropdown-item--${option.color}`}\n data-cy={`status-dropdown-item-${hyphenate(option.value)}`}\n data-testid={`status-dropdown-item-${option.value}`}\n key={option.value}\n onClick={() => onItemClick(option)}\n >\n {option.label}\n </MenuItem.Button>\n ))}\n </NeetoUIMenu>\n );\n};\n\nexport default memo(Menu);\n","export const ICON_SIZE = 16;\n","import { memo } from \"react\";\n\nimport { Down, Close } from \"neetoicons\";\nimport { Typography } from \"neetoui\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ICON_SIZE } from \"./constants\";\n\nconst Target = ({\n color,\n value,\n label,\n dataCy,\n isClearable,\n onClear,\n placeholder,\n}) => {\n const { t } = useTranslation();\n const targetClassName = `neeto-ui-rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--${\n color || \"waiting\"\n }`;\n const isOptionSelected = !isNil(value);\n\n return (\n <div\n className={targetClassName}\n data-cy={dataCy}\n data-testid=\"status-dropdown\"\n >\n {isOptionSelected ? (\n <Typography className=\"inline\" style=\"body2\">\n {label}\n </Typography>\n ) : (\n <Typography className=\"neeto-ui-text-gray-600 inline\" style=\"body2\">\n {placeholder || t(\"neetoMolecules.statusDropdown.placeholder\")}\n </Typography>\n )}\n <div className=\"inline-flex items-center gap-1\">\n {isClearable && isOptionSelected && (\n <button\n data-cy=\"status-dropdown-clear-button\"\n data-testid=\"status-dropdown-clear-button\"\n onClick={event => {\n onClear();\n event.stopPropagation();\n }}\n >\n <Close size={ICON_SIZE} />\n </button>\n )}\n <Down size={ICON_SIZE} />\n </div>\n </div>\n );\n};\n\nexport default memo(Target);\n","import { _findBy, noop } from \"neetocist\";\nimport { Dropdown, Spinner } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport Menu from \"./Menu\";\nimport \"./status-dropdown.scss\";\nimport Target from \"./Target\";\n\nconst StatusDropdown = ({\n disabled = false,\n hiddenStatuses = [],\n isLoading = false,\n onItemClick,\n options,\n placeholder = null,\n selectedValue,\n shouldShowAllOptions = false,\n isClearable = false,\n onClear = noop,\n dataCy = \"status-dropdown\",\n}) => {\n const selectedOption = _findBy({ value: selectedValue }, options);\n\n return (\n <Dropdown\n {...{ disabled }}\n strategy=\"fixed\"\n customTarget={() => (\n <Target\n label={selectedValue}\n {...{ ...selectedOption, dataCy, isClearable, onClear, placeholder }}\n />\n )}\n >\n {isLoading ? (\n <div className=\"flex w-full items-center justify-center py-8\">\n <Spinner />\n </div>\n ) : (\n <Menu\n {...{ hiddenStatuses, onItemClick, options, shouldShowAllOptions }}\n />\n )}\n </Dropdown>\n );\n};\n\nStatusDropdown.Menu = Menu;\n\nStatusDropdown.propTypes = {\n /**\n * This prop will decide whether the dropdown is disabled or not.\n */\n disabled: PropTypes.bool,\n /**\n * Statuses to be hidden when shouldShowAllOptions is false.\n */\n hiddenStatuses: PropTypes.array,\n /**\n * This prop will decide whether the dropdown is in loading state or not.\n */\n isLoading: PropTypes.bool,\n /**\n * Function to be called when a menu item is clicked.\n */\n onItemClick: PropTypes.func,\n /**\n * The items that should be shown in the dropdown.\n */\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n color: PropTypes.string,\n })\n ),\n /**\n * Placeholder for the dropdown.\n */\n placeholder: PropTypes.string,\n /**\n * The selected value.\n */\n selectedValue: PropTypes.string,\n /**\n * This prop will decide whether all options should be shown or not. If set to false, the items in hiddenStatuses will not be shown.\n */\n shouldShowAllOptions: PropTypes.bool,\n /**\n * This prop will decide whether the dropdown is clearable or not.\n */\n isClearable: PropTypes.bool,\n /**\n * Function to be called when the clear button is clicked.\n */\n onClear: PropTypes.func,\n};\n\nexport default StatusDropdown;\n"],"names":["NeetoUIMenu","Dropdown","Menu","MenuItem","_ref","onItemClick","options","_ref$shouldShowAllOpt","shouldShowAllOptions","_ref$hiddenStatuses","hiddenStatuses","allowedOptions","filter","status","includes","value","_jsx","children","map","option","Button","className","concat","color","hyphenate","onClick","label","memo","ICON_SIZE","Target","dataCy","isClearable","onClear","placeholder","_useTranslation","useTranslation","t","targetClassName","isOptionSelected","isNil","_jsxs","Typography","style","event","stopPropagation","Close","size","Down","StatusDropdown","_ref$disabled","disabled","_ref$isLoading","isLoading","_ref$placeholder","selectedValue","_ref$isClearable","_ref$onClear","noop","_ref$dataCy","selectedOption","_findBy","strategy","customTarget","_objectSpread","Spinner"],"mappings":";;;;;;;;;;;;;AAKA,IAAcA,WAAW,GAAeC,QAAQ,CAAxCC,IAAI;EAAeC,QAAQ,GAAKF,QAAQ,CAArBE,QAAQ,CAAA;AAEnC,IAAMD,IAAI,GAAG,SAAPA,IAAIA,CAAAE,IAAA,EAKJ;AAAA,EAAA,IAJJC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAAC,qBAAA,GAAAH,IAAA,CACPI,oBAAoB;AAApBA,IAAAA,oBAAoB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA;IAAAE,mBAAA,GAAAL,IAAA,CAC5BM,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,mBAAA,CAAA;EAEnB,IAAME,cAAc,GAAGH,oBAAoB,GACvCF,OAAO,GACPA,OAAO,CAACM,MAAM,CAAC,UAAAC,MAAM,EAAA;IAAA,OAAI,CAACH,cAAc,CAACI,QAAQ,CAACD,MAAM,CAACE,KAAK,CAAC,CAAA;GAAC,CAAA,CAAA;EAEpE,oBACEC,GAAA,CAAChB,WAAW,EAAA;AAAC,IAAA,aAAA,EAAY,sBAAsB;IAAAiB,QAAA,EAC5CN,cAAc,KAAA,IAAA,IAAdA,cAAc,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAdA,cAAc,CAAEO,GAAG,CAAC,UAAAC,MAAM,EAAA;AA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,OAAO,CAAC,CAAA;EAEjE,oBACEU,GAAA,CAACf,QAAQ,EAAA;AACDiD,IAAAA,QAAQ,EAARA,QAAQ;AACdW,IAAAA,QAAQ,EAAC,OAAO;IAChBC,YAAY,EAAE,SAAdA,YAAYA,GAAA;AAAA,MAAA,oBACV9C,GAAA,CAACa,QAAM,EAAAkC,aAAA,CAAA;AACLrC,QAAAA,KAAK,EAAE4B,aAAAA;AAAc,OAAA,EAAAS,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZJ,cAAc,CAAA,EAAA,EAAA,EAAA;AAAE7B,QAAAA,MAAM,EAANA,MAAM;AAAEC,QAAAA,WAAW,EAAXA,WAAW;AAAEC,QAAAA,OAAO,EAAPA,OAAO;AAAEC,QAAAA,WAAW,EAAXA,WAAAA;AAAW,OAAA,CAAA,CACnE,CAAC,CAAA;KACF;IAAAhB,QAAA,EAEDmC,SAAS,gBACRpC,GAAA,CAAA,KAAA,EAAA;AAAKK,MAAAA,SAAS,EAAC,8CAA8C;AAAAJ,MAAAA,QAAA,eAC3DD,GAAA,CAACgD,OAAO,EAAE,EAAA,CAAA;AAAC,KACR,CAAC,gBAENhD,GAAA,CAACd,MAAI,EAAA;AACGQ,MAAAA,cAAc,EAAdA,cAAc;AAAEL,MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,OAAO,EAAPA,OAAO;AAAEE,MAAAA,oBAAoB,EAApBA,oBAAAA;KAC7C,CAAA;AACF,GACO,CAAC,CAAA;AAEf,EAAC;AAEDwC,cAAc,CAAC9C,IAAI,GAAGA,MAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"StatusDropdown.js","sources":["../src/components/StatusDropdown/Menu.jsx","../src/components/StatusDropdown/constants.js","../src/components/StatusDropdown/Target.jsx","../src/components/StatusDropdown/index.jsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { hyphenate } from \"neetocist\";\nimport { Dropdown } from \"neetoui\";\n\nconst { Menu: NeetoUIMenu, MenuItem } = Dropdown;\n\nconst Menu = ({\n onItemClick,\n options,\n shouldShowAllOptions = false,\n hiddenStatuses = [],\n}) => {\n const allowedOptions = shouldShowAllOptions\n ? options\n : options.filter(status => !hiddenStatuses.includes(status.value));\n\n return (\n <NeetoUIMenu data-testid=\"status-dropdown-menu\">\n {allowedOptions?.map(option => (\n <MenuItem.Button\n className={`status-dropdown-item--${option.color}`}\n data-cy={`status-dropdown-item-${hyphenate(option.value)}`}\n data-testid={`status-dropdown-item-${option.value}`}\n key={option.value}\n onClick={() => onItemClick(option)}\n >\n {option.label}\n </MenuItem.Button>\n ))}\n </NeetoUIMenu>\n );\n};\n\nexport default memo(Menu);\n","export const ICON_SIZE = 16;\n","import { memo } from \"react\";\n\nimport { Down, Close } from \"neetoicons\";\nimport { Typography } from \"neetoui\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ICON_SIZE } from \"./constants.js\";\n\nconst Target = ({\n color,\n value,\n label,\n dataCy,\n isClearable,\n onClear,\n placeholder,\n}) => {\n const { t } = useTranslation();\n const targetClassName = `neeto-ui-rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--${\n color || \"waiting\"\n }`;\n const isOptionSelected = !isNil(value);\n\n const handleClearClick = event => {\n onClear();\n event.stopPropagation();\n };\n\n const handleClearKeyDown = event => {\n if (!(event.key === \"Enter\" || event.key === \" \")) return;\n event.preventDefault();\n handleClearClick(event);\n };\n\n return (\n <button\n aria-haspopup=\"listbox\"\n className={targetClassName}\n data-cy={dataCy}\n data-testid=\"status-dropdown\"\n type=\"button\"\n aria-label={\n isOptionSelected\n ? `Selected: ${label}`\n : placeholder || t(\"neetoMolecules.statusDropdown.placeholder\")\n }\n >\n {isOptionSelected ? (\n <Typography className=\"inline\" style=\"body2\">\n {label}\n </Typography>\n ) : (\n <Typography className=\"neeto-ui-text-gray-600 inline\" style=\"body2\">\n {placeholder || t(\"neetoMolecules.statusDropdown.placeholder\")}\n </Typography>\n )}\n <span className=\"inline-flex items-center gap-1\">\n {isClearable && isOptionSelected && (\n <span\n aria-label={t(\"neetoMolecules.statusDropdown.clear\")}\n className=\"cursor-pointer\"\n data-cy=\"status-dropdown-clear-button\"\n data-testid=\"status-dropdown-clear-button\"\n role=\"button\"\n tabIndex={0}\n onClick={handleClearClick}\n onKeyDown={handleClearKeyDown}\n >\n <Close size={ICON_SIZE} />\n </span>\n )}\n <Down aria-hidden=\"true\" size={ICON_SIZE} />\n </span>\n </button>\n );\n};\n\nexport default memo(Target);\n","import { _findBy, noop } from \"neetocist\";\nimport { Dropdown, Spinner } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport Menu from \"./Menu\";\nimport \"./status-dropdown.scss\";\nimport Target from \"./Target\";\n\nconst StatusDropdown = ({\n disabled = false,\n hiddenStatuses = [],\n isLoading = false,\n onItemClick,\n options,\n placeholder = null,\n selectedValue,\n shouldShowAllOptions = false,\n isClearable = false,\n onClear = noop,\n dataCy = \"status-dropdown\",\n}) => {\n const selectedOption = _findBy({ value: selectedValue }, options);\n\n return (\n <Dropdown\n {...{ disabled }}\n strategy=\"fixed\"\n customTarget={() => (\n <Target\n label={selectedValue}\n {...{ ...selectedOption, dataCy, isClearable, onClear, placeholder }}\n />\n )}\n >\n {isLoading ? (\n <div className=\"flex w-full items-center justify-center py-8\">\n <Spinner />\n </div>\n ) : (\n <Menu\n {...{ hiddenStatuses, onItemClick, options, shouldShowAllOptions }}\n />\n )}\n </Dropdown>\n );\n};\n\nStatusDropdown.Menu = Menu;\n\nStatusDropdown.propTypes = {\n /**\n * This prop will decide whether the dropdown is disabled or not.\n */\n disabled: PropTypes.bool,\n /**\n * Statuses to be hidden when shouldShowAllOptions is false.\n */\n hiddenStatuses: PropTypes.array,\n /**\n * This prop will decide whether the dropdown is in loading state or not.\n */\n isLoading: PropTypes.bool,\n /**\n * Function to be called when a menu item is clicked.\n */\n onItemClick: PropTypes.func,\n /**\n * The items that should be shown in the dropdown.\n */\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n color: PropTypes.string,\n })\n ),\n /**\n * Placeholder for the dropdown.\n */\n placeholder: PropTypes.string,\n /**\n * The selected value.\n */\n selectedValue: PropTypes.string,\n /**\n * This prop will decide whether all options should be shown or not. If set to false, the items in hiddenStatuses will not be shown.\n */\n shouldShowAllOptions: PropTypes.bool,\n /**\n * This prop will decide whether the dropdown is clearable or not.\n */\n isClearable: PropTypes.bool,\n /**\n * Function to be called when the clear button is clicked.\n */\n onClear: PropTypes.func,\n};\n\nexport default StatusDropdown;\n"],"names":["NeetoUIMenu","Dropdown","Menu","MenuItem","_ref","onItemClick","options","_ref$shouldShowAllOpt","shouldShowAllOptions","_ref$hiddenStatuses","hiddenStatuses","allowedOptions","filter","status","includes","value","_jsx","children","map","option","Button","className","concat","color","hyphenate","onClick","label","memo","ICON_SIZE","Target","dataCy","isClearable","onClear","placeholder","_useTranslation","useTranslation","t","targetClassName","isOptionSelected","isNil","handleClearClick","event","stopPropagation","handleClearKeyDown","key","preventDefault","_jsxs","type","Typography","style","role","tabIndex","onKeyDown","Close","size","Down","StatusDropdown","_ref$disabled","disabled","_ref$isLoading","isLoading","_ref$placeholder","selectedValue","_ref$isClearable","_ref$onClear","noop","_ref$dataCy","selectedOption","_findBy","strategy","customTarget","_objectSpread","Spinner"],"mappings":";;;;;;;;;;;;;AAKA,IAAcA,WAAW,GAAeC,QAAQ,CAAxCC,IAAI;EAAeC,QAAQ,GAAKF,QAAQ,CAArBE,QAAQ,CAAA;AAEnC,IAAMD,IAAI,GAAG,SAAPA,IAAIA,CAAAE,IAAA,EAKJ;AAAA,EAAA,IAJJC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAAC,qBAAA,GAAAH,IAAA,CACPI,oBAAoB;AAApBA,IAAAA,oBAAoB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA;IAAAE,mBAA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AAA;GAAe,EAAExD,OAAO,CAAC,CAAA;EAEjE,oBACEU,GAAA,CAACf,QAAQ,EAAA;AACDyD,IAAAA,QAAQ,EAARA,QAAQ;AACdW,IAAAA,QAAQ,EAAC,OAAO;IAChBC,YAAY,EAAE,SAAdA,YAAYA,GAAA;AAAA,MAAA,oBACVtD,GAAA,CAACa,QAAM,EAAA0C,aAAA,CAAA;AACL7C,QAAAA,KAAK,EAAEoC,aAAAA;AAAc,OAAA,EAAAS,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZJ,cAAc,CAAA,EAAA,EAAA,EAAA;AAAErC,QAAAA,MAAM,EAANA,MAAM;AAAEC,QAAAA,WAAW,EAAXA,WAAW;AAAEC,QAAAA,OAAO,EAAPA,OAAO;AAAEC,QAAAA,WAAW,EAAXA,WAAAA;AAAW,OAAA,CAAA,CACnE,CAAC,CAAA;KACF;IAAAhB,QAAA,EAED2C,SAAS,gBACR5C,GAAA,CAAA,KAAA,EAAA;AAAKK,MAAAA,SAAS,EAAC,8CAA8C;AAAAJ,MAAAA,QAAA,eAC3DD,GAAA,CAACwD,OAAO,EAAE,EAAA,CAAA;AAAC,KACR,CAAC,gBAENxD,GAAA,CAACd,MAAI,EAAA;AACGQ,MAAAA,cAAc,EAAdA,cAAc;AAAEL,MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,OAAO,EAAPA,OAAO;AAAEE,MAAAA,oBAAoB,EAApBA,oBAAAA;KAC7C,CAAA;AACF,GACO,CAAC,CAAA;AAEf,EAAC;AAEDgD,cAAc,CAACtD,IAAI,GAAGA,MAAI;;;;"}
|
package/dist/cjs/Rename.js
CHANGED
|
@@ -123,7 +123,7 @@ var Editor = function Editor(_ref) {
|
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
var css = ":root{--neeto-molecules-rename-font-size:var(--neeto-ui-text-sm);--neeto-molecules-rename-font-weight:600;--neeto-molecules-rename-letter-spacing:0;--neeto-molecules-rename-line-height:1.2;--neeto-molecules-rename-min-width:7.5rem;--neeto-molecules-rename-color:var(--neeto-ui-black)}.neeto-molecules-rename-common-styles,.neeto-molecules-rename__input .neeto-ui-input input,.neeto-molecules-rename__input-width-maker,.neeto-molecules-rename__text{color:rgb(var(--neeto-ui-black));font-size:var(--neeto-ui-text-sm)!important;font-size:var(--neeto-molecules-rename-font-size)!important;font-weight:600;font-weight:var(--neeto-molecules-rename-font-weight);letter-spacing:0;letter-spacing:var(--neeto-molecules-rename-letter-spacing);line-height:1.2;line-height:var(--neeto-molecules-rename-line-height);margin:0}.neeto-molecules-rename__input{height:100%;margin:0;max-width:100%;min-width:0;position:relative;transition:width .2s ease-in-out;width:100%}.neeto-molecules-rename__input .neeto-ui-input{height:100%}.neeto-molecules-rename__input .neeto-ui-input .neeto-ui-input__suffix{margin-right:0!important}.neeto-molecules-rename__input .neeto-ui-input input{min-width:0}.neeto-molecules-rename__text{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-white));border-radius:var(--neeto-ui-rounded);cursor:pointer;max-width:28rem;padding:.5rem;transition:var(--neeto-ui-transition)}.neeto-molecules-rename__display-text:hover{border:thin solid rgb(var(--neeto-ui-gray-400))}.neeto-molecules-rename__input-width-maker{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-white));border-radius:var(--neeto-ui-rounded);cursor:pointer;display:inline-flex;margin-right:4.25rem;max-width:100%;min-width:7.5rem;overflow:hidden;padding:.5rem;position:relative;transition:var(--neeto-ui-transition);visibility:hidden;white-space:nowrap}.neeto-molecules-rename-breadcrumbs{margin-bottom:0}.neeto-molecules-rename-breadcrumbs .neeto-molecules-breadcrumb a{display:flex}";
|
|
126
|
+
var css = ":root{--neeto-molecules-rename-font-size:var(--neeto-ui-text-sm);--neeto-molecules-rename-font-weight:600;--neeto-molecules-rename-letter-spacing:0;--neeto-molecules-rename-line-height:1.2;--neeto-molecules-rename-min-width:7.5rem;--neeto-molecules-rename-color:var(--neeto-ui-black)}.neeto-molecules-rename-common-styles,.neeto-molecules-rename__input .neeto-ui-input input,.neeto-molecules-rename__input-width-maker,.neeto-molecules-rename__text{color:rgb(var(--neeto-ui-black));font-size:var(--neeto-ui-text-sm)!important;font-size:var(--neeto-molecules-rename-font-size)!important;font-weight:600;font-weight:var(--neeto-molecules-rename-font-weight);letter-spacing:0;letter-spacing:var(--neeto-molecules-rename-letter-spacing);line-height:1.2;line-height:var(--neeto-molecules-rename-line-height);margin:0}.neeto-molecules-rename__input{height:100%;margin:0;max-width:100%;min-width:0;position:relative;transition:width .2s ease-in-out;width:100%}.neeto-molecules-rename__input .neeto-ui-input__label-wrapper .neeto-ui-input__max-length{font-size:10px;position:absolute;right:0;top:0;transform:translateY(-100%)}.neeto-molecules-rename__input .neeto-ui-input{height:100%}.neeto-molecules-rename__input .neeto-ui-input .neeto-ui-input__suffix{margin-right:0!important}.neeto-molecules-rename__input .neeto-ui-input input{min-width:0}.neeto-molecules-rename__text{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-white));border-radius:var(--neeto-ui-rounded);cursor:pointer;max-width:28rem;padding:.5rem;transition:var(--neeto-ui-transition)}.neeto-molecules-rename__display-text:hover{border:thin solid rgb(var(--neeto-ui-gray-400))}.neeto-molecules-rename__input-width-maker{background-color:rgb(var(--neeto-ui-white));border:thin solid rgb(var(--neeto-ui-white));border-radius:var(--neeto-ui-rounded);cursor:pointer;display:inline-flex;margin-right:4.25rem;max-width:100%;min-width:7.5rem;overflow:hidden;padding:.5rem;position:relative;transition:var(--neeto-ui-transition);visibility:hidden;white-space:nowrap}.neeto-molecules-rename-breadcrumbs{margin-bottom:0}.neeto-molecules-rename-breadcrumbs .neeto-molecules-breadcrumb a{display:flex}";
|
|
127
127
|
injectCss.n(css,{});
|
|
128
128
|
|
|
129
129
|
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -59,10 +59,22 @@ var Target = function Target(_ref) {
|
|
|
59
59
|
t = _useTranslation.t;
|
|
60
60
|
var targetClassName = "neeto-ui-rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--".concat(color || "waiting");
|
|
61
61
|
var isOptionSelected = !ramda.isNil(value);
|
|
62
|
-
|
|
62
|
+
var handleClearClick = function handleClearClick(event) {
|
|
63
|
+
onClear();
|
|
64
|
+
event.stopPropagation();
|
|
65
|
+
};
|
|
66
|
+
var handleClearKeyDown = function handleClearKeyDown(event) {
|
|
67
|
+
if (!(event.key === "Enter" || event.key === " ")) return;
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
handleClearClick(event);
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/jsxRuntime.jsxs("button", {
|
|
72
|
+
"aria-haspopup": "listbox",
|
|
63
73
|
className: targetClassName,
|
|
64
74
|
"data-cy": dataCy,
|
|
65
75
|
"data-testid": "status-dropdown",
|
|
76
|
+
type: "button",
|
|
77
|
+
"aria-label": isOptionSelected ? "Selected: ".concat(label) : placeholder || t("neetoMolecules.statusDropdown.placeholder"),
|
|
66
78
|
children: [isOptionSelected ? /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
67
79
|
className: "inline",
|
|
68
80
|
style: "body2",
|
|
@@ -71,19 +83,22 @@ var Target = function Target(_ref) {
|
|
|
71
83
|
className: "neeto-ui-text-gray-600 inline",
|
|
72
84
|
style: "body2",
|
|
73
85
|
children: placeholder || t("neetoMolecules.statusDropdown.placeholder")
|
|
74
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("
|
|
86
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
75
87
|
className: "inline-flex items-center gap-1",
|
|
76
|
-
children: [isClearable && isOptionSelected && /*#__PURE__*/jsxRuntime.jsx("
|
|
88
|
+
children: [isClearable && isOptionSelected && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
89
|
+
"aria-label": t("neetoMolecules.statusDropdown.clear"),
|
|
90
|
+
className: "cursor-pointer",
|
|
77
91
|
"data-cy": "status-dropdown-clear-button",
|
|
78
92
|
"data-testid": "status-dropdown-clear-button",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
93
|
+
role: "button",
|
|
94
|
+
tabIndex: 0,
|
|
95
|
+
onClick: handleClearClick,
|
|
96
|
+
onKeyDown: handleClearKeyDown,
|
|
83
97
|
children: /*#__PURE__*/jsxRuntime.jsx(Close, {
|
|
84
98
|
size: ICON_SIZE
|
|
85
99
|
})
|
|
86
100
|
}), /*#__PURE__*/jsxRuntime.jsx(Down, {
|
|
101
|
+
"aria-hidden": "true",
|
|
87
102
|
size: ICON_SIZE
|
|
88
103
|
})]
|
|
89
104
|
})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusDropdown.js","sources":["../../src/components/StatusDropdown/Menu.jsx","../../src/components/StatusDropdown/constants.js","../../src/components/StatusDropdown/Target.jsx","../../src/components/StatusDropdown/index.jsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { hyphenate } from \"neetocist\";\nimport { Dropdown } from \"neetoui\";\n\nconst { Menu: NeetoUIMenu, MenuItem } = Dropdown;\n\nconst Menu = ({\n onItemClick,\n options,\n shouldShowAllOptions = false,\n hiddenStatuses = [],\n}) => {\n const allowedOptions = shouldShowAllOptions\n ? options\n : options.filter(status => !hiddenStatuses.includes(status.value));\n\n return (\n <NeetoUIMenu data-testid=\"status-dropdown-menu\">\n {allowedOptions?.map(option => (\n <MenuItem.Button\n className={`status-dropdown-item--${option.color}`}\n data-cy={`status-dropdown-item-${hyphenate(option.value)}`}\n data-testid={`status-dropdown-item-${option.value}`}\n key={option.value}\n onClick={() => onItemClick(option)}\n >\n {option.label}\n </MenuItem.Button>\n ))}\n </NeetoUIMenu>\n );\n};\n\nexport default memo(Menu);\n","export const ICON_SIZE = 16;\n","import { memo } from \"react\";\n\nimport { Down, Close } from \"neetoicons\";\nimport { Typography } from \"neetoui\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ICON_SIZE } from \"./constants\";\n\nconst Target = ({\n color,\n value,\n label,\n dataCy,\n isClearable,\n onClear,\n placeholder,\n}) => {\n const { t } = useTranslation();\n const targetClassName = `neeto-ui-rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--${\n color || \"waiting\"\n }`;\n const isOptionSelected = !isNil(value);\n\n return (\n <div\n className={targetClassName}\n data-cy={dataCy}\n data-testid=\"status-dropdown\"\n >\n {isOptionSelected ? (\n <Typography className=\"inline\" style=\"body2\">\n {label}\n </Typography>\n ) : (\n <Typography className=\"neeto-ui-text-gray-600 inline\" style=\"body2\">\n {placeholder || t(\"neetoMolecules.statusDropdown.placeholder\")}\n </Typography>\n )}\n <div className=\"inline-flex items-center gap-1\">\n {isClearable && isOptionSelected && (\n <button\n data-cy=\"status-dropdown-clear-button\"\n data-testid=\"status-dropdown-clear-button\"\n onClick={event => {\n onClear();\n event.stopPropagation();\n }}\n >\n <Close size={ICON_SIZE} />\n </button>\n )}\n <Down size={ICON_SIZE} />\n </div>\n </div>\n );\n};\n\nexport default memo(Target);\n","import { _findBy, noop } from \"neetocist\";\nimport { Dropdown, Spinner } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport Menu from \"./Menu\";\nimport \"./status-dropdown.scss\";\nimport Target from \"./Target\";\n\nconst StatusDropdown = ({\n disabled = false,\n hiddenStatuses = [],\n isLoading = false,\n onItemClick,\n options,\n placeholder = null,\n selectedValue,\n shouldShowAllOptions = false,\n isClearable = false,\n onClear = noop,\n dataCy = \"status-dropdown\",\n}) => {\n const selectedOption = _findBy({ value: selectedValue }, options);\n\n return (\n <Dropdown\n {...{ disabled }}\n strategy=\"fixed\"\n customTarget={() => (\n <Target\n label={selectedValue}\n {...{ ...selectedOption, dataCy, isClearable, onClear, placeholder }}\n />\n )}\n >\n {isLoading ? (\n <div className=\"flex w-full items-center justify-center py-8\">\n <Spinner />\n </div>\n ) : (\n <Menu\n {...{ hiddenStatuses, onItemClick, options, shouldShowAllOptions }}\n />\n )}\n </Dropdown>\n );\n};\n\nStatusDropdown.Menu = Menu;\n\nStatusDropdown.propTypes = {\n /**\n * This prop will decide whether the dropdown is disabled or not.\n */\n disabled: PropTypes.bool,\n /**\n * Statuses to be hidden when shouldShowAllOptions is false.\n */\n hiddenStatuses: PropTypes.array,\n /**\n * This prop will decide whether the dropdown is in loading state or not.\n */\n isLoading: PropTypes.bool,\n /**\n * Function to be called when a menu item is clicked.\n */\n onItemClick: PropTypes.func,\n /**\n * The items that should be shown in the dropdown.\n */\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n color: PropTypes.string,\n })\n ),\n /**\n * Placeholder for the dropdown.\n */\n placeholder: PropTypes.string,\n /**\n * The selected value.\n */\n selectedValue: PropTypes.string,\n /**\n * This prop will decide whether all options should be shown or not. If set to false, the items in hiddenStatuses will not be shown.\n */\n shouldShowAllOptions: PropTypes.bool,\n /**\n * This prop will decide whether the dropdown is clearable or not.\n */\n isClearable: PropTypes.bool,\n /**\n * Function to be called when the clear button is clicked.\n */\n onClear: PropTypes.func,\n};\n\nexport default StatusDropdown;\n"],"names":["NeetoUIMenu","Dropdown","Menu","MenuItem","_ref","onItemClick","options","_ref$shouldShowAllOpt","shouldShowAllOptions","_ref$hiddenStatuses","hiddenStatuses","allowedOptions","filter","status","includes","value","_jsx","children","map","option","Button","className","concat","color","hyphenate","onClick","label","memo","ICON_SIZE","Target","dataCy","isClearable","onClear","placeholder","_useTranslation","useTranslation","t","targetClassName","isOptionSelected","isNil","_jsxs","Typography","style","event","stopPropagation","Close","size","Down","StatusDropdown","_ref$disabled","disabled","_ref$isLoading","isLoading","_ref$placeholder","selectedValue","_ref$isClearable","_ref$onClear","noop","_ref$dataCy","selectedOption","_findBy","strategy","customTarget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AAA,CAAAA,aAAA,CAAA,EAAA,EACZJ,cAAc,CAAA,EAAA,EAAA,EAAA;AAAE7B,QAAAA,MAAM,EAANA,MAAM;AAAEC,QAAAA,WAAW,EAAXA,WAAW;AAAEC,QAAAA,OAAO,EAAPA,OAAO;AAAEC,QAAAA,WAAW,EAAXA,WAAAA;AAAW,OAAA,CAAA,CACnE,CAAC,CAAA;KACF;IAAAhB,QAAA,EAEDmC,SAAS,gBACRpC,cAAA,CAAA,KAAA,EAAA;AAAKK,MAAAA,SAAS,EAAC,8CAA8C;AAAAJ,MAAAA,QAAA,eAC3DD,cAAA,CAACgD,OAAO,EAAE,EAAA,CAAA;AAAC,KACR,CAAC,gBAENhD,cAAA,CAACd,MAAI,EAAA;AACGQ,MAAAA,cAAc,EAAdA,cAAc;AAAEL,MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,OAAO,EAAPA,OAAO;AAAEE,MAAAA,oBAAoB,EAApBA,oBAAAA;KAC7C,CAAA;AACF,GACO,CAAC,CAAA;AAEf,EAAC;AAEDwC,cAAc,CAAC9C,IAAI,GAAGA,MAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"StatusDropdown.js","sources":["../../src/components/StatusDropdown/Menu.jsx","../../src/components/StatusDropdown/constants.js","../../src/components/StatusDropdown/Target.jsx","../../src/components/StatusDropdown/index.jsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { hyphenate } from \"neetocist\";\nimport { Dropdown } from \"neetoui\";\n\nconst { Menu: NeetoUIMenu, MenuItem } = Dropdown;\n\nconst Menu = ({\n onItemClick,\n options,\n shouldShowAllOptions = false,\n hiddenStatuses = [],\n}) => {\n const allowedOptions = shouldShowAllOptions\n ? options\n : options.filter(status => !hiddenStatuses.includes(status.value));\n\n return (\n <NeetoUIMenu data-testid=\"status-dropdown-menu\">\n {allowedOptions?.map(option => (\n <MenuItem.Button\n className={`status-dropdown-item--${option.color}`}\n data-cy={`status-dropdown-item-${hyphenate(option.value)}`}\n data-testid={`status-dropdown-item-${option.value}`}\n key={option.value}\n onClick={() => onItemClick(option)}\n >\n {option.label}\n </MenuItem.Button>\n ))}\n </NeetoUIMenu>\n );\n};\n\nexport default memo(Menu);\n","export const ICON_SIZE = 16;\n","import { memo } from \"react\";\n\nimport { Down, Close } from \"neetoicons\";\nimport { Typography } from \"neetoui\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ICON_SIZE } from \"./constants.js\";\n\nconst Target = ({\n color,\n value,\n label,\n dataCy,\n isClearable,\n onClear,\n placeholder,\n}) => {\n const { t } = useTranslation();\n const targetClassName = `neeto-ui-rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--${\n color || \"waiting\"\n }`;\n const isOptionSelected = !isNil(value);\n\n const handleClearClick = event => {\n onClear();\n event.stopPropagation();\n };\n\n const handleClearKeyDown = event => {\n if (!(event.key === \"Enter\" || event.key === \" \")) return;\n event.preventDefault();\n handleClearClick(event);\n };\n\n return (\n <button\n aria-haspopup=\"listbox\"\n className={targetClassName}\n data-cy={dataCy}\n data-testid=\"status-dropdown\"\n type=\"button\"\n aria-label={\n isOptionSelected\n ? `Selected: ${label}`\n : placeholder || t(\"neetoMolecules.statusDropdown.placeholder\")\n }\n >\n {isOptionSelected ? (\n <Typography className=\"inline\" style=\"body2\">\n {label}\n </Typography>\n ) : (\n <Typography className=\"neeto-ui-text-gray-600 inline\" style=\"body2\">\n {placeholder || t(\"neetoMolecules.statusDropdown.placeholder\")}\n </Typography>\n )}\n <span className=\"inline-flex items-center gap-1\">\n {isClearable && isOptionSelected && (\n <span\n aria-label={t(\"neetoMolecules.statusDropdown.clear\")}\n className=\"cursor-pointer\"\n data-cy=\"status-dropdown-clear-button\"\n data-testid=\"status-dropdown-clear-button\"\n role=\"button\"\n tabIndex={0}\n onClick={handleClearClick}\n onKeyDown={handleClearKeyDown}\n >\n <Close size={ICON_SIZE} />\n </span>\n )}\n <Down aria-hidden=\"true\" size={ICON_SIZE} />\n </span>\n </button>\n );\n};\n\nexport default memo(Target);\n","import { _findBy, noop } from \"neetocist\";\nimport { Dropdown, Spinner } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport Menu from \"./Menu\";\nimport \"./status-dropdown.scss\";\nimport Target from \"./Target\";\n\nconst StatusDropdown = ({\n disabled = false,\n hiddenStatuses = [],\n isLoading = false,\n onItemClick,\n options,\n placeholder = null,\n selectedValue,\n shouldShowAllOptions = false,\n isClearable = false,\n onClear = noop,\n dataCy = \"status-dropdown\",\n}) => {\n const selectedOption = _findBy({ value: selectedValue }, options);\n\n return (\n <Dropdown\n {...{ disabled }}\n strategy=\"fixed\"\n customTarget={() => (\n <Target\n label={selectedValue}\n {...{ ...selectedOption, dataCy, isClearable, onClear, placeholder }}\n />\n )}\n >\n {isLoading ? (\n <div className=\"flex w-full items-center justify-center py-8\">\n <Spinner />\n </div>\n ) : (\n <Menu\n {...{ hiddenStatuses, onItemClick, options, shouldShowAllOptions }}\n />\n )}\n </Dropdown>\n );\n};\n\nStatusDropdown.Menu = Menu;\n\nStatusDropdown.propTypes = {\n /**\n * This prop will decide whether the dropdown is disabled or not.\n */\n disabled: PropTypes.bool,\n /**\n * Statuses to be hidden when shouldShowAllOptions is false.\n */\n hiddenStatuses: PropTypes.array,\n /**\n * This prop will decide whether the dropdown is in loading state or not.\n */\n isLoading: PropTypes.bool,\n /**\n * Function to be called when a menu item is clicked.\n */\n onItemClick: PropTypes.func,\n /**\n * The items that should be shown in the dropdown.\n */\n options: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.string,\n color: PropTypes.string,\n })\n ),\n /**\n * Placeholder for the dropdown.\n */\n placeholder: PropTypes.string,\n /**\n * The selected value.\n */\n selectedValue: PropTypes.string,\n /**\n * This prop will decide whether all options should be shown or not. If set to false, the items in hiddenStatuses will not be shown.\n */\n shouldShowAllOptions: PropTypes.bool,\n /**\n * This prop will decide whether the dropdown is clearable or not.\n */\n isClearable: PropTypes.bool,\n /**\n * Function to be called when the clear button is clicked.\n */\n onClear: PropTypes.func,\n};\n\nexport default StatusDropdown;\n"],"names":["NeetoUIMenu","Dropdown","Menu","MenuItem","_ref","onItemClick","options","_ref$shouldShowAllOpt","shouldShowAllOptions","_ref$hiddenStatuses","hiddenStatuses","allowedOptions","filter","status","includes","value","_jsx","children","map","option","Button","className","concat","color","hyphenate","onClick","label","memo","ICON_SIZE","Target","dataCy","isClearable","onClear","placeholder","_useTranslation","useTranslation","t","targetClassName","isOptionSelected","isNil","handleClearClick","event","stopPropagation","handleClearKeyDown","key","preventDefault","_jsxs","type","Typography","style","role","tabIndex","onKeyDown","Close","size","Down","StatusDropdown","_ref$disabled","disabled","_ref$isLoading","isLoading","_ref$placeholder","selectedValue","_ref$isClearable","_ref$onClear","noop","_ref$dataCy","selectedOption","_findBy","strategy","customTarget","_objectSpread","Spinner"],"mappings":";;;;;;;;;;;;;;;AAKA,IAAcA,WAAW,GAAeC,QAAQ,CAAxCC,IAAI;EAAeC,QAAQ,GAAKF,QAAQ,CAArBE,QAAQ,CAAA;AAEnC,IAAMD,IAAI,GAAG,SAAPA,IAAIA,CAAAE,IAAA,EAKJ;AAAA,EAAA,IAJJC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAAC,qBAAA,GAAAH,IAAA,CACPI,oBAAoB;AAApBA,IAAAA,oBAAoB,GAAAD,qBAAA,KAAG,KAAA,CAAA,GAAA,KAAK,GAAAA,qBAAA;IAAAE,mBAAA,GAAAL,IAAA,CAC5BM,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,mBAAA,CAAA;EAEnB,IAAME,cAAc,GAAGH,oBAAoB,GACvCF,OAAO,GACPA,OAAO,CAACM,MAAM,CAAC,UAAAC,MAAM,EAAA;IAAA,OAAI,CAACH,cAAc,CAACI,QAAQ,CAACD,MAAM,CAACE,KAAK,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aAAAA;AAAc,OAAA,EAAAS,aAAA,CAAAA,aAAA,CAAA,EAAA,EACZJ,cAAc,CAAA,EAAA,EAAA,EAAA;AAAErC,QAAAA,MAAM,EAANA,MAAM;AAAEC,QAAAA,WAAW,EAAXA,WAAW;AAAEC,QAAAA,OAAO,EAAPA,OAAO;AAAEC,QAAAA,WAAW,EAAXA,WAAAA;AAAW,OAAA,CAAA,CACnE,CAAC,CAAA;KACF;IAAAhB,QAAA,EAED2C,SAAS,gBACR5C,cAAA,CAAA,KAAA,EAAA;AAAKK,MAAAA,SAAS,EAAC,8CAA8C;AAAAJ,MAAAA,QAAA,eAC3DD,cAAA,CAACwD,OAAO,EAAE,EAAA,CAAA;AAAC,KACR,CAAC,gBAENxD,cAAA,CAACd,MAAI,EAAA;AACGQ,MAAAA,cAAc,EAAdA,cAAc;AAAEL,MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,OAAO,EAAPA,OAAO;AAAEE,MAAAA,oBAAoB,EAApBA,oBAAAA;KAC7C,CAAA;AACF,GACO,CAAC,CAAA;AAEf,EAAC;AAEDgD,cAAc,CAACtD,IAAI,GAAGA,MAAI;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "3.16.
|
|
3
|
+
"version": "3.16.93",
|
|
4
4
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/src/translations/en.json
CHANGED
|
@@ -846,7 +846,8 @@
|
|
|
846
846
|
"refreshRibbon": "New updates are available. Please <button>refresh the page</button> to stay updated."
|
|
847
847
|
},
|
|
848
848
|
"statusDropdown": {
|
|
849
|
-
"placeholder": "Select a status"
|
|
849
|
+
"placeholder": "Select a status",
|
|
850
|
+
"clear": "Clear"
|
|
850
851
|
},
|
|
851
852
|
"versionHistory": {
|
|
852
853
|
"paneTitle": "Version history",
|