tenjin-ui-kit 0.3.66 → 0.3.69
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/.dockerignore +6 -0
- package/.storybook/main.js +16 -0
- package/.storybook/preview.js +11 -0
- package/Dockerfile +17 -0
- package/Jenkinsfile +66 -0
- package/build/asset-manifest.json +16 -0
- package/build/favicon.ico +0 -0
- package/build/index.html +1 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/build/static/css/main.e7366529.css +2 -0
- package/build/static/css/main.e7366529.css.map +1 -0
- package/build/static/js/453.900c81c3.chunk.js +2 -0
- package/build/static/js/453.900c81c3.chunk.js.map +1 -0
- package/build/static/js/main.8abb72fa.js +3 -0
- package/build/static/js/main.8abb72fa.js.LICENSE.txt +61 -0
- package/build/static/js/main.8abb72fa.js.map +1 -0
- package/build/static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg +1 -0
- package/build/tenjinLogo.png +0 -0
- package/dist/README.md +13 -0
- package/dist/common/hooks/apiHooks.js +155 -0
- package/dist/common/hooks/newApiHook.js +188 -0
- package/{common → dist/common}/utils/security/index.js +2 -2
- package/{common → dist/common}/utils/security/securityConfig.js +1 -2
- package/dist/components/Canvas.js +330 -0
- package/dist/components/DragBox/index.js +40 -0
- package/dist/components/InputWithChip/index.js +294 -0
- package/{components → dist/components}/RightContext/index.js +19 -28
- package/dist/components/WorkFlow.js +42 -0
- package/dist/components/WorkFlowBuilder.js +115 -0
- package/dist/components/alert/Style.js +20 -0
- package/dist/components/alert/index.js +67 -0
- package/{components → dist/components}/attachment/index.js +21 -28
- package/{components → dist/components}/authenticationProvider/AuthError.js +3 -4
- package/{components → dist/components}/authenticationProvider/AuthLoader.js +3 -4
- package/dist/components/authenticationProvider/index.js +110 -0
- package/{components → dist/components}/avatar/index.js +13 -14
- package/dist/components/avatar/styles.js +91 -0
- package/dist/components/breadCrumbs/index.js +169 -0
- package/{components → dist/components}/breadCrumbs/style.js +1 -4
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +5 -6
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +4 -5
- package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +4 -5
- package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +5 -6
- package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +23 -0
- package/{components → dist/components}/browsingTestCaseLayout/index.js +25 -30
- package/dist/components/button/index.js +133 -0
- package/{components → dist/components}/chatBotModal/index.js +36 -45
- package/dist/components/checkBox/index.js +29 -0
- package/{components → dist/components}/combobox/index.js +51 -72
- package/dist/components/divider/index.js +37 -0
- package/{components → dist/components}/editableField/index.js +19 -28
- package/{components → dist/components}/error/index.js +6 -12
- package/dist/components/errorBoundary/index.js +140 -0
- package/dist/components/fileUploader/index.js +151 -0
- package/dist/components/fileUploader/style.js +57 -0
- package/dist/components/filter/ValueSelector.js +333 -0
- package/{components → dist/components}/filter/index.js +51 -53
- package/{components → dist/components}/iconButton/index.js +3 -4
- package/dist/components/input/index.js +167 -0
- package/dist/components/layout/index.js +94 -0
- package/dist/components/layout/main/index.js +24 -0
- package/dist/components/layout/main/style.js +19 -0
- package/{components → dist/components}/layout/pageContent/index.js +6 -7
- package/dist/components/layout/sidebar/FlatMenu.js +64 -0
- package/dist/components/layout/sidebar/GroupedIconMenu.js +233 -0
- package/dist/components/layout/sidebar/GroupedMenu.js +57 -0
- package/dist/components/layout/sidebar/ProjectMenu.js +223 -0
- package/dist/components/layout/sidebar/index.js +88 -0
- package/dist/components/layout/sidebar/style.js +149 -0
- package/{components → dist/components}/layout/topBar/ProjectTopbar.js +81 -98
- package/dist/components/layout/topBar/UserAvatar.js +138 -0
- package/dist/components/layout/topBar/index.js +121 -0
- package/{components → dist/components}/loader/index.js +9 -12
- package/dist/components/menu/index.js +71 -0
- package/{components → dist/components}/modal/Modal.js +5 -6
- package/dist/components/modal/index.js +88 -0
- package/dist/components/modal/style.js +65 -0
- package/dist/components/optionMenu/index.js +105 -0
- package/dist/components/pagination/index.js +114 -0
- package/dist/components/pagination/style.js +33 -0
- package/dist/components/paginationUpdated/index.js +73 -0
- package/dist/components/paper/index.js +43 -0
- package/dist/components/paper/style.js +31 -0
- package/dist/components/reactSelect/index.js +195 -0
- package/dist/components/reactSelect/style.js +130 -0
- package/dist/components/richTextEditor/index.js +64 -0
- package/dist/components/select/GroupedSelect.js +167 -0
- package/dist/components/select/SimpleSelect.js +184 -0
- package/{components → dist/components}/select/index.js +38 -54
- package/dist/components/simpleSelect/index.js +53 -0
- package/{components → dist/components}/sort/index.js +19 -22
- package/{components → dist/components}/switch/index.js +10 -11
- package/dist/components/switch/style.js +39 -0
- package/{components → dist/components}/switch/switch.js +17 -23
- package/dist/components/table/ReactTable.js +101 -0
- package/dist/components/table/SimpleTable.js +117 -0
- package/dist/components/table/index.js +381 -0
- package/dist/components/text/index.js +65 -0
- package/{components → dist/components}/timeStamp/index.js +4 -6
- package/dist/components/timeStamp/style.js +20 -0
- package/dist/components/topBar/index.js +169 -0
- package/{components → dist/components}/tree/index.js +29 -47
- package/dist/components/tree/style.js +29 -0
- package/dist/components/valuePicker/ValueSelector.js +205 -0
- package/{components → dist/components}/valuePicker/index.js +19 -26
- package/{components → dist/components}/wrapperLayout/layout/index.js +4 -5
- package/{components → dist/components}/wrapperLayout/main/index.js +4 -5
- package/{components → dist/components}/wrapperLayout/main/pageContainer/index.js +4 -5
- package/dist/components/wrapperLayout/main/sideBar/index.js +272 -0
- package/dist/components/wrapperLayout/main/sideBar/style.js +190 -0
- package/{components → dist/components}/wrapperLayout/topBar/UserAvatar.js +4 -5
- package/dist/components/wrapperLayout/topBar/avatar.js +55 -0
- package/dist/components/wrapperLayout/topBar/index.js +196 -0
- package/{components → dist/components}/wrapperLayout/topBar/menuIcon.js +4 -5
- package/dist/components/wrapperLayout/topBar/style.js +74 -0
- package/dist/http/index.js +133 -0
- package/{index.js → dist/index.js} +53 -55
- package/dist/package.json +127 -0
- package/{templates → dist/templates}/listPage/index.js +36 -57
- package/{themes → dist/themes}/default.js +5 -7
- package/{themes → dist/themes}/defaultSmall.js +2 -3
- package/{themes → dist/themes}/responsiveTheme.js +6 -8
- package/package.json +6 -3
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/public/tenjinLogo.png +0 -0
- package/common/hooks/apiHooks.js +0 -223
- package/common/hooks/newApiHook.js +0 -270
- package/components/Canvas.js +0 -254
- package/components/DragBox/index.js +0 -45
- package/components/InputWithChip/index.js +0 -187
- package/components/WorkFlow.js +0 -47
- package/components/WorkFlowBuilder.js +0 -130
- package/components/alert/Style.js +0 -23
- package/components/alert/index.js +0 -69
- package/components/authenticationProvider/index.js +0 -166
- package/components/avatar/styles.js +0 -94
- package/components/breadCrumbs/index.js +0 -180
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +0 -26
- package/components/button/index.js +0 -135
- package/components/checkBox/index.js +0 -30
- package/components/divider/index.js +0 -41
- package/components/errorBoundary/index.js +0 -160
- package/components/fileUploader/index.js +0 -156
- package/components/fileUploader/style.js +0 -60
- package/components/filter/ValueSelector.js +0 -350
- package/components/input/index.js +0 -174
- package/components/layout/index.js +0 -98
- package/components/layout/main/index.js +0 -27
- package/components/layout/main/style.js +0 -22
- package/components/layout/sidebar/FlatMenu.js +0 -64
- package/components/layout/sidebar/GroupedIconMenu.js +0 -246
- package/components/layout/sidebar/GroupedMenu.js +0 -67
- package/components/layout/sidebar/ProjectMenu.js +0 -230
- package/components/layout/sidebar/index.js +0 -91
- package/components/layout/sidebar/style.js +0 -154
- package/components/layout/topBar/UserAvatar.js +0 -145
- package/components/layout/topBar/index.js +0 -132
- package/components/menu/index.js +0 -80
- package/components/modal/index.js +0 -91
- package/components/modal/style.js +0 -68
- package/components/optionMenu/index.js +0 -112
- package/components/pagination/index.js +0 -129
- package/components/pagination/style.js +0 -36
- package/components/paginationUpdated/index.js +0 -75
- package/components/paper/index.js +0 -44
- package/components/paper/style.js +0 -34
- package/components/reactSelect/index.js +0 -212
- package/components/reactSelect/style.js +0 -163
- package/components/richTextEditor/index.js +0 -83
- package/components/select/GroupedSelect.js +0 -183
- package/components/select/SimpleSelect.js +0 -212
- package/components/simpleSelect/index.js +0 -56
- package/components/switch/style.js +0 -42
- package/components/table/ReactTable.js +0 -118
- package/components/table/SimpleTable.js +0 -136
- package/components/table/index.js +0 -256
- package/components/text/index.js +0 -67
- package/components/timeStamp/style.js +0 -23
- package/components/topBar/index.js +0 -176
- package/components/tree/style.js +0 -32
- package/components/valuePicker/ValueSelector.js +0 -273
- package/components/wrapperLayout/main/sideBar/index.js +0 -262
- package/components/wrapperLayout/main/sideBar/style.js +0 -196
- package/components/wrapperLayout/topBar/avatar.js +0 -57
- package/components/wrapperLayout/topBar/index.js +0 -182
- package/components/wrapperLayout/topBar/style.js +0 -77
- package/http/index.js +0 -226
- /package/{assets → dist/assets}/images/MicrosoftTeams-image (1).png +0 -0
- /package/{assets → dist/assets}/images/tenjin-4.0-logo.png +0 -0
- /package/{components → dist/components}/RightContext/index.css +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/style.css +0 -0
- /package/{components → dist/components}/errorBoundary/Error.jpg +0 -0
- /package/{components → dist/components}/iconButton/style.js +0 -0
- /package/{components → dist/components}/richTextEditor/style.js +0 -0
- /package/{components → dist/components}/wrapperLayout/layout/style.js +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _reactSelect = _interopRequireWildcard(require("react-select"));
|
|
10
|
+
var _material = require("@mui/material");
|
|
11
|
+
var _KeyboardArrowDown = _interopRequireDefault(require("@mui/icons-material/KeyboardArrowDown"));
|
|
12
|
+
var _style = require("./style");
|
|
13
|
+
const _excluded = ["getStyles", "Icon", "isDisabled", "isFocused", "isSelected", "children", "innerProps", "isCheckBox"],
|
|
14
|
+
_excluded2 = ["options", "value", "label", "defaultValue", "isMulti", "isDisabled", "placeholder", "className", "isRequired", "simulateNativeSelect", "onChange", "theme", "error", "helperText", "isBlueTheme", "isLoading", "isCheckBox"];
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
18
|
+
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; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
24
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
26
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
27
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
28
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
29
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
30
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
31
|
+
const DropdownIndicator = props => {
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.DropdownIndicator, props, /*#__PURE__*/_react.default.createElement(_KeyboardArrowDown.default, null));
|
|
33
|
+
};
|
|
34
|
+
const InputOption = _ref => {
|
|
35
|
+
let getStyles = _ref.getStyles,
|
|
36
|
+
Icon = _ref.Icon,
|
|
37
|
+
isDisabled = _ref.isDisabled,
|
|
38
|
+
isFocused = _ref.isFocused,
|
|
39
|
+
isSelected = _ref.isSelected,
|
|
40
|
+
children = _ref.children,
|
|
41
|
+
innerProps = _ref.innerProps,
|
|
42
|
+
isCheckBox = _ref.isCheckBox,
|
|
43
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
44
|
+
const _React$useState = _react.default.useState(false),
|
|
45
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
46
|
+
isActive = _React$useState2[0],
|
|
47
|
+
setIsActive = _React$useState2[1];
|
|
48
|
+
const onMouseDown = () => setIsActive(true);
|
|
49
|
+
const onMouseUp = () => setIsActive(false);
|
|
50
|
+
const onMouseLeave = () => setIsActive(false);
|
|
51
|
+
|
|
52
|
+
// styles
|
|
53
|
+
let bg = "transparent";
|
|
54
|
+
if (isFocused) bg = "#eee";
|
|
55
|
+
if (isActive) bg = "#B2D4FF";
|
|
56
|
+
const style = {
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
backgroundColor: bg,
|
|
59
|
+
color: "inherit",
|
|
60
|
+
display: "flex "
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// prop assignment
|
|
64
|
+
const props = _objectSpread(_objectSpread({}, innerProps), {}, {
|
|
65
|
+
onMouseDown,
|
|
66
|
+
onMouseUp,
|
|
67
|
+
onMouseLeave,
|
|
68
|
+
style
|
|
69
|
+
});
|
|
70
|
+
return /*#__PURE__*/_react.default.createElement(_reactSelect.components.Option, _extends({}, rest, {
|
|
71
|
+
isDisabled: isDisabled,
|
|
72
|
+
isFocused: isFocused,
|
|
73
|
+
isSelected: isSelected,
|
|
74
|
+
getStyles: getStyles,
|
|
75
|
+
innerProps: props
|
|
76
|
+
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
77
|
+
type: "checkbox",
|
|
78
|
+
checked: isSelected
|
|
79
|
+
}), children);
|
|
80
|
+
};
|
|
81
|
+
const ReactSelect = _ref2 => {
|
|
82
|
+
let options = _ref2.options,
|
|
83
|
+
value = _ref2.value,
|
|
84
|
+
label = _ref2.label,
|
|
85
|
+
defaultValue = _ref2.defaultValue,
|
|
86
|
+
isMulti = _ref2.isMulti,
|
|
87
|
+
isDisabled = _ref2.isDisabled,
|
|
88
|
+
placeholder = _ref2.placeholder,
|
|
89
|
+
className = _ref2.className,
|
|
90
|
+
isRequired = _ref2.isRequired,
|
|
91
|
+
simulateNativeSelect = _ref2.simulateNativeSelect,
|
|
92
|
+
onChange = _ref2.onChange,
|
|
93
|
+
theme = _ref2.theme,
|
|
94
|
+
error = _ref2.error,
|
|
95
|
+
helperText = _ref2.helperText,
|
|
96
|
+
isBlueTheme = _ref2.isBlueTheme,
|
|
97
|
+
isLoading = _ref2.isLoading,
|
|
98
|
+
isCheckBox = _ref2.isCheckBox,
|
|
99
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
100
|
+
const classes = (0, _style.useStyles)({
|
|
101
|
+
colorTheme: isBlueTheme
|
|
102
|
+
});
|
|
103
|
+
const handleSelectChange = value => {
|
|
104
|
+
if (simulateNativeSelect) {
|
|
105
|
+
onChange(value.value);
|
|
106
|
+
} else {
|
|
107
|
+
onChange(value);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
const handleChange = options => {
|
|
111
|
+
if (Array.isArray(options)) {
|
|
112
|
+
setSelectedOptions(options.map(opt => opt.value));
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const _React$useState3 = _react.default.useState([]),
|
|
116
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
117
|
+
selectedOptions = _React$useState4[0],
|
|
118
|
+
setSelectedOptions = _React$useState4[1];
|
|
119
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
+
style: {
|
|
121
|
+
width: "100%"
|
|
122
|
+
}
|
|
123
|
+
}, label && /*#__PURE__*/_react.default.createElement("div", null, label, isRequired && /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
124
|
+
component: "span",
|
|
125
|
+
color: "error"
|
|
126
|
+
}, "*")), isMulti ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({
|
|
127
|
+
isMulti: true,
|
|
128
|
+
options: options,
|
|
129
|
+
defaultValue: defaultValue && defaultValue.length > 0 ? defaultValue : "",
|
|
130
|
+
styles: (0, _style.getCustomStyles)({
|
|
131
|
+
colorTheme: isBlueTheme,
|
|
132
|
+
error
|
|
133
|
+
}),
|
|
134
|
+
isDisabled: isDisabled,
|
|
135
|
+
placeholder: placeholder,
|
|
136
|
+
components: isCheckBox ? {
|
|
137
|
+
DropdownIndicator,
|
|
138
|
+
Option: InputOption
|
|
139
|
+
} : {
|
|
140
|
+
DropdownIndicator
|
|
141
|
+
},
|
|
142
|
+
isLoading: isLoading
|
|
143
|
+
/////isCheckBox
|
|
144
|
+
,
|
|
145
|
+
closeMenuOnSelect: !isCheckBox ? true : false,
|
|
146
|
+
hideSelectedOptions: !isCheckBox ? true : false,
|
|
147
|
+
onChange: options => isCheckBox && handleChange(options)
|
|
148
|
+
}, rest))) : /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_reactSelect.default, _extends({
|
|
149
|
+
options: options,
|
|
150
|
+
styles: (0, _style.getCustomStyles)({
|
|
151
|
+
colorTheme: isBlueTheme,
|
|
152
|
+
error
|
|
153
|
+
}),
|
|
154
|
+
onChange: handleSelectChange,
|
|
155
|
+
defaultValue: options.filter(option => option.value === defaultValue),
|
|
156
|
+
value: options.filter(option => option.value === value),
|
|
157
|
+
isMulti: isMulti,
|
|
158
|
+
isDisabled: isDisabled,
|
|
159
|
+
placeholder: placeholder,
|
|
160
|
+
components: {
|
|
161
|
+
DropdownIndicator
|
|
162
|
+
},
|
|
163
|
+
isLoading: isLoading
|
|
164
|
+
}, rest))), helperText && /*#__PURE__*/_react.default.createElement(_material.Typography, {
|
|
165
|
+
style: {
|
|
166
|
+
color: "#be1515"
|
|
167
|
+
}
|
|
168
|
+
}, helperText)));
|
|
169
|
+
};
|
|
170
|
+
ReactSelect.propTypes = {
|
|
171
|
+
value: _propTypes.default.string,
|
|
172
|
+
className: _propTypes.default.string,
|
|
173
|
+
label: _propTypes.default.string,
|
|
174
|
+
defaultValue: _propTypes.default.instanceOf(Object),
|
|
175
|
+
isMulti: _propTypes.default.bool,
|
|
176
|
+
isDisabled: _propTypes.default.bool,
|
|
177
|
+
options: _propTypes.default.instanceOf(Array),
|
|
178
|
+
placeholder: _propTypes.default.string,
|
|
179
|
+
isRequired: _propTypes.default.bool,
|
|
180
|
+
simulateNativeSelect: _propTypes.default.bool,
|
|
181
|
+
onChange: _propTypes.default.func
|
|
182
|
+
};
|
|
183
|
+
ReactSelect.defaultProps = {
|
|
184
|
+
value: {},
|
|
185
|
+
label: "",
|
|
186
|
+
className: "",
|
|
187
|
+
defaultValue: {},
|
|
188
|
+
isMulti: false,
|
|
189
|
+
isDisabled: false,
|
|
190
|
+
options: [],
|
|
191
|
+
placeholder: "",
|
|
192
|
+
isRequired: false,
|
|
193
|
+
simulateNativeSelect: true
|
|
194
|
+
};
|
|
195
|
+
var _default = exports.default = ReactSelect;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStyles = exports.getCustomStyles = void 0;
|
|
7
|
+
var _styles = require("@mui/styles");
|
|
8
|
+
var _responsiveTheme = _interopRequireDefault(require("../../themes/responsiveTheme"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
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; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
const useStyles = exports.useStyles = (0, _styles.makeStyles)(() => ({
|
|
16
|
+
inputLabel: _ref => {
|
|
17
|
+
let colorTheme = _ref.colorTheme;
|
|
18
|
+
return {
|
|
19
|
+
color: colorTheme ? _responsiveTheme.default.palette.text.main : _responsiveTheme.default.palette.text.main,
|
|
20
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
21
|
+
fontWeight: 500,
|
|
22
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
23
|
+
display: "flex",
|
|
24
|
+
marginBottom: "12px"
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
star: {
|
|
28
|
+
lineHeight: "unset",
|
|
29
|
+
marginLeft: "4px"
|
|
30
|
+
},
|
|
31
|
+
helperText: {
|
|
32
|
+
color: "#f44336",
|
|
33
|
+
fontSize: "8.5px"
|
|
34
|
+
},
|
|
35
|
+
blueTheme: {
|
|
36
|
+
// width: "100%",
|
|
37
|
+
height: "200px",
|
|
38
|
+
backgroundColor: "#3D3981",
|
|
39
|
+
borderRadius: "7px",
|
|
40
|
+
padding: "16px",
|
|
41
|
+
width: "50%"
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
const getCustomStyles = _ref2 => {
|
|
45
|
+
let colorTheme = _ref2.colorTheme,
|
|
46
|
+
error = _ref2.error;
|
|
47
|
+
return {
|
|
48
|
+
option: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
49
|
+
color: colorTheme ? "#f4f7fc" : _responsiveTheme.default.palette.text.main,
|
|
50
|
+
fontSize: "10px",
|
|
51
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
52
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.white.main,
|
|
53
|
+
opacity: "100%",
|
|
54
|
+
"&:hover": {
|
|
55
|
+
backgroundColor: _responsiveTheme.default.palette.secondary_grey.main,
|
|
56
|
+
color: _responsiveTheme.default.palette.primary.main
|
|
57
|
+
}
|
|
58
|
+
}),
|
|
59
|
+
control: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
60
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.primary.white,
|
|
61
|
+
boxShadow: "none",
|
|
62
|
+
fontSize: "10px",
|
|
63
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
64
|
+
// marginTop: theme.spacing(1.25),
|
|
65
|
+
height: "2.4rem !important",
|
|
66
|
+
border: error ? "1px solid #be1515" : colorTheme ? "none" : "1px solid #CFD7DF",
|
|
67
|
+
"&:hover": {
|
|
68
|
+
border: error ? "1px solid #be1515" : colorTheme ? "none" : "1px solid #CFD7DF"
|
|
69
|
+
}
|
|
70
|
+
// minHeight: "31.83px !important",
|
|
71
|
+
//border: "1px solid #adbac9",
|
|
72
|
+
}),
|
|
73
|
+
placeholder: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
74
|
+
color: colorTheme ? _responsiveTheme.default.palette.white.main : _responsiveTheme.default.palette.grey_dark.main,
|
|
75
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily,
|
|
76
|
+
fontWeight: 400,
|
|
77
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
78
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
79
|
+
}),
|
|
80
|
+
indicatorSeparator: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
81
|
+
background: "none"
|
|
82
|
+
}),
|
|
83
|
+
input: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
84
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.text.main,
|
|
85
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
86
|
+
}),
|
|
87
|
+
menu: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
88
|
+
padding: 0,
|
|
89
|
+
backgroundColor: colorTheme ? "#6e6ba1" : _responsiveTheme.default.palette.white.main,
|
|
90
|
+
zIndex: 9999
|
|
91
|
+
}),
|
|
92
|
+
menuPortal: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
93
|
+
zIndex: 9999
|
|
94
|
+
}),
|
|
95
|
+
dropdownIndicator: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
96
|
+
color: colorTheme ? "#f4f7fc" : _responsiveTheme.default.palette.text.main,
|
|
97
|
+
opacity: 1,
|
|
98
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
99
|
+
}),
|
|
100
|
+
singleValue: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
101
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.text.main,
|
|
102
|
+
// fontWeight: 500,
|
|
103
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
104
|
+
padding: "0rem 0rem 0.1rem 0rem"
|
|
105
|
+
}),
|
|
106
|
+
valueContainer: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
107
|
+
// padding: 0,
|
|
108
|
+
color: colorTheme ? "#F4F7FC" : _responsiveTheme.default.palette.primary.tenjinLightBlack
|
|
109
|
+
}),
|
|
110
|
+
clearIndicator: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
111
|
+
color: colorTheme ? "#f4f7fc" : "#adb0bb"
|
|
112
|
+
}),
|
|
113
|
+
multiValue: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
114
|
+
backgroundColor: _responsiveTheme.default.palette.primary.tenjinMLight,
|
|
115
|
+
border: "1px solid #DAE0FF",
|
|
116
|
+
marginTop: "-0.15rem"
|
|
117
|
+
}),
|
|
118
|
+
multiValueLabel: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
119
|
+
color: _responsiveTheme.default.palette.text.main,
|
|
120
|
+
fontWeight: 400,
|
|
121
|
+
fontSize: _responsiveTheme.default.typography.fontSize,
|
|
122
|
+
fontFamily: _responsiveTheme.default.typography.fontFamily
|
|
123
|
+
}),
|
|
124
|
+
multiValueRemove: provided => _objectSpread(_objectSpread({}, provided), {}, {
|
|
125
|
+
color: _responsiveTheme.default.palette.primary.tenjinFBlue,
|
|
126
|
+
cursor: "pointer"
|
|
127
|
+
})
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
exports.getCustomStyles = getCustomStyles;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _rte = require("@mantine/rte");
|
|
9
|
+
const _excluded = ["controls", "readOnly"];
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
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; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).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; }
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
18
|
+
const RichTextEditorTest = _ref => {
|
|
19
|
+
let _ref$controls = _ref.controls,
|
|
20
|
+
controls = _ref$controls === void 0 ? {} : _ref$controls,
|
|
21
|
+
_ref$readOnly = _ref.readOnly,
|
|
22
|
+
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
23
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
24
|
+
// By default everything is enabled
|
|
25
|
+
const defaultControls = {
|
|
26
|
+
bold: true,
|
|
27
|
+
italic: true,
|
|
28
|
+
underline: true,
|
|
29
|
+
link: true,
|
|
30
|
+
image: true,
|
|
31
|
+
unorderedList: true,
|
|
32
|
+
orderedList: true,
|
|
33
|
+
h1: true,
|
|
34
|
+
h2: true,
|
|
35
|
+
h3: true,
|
|
36
|
+
alignLeft: true,
|
|
37
|
+
alignCenter: true,
|
|
38
|
+
alignRight: true
|
|
39
|
+
};
|
|
40
|
+
const editorControls = (0, _react.useMemo)(() => {
|
|
41
|
+
if (readOnly) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
const finalControls = _objectSpread(_objectSpread({}, defaultControls), controls);
|
|
45
|
+
return [["bold", "italic", "underline"].filter(c => finalControls[c]), ["link", "image"].filter(c => finalControls[c]), ["unorderedList", "orderedList"].filter(c => finalControls[c]), ["h1", "h2", "h3"].filter(c => finalControls[c]), ["alignLeft", "alignCenter", "alignRight"].filter(c => finalControls[c])].filter(group => group.length > 0);
|
|
46
|
+
}, [controls, readOnly]);
|
|
47
|
+
const mentions = (0, _react.useMemo)(() => ({
|
|
48
|
+
allowedChars: /^[A-Za-z\sÅÄÖåäö]*$/,
|
|
49
|
+
mentionDenotationChars: ["@"],
|
|
50
|
+
source: (searchTerm, renderList, mentionChar) => {
|
|
51
|
+
const list = mentionChar === "@" ? props.data : "";
|
|
52
|
+
const includesSearchTerm = list.filter(item => item.value.toLowerCase().includes(searchTerm && searchTerm.toLowerCase()));
|
|
53
|
+
renderList(includesSearchTerm);
|
|
54
|
+
}
|
|
55
|
+
}), [props.data]);
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_rte.RichTextEditor, {
|
|
57
|
+
controls: editorControls,
|
|
58
|
+
value: props.value,
|
|
59
|
+
onChange: props.onChange,
|
|
60
|
+
mentions: props.mentions && mentions,
|
|
61
|
+
readOnly: readOnly
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
var _default = exports.default = RichTextEditorTest;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
9
|
+
var _fa = require("react-icons/fa");
|
|
10
|
+
var _reactDom = require("react-dom");
|
|
11
|
+
var _text = _interopRequireDefault(require("../text"));
|
|
12
|
+
const _excluded = ["options", "onChange", "value", "defaultValue", "fullWidth"];
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
17
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
18
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
19
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
20
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
21
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
22
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
23
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
24
|
+
const GroupedSelect = _ref => {
|
|
25
|
+
var _options$find, _Object$entries;
|
|
26
|
+
let options = _ref.options,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
propValue = _ref.value,
|
|
29
|
+
defaultValue = _ref.defaultValue,
|
|
30
|
+
fullWidth = _ref.fullWidth,
|
|
31
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
const triggerRef = React.useRef(null);
|
|
33
|
+
const _React$useState = React.useState(""),
|
|
34
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
35
|
+
searchTerm = _React$useState2[0],
|
|
36
|
+
setSearchTerm = _React$useState2[1];
|
|
37
|
+
const _React$useState3 = React.useState(false),
|
|
38
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
39
|
+
isDropdownOpen = _React$useState4[0],
|
|
40
|
+
setIsDropdownOpen = _React$useState4[1];
|
|
41
|
+
const _React$useState5 = React.useState(propValue || defaultValue),
|
|
42
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
43
|
+
value = _React$useState6[0],
|
|
44
|
+
setValue = _React$useState6[1];
|
|
45
|
+
const _React$useState7 = React.useState(null),
|
|
46
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
47
|
+
hoveredOption = _React$useState8[0],
|
|
48
|
+
setHoveredOption = _React$useState8[1];
|
|
49
|
+
const groupOptionsByPageTitle = options => {
|
|
50
|
+
const grouped = {};
|
|
51
|
+
options.forEach(option => {
|
|
52
|
+
var _grouped$option$pageT;
|
|
53
|
+
if (!grouped[option === null || option === void 0 ? void 0 : option.pageTitle]) {
|
|
54
|
+
grouped[option === null || option === void 0 ? void 0 : option.pageTitle] = [];
|
|
55
|
+
}
|
|
56
|
+
(_grouped$option$pageT = grouped[option === null || option === void 0 ? void 0 : option.pageTitle]) === null || _grouped$option$pageT === void 0 || _grouped$option$pageT.push(option);
|
|
57
|
+
});
|
|
58
|
+
return grouped;
|
|
59
|
+
};
|
|
60
|
+
const handleSearchChange = event => {
|
|
61
|
+
setSearchTerm(event.target.value);
|
|
62
|
+
};
|
|
63
|
+
const filteredOptions = options.filter(option => {
|
|
64
|
+
var _option$label, _option$pageTitle;
|
|
65
|
+
return (option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 ? void 0 : _option$label.includes(searchTerm)) || (option === null || option === void 0 || (_option$pageTitle = option.pageTitle) === null || _option$pageTitle === void 0 ? void 0 : _option$pageTitle.includes(searchTerm));
|
|
66
|
+
});
|
|
67
|
+
const groupedOptions = groupOptionsByPageTitle(filteredOptions);
|
|
68
|
+
const toggleDropdown = () => {
|
|
69
|
+
setIsDropdownOpen(prev => !prev);
|
|
70
|
+
};
|
|
71
|
+
const handleOptionClick = selectedValue => {
|
|
72
|
+
setValue(selectedValue);
|
|
73
|
+
setIsDropdownOpen(false);
|
|
74
|
+
onChange({
|
|
75
|
+
target: {
|
|
76
|
+
value: selectedValue
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const handleCloseDropdown = () => {
|
|
81
|
+
setIsDropdownOpen(false);
|
|
82
|
+
};
|
|
83
|
+
return /*#__PURE__*/React.createElement(_FormControl.default, _extends({
|
|
84
|
+
sx: {
|
|
85
|
+
width: fullWidth ? "100%" : 200
|
|
86
|
+
}
|
|
87
|
+
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
style: {
|
|
89
|
+
position: "relative",
|
|
90
|
+
width: "100%"
|
|
91
|
+
},
|
|
92
|
+
ref: triggerRef
|
|
93
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
onClick: toggleDropdown,
|
|
95
|
+
style: {
|
|
96
|
+
padding: "8px 10px",
|
|
97
|
+
border: "1px solid #ccc",
|
|
98
|
+
borderRadius: "4px",
|
|
99
|
+
cursor: "pointer",
|
|
100
|
+
display: "flex",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
justifyContent: "space-between"
|
|
103
|
+
}
|
|
104
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
style: {
|
|
106
|
+
flexGrow: 1
|
|
107
|
+
}
|
|
108
|
+
}, value ? options === null || options === void 0 || (_options$find = options.find(opt => (opt === null || opt === void 0 ? void 0 : opt.id) === value)) === null || _options$find === void 0 ? void 0 : _options$find.label : "Select Option"), /*#__PURE__*/React.createElement("div", null, isDropdownOpen ? /*#__PURE__*/React.createElement(_fa.FaCaretUp, null) : /*#__PURE__*/React.createElement(_fa.FaCaretDown, null)))), isDropdownOpen && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/React.createElement("div", {
|
|
109
|
+
style: {
|
|
110
|
+
position: "absolute",
|
|
111
|
+
top: "".concat(triggerRef.current.getBoundingClientRect().bottom + 8, "px"),
|
|
112
|
+
left: "".concat(triggerRef.current.getBoundingClientRect().left, "px"),
|
|
113
|
+
width: "".concat(triggerRef.current.offsetWidth, "px"),
|
|
114
|
+
backgroundColor: "#fff",
|
|
115
|
+
border: "1px solid #ccc",
|
|
116
|
+
borderRadius: "4px",
|
|
117
|
+
boxShadow: "0px 4px 6px rgba(0, 0, 0, 0.1)",
|
|
118
|
+
maxHeight: "200px",
|
|
119
|
+
overflowY: "auto",
|
|
120
|
+
zIndex: 2000
|
|
121
|
+
}
|
|
122
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
123
|
+
style: {
|
|
124
|
+
padding: "10px"
|
|
125
|
+
}
|
|
126
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
127
|
+
type: "text",
|
|
128
|
+
placeholder: "Search...",
|
|
129
|
+
value: searchTerm,
|
|
130
|
+
onChange: handleSearchChange,
|
|
131
|
+
style: {
|
|
132
|
+
paddingLeft: "2.5rem",
|
|
133
|
+
background: 'white url("https://static.thenounproject.com/png/101791-200.png") no-repeat left',
|
|
134
|
+
backgroundPosition: "0.875rem center",
|
|
135
|
+
backgroundSize: "1.125rem",
|
|
136
|
+
height: "2.188rem",
|
|
137
|
+
margin: 0,
|
|
138
|
+
width: "100%",
|
|
139
|
+
border: "1px solid #949494",
|
|
140
|
+
borderRadius: "4px"
|
|
141
|
+
}
|
|
142
|
+
}), (_Object$entries = Object.entries(groupedOptions)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(_ref2 => {
|
|
143
|
+
let _ref3 = _slicedToArray(_ref2, 2),
|
|
144
|
+
pageTitle = _ref3[0],
|
|
145
|
+
options = _ref3[1];
|
|
146
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
147
|
+
key: pageTitle
|
|
148
|
+
}, /*#__PURE__*/React.createElement(_text.default, {
|
|
149
|
+
style: {
|
|
150
|
+
padding: "5px 10px"
|
|
151
|
+
// backgroundColor: "#f5f5f5",
|
|
152
|
+
},
|
|
153
|
+
semibold: true
|
|
154
|
+
}, pageTitle !== null && pageTitle !== void 0 ? pageTitle : "N/A"), options.map(option => /*#__PURE__*/React.createElement("div", {
|
|
155
|
+
key: option === null || option === void 0 ? void 0 : option.id,
|
|
156
|
+
onClick: () => handleOptionClick(option.id),
|
|
157
|
+
onMouseEnter: () => setHoveredOption(option.id),
|
|
158
|
+
onMouseLeave: () => setHoveredOption(null),
|
|
159
|
+
style: {
|
|
160
|
+
padding: "8px 24px",
|
|
161
|
+
cursor: "pointer",
|
|
162
|
+
backgroundColor: value === (option === null || option === void 0 ? void 0 : option.id) ? "#f0f0f7" : hoveredOption === (option === null || option === void 0 ? void 0 : option.id) ? "#f5f5f5" : "transparent"
|
|
163
|
+
}
|
|
164
|
+
}, option.label)));
|
|
165
|
+
}))), document.body));
|
|
166
|
+
};
|
|
167
|
+
var _default = exports.default = GroupedSelect;
|