@bigbinary/neeto-molecules 5.2.19 → 5.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/v2/DynamicVariables.js +66 -43
- package/dist/cjs/v2/DynamicVariables.js.map +1 -1
- package/dist/cjs/v2/StatusDropdown.js +41 -14
- package/dist/cjs/v2/StatusDropdown.js.map +1 -1
- package/dist/v2/DynamicVariables.js +66 -43
- package/dist/v2/DynamicVariables.js.map +1 -1
- package/dist/v2/StatusDropdown.js +43 -16
- package/dist/v2/StatusDropdown.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
|
-
var React = require('react');
|
|
6
5
|
var neetoAtoms = require('@bigbinary/neeto-atoms');
|
|
7
6
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
8
7
|
var general = require('@bigbinary/neeto-commons-frontend/v2/utils/general');
|
|
9
8
|
var ramda = require('ramda');
|
|
10
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
11
10
|
var createLucideIcon = require('../createLucideIcon-BbuuRL2u.js');
|
|
11
|
+
require('react');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license lucide-react v1.24.0 - ISC
|
|
@@ -84,50 +84,73 @@ var DynamicVariables = function DynamicVariables(_ref) {
|
|
|
84
84
|
dropdownProps = _objectWithoutProperties(_ref, _excluded);
|
|
85
85
|
if (ramda.isEmpty(variables)) return null;
|
|
86
86
|
var parsedVariables = parseVariables(variables);
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
87
|
+
return (
|
|
88
|
+
/*#__PURE__*/
|
|
89
|
+
// End-aligned with collision padding: the trigger usually sits at the
|
|
90
|
+
// content's right edge (e.g. the editor's variables button), so a
|
|
91
|
+
// start-aligned panel would hang past the viewport and get clipped.
|
|
92
|
+
jsxRuntime.jsx(neetoAtoms.DropdownMenu, _objectSpread(_objectSpread({
|
|
93
|
+
position: "bottom-end",
|
|
94
|
+
customTarget:
|
|
95
|
+
/*#__PURE__*/
|
|
96
|
+
// The inline-flex wrapper keeps the popper anchor button-sized;
|
|
97
|
+
// otherwise the trigger element can stretch with its container and
|
|
98
|
+
// end-align the panel far past the visible button.
|
|
99
|
+
jsxRuntime.jsx("div", {
|
|
100
|
+
className: "inline-flex",
|
|
101
|
+
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, _objectSpread({
|
|
102
|
+
"data-testid": "dynamic-variables-button",
|
|
103
|
+
icon: Braces,
|
|
104
|
+
size: "icon",
|
|
105
|
+
variant: "outline"
|
|
106
|
+
}, buttonProps))
|
|
107
|
+
})
|
|
108
|
+
}, dropdownProps), {}, {
|
|
109
|
+
dropdownProps: _objectSpread({
|
|
110
|
+
// w-max frees the popup from the content wrapper's default
|
|
111
|
+
// trigger-width lock (which clips the chip grid via its
|
|
112
|
+
// overflow-x-hidden).
|
|
113
|
+
className: "w-max",
|
|
114
|
+
collisionPadding: 8
|
|
115
|
+
}, dropdownProps === null || dropdownProps === void 0 ? void 0 : dropdownProps.dropdownProps),
|
|
116
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
117
|
+
className: "flex max-w-[22.5rem] min-w-64 flex-col gap-3 p-3",
|
|
118
|
+
"data-testid": "dynamic-variables-list",
|
|
119
|
+
children: parsedVariables.map(function (_ref2) {
|
|
120
|
+
var label = _ref2.label,
|
|
121
|
+
variables = _ref2.variables;
|
|
122
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
123
|
+
className: "flex flex-col gap-1.5",
|
|
124
|
+
children: [label && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
125
|
+
className: "flex flex-row items-center gap-x-2",
|
|
126
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
127
|
+
className: "uppercase",
|
|
128
|
+
color: "muted",
|
|
129
|
+
variant: "caption",
|
|
130
|
+
weight: "medium",
|
|
131
|
+
children: label
|
|
132
|
+
}), /*#__PURE__*/jsxRuntime.jsx("hr", {
|
|
133
|
+
className: "border-border flex flex-grow"
|
|
134
|
+
})]
|
|
135
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
136
|
+
className: "flex flex-wrap items-center gap-2",
|
|
137
|
+
"data-testid": general.joinHyphenCase("dynamic-variables-list", label),
|
|
138
|
+
children: variables.map(function (item) {
|
|
139
|
+
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
140
|
+
className: "border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary cursor-pointer rounded-md border px-1.5 py-1 text-start text-sm leading-tight transition-colors select-none focus:outline-none",
|
|
141
|
+
"data-testid": general.joinHyphenCase("dynamic-variables-list-item", item.label),
|
|
142
|
+
onClick: function onClick() {
|
|
143
|
+
return onVariableClick(item);
|
|
144
|
+
},
|
|
145
|
+
children: item.label
|
|
146
|
+
}, item.label);
|
|
147
|
+
})
|
|
112
148
|
})]
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
"data-testid": general.joinHyphenCase("dynamic-variables-list", label),
|
|
116
|
-
children: variables.map(function (item) {
|
|
117
|
-
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
118
|
-
className: "border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary rounded-md border p-1.5 text-start transition-colors select-none focus:outline-none",
|
|
119
|
-
"data-testid": general.joinHyphenCase("dynamic-variables-list-item", item.label),
|
|
120
|
-
onClick: function onClick() {
|
|
121
|
-
return onVariableClick(item);
|
|
122
|
-
},
|
|
123
|
-
children: item.label
|
|
124
|
-
}, item.label);
|
|
125
|
-
})
|
|
126
|
-
})]
|
|
127
|
-
}, label);
|
|
149
|
+
}, label);
|
|
150
|
+
})
|
|
128
151
|
})
|
|
129
|
-
})
|
|
130
|
-
|
|
152
|
+
}))
|
|
153
|
+
);
|
|
131
154
|
};
|
|
132
155
|
|
|
133
156
|
module.exports = DynamicVariables;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicVariables.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/braces.mjs","../../../src/v2/components/DynamicVariables/utils.js","../../../src/v2/components/DynamicVariables/index.jsx"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n { d: \"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\", key: \"ezmyqa\" }\n ],\n [\n \"path\",\n {\n d: \"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\",\n key: \"e1hn23\"\n }\n ]\n];\nconst Braces = createLucideIcon(\"braces\", __iconNode);\n\nexport { __iconNode, Braces as default };\n//# sourceMappingURL=braces.mjs.map\n","import { findBy } from \"neetocist\";\nimport { prop, isEmpty, uniqBy, mergeLeft } from \"ramda\";\n\nexport const parseVariables = (variableArr = []) => {\n const uncategorized = [];\n const groupedVariables = [];\n const categorySet = new Set();\n\n variableArr.forEach(variable => {\n const { category, label, variables } = variable;\n if (category && variables) {\n const parsedVariables = variables.map(\n mergeLeft({ category, categoryLabel: label })\n );\n\n if (!categorySet.has(category)) {\n categorySet.add(category);\n groupedVariables.push({ label, variables: parsedVariables });\n } else {\n const existingGroup = findBy({ label }, groupedVariables);\n\n existingGroup.variables = uniqBy(\n prop(\"key\"),\n existingGroup.variables.concat(parsedVariables)\n );\n }\n } else {\n uncategorized.push(variable);\n }\n });\n\n if (!isEmpty(uncategorized)) {\n groupedVariables.push({\n label: !isEmpty(groupedVariables) ? \"Others\" : null,\n variables: uncategorized,\n });\n }\n\n return groupedVariables;\n};\n","import { Fragment } from \"react\";\n\nimport { Button, DropdownMenu, Typography } from \"@bigbinary/neeto-atoms\";\nimport { Braces } from \"lucide-react\";\nimport { noop } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/v2/utils/general\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport { parseVariables } from \"./utils\";\n\nconst DynamicVariables = ({\n onVariableClick = noop,\n variables = [],\n buttonProps,\n ...dropdownProps\n}) => {\n if (isEmpty(variables)) return null;\n\n const parsedVariables = parseVariables(variables);\n\n return (\n <DropdownMenu\n customTarget={\n <Button\n data-testid=\"dynamic-variables-button\"\n icon={Braces}\n size=\"icon\"\n variant=\"outline\"\n {...buttonProps}\n />\n }\n {...dropdownProps}\n dropdownProps={{\n className: \"min-w-56\",\n ...dropdownProps?.dropdownProps,\n }}\n >\n <div\n className=\"flex max-w-[22.5rem] min-w-[11.5rem] flex-col gap-1.5 p-2\"\n data-testid=\"dynamic-variables-list\"\n >\n {parsedVariables.map(({ label, variables }) => (\n <Fragment key={label}>\n {label && (\n <div className=\"flex flex-row items-center gap-x-2\">\n <Typography variant=\"h6\">{label}</Typography>\n <hr className=\"border-border flex flex-grow\" />\n </div>\n )}\n <div\n className=\"flex flex-wrap items-center gap-2\"\n data-testid={joinHyphenCase(\"dynamic-variables-list\", label)}\n >\n {variables.map(item => (\n <button\n className=\"border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary rounded-md border p-1.5 text-start transition-colors select-none focus:outline-none\"\n key={item.label}\n data-testid={joinHyphenCase(\n \"dynamic-variables-list-item\",\n item.label\n )}\n onClick={() => onVariableClick(item)}\n >\n {item.label}\n </button>\n ))}\n </div>\n </Fragment>\n ))}\n </div>\n </DropdownMenu>\n );\n};\n\nDynamicVariables.propTypes = {\n onVariableClick: PropTypes.func,\n variables: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, key: PropTypes.string })\n ),\n};\n\nexport default DynamicVariables;\n"],"names":["createLucideIcon","parseVariables","variableArr","arguments","length","undefined","uncategorized","groupedVariables","categorySet","Set","forEach","variable","category","label","variables","parsedVariables","map","mergeLeft","categoryLabel","has","add","push","existingGroup","findBy","uniqBy","prop","concat","isEmpty","DynamicVariables","_ref","_ref$onVariableClick","onVariableClick","noop","_ref$variables","buttonProps","dropdownProps","_objectWithoutProperties","_excluded","_jsx","DropdownMenu","_objectSpread","customTarget","Button","icon","Braces","size","variant","className","children","_ref2","_jsxs","Fragment","Typography","joinHyphenCase","item","onClick"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAM,UAAU,GAAG;AACnB,EAAE;AACF,IAAI,MAAM;AACV,IAAI,EAAE,CAAC,EAAE,sEAAsE,EAAE,GAAG,EAAE,QAAQ;AAC9F,GAAG;AACH,EAAE;AACF,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,CAAC,EAAE,0EAA0E;AACnF,MAAM,GAAG,EAAE;AACX;AACA;AACA,CAAC;AACD,MAAM,MAAM,GAAGA,iCAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC;;ACnB9C,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAAyB;AAAA,EAAA,IAArBC,WAAW,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE;EAC7C,IAAMG,aAAa,GAAG,EAA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reList":[0]}
|
|
1
|
+
{"version":3,"file":"DynamicVariables.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/braces.mjs","../../../src/v2/components/DynamicVariables/utils.js","../../../src/v2/components/DynamicVariables/index.jsx"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n { d: \"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\", key: \"ezmyqa\" }\n ],\n [\n \"path\",\n {\n d: \"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\",\n key: \"e1hn23\"\n }\n ]\n];\nconst Braces = createLucideIcon(\"braces\", __iconNode);\n\nexport { __iconNode, Braces as default };\n//# sourceMappingURL=braces.mjs.map\n","import { findBy } from \"neetocist\";\nimport { prop, isEmpty, uniqBy, mergeLeft } from \"ramda\";\n\nexport const parseVariables = (variableArr = []) => {\n const uncategorized = [];\n const groupedVariables = [];\n const categorySet = new Set();\n\n variableArr.forEach(variable => {\n const { category, label, variables } = variable;\n if (category && variables) {\n const parsedVariables = variables.map(\n mergeLeft({ category, categoryLabel: label })\n );\n\n if (!categorySet.has(category)) {\n categorySet.add(category);\n groupedVariables.push({ label, variables: parsedVariables });\n } else {\n const existingGroup = findBy({ label }, groupedVariables);\n\n existingGroup.variables = uniqBy(\n prop(\"key\"),\n existingGroup.variables.concat(parsedVariables)\n );\n }\n } else {\n uncategorized.push(variable);\n }\n });\n\n if (!isEmpty(uncategorized)) {\n groupedVariables.push({\n label: !isEmpty(groupedVariables) ? \"Others\" : null,\n variables: uncategorized,\n });\n }\n\n return groupedVariables;\n};\n","import { Button, DropdownMenu, Typography } from \"@bigbinary/neeto-atoms\";\nimport { Braces } from \"lucide-react\";\nimport { noop } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/v2/utils/general\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport { parseVariables } from \"./utils\";\n\nconst DynamicVariables = ({\n onVariableClick = noop,\n variables = [],\n buttonProps,\n ...dropdownProps\n}) => {\n if (isEmpty(variables)) return null;\n\n const parsedVariables = parseVariables(variables);\n\n return (\n // End-aligned with collision padding: the trigger usually sits at the\n // content's right edge (e.g. the editor's variables button), so a\n // start-aligned panel would hang past the viewport and get clipped.\n <DropdownMenu\n position=\"bottom-end\"\n customTarget={\n // The inline-flex wrapper keeps the popper anchor button-sized;\n // otherwise the trigger element can stretch with its container and\n // end-align the panel far past the visible button.\n <div className=\"inline-flex\">\n <Button\n data-testid=\"dynamic-variables-button\"\n icon={Braces}\n size=\"icon\"\n variant=\"outline\"\n {...buttonProps}\n />\n </div>\n }\n {...dropdownProps}\n dropdownProps={{\n // w-max frees the popup from the content wrapper's default\n // trigger-width lock (which clips the chip grid via its\n // overflow-x-hidden).\n className: \"w-max\",\n collisionPadding: 8,\n ...dropdownProps?.dropdownProps,\n }}\n >\n {/* Groups own their label-to-chips gap; the outer column spaces the\n groups themselves (the editor's old h6-based margin rule no longer\n matches now that the label is a caption span). */}\n <div\n className=\"flex max-w-[22.5rem] min-w-64 flex-col gap-3 p-3\"\n data-testid=\"dynamic-variables-list\"\n >\n {parsedVariables.map(({ label, variables }) => (\n <div className=\"flex flex-col gap-1.5\" key={label}>\n {label && (\n <div className=\"flex flex-row items-center gap-x-2\">\n {/* Group label, not a heading: caption keeps the v1 12px;\n medium weight so the uppercase run still reads muted. */}\n <Typography\n className=\"uppercase\"\n color=\"muted\"\n variant=\"caption\"\n weight=\"medium\"\n >\n {label}\n </Typography>\n <hr className=\"border-border flex flex-grow\" />\n </div>\n )}\n <div\n className=\"flex flex-wrap items-center gap-2\"\n data-testid={joinHyphenCase(\"dynamic-variables-list\", label)}\n >\n {variables.map(item => (\n <button\n className=\"border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary cursor-pointer rounded-md border px-1.5 py-1 text-start text-sm leading-tight transition-colors select-none focus:outline-none\"\n key={item.label}\n data-testid={joinHyphenCase(\n \"dynamic-variables-list-item\",\n item.label\n )}\n onClick={() => onVariableClick(item)}\n >\n {item.label}\n </button>\n ))}\n </div>\n </div>\n ))}\n </div>\n </DropdownMenu>\n );\n};\n\nDynamicVariables.propTypes = {\n onVariableClick: PropTypes.func,\n variables: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, key: PropTypes.string })\n ),\n};\n\nexport default DynamicVariables;\n"],"names":["createLucideIcon","parseVariables","variableArr","arguments","length","undefined","uncategorized","groupedVariables","categorySet","Set","forEach","variable","category","label","variables","parsedVariables","map","mergeLeft","categoryLabel","has","add","push","existingGroup","findBy","uniqBy","prop","concat","isEmpty","DynamicVariables","_ref","_ref$onVariableClick","onVariableClick","noop","_ref$variables","buttonProps","dropdownProps","_objectWithoutProperties","_excluded","_jsx","DropdownMenu","_objectSpread","position","customTarget","className","children","Button","icon","Braces","size","variant","collisionPadding","_ref2","_jsxs","Typography","color","weight","joinHyphenCase","item","onClick"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAM,UAAU,GAAG;AACnB,EAAE;AACF,IAAI,MAAM;AACV,IAAI,EAAE,CAAC,EAAE,sEAAsE,EAAE,GAAG,EAAE,QAAQ;AAC9F,GAAG;AACH,EAAE;AACF,IAAI,MAAM;AACV,IAAI;AACJ,MAAM,CAAC,EAAE,0EAA0E;AACnF,MAAM,GAAG,EAAE;AACX;AACA;AACA,CAAC;AACD,MAAM,MAAM,GAAGA,iCAAgB,CAAC,QAAQ,EAAE,UAAU,CAAC;;ACnB9C,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAAyB;AAAA,EAAA,IAArBC,WAAW,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,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yC,IAAI,EAAA;AAAA,gBAAA,oBACjBnB,cAAA,CAAA,QAAA,EAAA;AACEK,kBAAAA,SAAS,EAAC,8PAA8P;AAExQ,kBAAA,aAAA,EAAaa,sBAAc,CACzB,6BAA6B,EAC7BC,IAAI,CAAC5C,KACP,CAAE;kBACF6C,OAAO,EAAE,SAATA,OAAOA,GAAA;oBAAA,OAAQ3B,eAAe,CAAC0B,IAAI,CAAC;kBAAA,CAAC;kBAAAb,QAAA,EAEpCa,IAAI,CAAC5C;iBAAK,EAPN4C,IAAI,CAAC5C,KAQJ,CAAC;cAAA,CACV;AAAC,aACC,CAAC;AAAA,WAAA,EAjCoCA,KAkCvC,CAAC;QAAA,CACP;OACE;KAAC,CACM;AAAC;AAEnB;;;;","x_google_ignoreList":[0]}
|
|
@@ -5,6 +5,7 @@ var neetoAtoms = require('@bigbinary/neeto-atoms');
|
|
|
5
5
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var check = require('../check-DRNN0_Gt.js');
|
|
8
9
|
var injectCss = require('../inject-css-B6qYtOJe.js');
|
|
9
10
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
10
11
|
var ramda = require('ramda');
|
|
@@ -13,9 +14,13 @@ var x = require('../x-B2CPkf_D.js');
|
|
|
13
14
|
var chevronDown = require('../chevron-down-DF-0X6bx.js');
|
|
14
15
|
require('../createLucideIcon-BbuuRL2u.js');
|
|
15
16
|
|
|
17
|
+
var ICON_SIZE = 16;
|
|
18
|
+
|
|
16
19
|
var Menu$1 = function Menu(_ref) {
|
|
17
20
|
var onItemClick = _ref.onItemClick,
|
|
18
21
|
options = _ref.options,
|
|
22
|
+
_ref$selectedValue = _ref.selectedValue,
|
|
23
|
+
selectedValue = _ref$selectedValue === void 0 ? null : _ref$selectedValue,
|
|
19
24
|
_ref$shouldShowAllOpt = _ref.shouldShowAllOptions,
|
|
20
25
|
shouldShowAllOptions = _ref$shouldShowAllOpt === void 0 ? false : _ref$shouldShowAllOpt,
|
|
21
26
|
_ref$hiddenStatuses = _ref.hiddenStatuses,
|
|
@@ -23,11 +28,17 @@ var Menu$1 = function Menu(_ref) {
|
|
|
23
28
|
var allowedOptions = shouldShowAllOptions ? options : options.filter(function (status) {
|
|
24
29
|
return !hiddenStatuses.includes(status.value);
|
|
25
30
|
});
|
|
26
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
31
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
32
|
+
className: "flex w-full flex-col gap-y-0.5",
|
|
27
33
|
children: allowedOptions === null || allowedOptions === void 0 ? void 0 : allowedOptions.map(function (option) {
|
|
34
|
+
var isSelected = neetoCist.isPresent(selectedValue) && option.value === selectedValue;
|
|
28
35
|
return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DropdownMenu.MenuItem, {
|
|
29
36
|
className: "status-dropdown-item--".concat(option.color),
|
|
30
37
|
"data-testid": "status-dropdown-item-".concat(neetoCist.hyphenate(option.value)),
|
|
38
|
+
isActive: isSelected,
|
|
39
|
+
suffix: isSelected && /*#__PURE__*/jsxRuntime.jsx(check.Check, {
|
|
40
|
+
size: ICON_SIZE
|
|
41
|
+
}),
|
|
31
42
|
onClick: function onClick() {
|
|
32
43
|
return onItemClick(option);
|
|
33
44
|
},
|
|
@@ -38,11 +49,9 @@ var Menu$1 = function Menu(_ref) {
|
|
|
38
49
|
};
|
|
39
50
|
var Menu = /*#__PURE__*/React.memo(Menu$1);
|
|
40
51
|
|
|
41
|
-
var css = ":root{--neeto-molecules-status-color-open:9,90,186;--neeto-molecules-status-color-done:189,100,13;--neeto-molecules-status-color-waiting:47,57,65;--neeto-molecules-status-color-red:187,18,26;--neeto-molecules-status-color-yellow:255,204,112;--neeto-molecules-status-color-violet:157,98,162;--neeto-molecules-status-color-pink:225,62,230;--neeto-molecules-status-color-teal:38,87,124;--neeto-molecules-status-color-cyan:66,160,157;--neeto-molecules-status-color-green:16,113,84;--neeto-molecules-status-bg-open:226,241,255;--neeto-molecules-status-bg-done:250,241,225;--neeto-molecules-status-bg-waiting:233,235,237;--neeto-molecules-status-bg-red:254,236,240;--neeto-molecules-status-bg-yellow:255,247,233;--neeto-molecules-status-bg-violet:235,222,255;--neeto-molecules-status-bg-pink:254,233,255;--neeto-molecules-status-bg-teal:228,244,255;--neeto-molecules-status-bg-cyan:224,255,254;--neeto-molecules-status-bg-green:224,244,238}.dark{--neeto-molecules-status-color-open:144,194,255;--neeto-molecules-status-bg-open:24,42,66;--neeto-molecules-status-color-done:255,194,121;--neeto-molecules-status-bg-done:54,38,18;--neeto-molecules-status-color-waiting:255,255,255;--neeto-molecules-status-bg-waiting:16,24,40;--neeto-molecules-status-color-red:255,119,130;--neeto-molecules-status-bg-red:60,20,24;--neeto-molecules-status-color-yellow:255,221,138;--neeto-molecules-status-bg-yellow:60,48,20;--neeto-molecules-status-color-violet:218,170,255;--neeto-molecules-status-bg-violet:49,27,63;--neeto-molecules-status-color-pink:255,155,255;--neeto-molecules-status-bg-pink:56,30,60;--neeto-molecules-status-color-teal:139,205,255;--neeto-molecules-status-bg-teal:22,42,55;--neeto-molecules-status-color-cyan:130,255,247;--neeto-molecules-status-bg-cyan:14,49,48;--neeto-molecules-status-color-green:117,255,195;--neeto-molecules-status-bg-green:15,50,36}.status-dropdown-target--cyan,.status-dropdown-target--done,.status-dropdown-target--green,.status-dropdown-target--open,.status-dropdown-target--pink,.status-dropdown-target--red,.status-dropdown-target--teal,.status-dropdown-target--violet,.status-dropdown-target--waiting,.status-dropdown-target--yellow{background-color:rgb(var(--status-target-bg));color:rgb(var(--status-target-color))}.status-dropdown-target--open{--status-target-color:var(--neeto-molecules-status-color-open);--status-target-bg:var(--neeto-molecules-status-bg-open)}.status-dropdown-target--done{--status-target-color:var(--neeto-molecules-status-color-done);--status-target-bg:var(--neeto-molecules-status-bg-done)}.status-dropdown-target--waiting{--status-target-color:var(--neeto-molecules-status-color-waiting);--status-target-bg:var(--neeto-molecules-status-bg-waiting)}.status-dropdown-target--red{--status-target-color:var(--neeto-molecules-status-color-red);--status-target-bg:var(--neeto-molecules-status-bg-red)}.status-dropdown-target--yellow{--status-target-color:var(--neeto-molecules-status-color-yellow);--status-target-bg:var(--neeto-molecules-status-bg-yellow)}.status-dropdown-target--violet{--status-target-color:var(--neeto-molecules-status-color-violet);--status-target-bg:var(--neeto-molecules-status-bg-violet)}.status-dropdown-target--pink{--status-target-color:var(--neeto-molecules-status-color-pink);--status-target-bg:var(--neeto-molecules-status-bg-pink)}.status-dropdown-target--teal{--status-target-color:var(--neeto-molecules-status-color-teal);--status-target-bg:var(--neeto-molecules-status-bg-teal)}.status-dropdown-target--cyan{--status-target-color:var(--neeto-molecules-status-color-cyan);--status-target-bg:var(--neeto-molecules-status-bg-cyan)}.status-dropdown-target--green{--status-target-color:var(--neeto-molecules-status-color-green);--status-target-bg:var(--neeto-molecules-status-bg-green)}.status-dropdown-item--open{color:#095aba!important;color:rgb(var(--neeto-molecules-status-color-open))!important}.status-dropdown-item--done{color:#bd640d!important;color:rgb(var(--neeto-molecules-status-color-done))!important}.status-dropdown-item--waiting{color:#2f3941!important;color:rgb(var(--neeto-molecules-status-color-waiting))!important}.status-dropdown-item--red{color:#bb121a!important;color:rgb(var(--neeto-molecules-status-color-red))!important}.status-dropdown-item--yellow{color:#ffcc70!important;color:rgb(var(--neeto-molecules-status-color-yellow))!important}.status-dropdown-item--violet{color:#9d62a2!important;color:rgb(var(--neeto-molecules-status-color-violet))!important}.status-dropdown-item--pink{color:#e13ee6!important;color:rgb(var(--neeto-molecules-status-color-pink))!important}.status-dropdown-item--teal{color:#26577c!important;color:rgb(var(--neeto-molecules-status-color-teal))!important}.status-dropdown-item--cyan{color:#42a09d!important;color:rgb(var(--neeto-molecules-status-color-cyan))!important}.status-dropdown-item--green{color:#107154!important;color:rgb(var(--neeto-molecules-status-color-green))!important}";
|
|
52
|
+
var css = ":root{--neeto-molecules-status-color-open:9,90,186;--neeto-molecules-status-color-done:189,100,13;--neeto-molecules-status-color-waiting:47,57,65;--neeto-molecules-status-color-red:187,18,26;--neeto-molecules-status-color-yellow:255,204,112;--neeto-molecules-status-color-violet:157,98,162;--neeto-molecules-status-color-pink:225,62,230;--neeto-molecules-status-color-teal:38,87,124;--neeto-molecules-status-color-cyan:66,160,157;--neeto-molecules-status-color-green:16,113,84;--neeto-molecules-status-bg-open:226,241,255;--neeto-molecules-status-bg-done:250,241,225;--neeto-molecules-status-bg-waiting:233,235,237;--neeto-molecules-status-bg-red:254,236,240;--neeto-molecules-status-bg-yellow:255,247,233;--neeto-molecules-status-bg-violet:235,222,255;--neeto-molecules-status-bg-pink:254,233,255;--neeto-molecules-status-bg-teal:228,244,255;--neeto-molecules-status-bg-cyan:224,255,254;--neeto-molecules-status-bg-green:224,244,238}.dark{--neeto-molecules-status-color-open:144,194,255;--neeto-molecules-status-bg-open:24,42,66;--neeto-molecules-status-color-done:255,194,121;--neeto-molecules-status-bg-done:54,38,18;--neeto-molecules-status-color-waiting:255,255,255;--neeto-molecules-status-bg-waiting:16,24,40;--neeto-molecules-status-color-red:255,119,130;--neeto-molecules-status-bg-red:60,20,24;--neeto-molecules-status-color-yellow:255,221,138;--neeto-molecules-status-bg-yellow:60,48,20;--neeto-molecules-status-color-violet:218,170,255;--neeto-molecules-status-bg-violet:49,27,63;--neeto-molecules-status-color-pink:255,155,255;--neeto-molecules-status-bg-pink:56,30,60;--neeto-molecules-status-color-teal:139,205,255;--neeto-molecules-status-bg-teal:22,42,55;--neeto-molecules-status-color-cyan:130,255,247;--neeto-molecules-status-bg-cyan:14,49,48;--neeto-molecules-status-color-green:117,255,195;--neeto-molecules-status-bg-green:15,50,36}.status-dropdown-target--cyan,.status-dropdown-target--done,.status-dropdown-target--green,.status-dropdown-target--open,.status-dropdown-target--pink,.status-dropdown-target--red,.status-dropdown-target--teal,.status-dropdown-target--violet,.status-dropdown-target--waiting,.status-dropdown-target--yellow{background-color:rgb(var(--status-target-bg));color:rgb(var(--status-target-color))}.status-dropdown-target--open{--status-target-color:var(--neeto-molecules-status-color-open);--status-target-bg:var(--neeto-molecules-status-bg-open)}.status-dropdown-target--done{--status-target-color:var(--neeto-molecules-status-color-done);--status-target-bg:var(--neeto-molecules-status-bg-done)}.status-dropdown-target--waiting{--status-target-color:var(--neeto-molecules-status-color-waiting);--status-target-bg:var(--neeto-molecules-status-bg-waiting)}.status-dropdown-target--red{--status-target-color:var(--neeto-molecules-status-color-red);--status-target-bg:var(--neeto-molecules-status-bg-red)}.status-dropdown-target--yellow{--status-target-color:var(--neeto-molecules-status-color-yellow);--status-target-bg:var(--neeto-molecules-status-bg-yellow)}.status-dropdown-target--violet{--status-target-color:var(--neeto-molecules-status-color-violet);--status-target-bg:var(--neeto-molecules-status-bg-violet)}.status-dropdown-target--pink{--status-target-color:var(--neeto-molecules-status-color-pink);--status-target-bg:var(--neeto-molecules-status-bg-pink)}.status-dropdown-target--teal{--status-target-color:var(--neeto-molecules-status-color-teal);--status-target-bg:var(--neeto-molecules-status-bg-teal)}.status-dropdown-target--cyan{--status-target-color:var(--neeto-molecules-status-color-cyan);--status-target-bg:var(--neeto-molecules-status-bg-cyan)}.status-dropdown-target--green{--status-target-color:var(--neeto-molecules-status-color-green);--status-target-bg:var(--neeto-molecules-status-bg-green)}.status-dropdown-item--open,.status-dropdown-item--open *{color:#095aba!important;color:rgb(var(--neeto-molecules-status-color-open))!important}.status-dropdown-item--done,.status-dropdown-item--done *{color:#bd640d!important;color:rgb(var(--neeto-molecules-status-color-done))!important}.status-dropdown-item--waiting,.status-dropdown-item--waiting *{color:#2f3941!important;color:rgb(var(--neeto-molecules-status-color-waiting))!important}.status-dropdown-item--red,.status-dropdown-item--red *{color:#bb121a!important;color:rgb(var(--neeto-molecules-status-color-red))!important}.status-dropdown-item--yellow,.status-dropdown-item--yellow *{color:#ffcc70!important;color:rgb(var(--neeto-molecules-status-color-yellow))!important}.status-dropdown-item--violet,.status-dropdown-item--violet *{color:#9d62a2!important;color:rgb(var(--neeto-molecules-status-color-violet))!important}.status-dropdown-item--pink,.status-dropdown-item--pink *{color:#e13ee6!important;color:rgb(var(--neeto-molecules-status-color-pink))!important}.status-dropdown-item--teal,.status-dropdown-item--teal *{color:#26577c!important;color:rgb(var(--neeto-molecules-status-color-teal))!important}.status-dropdown-item--cyan,.status-dropdown-item--cyan *{color:#42a09d!important;color:rgb(var(--neeto-molecules-status-color-cyan))!important}.status-dropdown-item--green,.status-dropdown-item--green *{color:#107154!important;color:rgb(var(--neeto-molecules-status-color-green))!important}";
|
|
42
53
|
injectCss.n(css,{});
|
|
43
54
|
|
|
44
|
-
var ICON_SIZE = 16;
|
|
45
|
-
|
|
46
55
|
var _excluded = ["color", "value", "label", "dataTestid", "isClearable", "onClear", "placeholder"];
|
|
47
56
|
function ownKeys$1(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; }
|
|
48
57
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -57,7 +66,7 @@ var Target = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
57
66
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
58
67
|
var _useTranslation = reactI18next.useTranslation(),
|
|
59
68
|
t = _useTranslation.t;
|
|
60
|
-
var targetClassName = "rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--".concat(color || "waiting");
|
|
69
|
+
var targetClassName = "pointer-events-auto rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--".concat(color || "waiting");
|
|
61
70
|
var isOptionSelected = !ramda.isNil(value);
|
|
62
71
|
var handleClearClick = function handleClearClick(event) {
|
|
63
72
|
onClear();
|
|
@@ -79,6 +88,7 @@ var Target = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
79
88
|
children: [isOptionSelected ? /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
80
89
|
className: "inline",
|
|
81
90
|
variant: "body2",
|
|
91
|
+
weight: "medium",
|
|
82
92
|
children: label
|
|
83
93
|
}) : /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
|
|
84
94
|
className: "text-muted-foreground inline",
|
|
@@ -109,7 +119,9 @@ Target.displayName = "Target";
|
|
|
109
119
|
function ownKeys(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; }
|
|
110
120
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
111
121
|
var StatusDropdown = function StatusDropdown(_ref) {
|
|
112
|
-
var _ref$
|
|
122
|
+
var _ref$className = _ref.className,
|
|
123
|
+
className = _ref$className === void 0 ? "w-full" : _ref$className,
|
|
124
|
+
_ref$disabled = _ref.disabled,
|
|
113
125
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
114
126
|
_ref$hiddenStatuses = _ref.hiddenStatuses,
|
|
115
127
|
hiddenStatuses = _ref$hiddenStatuses === void 0 ? [] : _ref$hiddenStatuses,
|
|
@@ -133,17 +145,31 @@ var StatusDropdown = function StatusDropdown(_ref) {
|
|
|
133
145
|
}, options);
|
|
134
146
|
return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DropdownMenu, {
|
|
135
147
|
disabled: disabled,
|
|
148
|
+
position: "bottom-end",
|
|
149
|
+
customTarget:
|
|
150
|
+
/*#__PURE__*/
|
|
151
|
+
// The wrapper is the popper anchor: full row width by default so the
|
|
152
|
+
// menu aligns with the row end like the other metadata dropdowns,
|
|
153
|
+
// while the colored chip inside keeps its intrinsic width. The
|
|
154
|
+
// wrapper ignores pointer events so only the chip is clickable —
|
|
155
|
+
// Radix's trigger handlers live on the wrapper and still fire when
|
|
156
|
+
// chip clicks bubble up.
|
|
157
|
+
jsxRuntime.jsx("div", {
|
|
158
|
+
className: "pointer-events-none ".concat(className),
|
|
159
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Target, _objectSpread({
|
|
160
|
+
label: selectedValue
|
|
161
|
+
}, _objectSpread(_objectSpread({}, selectedOption), {}, {
|
|
162
|
+
dataTestid: dataTestid,
|
|
163
|
+
isClearable: isClearable,
|
|
164
|
+
onClear: onClear,
|
|
165
|
+
placeholder: placeholder
|
|
166
|
+
})))
|
|
167
|
+
}),
|
|
136
168
|
dropdownProps: {
|
|
169
|
+
className: "w-64",
|
|
170
|
+
collisionPadding: 8,
|
|
137
171
|
"data-testid": "status-dropdown-menu"
|
|
138
172
|
},
|
|
139
|
-
customTarget: /*#__PURE__*/jsxRuntime.jsx(Target, _objectSpread({
|
|
140
|
-
label: selectedValue
|
|
141
|
-
}, _objectSpread(_objectSpread({}, selectedOption), {}, {
|
|
142
|
-
dataTestid: dataTestid,
|
|
143
|
-
isClearable: isClearable,
|
|
144
|
-
onClear: onClear,
|
|
145
|
-
placeholder: placeholder
|
|
146
|
-
}))),
|
|
147
173
|
children: isLoading ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
148
174
|
className: "flex w-full items-center justify-center py-8",
|
|
149
175
|
children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Spinner, {})
|
|
@@ -151,6 +177,7 @@ var StatusDropdown = function StatusDropdown(_ref) {
|
|
|
151
177
|
hiddenStatuses: hiddenStatuses,
|
|
152
178
|
onItemClick: onItemClick,
|
|
153
179
|
options: options,
|
|
180
|
+
selectedValue: selectedValue,
|
|
154
181
|
shouldShowAllOptions: shouldShowAllOptions
|
|
155
182
|
})
|
|
156
183
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusDropdown.js","sources":["../../../src/v2/components/StatusDropdown/Menu.jsx","../../../src/v2/components/StatusDropdown/constants.js","../../../src/v2/components/StatusDropdown/Target.jsx","../../../src/v2/components/StatusDropdown/index.jsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { DropdownMenu } from \"@bigbinary/neeto-atoms\";\nimport { hyphenate } from \"neetocist\";\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 <>\n {allowedOptions?.map(option => (\n <DropdownMenu.MenuItem\n className={`status-dropdown-item--${option.color}`}\n data-testid={`status-dropdown-item-${hyphenate(option.value)}`}\n key={option.value}\n onClick={() => onItemClick(option)}\n >\n {option.label}\n </DropdownMenu.MenuItem>\n ))}\n </>\n );\n};\n\nexport default memo(Menu);\n","export const ICON_SIZE = 16;\n","import { forwardRef } from \"react\";\n\nimport { Typography } from \"@bigbinary/neeto-atoms\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { isPresent } from \"neetocist\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ICON_SIZE } from \"./constants.js\";\n\nconst Target = forwardRef(\n (\n {\n color,\n value,\n label,\n dataTestid,\n isClearable,\n onClear,\n placeholder,\n ...otherProps\n },\n ref\n ) => {\n const { t } = useTranslation();\n const targetClassName = `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 {...{ ref, ...otherProps }}\n aria-haspopup=\"listbox\"\n className={targetClassName}\n data-testid={isPresent(dataTestid) ? dataTestid : \"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\" variant=\"body2\">\n {label}\n </Typography>\n ) : (\n <Typography className=\"text-muted-foreground inline\" variant=\"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-testid=\"status-dropdown-clear-button\"\n role=\"button\"\n tabIndex={0}\n onClick={handleClearClick}\n onKeyDown={handleClearKeyDown}\n >\n <X size={ICON_SIZE} />\n </span>\n )}\n <ChevronDown aria-hidden=\"true\" size={ICON_SIZE} />\n </span>\n </button>\n );\n }\n);\n\nTarget.displayName = \"Target\";\n\nexport default Target;\n","import { DropdownMenu, Spinner } from \"@bigbinary/neeto-atoms\";\nimport { _findBy, noop } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport Menu from \"./Menu\";\nimport \"./status-dropdown.css\";\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 dataTestid = \"status-dropdown\",\n}) => {\n const selectedOption = _findBy({ value: selectedValue }, options);\n\n return (\n <DropdownMenu\n {...{ disabled }}\n dropdownProps={{ \"data-testid\": \"status-dropdown-menu\" }}\n customTarget={\n <Target\n label={selectedValue}\n {...{\n ...selectedOption,\n dataTestid,\n isClearable,\n onClear,\n placeholder,\n }}\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 </DropdownMenu>\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":["Menu","_ref","onItemClick","options","_ref$shouldShowAllOpt","shouldShowAllOptions","_ref$hiddenStatuses","hiddenStatuses","allowedOptions","filter","status","includes","value","_jsx","_Fragment","children","map","option","DropdownMenu","MenuItem","className","concat","color","hyphenate","onClick","label","memo","ICON_SIZE","Target","forwardRef","ref","dataTestid","isClearable","onClear","placeholder","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","targetClassName","isOptionSelected","isNil","handleClearClick","event","stopPropagation","handleClearKeyDown","key","preventDefault","_jsxs","_objectSpread","isPresent","type","Typography","variant","role","tabIndex","onKeyDown","X","size","ChevronDown","displayName","StatusDropdown","_ref$disabled","disabled","_ref$isLoading","isLoading","_ref$placeholder","selectedValue","_ref$isClearable","_ref$onClear","noop","_ref$dataTestid","selectedOption","_findBy","dropdownProps","customTarget","Spinner"],"mappings":";;;;;;;;;;;;;;;AAKA,IAAMA,MAAI,GAAG,SAAPA,IAAIA,CAAAC,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,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;IAAAE,mBAAA,GAAAL,IAAA,CAC5BM,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,mBAAA;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;EAAA,CAAA,CAAC;EAEpE,oBACEC,cAAA,CAAAC,mBAAA,EAAA;IAAAC,QAAA,EACGP,cAAc,KAAA,IAAA,IAAdA,cAAc,KAAA,MAAA,GAAA,MAAA,GAAdA,cAAc,CAAEQ,GAAG,CAAC,UAAAC,MAAM,EAAA;AAAA,MAAA,oBACzBJ,cAAA,CAACK,uBAAY,CAACC,QAAQ,EAAA;AACpBC,QAAAA,SAAS,2BAAAC,MAAA,CAA2BJ,MAAM,CAACK,KAAK,CAAG;QACnD,aAAA,EAAA,u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MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,OAAO,EAAPA,OAAO;AAAEE,MAAAA,oBAAoB,EAApBA;KAC7C;AACF,GACW,CAAC;AAEnB;AAEA0D,cAAc,CAAC/D,IAAI,GAAGA,IAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"StatusDropdown.js","sources":["../../../src/v2/components/StatusDropdown/constants.js","../../../src/v2/components/StatusDropdown/Menu.jsx","../../../src/v2/components/StatusDropdown/Target.jsx","../../../src/v2/components/StatusDropdown/index.jsx"],"sourcesContent":["export const ICON_SIZE = 16;\n","import { memo } from \"react\";\n\nimport { DropdownMenu } from \"@bigbinary/neeto-atoms\";\nimport { Check } from \"lucide-react\";\nimport { hyphenate, isPresent } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport { ICON_SIZE } from \"./constants.js\";\n\nconst Menu = ({\n onItemClick,\n options,\n selectedValue = null,\n shouldShowAllOptions = false,\n hiddenStatuses = [],\n}) => {\n const allowedOptions = shouldShowAllOptions\n ? options\n : options.filter(status => !hiddenStatuses.includes(status.value));\n\n return (\n <div className=\"flex w-full flex-col gap-y-0.5\">\n {allowedOptions?.map(option => {\n const isSelected =\n isPresent(selectedValue) && option.value === selectedValue;\n\n return (\n <DropdownMenu.MenuItem\n className={`status-dropdown-item--${option.color}`}\n data-testid={`status-dropdown-item-${hyphenate(option.value)}`}\n isActive={isSelected}\n key={option.value}\n suffix={isSelected && <Check size={ICON_SIZE} />}\n onClick={() => onItemClick(option)}\n >\n {option.label}\n </DropdownMenu.MenuItem>\n );\n })}\n </div>\n );\n};\n\nMenu.propTypes = {\n /**\n * Statuses to be hidden when shouldShowAllOptions is false.\n */\n hiddenStatuses: PropTypes.array,\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 * The selected value; the matching option gets the active state and check.\n */\n selectedValue: PropTypes.string,\n /**\n * This prop will decide whether all options should be shown or not.\n */\n shouldShowAllOptions: PropTypes.bool,\n};\n\nexport default memo(Menu);\n","import { forwardRef } from \"react\";\n\nimport { Typography } from \"@bigbinary/neeto-atoms\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { isPresent } from \"neetocist\";\nimport PropTypes from \"prop-types\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ICON_SIZE } from \"./constants.js\";\n\nconst Target = forwardRef(\n (\n {\n color,\n value,\n label,\n dataTestid,\n isClearable,\n onClear,\n placeholder,\n ...otherProps\n },\n ref\n ) => {\n const { t } = useTranslation();\n const targetClassName = `pointer-events-auto 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 {...{ ref, ...otherProps }}\n aria-haspopup=\"listbox\"\n className={targetClassName}\n data-testid={isPresent(dataTestid) ? dataTestid : \"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\" variant=\"body2\" weight=\"medium\">\n {label}\n </Typography>\n ) : (\n <Typography className=\"text-muted-foreground inline\" variant=\"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-testid=\"status-dropdown-clear-button\"\n role=\"button\"\n tabIndex={0}\n onClick={handleClearClick}\n onKeyDown={handleClearKeyDown}\n >\n <X size={ICON_SIZE} />\n </span>\n )}\n <ChevronDown aria-hidden=\"true\" size={ICON_SIZE} />\n </span>\n </button>\n );\n }\n);\n\nTarget.displayName = \"Target\";\n\nTarget.propTypes = {\n /**\n * Color key of the selected option, mapped to the status color classes.\n */\n color: PropTypes.string,\n /**\n * data-testid for the target button.\n */\n dataTestid: PropTypes.string,\n /**\n * This prop will decide whether the clear button is shown.\n */\n isClearable: PropTypes.bool,\n /**\n * Label of the selected option.\n */\n label: PropTypes.string,\n /**\n * Function to be called when the clear button is clicked.\n */\n onClear: PropTypes.func,\n /**\n * Placeholder shown when no option is selected.\n */\n placeholder: PropTypes.string,\n /**\n * Value of the selected option.\n */\n value: PropTypes.string,\n};\n\nexport default Target;\n","import { DropdownMenu, Spinner } from \"@bigbinary/neeto-atoms\";\nimport { _findBy, noop } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport Menu from \"./Menu\";\nimport \"./status-dropdown.css\";\nimport Target from \"./Target\";\n\nconst StatusDropdown = ({\n className = \"w-full\",\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 dataTestid = \"status-dropdown\",\n}) => {\n const selectedOption = _findBy({ value: selectedValue }, options);\n\n return (\n <DropdownMenu\n {...{ disabled }}\n position=\"bottom-end\"\n customTarget={\n // The wrapper is the popper anchor: full row width by default so the\n // menu aligns with the row end like the other metadata dropdowns,\n // while the colored chip inside keeps its intrinsic width. The\n // wrapper ignores pointer events so only the chip is clickable —\n // Radix's trigger handlers live on the wrapper and still fire when\n // chip clicks bubble up.\n <div className={`pointer-events-none ${className}`}>\n <Target\n label={selectedValue}\n {...{\n ...selectedOption,\n dataTestid,\n isClearable,\n onClear,\n placeholder,\n }}\n />\n </div>\n }\n dropdownProps={{\n className: \"w-64\",\n collisionPadding: 8,\n \"data-testid\": \"status-dropdown-menu\",\n }}\n >\n {isLoading ? (\n <div className=\"flex w-full items-center justify-center py-8\">\n <Spinner />\n </div>\n ) : (\n <Menu\n {...{\n hiddenStatuses,\n onItemClick,\n options,\n selectedValue,\n shouldShowAllOptions,\n }}\n />\n )}\n </DropdownMenu>\n );\n};\n\nStatusDropdown.Menu = Menu;\n\nStatusDropdown.propTypes = {\n /**\n * External classNames for the target wrapper, which anchors the menu.\n * Defaults to `w-full` so the menu aligns with the row end like the other\n * metadata-pane dropdowns.\n */\n className: PropTypes.string,\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 * data-testid for the target button.\n */\n dataTestid: PropTypes.string,\n};\n\nexport default StatusDropdown;\n"],"names":["ICON_SIZE","Menu","_ref","onItemClick","options","_ref$selectedValue","selectedValue","_ref$shouldShowAllOpt","shouldShowAllOptions","_ref$hiddenStatuses","hiddenStatuses","allowedOptions","filter","status","includes","value","_jsx","className","children","map","option","isSelected","isPresent","DropdownMenu","MenuItem","concat","color","hyphenate","isActive","suffix","Check","size","onClick","label","memo","Target","forwardRef","ref","dataTestid","isClearable","onClear","placeholder","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","targetClassName","isOptionSelected","isNil","handleClearClick","event","stopPropagation","handleClearKeyDown","key","preventDefault","_jsxs","_objectSpread","type","Typography","variant","weight","role","tabIndex","onKeyDown","X","ChevronDown","displayName","StatusDropdown","_ref$className","_ref$disabled","disabled","_ref$isLoading","isLoading","_ref$placeholder","_ref$isClearable","_ref$onClear","noop","_ref$dataTestid","selectedOption","_findBy","position","customTarget","dropdownProps","collisionPadding","Spinner"],"mappings":";;;;;;;;;;;;;;;;AAAO,IAAMA,SAAS,GAAG,EAAE;;ACS3B,IAAMC,MAAI,GAAG,SAAPA,IAAIA,CAAAC,IAAA,EAMJ;AAAA,EAAA,IALJC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAAC,kBAAA,GAAAH,IAAA,CACPI,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,kBAAA;IAAAE,qBAAA,GAAAL,IAAA,CACpBM,oBAAoB;AAApBA,IAAAA,oBAAoB,GAAAD,qBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;IAAAE,mBAAA,GAAAP,IAAA,CAC5BQ,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,mBAAA;EAEnB,IAAME,cAAc,GAAGH,oBAAoB,GACvCJ,OAAO,GACPA,OAAO,CAACQ,MAAM,CAAC,UAAAC,MAAM,EAAA;IAAA,OAAI,CAACH,cAAc,CAACI,QAAQ,CAACD,MAAM,CAACE,KAAK,CAAC;EAAA,CAAA,CAAC;AAEpE,EAAA,oBACEC,cAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,gCAAgC;IAAAC,QAAA,EAC5CP,cAAc,KAAA,IAAA,IAAdA,cAAc,KAAA,MAAA,GAAA,MAAA,GAAdA,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nE,cAAA,CAAA,KAAA,EAAA;AAAKC,MAAAA,SAAS,EAAA,sBAAA,CAAAQ,MAAA,CAAyBR,SAAS,CAAG;AAAAC,MAAAA,QAAA,eACjDF,cAAA,CAACmB,MAAM,EAAAuB,aAAA,CAAA;AACLzB,QAAAA,KAAK,EAAE3B;AAAc,OAAA,EAAAoD,aAAA,CAAAA,aAAA,CAAA,EAAA,EAEhBsB,cAAc,CAAA,EAAA,EAAA,EAAA;AACjB1C,QAAAA,UAAU,EAAVA,UAAU;AACVC,QAAAA,WAAW,EAAXA,WAAW;AACXC,QAAAA,OAAO,EAAPA,OAAO;AACPC,QAAAA,WAAW,EAAXA;OAAW,CAAA,CAEd;AAAC,KACC,CACN;AACD2C,IAAAA,aAAa,EAAE;AACbnE,MAAAA,SAAS,EAAE,MAAM;AACjBoE,MAAAA,gBAAgB,EAAE,CAAC;AACnB,MAAA,aAAa,EAAE;KACf;IAAAnE,QAAA,EAEDwD,SAAS,gBACR1D,cAAA,CAAA,KAAA,EAAA;AAAKC,MAAAA,SAAS,EAAC,8CAA8C;AAAAC,MAAAA,QAAA,eAC3DF,cAAA,CAACsE,kBAAO,EAAA,EAAE;AAAC,KACR,CAAC,gBAENtE,cAAA,CAACf,IAAI,EAAA;AAEDS,MAAAA,cAAc,EAAdA,cAAc;AACdP,MAAAA,WAAW,EAAXA,WAAW;AACXC,MAAAA,OAAO,EAAPA,OAAO;AACPE,MAAAA,aAAa,EAAbA,aAAa;AACbE,MAAAA,oBAAoB,EAApBA;KAEH;AACF,GACW,CAAC;AAEnB;AAEA6D,cAAc,CAACpE,IAAI,GAAGA,IAAI;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
-
import { Fragment } from 'react';
|
|
4
3
|
import { DropdownMenu, Typography, Button } from '@bigbinary/neeto-atoms';
|
|
5
4
|
import { findBy, noop } from '@bigbinary/neeto-cist';
|
|
6
5
|
import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/v2/utils/general';
|
|
7
6
|
import { mergeLeft, uniqBy, prop, isEmpty } from 'ramda';
|
|
8
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
8
|
import { c as createLucideIcon } from '../createLucideIcon--oLqczpc.js';
|
|
9
|
+
import 'react';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @license lucide-react v1.24.0 - ISC
|
|
@@ -82,50 +82,73 @@ var DynamicVariables = function DynamicVariables(_ref) {
|
|
|
82
82
|
dropdownProps = _objectWithoutProperties(_ref, _excluded);
|
|
83
83
|
if (isEmpty(variables)) return null;
|
|
84
84
|
var parsedVariables = parseVariables(variables);
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
85
|
+
return (
|
|
86
|
+
/*#__PURE__*/
|
|
87
|
+
// End-aligned with collision padding: the trigger usually sits at the
|
|
88
|
+
// content's right edge (e.g. the editor's variables button), so a
|
|
89
|
+
// start-aligned panel would hang past the viewport and get clipped.
|
|
90
|
+
jsx(DropdownMenu, _objectSpread(_objectSpread({
|
|
91
|
+
position: "bottom-end",
|
|
92
|
+
customTarget:
|
|
93
|
+
/*#__PURE__*/
|
|
94
|
+
// The inline-flex wrapper keeps the popper anchor button-sized;
|
|
95
|
+
// otherwise the trigger element can stretch with its container and
|
|
96
|
+
// end-align the panel far past the visible button.
|
|
97
|
+
jsx("div", {
|
|
98
|
+
className: "inline-flex",
|
|
99
|
+
children: /*#__PURE__*/jsx(Button, _objectSpread({
|
|
100
|
+
"data-testid": "dynamic-variables-button",
|
|
101
|
+
icon: Braces,
|
|
102
|
+
size: "icon",
|
|
103
|
+
variant: "outline"
|
|
104
|
+
}, buttonProps))
|
|
105
|
+
})
|
|
106
|
+
}, dropdownProps), {}, {
|
|
107
|
+
dropdownProps: _objectSpread({
|
|
108
|
+
// w-max frees the popup from the content wrapper's default
|
|
109
|
+
// trigger-width lock (which clips the chip grid via its
|
|
110
|
+
// overflow-x-hidden).
|
|
111
|
+
className: "w-max",
|
|
112
|
+
collisionPadding: 8
|
|
113
|
+
}, dropdownProps === null || dropdownProps === void 0 ? void 0 : dropdownProps.dropdownProps),
|
|
114
|
+
children: /*#__PURE__*/jsx("div", {
|
|
115
|
+
className: "flex max-w-[22.5rem] min-w-64 flex-col gap-3 p-3",
|
|
116
|
+
"data-testid": "dynamic-variables-list",
|
|
117
|
+
children: parsedVariables.map(function (_ref2) {
|
|
118
|
+
var label = _ref2.label,
|
|
119
|
+
variables = _ref2.variables;
|
|
120
|
+
return /*#__PURE__*/jsxs("div", {
|
|
121
|
+
className: "flex flex-col gap-1.5",
|
|
122
|
+
children: [label && /*#__PURE__*/jsxs("div", {
|
|
123
|
+
className: "flex flex-row items-center gap-x-2",
|
|
124
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
125
|
+
className: "uppercase",
|
|
126
|
+
color: "muted",
|
|
127
|
+
variant: "caption",
|
|
128
|
+
weight: "medium",
|
|
129
|
+
children: label
|
|
130
|
+
}), /*#__PURE__*/jsx("hr", {
|
|
131
|
+
className: "border-border flex flex-grow"
|
|
132
|
+
})]
|
|
133
|
+
}), /*#__PURE__*/jsx("div", {
|
|
134
|
+
className: "flex flex-wrap items-center gap-2",
|
|
135
|
+
"data-testid": joinHyphenCase("dynamic-variables-list", label),
|
|
136
|
+
children: variables.map(function (item) {
|
|
137
|
+
return /*#__PURE__*/jsx("button", {
|
|
138
|
+
className: "border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary cursor-pointer rounded-md border px-1.5 py-1 text-start text-sm leading-tight transition-colors select-none focus:outline-none",
|
|
139
|
+
"data-testid": joinHyphenCase("dynamic-variables-list-item", item.label),
|
|
140
|
+
onClick: function onClick() {
|
|
141
|
+
return onVariableClick(item);
|
|
142
|
+
},
|
|
143
|
+
children: item.label
|
|
144
|
+
}, item.label);
|
|
145
|
+
})
|
|
110
146
|
})]
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
"data-testid": joinHyphenCase("dynamic-variables-list", label),
|
|
114
|
-
children: variables.map(function (item) {
|
|
115
|
-
return /*#__PURE__*/jsx("button", {
|
|
116
|
-
className: "border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary rounded-md border p-1.5 text-start transition-colors select-none focus:outline-none",
|
|
117
|
-
"data-testid": joinHyphenCase("dynamic-variables-list-item", item.label),
|
|
118
|
-
onClick: function onClick() {
|
|
119
|
-
return onVariableClick(item);
|
|
120
|
-
},
|
|
121
|
-
children: item.label
|
|
122
|
-
}, item.label);
|
|
123
|
-
})
|
|
124
|
-
})]
|
|
125
|
-
}, label);
|
|
147
|
+
}, label);
|
|
148
|
+
})
|
|
126
149
|
})
|
|
127
|
-
})
|
|
128
|
-
|
|
150
|
+
}))
|
|
151
|
+
);
|
|
129
152
|
};
|
|
130
153
|
|
|
131
154
|
export { DynamicVariables as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicVariables.js","sources":["../../node_modules/lucide-react/dist/esm/icons/braces.mjs","../../src/v2/components/DynamicVariables/utils.js","../../src/v2/components/DynamicVariables/index.jsx"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n { d: \"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\", key: \"ezmyqa\" }\n ],\n [\n \"path\",\n {\n d: \"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\",\n key: \"e1hn23\"\n }\n ]\n];\nconst Braces = createLucideIcon(\"braces\", __iconNode);\n\nexport { __iconNode, Braces as default };\n//# sourceMappingURL=braces.mjs.map\n","import { findBy } from \"neetocist\";\nimport { prop, isEmpty, uniqBy, mergeLeft } from \"ramda\";\n\nexport const parseVariables = (variableArr = []) => {\n const uncategorized = [];\n const groupedVariables = [];\n const categorySet = new Set();\n\n variableArr.forEach(variable => {\n const { category, label, variables } = variable;\n if (category && variables) {\n const parsedVariables = variables.map(\n mergeLeft({ category, categoryLabel: label })\n );\n\n if (!categorySet.has(category)) {\n categorySet.add(category);\n groupedVariables.push({ label, variables: parsedVariables });\n } else {\n const existingGroup = findBy({ label }, groupedVariables);\n\n existingGroup.variables = uniqBy(\n prop(\"key\"),\n existingGroup.variables.concat(parsedVariables)\n );\n }\n } else {\n uncategorized.push(variable);\n }\n });\n\n if (!isEmpty(uncategorized)) {\n groupedVariables.push({\n label: !isEmpty(groupedVariables) ? \"Others\" : null,\n variables: uncategorized,\n });\n }\n\n return groupedVariables;\n};\n","import { Fragment } from \"react\";\n\nimport { Button, DropdownMenu, Typography } from \"@bigbinary/neeto-atoms\";\nimport { Braces } from \"lucide-react\";\nimport { noop } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/v2/utils/general\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport { parseVariables } from \"./utils\";\n\nconst DynamicVariables = ({\n onVariableClick = noop,\n variables = [],\n buttonProps,\n ...dropdownProps\n}) => {\n if (isEmpty(variables)) return null;\n\n const parsedVariables = parseVariables(variables);\n\n return (\n <DropdownMenu\n customTarget={\n <Button\n data-testid=\"dynamic-variables-button\"\n icon={Braces}\n size=\"icon\"\n variant=\"outline\"\n {...buttonProps}\n />\n }\n {...dropdownProps}\n dropdownProps={{\n className: \"min-w-56\",\n ...dropdownProps?.dropdownProps,\n }}\n >\n <div\n className=\"flex max-w-[22.5rem] min-w-[11.5rem] flex-col gap-1.5 p-2\"\n data-testid=\"dynamic-variables-list\"\n >\n {parsedVariables.map(({ label, variables }) => (\n <Fragment key={label}>\n {label && (\n <div className=\"flex flex-row items-center gap-x-2\">\n <Typography variant=\"h6\">{label}</Typography>\n <hr className=\"border-border flex flex-grow\" />\n </div>\n )}\n <div\n className=\"flex flex-wrap items-center gap-2\"\n data-testid={joinHyphenCase(\"dynamic-variables-list\", label)}\n >\n {variables.map(item => (\n <button\n className=\"border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary rounded-md border p-1.5 text-start transition-colors select-none focus:outline-none\"\n key={item.label}\n data-testid={joinHyphenCase(\n \"dynamic-variables-list-item\",\n item.label\n )}\n onClick={() => onVariableClick(item)}\n >\n {item.label}\n </button>\n ))}\n </div>\n </Fragment>\n ))}\n </div>\n </DropdownMenu>\n );\n};\n\nDynamicVariables.propTypes = {\n onVariableClick: PropTypes.func,\n variables: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, key: PropTypes.string })\n ),\n};\n\nexport default DynamicVariables;\n"],"names":["parseVariables","variableArr","arguments","length","undefined","uncategorized","groupedVariables","categorySet","Set","forEach","variable","category","label","variables","parsedVariables","map","mergeLeft","categoryLabel","has","add","push","existingGroup","findBy","uniqBy","prop","concat","isEmpty","DynamicVariables","_ref","_ref$onVariableClick","onVariableClick","noop","_ref$variables","buttonProps","dropdownProps","_objectWithoutProperties","_excluded","_jsx","DropdownMenu","_objectSpread","customTarget","Button","icon","Braces","size","variant","className","children","_ref2","_jsxs","Fragment","Typography","joinHyphenCase","item","onClick"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAIA,MAAM,UAAU,GAAG;AACnB,EAAE;AACF,I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CAACE,GAAG,CAAC,UAAAsC,IAAI,EAAA;AAAA,cAAA,oBACjBhB,GAAA,CAAA,QAAA,EAAA;AACES,gBAAAA,SAAS,EAAC,mNAAmN;AAE7N,gBAAA,aAAA,EAAaM,cAAc,CACzB,6BAA6B,EAC7BC,IAAI,CAACzC,KACP,CAAE;gBACF0C,OAAO,EAAE,SAATA,OAAOA,GAAA;kBAAA,OAAQxB,eAAe,CAACuB,IAAI,CAAC;gBAAA,CAAC;gBAAAN,QAAA,EAEpCM,IAAI,CAACzC;eAAK,EAPNyC,IAAI,CAACzC,KAQJ,CAAC;YAAA,CACV;AAAC,WACC,CAAC;AAAA,SAAA,EAxBOA,KAyBL,CAAC;MAAA,CACZ;KACE;AAAC,GAAA,CACM,CAAC;AAEnB;;;;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"DynamicVariables.js","sources":["../../node_modules/lucide-react/dist/esm/icons/braces.mjs","../../src/v2/components/DynamicVariables/utils.js","../../src/v2/components/DynamicVariables/index.jsx"],"sourcesContent":["/**\n * @license lucide-react v1.24.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconNode = [\n [\n \"path\",\n { d: \"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1\", key: \"ezmyqa\" }\n ],\n [\n \"path\",\n {\n d: \"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1\",\n key: \"e1hn23\"\n }\n ]\n];\nconst Braces = createLucideIcon(\"braces\", __iconNode);\n\nexport { __iconNode, Braces as default };\n//# sourceMappingURL=braces.mjs.map\n","import { findBy } from \"neetocist\";\nimport { prop, isEmpty, uniqBy, mergeLeft } from \"ramda\";\n\nexport const parseVariables = (variableArr = []) => {\n const uncategorized = [];\n const groupedVariables = [];\n const categorySet = new Set();\n\n variableArr.forEach(variable => {\n const { category, label, variables } = variable;\n if (category && variables) {\n const parsedVariables = variables.map(\n mergeLeft({ category, categoryLabel: label })\n );\n\n if (!categorySet.has(category)) {\n categorySet.add(category);\n groupedVariables.push({ label, variables: parsedVariables });\n } else {\n const existingGroup = findBy({ label }, groupedVariables);\n\n existingGroup.variables = uniqBy(\n prop(\"key\"),\n existingGroup.variables.concat(parsedVariables)\n );\n }\n } else {\n uncategorized.push(variable);\n }\n });\n\n if (!isEmpty(uncategorized)) {\n groupedVariables.push({\n label: !isEmpty(groupedVariables) ? \"Others\" : null,\n variables: uncategorized,\n });\n }\n\n return groupedVariables;\n};\n","import { Button, DropdownMenu, Typography } from \"@bigbinary/neeto-atoms\";\nimport { Braces } from \"lucide-react\";\nimport { noop } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/v2/utils/general\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport { parseVariables } from \"./utils\";\n\nconst DynamicVariables = ({\n onVariableClick = noop,\n variables = [],\n buttonProps,\n ...dropdownProps\n}) => {\n if (isEmpty(variables)) return null;\n\n const parsedVariables = parseVariables(variables);\n\n return (\n // End-aligned with collision padding: the trigger usually sits at the\n // content's right edge (e.g. the editor's variables button), so a\n // start-aligned panel would hang past the viewport and get clipped.\n <DropdownMenu\n position=\"bottom-end\"\n customTarget={\n // The inline-flex wrapper keeps the popper anchor button-sized;\n // otherwise the trigger element can stretch with its container and\n // end-align the panel far past the visible button.\n <div className=\"inline-flex\">\n <Button\n data-testid=\"dynamic-variables-button\"\n icon={Braces}\n size=\"icon\"\n variant=\"outline\"\n {...buttonProps}\n />\n </div>\n }\n {...dropdownProps}\n dropdownProps={{\n // w-max frees the popup from the content wrapper's default\n // trigger-width lock (which clips the chip grid via its\n // overflow-x-hidden).\n className: \"w-max\",\n collisionPadding: 8,\n ...dropdownProps?.dropdownProps,\n }}\n >\n {/* Groups own their label-to-chips gap; the outer column spaces the\n groups themselves (the editor's old h6-based margin rule no longer\n matches now that the label is a caption span). */}\n <div\n className=\"flex max-w-[22.5rem] min-w-64 flex-col gap-3 p-3\"\n data-testid=\"dynamic-variables-list\"\n >\n {parsedVariables.map(({ label, variables }) => (\n <div className=\"flex flex-col gap-1.5\" key={label}>\n {label && (\n <div className=\"flex flex-row items-center gap-x-2\">\n {/* Group label, not a heading: caption keeps the v1 12px;\n medium weight so the uppercase run still reads muted. */}\n <Typography\n className=\"uppercase\"\n color=\"muted\"\n variant=\"caption\"\n weight=\"medium\"\n >\n {label}\n </Typography>\n <hr className=\"border-border flex flex-grow\" />\n </div>\n )}\n <div\n className=\"flex flex-wrap items-center gap-2\"\n data-testid={joinHyphenCase(\"dynamic-variables-list\", label)}\n >\n {variables.map(item => (\n <button\n className=\"border-border text-foreground hover:border-primary hover:text-primary focus-visible:border-primary focus-visible:text-primary cursor-pointer rounded-md border px-1.5 py-1 text-start text-sm leading-tight transition-colors select-none focus:outline-none\"\n key={item.label}\n data-testid={joinHyphenCase(\n \"dynamic-variables-list-item\",\n item.label\n )}\n onClick={() => onVariableClick(item)}\n >\n {item.label}\n </button>\n ))}\n </div>\n </div>\n ))}\n </div>\n </DropdownMenu>\n );\n};\n\nDynamicVariables.propTypes = {\n onVariableClick: PropTypes.func,\n variables: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, key: PropTypes.string })\n ),\n};\n\nexport default DynamicVariables;\n"],"names":["parseVariables","variableArr","arguments","length","undefined","uncategorized","groupedVariables","categorySet","Set","forEach","variable","category","label","variables","parsedVariables","map","mergeLeft","categoryLabel","has","add","push","existingGroup","findBy","uniqBy","prop","concat","isEmpty","DynamicVariables","_ref","_ref$onVariableClick","onVariableClick","noop","_ref$variables","buttonProps","dropdownProps","_objectWithoutProperties","_excluded","_jsx","DropdownMenu","_objectSpread","position","customTarget","className","children","Button","icon","Braces","size","variant","collisionPadding","_ref2","_jsxs","Typography","color","weight","joinHyphenCase","item","onClick"],"mappings":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UAAU,EAAA;AACTV,gBAAAA,SAAS,EAAC,WAAW;AACrBW,gBAAAA,KAAK,EAAC,OAAO;AACbL,gBAAAA,OAAO,EAAC,SAAS;AACjBM,gBAAAA,MAAM,EAAC,QAAQ;AAAAX,gBAAAA,QAAA,EAEd/B;eACS,CAAC,eACbyB,GAAA,CAAA,IAAA,EAAA;AAAIK,gBAAAA,SAAS,EAAC;AAA8B,eAAE,CAAC;aAC5C,CACN,eACDL,GAAA,CAAA,KAAA,EAAA;AACEK,cAAAA,SAAS,EAAC,mCAAmC;AAC7C,cAAA,aAAA,EAAaa,cAAc,CAAC,wBAAwB,EAAE3C,KAAK,CAAE;AAAA+B,cAAAA,QAAA,EAE5D9B,SAAS,CAACE,GAAG,CAAC,UAAAyC,IAAI,EAAA;AAAA,gBAAA,oBACjBnB,GAAA,CAAA,QAAA,EAAA;AACEK,kBAAAA,SAAS,EAAC,8PAA8P;AAExQ,kBAAA,aAAA,EAAaa,cAAc,CACzB,6BAA6B,EAC7BC,IAAI,CAAC5C,KACP,CAAE;kBACF6C,OAAO,EAAE,SAATA,OAAOA,GAAA;oBAAA,OAAQ3B,eAAe,CAAC0B,IAAI,CAAC;kBAAA,CAAC;kBAAAb,QAAA,EAEpCa,IAAI,CAAC5C;iBAAK,EAPN4C,IAAI,CAAC5C,KAQJ,CAAC;cAAA,CACV;AAAC,aACC,CAAC;AAAA,WAAA,EAjCoCA,KAkCvC,CAAC;QAAA,CACP;OACE;KAAC,CACM;AAAC;AAEnB;;;;","x_google_ignoreList":[0]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import { DropdownMenu, Typography, Spinner } from '@bigbinary/neeto-atoms';
|
|
3
|
-
import {
|
|
3
|
+
import { isPresent, hyphenate, _findBy, noop } from '@bigbinary/neeto-cist';
|
|
4
4
|
import { memo, forwardRef } from 'react';
|
|
5
|
-
import { jsx,
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
import { C as Check } from '../check-BjsXqoAv.js';
|
|
6
7
|
import { n } from '../inject-css-C2dztUxs.js';
|
|
7
8
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
8
9
|
import { isNil } from 'ramda';
|
|
@@ -11,9 +12,13 @@ import { X } from '../x-DcQBAC3X.js';
|
|
|
11
12
|
import { C as ChevronDown } from '../chevron-down-BrliMcYV.js';
|
|
12
13
|
import '../createLucideIcon--oLqczpc.js';
|
|
13
14
|
|
|
15
|
+
var ICON_SIZE = 16;
|
|
16
|
+
|
|
14
17
|
var Menu = function Menu(_ref) {
|
|
15
18
|
var onItemClick = _ref.onItemClick,
|
|
16
19
|
options = _ref.options,
|
|
20
|
+
_ref$selectedValue = _ref.selectedValue,
|
|
21
|
+
selectedValue = _ref$selectedValue === void 0 ? null : _ref$selectedValue,
|
|
17
22
|
_ref$shouldShowAllOpt = _ref.shouldShowAllOptions,
|
|
18
23
|
shouldShowAllOptions = _ref$shouldShowAllOpt === void 0 ? false : _ref$shouldShowAllOpt,
|
|
19
24
|
_ref$hiddenStatuses = _ref.hiddenStatuses,
|
|
@@ -21,11 +26,17 @@ var Menu = function Menu(_ref) {
|
|
|
21
26
|
var allowedOptions = shouldShowAllOptions ? options : options.filter(function (status) {
|
|
22
27
|
return !hiddenStatuses.includes(status.value);
|
|
23
28
|
});
|
|
24
|
-
return /*#__PURE__*/jsx(
|
|
29
|
+
return /*#__PURE__*/jsx("div", {
|
|
30
|
+
className: "flex w-full flex-col gap-y-0.5",
|
|
25
31
|
children: allowedOptions === null || allowedOptions === void 0 ? void 0 : allowedOptions.map(function (option) {
|
|
32
|
+
var isSelected = isPresent(selectedValue) && option.value === selectedValue;
|
|
26
33
|
return /*#__PURE__*/jsx(DropdownMenu.MenuItem, {
|
|
27
34
|
className: "status-dropdown-item--".concat(option.color),
|
|
28
35
|
"data-testid": "status-dropdown-item-".concat(hyphenate(option.value)),
|
|
36
|
+
isActive: isSelected,
|
|
37
|
+
suffix: isSelected && /*#__PURE__*/jsx(Check, {
|
|
38
|
+
size: ICON_SIZE
|
|
39
|
+
}),
|
|
29
40
|
onClick: function onClick() {
|
|
30
41
|
return onItemClick(option);
|
|
31
42
|
},
|
|
@@ -36,11 +47,9 @@ var Menu = function Menu(_ref) {
|
|
|
36
47
|
};
|
|
37
48
|
var Menu$1 = /*#__PURE__*/memo(Menu);
|
|
38
49
|
|
|
39
|
-
var css = ":root{--neeto-molecules-status-color-open:9,90,186;--neeto-molecules-status-color-done:189,100,13;--neeto-molecules-status-color-waiting:47,57,65;--neeto-molecules-status-color-red:187,18,26;--neeto-molecules-status-color-yellow:255,204,112;--neeto-molecules-status-color-violet:157,98,162;--neeto-molecules-status-color-pink:225,62,230;--neeto-molecules-status-color-teal:38,87,124;--neeto-molecules-status-color-cyan:66,160,157;--neeto-molecules-status-color-green:16,113,84;--neeto-molecules-status-bg-open:226,241,255;--neeto-molecules-status-bg-done:250,241,225;--neeto-molecules-status-bg-waiting:233,235,237;--neeto-molecules-status-bg-red:254,236,240;--neeto-molecules-status-bg-yellow:255,247,233;--neeto-molecules-status-bg-violet:235,222,255;--neeto-molecules-status-bg-pink:254,233,255;--neeto-molecules-status-bg-teal:228,244,255;--neeto-molecules-status-bg-cyan:224,255,254;--neeto-molecules-status-bg-green:224,244,238}.dark{--neeto-molecules-status-color-open:144,194,255;--neeto-molecules-status-bg-open:24,42,66;--neeto-molecules-status-color-done:255,194,121;--neeto-molecules-status-bg-done:54,38,18;--neeto-molecules-status-color-waiting:255,255,255;--neeto-molecules-status-bg-waiting:16,24,40;--neeto-molecules-status-color-red:255,119,130;--neeto-molecules-status-bg-red:60,20,24;--neeto-molecules-status-color-yellow:255,221,138;--neeto-molecules-status-bg-yellow:60,48,20;--neeto-molecules-status-color-violet:218,170,255;--neeto-molecules-status-bg-violet:49,27,63;--neeto-molecules-status-color-pink:255,155,255;--neeto-molecules-status-bg-pink:56,30,60;--neeto-molecules-status-color-teal:139,205,255;--neeto-molecules-status-bg-teal:22,42,55;--neeto-molecules-status-color-cyan:130,255,247;--neeto-molecules-status-bg-cyan:14,49,48;--neeto-molecules-status-color-green:117,255,195;--neeto-molecules-status-bg-green:15,50,36}.status-dropdown-target--cyan,.status-dropdown-target--done,.status-dropdown-target--green,.status-dropdown-target--open,.status-dropdown-target--pink,.status-dropdown-target--red,.status-dropdown-target--teal,.status-dropdown-target--violet,.status-dropdown-target--waiting,.status-dropdown-target--yellow{background-color:rgb(var(--status-target-bg));color:rgb(var(--status-target-color))}.status-dropdown-target--open{--status-target-color:var(--neeto-molecules-status-color-open);--status-target-bg:var(--neeto-molecules-status-bg-open)}.status-dropdown-target--done{--status-target-color:var(--neeto-molecules-status-color-done);--status-target-bg:var(--neeto-molecules-status-bg-done)}.status-dropdown-target--waiting{--status-target-color:var(--neeto-molecules-status-color-waiting);--status-target-bg:var(--neeto-molecules-status-bg-waiting)}.status-dropdown-target--red{--status-target-color:var(--neeto-molecules-status-color-red);--status-target-bg:var(--neeto-molecules-status-bg-red)}.status-dropdown-target--yellow{--status-target-color:var(--neeto-molecules-status-color-yellow);--status-target-bg:var(--neeto-molecules-status-bg-yellow)}.status-dropdown-target--violet{--status-target-color:var(--neeto-molecules-status-color-violet);--status-target-bg:var(--neeto-molecules-status-bg-violet)}.status-dropdown-target--pink{--status-target-color:var(--neeto-molecules-status-color-pink);--status-target-bg:var(--neeto-molecules-status-bg-pink)}.status-dropdown-target--teal{--status-target-color:var(--neeto-molecules-status-color-teal);--status-target-bg:var(--neeto-molecules-status-bg-teal)}.status-dropdown-target--cyan{--status-target-color:var(--neeto-molecules-status-color-cyan);--status-target-bg:var(--neeto-molecules-status-bg-cyan)}.status-dropdown-target--green{--status-target-color:var(--neeto-molecules-status-color-green);--status-target-bg:var(--neeto-molecules-status-bg-green)}.status-dropdown-item--open{color:#095aba!important;color:rgb(var(--neeto-molecules-status-color-open))!important}.status-dropdown-item--done{color:#bd640d!important;color:rgb(var(--neeto-molecules-status-color-done))!important}.status-dropdown-item--waiting{color:#2f3941!important;color:rgb(var(--neeto-molecules-status-color-waiting))!important}.status-dropdown-item--red{color:#bb121a!important;color:rgb(var(--neeto-molecules-status-color-red))!important}.status-dropdown-item--yellow{color:#ffcc70!important;color:rgb(var(--neeto-molecules-status-color-yellow))!important}.status-dropdown-item--violet{color:#9d62a2!important;color:rgb(var(--neeto-molecules-status-color-violet))!important}.status-dropdown-item--pink{color:#e13ee6!important;color:rgb(var(--neeto-molecules-status-color-pink))!important}.status-dropdown-item--teal{color:#26577c!important;color:rgb(var(--neeto-molecules-status-color-teal))!important}.status-dropdown-item--cyan{color:#42a09d!important;color:rgb(var(--neeto-molecules-status-color-cyan))!important}.status-dropdown-item--green{color:#107154!important;color:rgb(var(--neeto-molecules-status-color-green))!important}";
|
|
50
|
+
var css = ":root{--neeto-molecules-status-color-open:9,90,186;--neeto-molecules-status-color-done:189,100,13;--neeto-molecules-status-color-waiting:47,57,65;--neeto-molecules-status-color-red:187,18,26;--neeto-molecules-status-color-yellow:255,204,112;--neeto-molecules-status-color-violet:157,98,162;--neeto-molecules-status-color-pink:225,62,230;--neeto-molecules-status-color-teal:38,87,124;--neeto-molecules-status-color-cyan:66,160,157;--neeto-molecules-status-color-green:16,113,84;--neeto-molecules-status-bg-open:226,241,255;--neeto-molecules-status-bg-done:250,241,225;--neeto-molecules-status-bg-waiting:233,235,237;--neeto-molecules-status-bg-red:254,236,240;--neeto-molecules-status-bg-yellow:255,247,233;--neeto-molecules-status-bg-violet:235,222,255;--neeto-molecules-status-bg-pink:254,233,255;--neeto-molecules-status-bg-teal:228,244,255;--neeto-molecules-status-bg-cyan:224,255,254;--neeto-molecules-status-bg-green:224,244,238}.dark{--neeto-molecules-status-color-open:144,194,255;--neeto-molecules-status-bg-open:24,42,66;--neeto-molecules-status-color-done:255,194,121;--neeto-molecules-status-bg-done:54,38,18;--neeto-molecules-status-color-waiting:255,255,255;--neeto-molecules-status-bg-waiting:16,24,40;--neeto-molecules-status-color-red:255,119,130;--neeto-molecules-status-bg-red:60,20,24;--neeto-molecules-status-color-yellow:255,221,138;--neeto-molecules-status-bg-yellow:60,48,20;--neeto-molecules-status-color-violet:218,170,255;--neeto-molecules-status-bg-violet:49,27,63;--neeto-molecules-status-color-pink:255,155,255;--neeto-molecules-status-bg-pink:56,30,60;--neeto-molecules-status-color-teal:139,205,255;--neeto-molecules-status-bg-teal:22,42,55;--neeto-molecules-status-color-cyan:130,255,247;--neeto-molecules-status-bg-cyan:14,49,48;--neeto-molecules-status-color-green:117,255,195;--neeto-molecules-status-bg-green:15,50,36}.status-dropdown-target--cyan,.status-dropdown-target--done,.status-dropdown-target--green,.status-dropdown-target--open,.status-dropdown-target--pink,.status-dropdown-target--red,.status-dropdown-target--teal,.status-dropdown-target--violet,.status-dropdown-target--waiting,.status-dropdown-target--yellow{background-color:rgb(var(--status-target-bg));color:rgb(var(--status-target-color))}.status-dropdown-target--open{--status-target-color:var(--neeto-molecules-status-color-open);--status-target-bg:var(--neeto-molecules-status-bg-open)}.status-dropdown-target--done{--status-target-color:var(--neeto-molecules-status-color-done);--status-target-bg:var(--neeto-molecules-status-bg-done)}.status-dropdown-target--waiting{--status-target-color:var(--neeto-molecules-status-color-waiting);--status-target-bg:var(--neeto-molecules-status-bg-waiting)}.status-dropdown-target--red{--status-target-color:var(--neeto-molecules-status-color-red);--status-target-bg:var(--neeto-molecules-status-bg-red)}.status-dropdown-target--yellow{--status-target-color:var(--neeto-molecules-status-color-yellow);--status-target-bg:var(--neeto-molecules-status-bg-yellow)}.status-dropdown-target--violet{--status-target-color:var(--neeto-molecules-status-color-violet);--status-target-bg:var(--neeto-molecules-status-bg-violet)}.status-dropdown-target--pink{--status-target-color:var(--neeto-molecules-status-color-pink);--status-target-bg:var(--neeto-molecules-status-bg-pink)}.status-dropdown-target--teal{--status-target-color:var(--neeto-molecules-status-color-teal);--status-target-bg:var(--neeto-molecules-status-bg-teal)}.status-dropdown-target--cyan{--status-target-color:var(--neeto-molecules-status-color-cyan);--status-target-bg:var(--neeto-molecules-status-bg-cyan)}.status-dropdown-target--green{--status-target-color:var(--neeto-molecules-status-color-green);--status-target-bg:var(--neeto-molecules-status-bg-green)}.status-dropdown-item--open,.status-dropdown-item--open *{color:#095aba!important;color:rgb(var(--neeto-molecules-status-color-open))!important}.status-dropdown-item--done,.status-dropdown-item--done *{color:#bd640d!important;color:rgb(var(--neeto-molecules-status-color-done))!important}.status-dropdown-item--waiting,.status-dropdown-item--waiting *{color:#2f3941!important;color:rgb(var(--neeto-molecules-status-color-waiting))!important}.status-dropdown-item--red,.status-dropdown-item--red *{color:#bb121a!important;color:rgb(var(--neeto-molecules-status-color-red))!important}.status-dropdown-item--yellow,.status-dropdown-item--yellow *{color:#ffcc70!important;color:rgb(var(--neeto-molecules-status-color-yellow))!important}.status-dropdown-item--violet,.status-dropdown-item--violet *{color:#9d62a2!important;color:rgb(var(--neeto-molecules-status-color-violet))!important}.status-dropdown-item--pink,.status-dropdown-item--pink *{color:#e13ee6!important;color:rgb(var(--neeto-molecules-status-color-pink))!important}.status-dropdown-item--teal,.status-dropdown-item--teal *{color:#26577c!important;color:rgb(var(--neeto-molecules-status-color-teal))!important}.status-dropdown-item--cyan,.status-dropdown-item--cyan *{color:#42a09d!important;color:rgb(var(--neeto-molecules-status-color-cyan))!important}.status-dropdown-item--green,.status-dropdown-item--green *{color:#107154!important;color:rgb(var(--neeto-molecules-status-color-green))!important}";
|
|
40
51
|
n(css,{});
|
|
41
52
|
|
|
42
|
-
var ICON_SIZE = 16;
|
|
43
|
-
|
|
44
53
|
var _excluded = ["color", "value", "label", "dataTestid", "isClearable", "onClear", "placeholder"];
|
|
45
54
|
function ownKeys$1(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; }
|
|
46
55
|
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -55,7 +64,7 @@ var Target = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
55
64
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
56
65
|
var _useTranslation = useTranslation(),
|
|
57
66
|
t = _useTranslation.t;
|
|
58
|
-
var targetClassName = "rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--".concat(color || "waiting");
|
|
67
|
+
var targetClassName = "pointer-events-auto rounded-sm inline-flex items-center gap-2 cursor-pointer py-0.5 px-2 status-dropdown-target--".concat(color || "waiting");
|
|
59
68
|
var isOptionSelected = !isNil(value);
|
|
60
69
|
var handleClearClick = function handleClearClick(event) {
|
|
61
70
|
onClear();
|
|
@@ -77,6 +86,7 @@ var Target = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
77
86
|
children: [isOptionSelected ? /*#__PURE__*/jsx(Typography, {
|
|
78
87
|
className: "inline",
|
|
79
88
|
variant: "body2",
|
|
89
|
+
weight: "medium",
|
|
80
90
|
children: label
|
|
81
91
|
}) : /*#__PURE__*/jsx(Typography, {
|
|
82
92
|
className: "text-muted-foreground inline",
|
|
@@ -107,7 +117,9 @@ Target.displayName = "Target";
|
|
|
107
117
|
function ownKeys(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; }
|
|
108
118
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
109
119
|
var StatusDropdown = function StatusDropdown(_ref) {
|
|
110
|
-
var _ref$
|
|
120
|
+
var _ref$className = _ref.className,
|
|
121
|
+
className = _ref$className === void 0 ? "w-full" : _ref$className,
|
|
122
|
+
_ref$disabled = _ref.disabled,
|
|
111
123
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
112
124
|
_ref$hiddenStatuses = _ref.hiddenStatuses,
|
|
113
125
|
hiddenStatuses = _ref$hiddenStatuses === void 0 ? [] : _ref$hiddenStatuses,
|
|
@@ -131,17 +143,31 @@ var StatusDropdown = function StatusDropdown(_ref) {
|
|
|
131
143
|
}, options);
|
|
132
144
|
return /*#__PURE__*/jsx(DropdownMenu, {
|
|
133
145
|
disabled: disabled,
|
|
146
|
+
position: "bottom-end",
|
|
147
|
+
customTarget:
|
|
148
|
+
/*#__PURE__*/
|
|
149
|
+
// The wrapper is the popper anchor: full row width by default so the
|
|
150
|
+
// menu aligns with the row end like the other metadata dropdowns,
|
|
151
|
+
// while the colored chip inside keeps its intrinsic width. The
|
|
152
|
+
// wrapper ignores pointer events so only the chip is clickable —
|
|
153
|
+
// Radix's trigger handlers live on the wrapper and still fire when
|
|
154
|
+
// chip clicks bubble up.
|
|
155
|
+
jsx("div", {
|
|
156
|
+
className: "pointer-events-none ".concat(className),
|
|
157
|
+
children: /*#__PURE__*/jsx(Target, _objectSpread({
|
|
158
|
+
label: selectedValue
|
|
159
|
+
}, _objectSpread(_objectSpread({}, selectedOption), {}, {
|
|
160
|
+
dataTestid: dataTestid,
|
|
161
|
+
isClearable: isClearable,
|
|
162
|
+
onClear: onClear,
|
|
163
|
+
placeholder: placeholder
|
|
164
|
+
})))
|
|
165
|
+
}),
|
|
134
166
|
dropdownProps: {
|
|
167
|
+
className: "w-64",
|
|
168
|
+
collisionPadding: 8,
|
|
135
169
|
"data-testid": "status-dropdown-menu"
|
|
136
170
|
},
|
|
137
|
-
customTarget: /*#__PURE__*/jsx(Target, _objectSpread({
|
|
138
|
-
label: selectedValue
|
|
139
|
-
}, _objectSpread(_objectSpread({}, selectedOption), {}, {
|
|
140
|
-
dataTestid: dataTestid,
|
|
141
|
-
isClearable: isClearable,
|
|
142
|
-
onClear: onClear,
|
|
143
|
-
placeholder: placeholder
|
|
144
|
-
}))),
|
|
145
171
|
children: isLoading ? /*#__PURE__*/jsx("div", {
|
|
146
172
|
className: "flex w-full items-center justify-center py-8",
|
|
147
173
|
children: /*#__PURE__*/jsx(Spinner, {})
|
|
@@ -149,6 +175,7 @@ var StatusDropdown = function StatusDropdown(_ref) {
|
|
|
149
175
|
hiddenStatuses: hiddenStatuses,
|
|
150
176
|
onItemClick: onItemClick,
|
|
151
177
|
options: options,
|
|
178
|
+
selectedValue: selectedValue,
|
|
152
179
|
shouldShowAllOptions: shouldShowAllOptions
|
|
153
180
|
})
|
|
154
181
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusDropdown.js","sources":["../../src/v2/components/StatusDropdown/Menu.jsx","../../src/v2/components/StatusDropdown/constants.js","../../src/v2/components/StatusDropdown/Target.jsx","../../src/v2/components/StatusDropdown/index.jsx"],"sourcesContent":["import { memo } from \"react\";\n\nimport { DropdownMenu } from \"@bigbinary/neeto-atoms\";\nimport { hyphenate } from \"neetocist\";\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 <>\n {allowedOptions?.map(option => (\n <DropdownMenu.MenuItem\n className={`status-dropdown-item--${option.color}`}\n data-testid={`status-dropdown-item-${hyphenate(option.value)}`}\n key={option.value}\n onClick={() => onItemClick(option)}\n >\n {option.label}\n </DropdownMenu.MenuItem>\n ))}\n </>\n );\n};\n\nexport default memo(Menu);\n","export const ICON_SIZE = 16;\n","import { forwardRef } from \"react\";\n\nimport { Typography } from \"@bigbinary/neeto-atoms\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { isPresent } from \"neetocist\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ICON_SIZE } from \"./constants.js\";\n\nconst Target = forwardRef(\n (\n {\n color,\n value,\n label,\n dataTestid,\n isClearable,\n onClear,\n placeholder,\n ...otherProps\n },\n ref\n ) => {\n const { t } = useTranslation();\n const targetClassName = `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 {...{ ref, ...otherProps }}\n aria-haspopup=\"listbox\"\n className={targetClassName}\n data-testid={isPresent(dataTestid) ? dataTestid : \"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\" variant=\"body2\">\n {label}\n </Typography>\n ) : (\n <Typography className=\"text-muted-foreground inline\" variant=\"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-testid=\"status-dropdown-clear-button\"\n role=\"button\"\n tabIndex={0}\n onClick={handleClearClick}\n onKeyDown={handleClearKeyDown}\n >\n <X size={ICON_SIZE} />\n </span>\n )}\n <ChevronDown aria-hidden=\"true\" size={ICON_SIZE} />\n </span>\n </button>\n );\n }\n);\n\nTarget.displayName = \"Target\";\n\nexport default Target;\n","import { DropdownMenu, Spinner } from \"@bigbinary/neeto-atoms\";\nimport { _findBy, noop } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport Menu from \"./Menu\";\nimport \"./status-dropdown.css\";\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 dataTestid = \"status-dropdown\",\n}) => {\n const selectedOption = _findBy({ value: selectedValue }, options);\n\n return (\n <DropdownMenu\n {...{ disabled }}\n dropdownProps={{ \"data-testid\": \"status-dropdown-menu\" }}\n customTarget={\n <Target\n label={selectedValue}\n {...{\n ...selectedOption,\n dataTestid,\n isClearable,\n onClear,\n placeholder,\n }}\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 </DropdownMenu>\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":["Menu","_ref","onItemClick","options","_ref$shouldShowAllOpt","shouldShowAllOptions","_ref$hiddenStatuses","hiddenStatuses","allowedOptions","filter","status","includes","value","_jsx","_Fragment","children","map","option","DropdownMenu","MenuItem","className","concat","color","hyphenate","onClick","label","memo","ICON_SIZE","Target","forwardRef","ref","dataTestid","isClearable","onClear","placeholder","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","targetClassName","isOptionSelected","isNil","handleClearClick","event","stopPropagation","handleClearKeyDown","key","preventDefault","_jsxs","_objectSpread","isPresent","type","Typography","variant","role","tabIndex","onKeyDown","X","size","ChevronDown","displayName","StatusDropdown","_ref$disabled","disabled","_ref$isLoading","isLoading","_ref$placeholder","selectedValue","_ref$isClearable","_ref$onClear","noop","_ref$dataTestid","selectedOption","_findBy","dropdownProps","customTarget","Spinner"],"mappings":";;;;;;;;;;;;;AAKA,IAAMA,IAAI,GAAG,SAAPA,IAAIA,CAAAC,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,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;IAAAE,mBAAA,GAAAL,IAAA,CAC5BM,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,mBAAA;EAEnB,IAAME,cAAc,GAAGH,oBAAoB,GACvCF,OAAO,GACPA,OAAO,CAACM,MAAM,CAAC,UAAAC,MAAM,EAAA;IAAA,OAAI,CAACH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AAU;AACVC,MAAAA,WAAW,EAAXA,WAAW;AACXC,MAAAA,OAAO,EAAPA,OAAO;AACPC,MAAAA,WAAW,EAAXA;AAAW,KAAA,CAAA,CAEd,CACF;IAAAnB,QAAA,EAEAoD,SAAS,gBACRtD,GAAA,CAAA,KAAA,EAAA;AAAKO,MAAAA,SAAS,EAAC,8CAA8C;AAAAL,MAAAA,QAAA,eAC3DF,GAAA,CAACiE,OAAO,EAAA,EAAE;AAAC,KACR,CAAC,gBAENjE,GAAA,CAACb,MAAI,EAAA;AACGO,MAAAA,cAAc,EAAdA,cAAc;AAAEL,MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,OAAO,EAAPA,OAAO;AAAEE,MAAAA,oBAAoB,EAApBA;KAC7C;AACF,GACW,CAAC;AAEnB;AAEA0D,cAAc,CAAC/D,IAAI,GAAGA,MAAI;;;;"}
|
|
1
|
+
{"version":3,"file":"StatusDropdown.js","sources":["../../src/v2/components/StatusDropdown/constants.js","../../src/v2/components/StatusDropdown/Menu.jsx","../../src/v2/components/StatusDropdown/Target.jsx","../../src/v2/components/StatusDropdown/index.jsx"],"sourcesContent":["export const ICON_SIZE = 16;\n","import { memo } from \"react\";\n\nimport { DropdownMenu } from \"@bigbinary/neeto-atoms\";\nimport { Check } from \"lucide-react\";\nimport { hyphenate, isPresent } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport { ICON_SIZE } from \"./constants.js\";\n\nconst Menu = ({\n onItemClick,\n options,\n selectedValue = null,\n shouldShowAllOptions = false,\n hiddenStatuses = [],\n}) => {\n const allowedOptions = shouldShowAllOptions\n ? options\n : options.filter(status => !hiddenStatuses.includes(status.value));\n\n return (\n <div className=\"flex w-full flex-col gap-y-0.5\">\n {allowedOptions?.map(option => {\n const isSelected =\n isPresent(selectedValue) && option.value === selectedValue;\n\n return (\n <DropdownMenu.MenuItem\n className={`status-dropdown-item--${option.color}`}\n data-testid={`status-dropdown-item-${hyphenate(option.value)}`}\n isActive={isSelected}\n key={option.value}\n suffix={isSelected && <Check size={ICON_SIZE} />}\n onClick={() => onItemClick(option)}\n >\n {option.label}\n </DropdownMenu.MenuItem>\n );\n })}\n </div>\n );\n};\n\nMenu.propTypes = {\n /**\n * Statuses to be hidden when shouldShowAllOptions is false.\n */\n hiddenStatuses: PropTypes.array,\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 * The selected value; the matching option gets the active state and check.\n */\n selectedValue: PropTypes.string,\n /**\n * This prop will decide whether all options should be shown or not.\n */\n shouldShowAllOptions: PropTypes.bool,\n};\n\nexport default memo(Menu);\n","import { forwardRef } from \"react\";\n\nimport { Typography } from \"@bigbinary/neeto-atoms\";\nimport { ChevronDown, X } from \"lucide-react\";\nimport { isPresent } from \"neetocist\";\nimport PropTypes from \"prop-types\";\nimport { isNil } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { ICON_SIZE } from \"./constants.js\";\n\nconst Target = forwardRef(\n (\n {\n color,\n value,\n label,\n dataTestid,\n isClearable,\n onClear,\n placeholder,\n ...otherProps\n },\n ref\n ) => {\n const { t } = useTranslation();\n const targetClassName = `pointer-events-auto 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 {...{ ref, ...otherProps }}\n aria-haspopup=\"listbox\"\n className={targetClassName}\n data-testid={isPresent(dataTestid) ? dataTestid : \"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\" variant=\"body2\" weight=\"medium\">\n {label}\n </Typography>\n ) : (\n <Typography className=\"text-muted-foreground inline\" variant=\"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-testid=\"status-dropdown-clear-button\"\n role=\"button\"\n tabIndex={0}\n onClick={handleClearClick}\n onKeyDown={handleClearKeyDown}\n >\n <X size={ICON_SIZE} />\n </span>\n )}\n <ChevronDown aria-hidden=\"true\" size={ICON_SIZE} />\n </span>\n </button>\n );\n }\n);\n\nTarget.displayName = \"Target\";\n\nTarget.propTypes = {\n /**\n * Color key of the selected option, mapped to the status color classes.\n */\n color: PropTypes.string,\n /**\n * data-testid for the target button.\n */\n dataTestid: PropTypes.string,\n /**\n * This prop will decide whether the clear button is shown.\n */\n isClearable: PropTypes.bool,\n /**\n * Label of the selected option.\n */\n label: PropTypes.string,\n /**\n * Function to be called when the clear button is clicked.\n */\n onClear: PropTypes.func,\n /**\n * Placeholder shown when no option is selected.\n */\n placeholder: PropTypes.string,\n /**\n * Value of the selected option.\n */\n value: PropTypes.string,\n};\n\nexport default Target;\n","import { DropdownMenu, Spinner } from \"@bigbinary/neeto-atoms\";\nimport { _findBy, noop } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport Menu from \"./Menu\";\nimport \"./status-dropdown.css\";\nimport Target from \"./Target\";\n\nconst StatusDropdown = ({\n className = \"w-full\",\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 dataTestid = \"status-dropdown\",\n}) => {\n const selectedOption = _findBy({ value: selectedValue }, options);\n\n return (\n <DropdownMenu\n {...{ disabled }}\n position=\"bottom-end\"\n customTarget={\n // The wrapper is the popper anchor: full row width by default so the\n // menu aligns with the row end like the other metadata dropdowns,\n // while the colored chip inside keeps its intrinsic width. The\n // wrapper ignores pointer events so only the chip is clickable —\n // Radix's trigger handlers live on the wrapper and still fire when\n // chip clicks bubble up.\n <div className={`pointer-events-none ${className}`}>\n <Target\n label={selectedValue}\n {...{\n ...selectedOption,\n dataTestid,\n isClearable,\n onClear,\n placeholder,\n }}\n />\n </div>\n }\n dropdownProps={{\n className: \"w-64\",\n collisionPadding: 8,\n \"data-testid\": \"status-dropdown-menu\",\n }}\n >\n {isLoading ? (\n <div className=\"flex w-full items-center justify-center py-8\">\n <Spinner />\n </div>\n ) : (\n <Menu\n {...{\n hiddenStatuses,\n onItemClick,\n options,\n selectedValue,\n shouldShowAllOptions,\n }}\n />\n )}\n </DropdownMenu>\n );\n};\n\nStatusDropdown.Menu = Menu;\n\nStatusDropdown.propTypes = {\n /**\n * External classNames for the target wrapper, which anchors the menu.\n * Defaults to `w-full` so the menu aligns with the row end like the other\n * metadata-pane dropdowns.\n */\n className: PropTypes.string,\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 * data-testid for the target button.\n */\n dataTestid: PropTypes.string,\n};\n\nexport default StatusDropdown;\n"],"names":["ICON_SIZE","Menu","_ref","onItemClick","options","_ref$selectedValue","selectedValue","_ref$shouldShowAllOpt","shouldShowAllOptions","_ref$hiddenStatuses","hiddenStatuses","allowedOptions","filter","status","includes","value","_jsx","className","children","map","option","isSelected","isPresent","DropdownMenu","MenuItem","concat","color","hyphenate","isActive","suffix","Check","size","onClick","label","memo","Target","forwardRef","ref","dataTestid","isClearable","onClear","placeholder","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","targetClassName","isOptionSelected","isNil","handleClearClick","event","stopPropagation","handleClearKeyDown","key","preventDefault","_jsxs","_objectSpread","type","Typography","variant","weight","role","tabIndex","onKeyDown","X","ChevronDown","displayName","StatusDropdown","_ref$className","_ref$disabled","disabled","_ref$isLoading","isLoading","_ref$placeholder","_ref$isClearable","_ref$onClear","noop","_ref$dataTestid","selectedOption","_findBy","position","customTarget","dropdownProps","collisionPadding","Spinner"],"mappings":";;;;;;;;;;;;;;AAAO,IAAMA,SAAS,GAAG,EAAE;;ACS3B,IAAMC,IAAI,GAAG,SAAPA,IAAIA,CAAAC,IAAA,EAMJ;AAAA,EAAA,IALJC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IAAAC,kBAAA,GAAAH,IAAA,CACPI,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,kBAAA;IAAAE,qBAAA,GAAAL,IAAA,CACpBM,oBAAoB;AAApBA,IAAAA,oBAAoB,GAAAD,qBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,qBAAA;IAAAE,mBAAA,GAAAP,IAAA,CAC5BQ,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAA,MAAA,GAAG,EAAE,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AA,aAAa,EAAbA,aAAa;AACbE,MAAAA,oBAAoB,EAApBA;KAEH;AACF,GACW,CAAC;AAEnB;AAEA6D,cAAc,CAACpE,IAAI,GAAGA,MAAI;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.21",
|
|
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>",
|