tenjin-ui-kit 0.3.56 → 0.3.57
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/components/breadCrumbs/index.js +11 -3
- package/components/button/index.js +7 -3
- package/components/combobox/index.js +411 -0
- package/components/input/index.js +3 -2
- package/components/layout/topBar/ProjectTopbar.js +26 -24
- package/components/select/SimpleSelect.js +4 -30
- package/components/simpleSelect/index.js +7 -73
- package/components/text/index.js +5 -2
- package/package.json +6 -3
|
@@ -103,7 +103,9 @@ function BreadCrumbs(props) {
|
|
|
103
103
|
title: (_crumbInfo$3 = crumbInfo[0]) === null || _crumbInfo$3 === void 0 ? void 0 : _crumbInfo$3.title,
|
|
104
104
|
arrow: true,
|
|
105
105
|
placement: "top"
|
|
106
|
-
}, /*#__PURE__*/React.createElement("span", null, ((_crumbInfo$4 = crumbInfo[0]) === null || _crumbInfo$4 === void 0 ? void 0 : (_crumbInfo$4$title = _crumbInfo$4.title) === null || _crumbInfo$4$title === void 0 ? void 0 : _crumbInfo$4$title.slice(0, 20)) + "...")) : /*#__PURE__*/React.createElement(_text.default,
|
|
106
|
+
}, /*#__PURE__*/React.createElement("span", null, ((_crumbInfo$4 = crumbInfo[0]) === null || _crumbInfo$4 === void 0 ? void 0 : (_crumbInfo$4$title = _crumbInfo$4.title) === null || _crumbInfo$4$title === void 0 ? void 0 : _crumbInfo$4$title.slice(0, 20)) + "...")) : /*#__PURE__*/React.createElement(_text.default, {
|
|
107
|
+
component: "span"
|
|
108
|
+
}, (_crumbInfo$5 = crumbInfo[0]) === null || _crumbInfo$5 === void 0 ? void 0 : _crumbInfo$5.title)), crumbInfo.length > maxItems && crumbInfo.length - 1 !== maxItems && /*#__PURE__*/React.createElement(_button.default, {
|
|
107
109
|
color: "inherit",
|
|
108
110
|
variant: "text",
|
|
109
111
|
onClick: handleMenuClick,
|
|
@@ -141,7 +143,11 @@ function BreadCrumbs(props) {
|
|
|
141
143
|
title: breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.title,
|
|
142
144
|
arrow: true,
|
|
143
145
|
placement: "top"
|
|
144
|
-
}, /*#__PURE__*/React.createElement(
|
|
146
|
+
}, /*#__PURE__*/React.createElement(_text.default, {
|
|
147
|
+
component: "span"
|
|
148
|
+
}, (breadcrumb === null || breadcrumb === void 0 ? void 0 : (_breadcrumb$title2 = breadcrumb.title) === null || _breadcrumb$title2 === void 0 ? void 0 : _breadcrumb$title2.slice(0, 20)) + "...")) : /*#__PURE__*/React.createElement(_text.default, {
|
|
149
|
+
component: "span"
|
|
150
|
+
}, breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.title));
|
|
145
151
|
})), /*#__PURE__*/React.createElement(_material.Menu, {
|
|
146
152
|
anchorEl: anchorEl,
|
|
147
153
|
open: menuOpen,
|
|
@@ -167,6 +173,8 @@ function BreadCrumbs(props) {
|
|
|
167
173
|
display: "flex",
|
|
168
174
|
marginRight: "3px"
|
|
169
175
|
}
|
|
170
|
-
}, breadcrumb.icon), /*#__PURE__*/React.createElement(_text.default,
|
|
176
|
+
}, breadcrumb.icon), /*#__PURE__*/React.createElement(_text.default, {
|
|
177
|
+
component: "span"
|
|
178
|
+
}, breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.title));
|
|
171
179
|
})));
|
|
172
180
|
}
|
|
@@ -4,13 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.ButtonLoader = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
7
|
var _material = require("@mui/material");
|
|
9
8
|
var _styles = require("@mui/material/styles");
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
11
|
var _Menu = _interopRequireDefault(require("@mui/material/Menu"));
|
|
13
12
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
13
|
+
var _excluded = ["loading"];
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
16
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -19,6 +19,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
19
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
20
20
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
21
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
22
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
23
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
22
24
|
var Button = function Button(props) {
|
|
23
25
|
var loading = props.loading,
|
|
24
26
|
loadingText = props.loadingText,
|
|
@@ -28,6 +30,8 @@ var Button = function Button(props) {
|
|
|
28
30
|
color = props.color,
|
|
29
31
|
fixedWidth = props.fixedWidth,
|
|
30
32
|
type = props.type;
|
|
33
|
+
var _ = props.loading,
|
|
34
|
+
propsSansLoading = _objectWithoutProperties(props, _excluded);
|
|
31
35
|
var handleClick = function handleClick(e) {
|
|
32
36
|
if (loading) {
|
|
33
37
|
e.preventDefault();
|
|
@@ -65,7 +69,7 @@ var Button = function Button(props) {
|
|
|
65
69
|
"aria-haspopup": "true",
|
|
66
70
|
"aria-expanded": open ? "true" : undefined,
|
|
67
71
|
onClick: handleMenuClick
|
|
68
|
-
},
|
|
72
|
+
}, propsSansLoading), children), /*#__PURE__*/_react.default.createElement(_Menu.default, {
|
|
69
73
|
id: "basic-menu",
|
|
70
74
|
anchorEl: anchorEl,
|
|
71
75
|
open: open,
|
|
@@ -0,0 +1,411 @@
|
|
|
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 _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _material = require("@mui/material");
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
11
|
+
var _KeyboardArrowDown = _interopRequireDefault(require("@mui/icons-material/KeyboardArrowDown"));
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
16
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
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."); }
|
|
24
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
// Styled components to match the Tailwind design
|
|
29
|
+
var StyledTextField = (0, _styles.styled)(_material.TextField, {
|
|
30
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
31
|
+
return prop !== "error" && prop !== "loading";
|
|
32
|
+
}
|
|
33
|
+
})(function (_ref) {
|
|
34
|
+
var theme = _ref.theme,
|
|
35
|
+
error = _ref.error,
|
|
36
|
+
loading = _ref.loading;
|
|
37
|
+
return {
|
|
38
|
+
"& .MuiOutlinedInput-root": {
|
|
39
|
+
backgroundColor: loading ? "#f9fafb" : "#ffffff",
|
|
40
|
+
borderRadius: "0.375rem",
|
|
41
|
+
boxShadow: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
42
|
+
cursor: loading ? "not-allowed" : "text",
|
|
43
|
+
"& fieldset": {
|
|
44
|
+
borderColor: error ? theme.palette.error.main : "#d1d5db"
|
|
45
|
+
},
|
|
46
|
+
"&:hover fieldset": {
|
|
47
|
+
borderColor: error ? theme.palette.error.main : "#d1d5db"
|
|
48
|
+
},
|
|
49
|
+
"&.Mui-focused fieldset": {
|
|
50
|
+
borderColor: error ? theme.palette.error.main : theme.palette.primary.main,
|
|
51
|
+
borderWidth: "1px"
|
|
52
|
+
},
|
|
53
|
+
"&.Mui-focused": {
|
|
54
|
+
boxShadow: error ? "0 0 0 1px ".concat(theme.palette.error.main) : "0 0 0 1px ".concat(theme.palette.primary.main)
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"& .MuiOutlinedInput-input": {
|
|
58
|
+
padding: "8px 12px",
|
|
59
|
+
fontSize: "0.875rem",
|
|
60
|
+
lineHeight: "1.25rem",
|
|
61
|
+
color: "#111827",
|
|
62
|
+
"&::placeholder": {
|
|
63
|
+
color: "#9ca3af",
|
|
64
|
+
opacity: 1
|
|
65
|
+
},
|
|
66
|
+
"&.Mui-disabled": {
|
|
67
|
+
cursor: "not-allowed",
|
|
68
|
+
WebkitTextFillColor: "#6b7280"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
var StyledPaper = (0, _styles.styled)(_material.Paper)(function (_ref2) {
|
|
74
|
+
var theme = _ref2.theme;
|
|
75
|
+
return {
|
|
76
|
+
marginTop: "4px",
|
|
77
|
+
maxHeight: "240px",
|
|
78
|
+
border: "1px solid #d1d5db",
|
|
79
|
+
borderRadius: "0.375rem",
|
|
80
|
+
boxShadow: "0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",
|
|
81
|
+
"& .MuiAutocomplete-listbox": {
|
|
82
|
+
padding: "4px 0",
|
|
83
|
+
maxHeight: "232px",
|
|
84
|
+
fontSize: "0.875rem",
|
|
85
|
+
lineHeight: "1.25rem"
|
|
86
|
+
},
|
|
87
|
+
"& .MuiAutocomplete-option": {
|
|
88
|
+
padding: "8px 12px",
|
|
89
|
+
color: "#111827",
|
|
90
|
+
cursor: "pointer",
|
|
91
|
+
userSelect: "none",
|
|
92
|
+
'&[aria-selected="true"]': {
|
|
93
|
+
backgroundColor: "#eff6ff !important",
|
|
94
|
+
color: "#1e40af"
|
|
95
|
+
},
|
|
96
|
+
"&.Mui-focused": {
|
|
97
|
+
backgroundColor: "#eff6ff !important",
|
|
98
|
+
color: "#1e40af"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"& .MuiAutocomplete-noOptions": {
|
|
102
|
+
padding: "8px 12px",
|
|
103
|
+
fontSize: "0.875rem",
|
|
104
|
+
color: "#6b7280"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
var Label = (0, _styles.styled)(_material.Typography, {
|
|
109
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
110
|
+
return prop !== "isRequired";
|
|
111
|
+
}
|
|
112
|
+
})(function (_ref3) {
|
|
113
|
+
var isRequired = _ref3.isRequired;
|
|
114
|
+
return {
|
|
115
|
+
display: "block",
|
|
116
|
+
fontSize: "0.875rem",
|
|
117
|
+
lineHeight: "1.5rem",
|
|
118
|
+
fontWeight: 500,
|
|
119
|
+
color: "#111827",
|
|
120
|
+
marginBottom: "8px",
|
|
121
|
+
"&::after": isRequired ? {
|
|
122
|
+
content: '" *"',
|
|
123
|
+
color: "#ef4444",
|
|
124
|
+
marginLeft: "2px"
|
|
125
|
+
} : {}
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
var HelperText = (0, _styles.styled)(_material.Typography, {
|
|
129
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
130
|
+
return prop !== "error";
|
|
131
|
+
}
|
|
132
|
+
})(function (_ref4) {
|
|
133
|
+
var error = _ref4.error;
|
|
134
|
+
return {
|
|
135
|
+
marginTop: "8px",
|
|
136
|
+
fontSize: "0.875rem",
|
|
137
|
+
lineHeight: "1.25rem",
|
|
138
|
+
color: error ? "#dc2626" : "#4b5563"
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
var Combobox = function Combobox(_ref5) {
|
|
142
|
+
var _ref5$options = _ref5.options,
|
|
143
|
+
options = _ref5$options === void 0 ? [] : _ref5$options,
|
|
144
|
+
selected = _ref5.selected,
|
|
145
|
+
defaultValue = _ref5.defaultValue,
|
|
146
|
+
label = _ref5.label,
|
|
147
|
+
id = _ref5.id,
|
|
148
|
+
isRequired = _ref5.isRequired,
|
|
149
|
+
onChange = _ref5.onChange,
|
|
150
|
+
error = _ref5.error,
|
|
151
|
+
helperText = _ref5.helperText,
|
|
152
|
+
_ref5$loading = _ref5.loading,
|
|
153
|
+
loading = _ref5$loading === void 0 ? false : _ref5$loading,
|
|
154
|
+
_ref5$by = _ref5.by,
|
|
155
|
+
by = _ref5$by === void 0 ? "id" : _ref5$by,
|
|
156
|
+
_ref5$labelKey = _ref5.labelKey,
|
|
157
|
+
labelKey = _ref5$labelKey === void 0 ? "label" : _ref5$labelKey;
|
|
158
|
+
var _useState = (0, _react.useState)(null),
|
|
159
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
160
|
+
internalSelected = _useState2[0],
|
|
161
|
+
setInternalSelected = _useState2[1];
|
|
162
|
+
var _useState3 = (0, _react.useState)(false),
|
|
163
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
164
|
+
hasSetDefault = _useState4[0],
|
|
165
|
+
setHasSetDefault = _useState4[1];
|
|
166
|
+
var _useState5 = (0, _react.useState)(false),
|
|
167
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
168
|
+
open = _useState6[0],
|
|
169
|
+
setOpen = _useState6[1];
|
|
170
|
+
|
|
171
|
+
// Handle defaultValue - accepts both object and primitive (ID)
|
|
172
|
+
(0, _react.useEffect)(function () {
|
|
173
|
+
if (defaultValue && options.length > 0 && !hasSetDefault) {
|
|
174
|
+
var defaultOption;
|
|
175
|
+
if (_typeof(defaultValue) === "object" && defaultValue !== null) {
|
|
176
|
+
// defaultValue is already a full object
|
|
177
|
+
defaultOption = defaultValue;
|
|
178
|
+
} else {
|
|
179
|
+
// defaultValue is a primitive (ID), find the matching option
|
|
180
|
+
defaultOption = options.find(function (opt) {
|
|
181
|
+
return opt[by] === defaultValue;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
if (defaultOption) {
|
|
185
|
+
setInternalSelected(defaultOption);
|
|
186
|
+
setHasSetDefault(true);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}, [defaultValue, options, by, hasSetDefault]);
|
|
190
|
+
|
|
191
|
+
// Use selected prop if provided, otherwise use internal state
|
|
192
|
+
var currentValue = selected || internalSelected;
|
|
193
|
+
var handleChange = function handleChange(event, value) {
|
|
194
|
+
setInternalSelected(value);
|
|
195
|
+
if (onChange) {
|
|
196
|
+
// Pass the full object to onChange (industry standard)
|
|
197
|
+
onChange(value);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
201
|
+
sx: {
|
|
202
|
+
width: "100%"
|
|
203
|
+
}
|
|
204
|
+
}, label && /*#__PURE__*/_react.default.createElement(Label, {
|
|
205
|
+
htmlFor: id,
|
|
206
|
+
isRequired: isRequired
|
|
207
|
+
}, label), /*#__PURE__*/_react.default.createElement(_material.Autocomplete, {
|
|
208
|
+
id: id,
|
|
209
|
+
value: currentValue,
|
|
210
|
+
onChange: handleChange,
|
|
211
|
+
options: options,
|
|
212
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
213
|
+
return (option === null || option === void 0 ? void 0 : option[labelKey]) || "";
|
|
214
|
+
},
|
|
215
|
+
isOptionEqualToValue: function isOptionEqualToValue(option, value) {
|
|
216
|
+
return (option === null || option === void 0 ? void 0 : option[by]) === (value === null || value === void 0 ? void 0 : value[by]);
|
|
217
|
+
},
|
|
218
|
+
loading: loading,
|
|
219
|
+
disabled: loading,
|
|
220
|
+
open: open && !loading,
|
|
221
|
+
onOpen: function onOpen() {
|
|
222
|
+
return setOpen(true);
|
|
223
|
+
},
|
|
224
|
+
onClose: function onClose() {
|
|
225
|
+
return setOpen(false);
|
|
226
|
+
},
|
|
227
|
+
disableClearable: false,
|
|
228
|
+
PaperComponent: StyledPaper,
|
|
229
|
+
popupIcon: loading ? /*#__PURE__*/_react.default.createElement(_material.CircularProgress, {
|
|
230
|
+
size: 20,
|
|
231
|
+
sx: {
|
|
232
|
+
color: "#9ca3af"
|
|
233
|
+
}
|
|
234
|
+
}) : /*#__PURE__*/_react.default.createElement(_KeyboardArrowDown.default, {
|
|
235
|
+
sx: {
|
|
236
|
+
color: error ? "#ef4444" : "#9ca3af"
|
|
237
|
+
}
|
|
238
|
+
}),
|
|
239
|
+
noOptionsText: "No results found",
|
|
240
|
+
renderInput: function renderInput(params) {
|
|
241
|
+
return /*#__PURE__*/_react.default.createElement(StyledTextField, _extends({}, params, {
|
|
242
|
+
error: error,
|
|
243
|
+
loading: loading,
|
|
244
|
+
placeholder: loading ? "Loading..." : "",
|
|
245
|
+
InputProps: _objectSpread(_objectSpread({}, params.InputProps), {}, {
|
|
246
|
+
endAdornment: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, params.InputProps.endAdornment)
|
|
247
|
+
})
|
|
248
|
+
}));
|
|
249
|
+
}
|
|
250
|
+
}), helperText && /*#__PURE__*/_react.default.createElement(HelperText, {
|
|
251
|
+
error: error
|
|
252
|
+
}, helperText));
|
|
253
|
+
};
|
|
254
|
+
Combobox.propTypes = {
|
|
255
|
+
/**
|
|
256
|
+
* Array of option objects to display in the dropdown.
|
|
257
|
+
* Each option should be an object containing at minimum the key specified by `by` prop
|
|
258
|
+
* and the key specified by `labelKey` prop.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* options={[
|
|
262
|
+
* { id: 1, label: "Option 1", value: "opt1" },
|
|
263
|
+
* { id: 2, label: "Option 2", value: "opt2" }
|
|
264
|
+
* ]}
|
|
265
|
+
*/
|
|
266
|
+
options: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
267
|
+
/**
|
|
268
|
+
* Controlled selected value. When provided, the component operates in controlled mode.
|
|
269
|
+
* Should be one of the objects from the `options` array.
|
|
270
|
+
* The component will match this object to options using the `by` prop.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* selected={{ id: 1, label: "Option 1" }}
|
|
274
|
+
*/
|
|
275
|
+
selected: _propTypes.default.object,
|
|
276
|
+
/**
|
|
277
|
+
* Default value for uncontrolled mode. Can be either:
|
|
278
|
+
* - A complete option object from the options array
|
|
279
|
+
* - A primitive value (string/number) matching the `by` key of an option
|
|
280
|
+
*
|
|
281
|
+
* The component will automatically find and select the matching option from the options array.
|
|
282
|
+
* This prop is only used for initial render and is ignored if `selected` prop is provided.
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* // Using a primitive ID
|
|
286
|
+
* defaultValue={1}
|
|
287
|
+
*
|
|
288
|
+
* // Using a complete object
|
|
289
|
+
* defaultValue={{ id: 1, label: "Option 1" }}
|
|
290
|
+
*/
|
|
291
|
+
defaultValue: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string, _propTypes.default.number]),
|
|
292
|
+
/**
|
|
293
|
+
* Label text to display above the combobox input field.
|
|
294
|
+
* If not provided, no label will be rendered.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* label="Select a category"
|
|
298
|
+
*/
|
|
299
|
+
label: _propTypes.default.string,
|
|
300
|
+
/**
|
|
301
|
+
* HTML id attribute for the input element.
|
|
302
|
+
* Useful for accessibility (connecting labels) and form handling.
|
|
303
|
+
*
|
|
304
|
+
* @example
|
|
305
|
+
* id="category-select"
|
|
306
|
+
*/
|
|
307
|
+
id: _propTypes.default.string,
|
|
308
|
+
/**
|
|
309
|
+
* Indicates if the field is required.
|
|
310
|
+
* When true, displays a red asterisk (*) next to the label.
|
|
311
|
+
* Note: This is only visual - you must handle validation separately.
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* isRequired={true}
|
|
315
|
+
*/
|
|
316
|
+
isRequired: _propTypes.default.bool,
|
|
317
|
+
/**
|
|
318
|
+
* Callback function invoked when the selected value changes.
|
|
319
|
+
* Receives the complete selected option object as its argument (not just the ID).
|
|
320
|
+
* Called with `null` when selection is cleared.
|
|
321
|
+
*
|
|
322
|
+
* @param {Object|null} selectedOption - The complete selected option object or null
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* onChange={(option) => {
|
|
326
|
+
* console.log("Selected:", option);
|
|
327
|
+
* // option will be like: { id: 1, label: "Option 1", value: "opt1" }
|
|
328
|
+
* }}
|
|
329
|
+
*/
|
|
330
|
+
onChange: _propTypes.default.func,
|
|
331
|
+
/**
|
|
332
|
+
* Error state flag. When true:
|
|
333
|
+
* - Input border becomes red
|
|
334
|
+
* - Helper text (if provided) becomes red
|
|
335
|
+
* - Dropdown icon becomes red
|
|
336
|
+
* Use this to indicate validation errors.
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* error={formErrors.category !== undefined}
|
|
340
|
+
*/
|
|
341
|
+
error: _propTypes.default.bool,
|
|
342
|
+
/**
|
|
343
|
+
* Helper text displayed below the input field.
|
|
344
|
+
* Can be used for:
|
|
345
|
+
* - Field descriptions/instructions (when error is false)
|
|
346
|
+
* - Error messages (when error is true)
|
|
347
|
+
* Color automatically adjusts based on error state.
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* helperText={error ? "Please select a category" : "Choose your preferred category"}
|
|
351
|
+
*/
|
|
352
|
+
helperText: _propTypes.default.string,
|
|
353
|
+
/**
|
|
354
|
+
* Loading state flag. When true:
|
|
355
|
+
* - Displays a loading spinner instead of dropdown arrow
|
|
356
|
+
* - Shows "Loading..." placeholder text
|
|
357
|
+
* - Disables the input (prevents user interaction)
|
|
358
|
+
* - Prevents dropdown from opening
|
|
359
|
+
* - Input background becomes gray
|
|
360
|
+
*
|
|
361
|
+
* Use this when fetching options from an API or performing async operations.
|
|
362
|
+
*
|
|
363
|
+
* @example
|
|
364
|
+
* loading={isLoadingOptions}
|
|
365
|
+
*/
|
|
366
|
+
loading: _propTypes.default.bool,
|
|
367
|
+
/**
|
|
368
|
+
* Property name to use as the unique identifier for options.
|
|
369
|
+
* Used for:
|
|
370
|
+
* - Comparing options for equality (isOptionEqualToValue)
|
|
371
|
+
* - Matching defaultValue when it's a primitive
|
|
372
|
+
* - React keys in the options list
|
|
373
|
+
*
|
|
374
|
+
* Each option object must have this property and it should be unique.
|
|
375
|
+
*
|
|
376
|
+
* @default "id"
|
|
377
|
+
* @example
|
|
378
|
+
* by="userId"
|
|
379
|
+
* // Then options would be: [{ userId: 1, name: "John" }, ...]
|
|
380
|
+
*/
|
|
381
|
+
by: _propTypes.default.string,
|
|
382
|
+
/**
|
|
383
|
+
* Property name to use for displaying option text.
|
|
384
|
+
* This value is shown in:
|
|
385
|
+
* - The dropdown options list
|
|
386
|
+
* - The input field when an option is selected
|
|
387
|
+
* - The filtered search results
|
|
388
|
+
*
|
|
389
|
+
* @default "label"
|
|
390
|
+
* @example
|
|
391
|
+
* labelKey="name"
|
|
392
|
+
* // Then options would be: [{ id: 1, name: "Option 1" }, ...]
|
|
393
|
+
*/
|
|
394
|
+
labelKey: _propTypes.default.string
|
|
395
|
+
};
|
|
396
|
+
Combobox.defaultProps = {
|
|
397
|
+
options: [],
|
|
398
|
+
selected: undefined,
|
|
399
|
+
defaultValue: undefined,
|
|
400
|
+
label: "",
|
|
401
|
+
id: undefined,
|
|
402
|
+
isRequired: false,
|
|
403
|
+
onChange: undefined,
|
|
404
|
+
error: false,
|
|
405
|
+
helperText: "",
|
|
406
|
+
loading: false,
|
|
407
|
+
by: "id",
|
|
408
|
+
labelKey: "label"
|
|
409
|
+
};
|
|
410
|
+
var _default = Combobox;
|
|
411
|
+
exports.default = _default;
|
|
@@ -130,8 +130,9 @@ var Input = function Input(_ref) {
|
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
startAdornment: startIcon,
|
|
133
|
-
endAdornment: endIcon
|
|
134
|
-
helperText
|
|
133
|
+
endAdornment: endIcon
|
|
134
|
+
// helperText={errorMessage || localErrorMessage}
|
|
135
|
+
,
|
|
135
136
|
disabled: isDisabled,
|
|
136
137
|
error: !!error || !!localErrorMessage,
|
|
137
138
|
onChange: validateRestrictiveCharacters,
|
|
@@ -33,24 +33,24 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
33
33
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
34
|
var ANNOUNCEMENT_TYPES = {
|
|
35
35
|
success: {
|
|
36
|
-
backgroundColor:
|
|
37
|
-
borderLeft:
|
|
38
|
-
color:
|
|
36
|
+
backgroundColor: "#EDF7ED",
|
|
37
|
+
borderLeft: "6px solid #4CAF50",
|
|
38
|
+
color: "#1B5E20"
|
|
39
39
|
},
|
|
40
40
|
error: {
|
|
41
|
-
backgroundColor:
|
|
42
|
-
borderLeft:
|
|
43
|
-
color:
|
|
41
|
+
backgroundColor: "#FDECEA",
|
|
42
|
+
borderLeft: "6px solid #F44336",
|
|
43
|
+
color: "#B71C1C"
|
|
44
44
|
},
|
|
45
45
|
warning: {
|
|
46
|
-
backgroundColor:
|
|
47
|
-
borderLeft:
|
|
48
|
-
color:
|
|
46
|
+
backgroundColor: "#FFF6DA",
|
|
47
|
+
borderLeft: "6px solid #FFC107",
|
|
48
|
+
color: "#7C5E10"
|
|
49
49
|
},
|
|
50
50
|
info: {
|
|
51
|
-
backgroundColor:
|
|
52
|
-
borderLeft:
|
|
53
|
-
color:
|
|
51
|
+
backgroundColor: "#E8F4FD",
|
|
52
|
+
borderLeft: "6px solid #2196F3",
|
|
53
|
+
color: "#0D47A1"
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
var ProjectTopbar = function ProjectTopbar(_ref) {
|
|
@@ -103,6 +103,8 @@ var ProjectTopbar = function ProjectTopbar(_ref) {
|
|
|
103
103
|
} else {
|
|
104
104
|
navigate(item.href);
|
|
105
105
|
}
|
|
106
|
+
} else if (item.onClick) {
|
|
107
|
+
item.onClick();
|
|
106
108
|
} else {
|
|
107
109
|
if (localStorage.getItem("chatBot")) {
|
|
108
110
|
localStorage.removeItem("chatBot");
|
|
@@ -255,20 +257,20 @@ var ProjectTopbar = function ProjectTopbar(_ref) {
|
|
|
255
257
|
backgroundColor: ANNOUNCEMENT_TYPES[announcement.type].backgroundColor,
|
|
256
258
|
borderLeft: ANNOUNCEMENT_TYPES[announcement.type].borderLeft,
|
|
257
259
|
color: ANNOUNCEMENT_TYPES[announcement.type].color,
|
|
258
|
-
minHeight:
|
|
259
|
-
height:
|
|
260
|
-
minWidth:
|
|
261
|
-
borderRadius:
|
|
262
|
-
marginRight:
|
|
263
|
-
paddingInline:
|
|
264
|
-
paddingBlock:
|
|
265
|
-
display:
|
|
266
|
-
alignItems:
|
|
267
|
-
fontSize:
|
|
260
|
+
minHeight: "26px",
|
|
261
|
+
height: "100%",
|
|
262
|
+
minWidth: "200px",
|
|
263
|
+
borderRadius: "4px",
|
|
264
|
+
marginRight: "10px",
|
|
265
|
+
paddingInline: "10px",
|
|
266
|
+
paddingBlock: "6px",
|
|
267
|
+
display: "flex",
|
|
268
|
+
alignItems: "center",
|
|
269
|
+
fontSize: "12px"
|
|
268
270
|
}
|
|
269
|
-
}, typeof announcement.message ===
|
|
271
|
+
}, typeof announcement.message === "string" ? /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
270
272
|
sx: {
|
|
271
|
-
fontSize:
|
|
273
|
+
fontSize: "12px"
|
|
272
274
|
}
|
|
273
275
|
}, announcement.message) : announcement.message), (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$role = loggedInUser.role) === null || _loggedInUser$role === void 0 ? void 0 : _loggedInUser$role.id) === 1 && /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
274
276
|
variant: "text",
|
|
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactFinalForm = require("react-final-form");
|
|
9
7
|
var _material = require("@mui/material");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
9
|
var _text = _interopRequireDefault(require("../text"));
|
|
11
|
-
var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
|
|
12
|
-
var _iconsMaterial = require("@mui/icons-material");
|
|
13
10
|
var _excluded = ["options", "errorMessage", "error", "fullWidth", "isDisabled", "label", "isRequired", "helperText", "isSearch", "isClearOption", "loading", "isSort", "placeholder"];
|
|
14
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -25,9 +22,6 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
25
22
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
23
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
27
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
28
|
-
// import { Form } from "react-final-form";
|
|
29
|
-
// import { Input } from "tenjin-ui-kit";
|
|
30
|
-
|
|
31
25
|
var SimpleSelect = function SimpleSelect(_ref) {
|
|
32
26
|
var _isSort, _isSearch, _isClearOption;
|
|
33
27
|
var options = _ref.options,
|
|
@@ -119,6 +113,7 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
119
113
|
value: option === null || option === void 0 ? void 0 : option.value
|
|
120
114
|
};
|
|
121
115
|
});
|
|
116
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
122
117
|
}, [options, searchText, isSearch]);
|
|
123
118
|
var recommendedOptions = isSearch ? displayedOptions : options;
|
|
124
119
|
var typingTimer;
|
|
@@ -155,14 +150,6 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
155
150
|
color: "red"
|
|
156
151
|
}
|
|
157
152
|
}, " * ") : "")), /*#__PURE__*/_react.default.createElement(_material.Select, _extends({}, rest, {
|
|
158
|
-
// displayEmpty // To display the placeholder
|
|
159
|
-
// renderValue={(selected) => {
|
|
160
|
-
// if (!selected) {
|
|
161
|
-
// return <span style={{ color: "#acacac" }}>{placeholder || "Select an option"}</span>;
|
|
162
|
-
// }
|
|
163
|
-
// const selectedOption = options?.find((option) => option?.value === selected);
|
|
164
|
-
// return selectedOption?.label;
|
|
165
|
-
// }}
|
|
166
153
|
fullWidth: true,
|
|
167
154
|
onClose: function onClose() {
|
|
168
155
|
return setSearchText("");
|
|
@@ -174,7 +161,7 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
174
161
|
}
|
|
175
162
|
}
|
|
176
163
|
}
|
|
177
|
-
}), isSearch && /*#__PURE__*/_react.default.createElement(
|
|
164
|
+
}), isSearch && /*#__PURE__*/_react.default.createElement("input", {
|
|
178
165
|
id: "search-box",
|
|
179
166
|
type: "text",
|
|
180
167
|
autoFocus: true,
|
|
@@ -192,26 +179,13 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
192
179
|
width: "100%",
|
|
193
180
|
border: "1px solid #949494",
|
|
194
181
|
borderRadius: "4px"
|
|
195
|
-
// paddingLeft: "2.5rem",
|
|
196
|
-
// background:
|
|
197
|
-
// "white url('https://static.thenounproject.com/png/101791-200.png') no-repeat left center",
|
|
198
|
-
// backgroundSize: "1.125rem",
|
|
199
|
-
// position: "sticky",
|
|
200
|
-
// top: 0,
|
|
201
|
-
// zIndex: 9999,
|
|
202
|
-
// height: "2.188rem",
|
|
203
|
-
// margin: 0,
|
|
204
|
-
// width: "100%",
|
|
205
|
-
// border: "1px solid #949494",
|
|
206
|
-
// borderRadius: "4px",
|
|
207
182
|
},
|
|
208
|
-
|
|
209
183
|
placeholder: "Type to search...",
|
|
210
184
|
onChange: function onChange(e) {
|
|
211
185
|
return setSearchText(e.target.value);
|
|
212
186
|
},
|
|
213
187
|
onKeyDown: handleKeyDown
|
|
214
|
-
})
|
|
188
|
+
}), isClearOption && !loading && /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
215
189
|
value: ""
|
|
216
190
|
}, /*#__PURE__*/_react.default.createElement("em", {
|
|
217
191
|
style: {
|
|
@@ -4,8 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _reactFinalForm = require("react-final-form");
|
|
9
7
|
var _material = require("@mui/material");
|
|
10
8
|
var _text = _interopRequireDefault(require("../text"));
|
|
11
9
|
var _excluded = ["options", "errorMessage", "error", "fullWidth", "isDisabled", "label", "isRequired"];
|
|
@@ -13,9 +11,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
11
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
12
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
-
// import { Form } from "react-final-form";
|
|
17
|
-
// import { Input } from "tenjin-ui-kit";
|
|
18
|
-
|
|
19
14
|
var SimpleSelect = function SimpleSelect(_ref) {
|
|
20
15
|
var options = _ref.options,
|
|
21
16
|
errorMessage = _ref.errorMessage,
|
|
@@ -26,7 +21,7 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
26
21
|
isRequired = _ref.isRequired,
|
|
27
22
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
28
23
|
console.log(errorMessage, error, "error");
|
|
29
|
-
return /*#__PURE__*/
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_material.FormControl, {
|
|
30
25
|
sx: {
|
|
31
26
|
m: 1,
|
|
32
27
|
minWidth: 120
|
|
@@ -37,86 +32,25 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
37
32
|
style: {
|
|
38
33
|
margin: "0rem !important"
|
|
39
34
|
}
|
|
40
|
-
}, label && /*#__PURE__*/
|
|
35
|
+
}, label && /*#__PURE__*/React.createElement(_material.FormLabel, {
|
|
41
36
|
htmlFor: "my-input",
|
|
42
37
|
sx: {
|
|
43
38
|
fontSize: "0.8rem",
|
|
44
39
|
fontWeight: 500,
|
|
45
40
|
paddingBottom: "0.2rem"
|
|
46
41
|
}
|
|
47
|
-
}, /*#__PURE__*/
|
|
42
|
+
}, /*#__PURE__*/React.createElement(_text.default, null, label, isRequired ? /*#__PURE__*/React.createElement("span", {
|
|
48
43
|
style: {
|
|
49
44
|
color: "red"
|
|
50
45
|
}
|
|
51
|
-
}, " * ") : "")), /*#__PURE__*/
|
|
46
|
+
}, " * ") : "")), /*#__PURE__*/React.createElement(_material.Select, _extends({}, rest, {
|
|
52
47
|
fullWidth: true
|
|
53
48
|
}), options.map(function (option) {
|
|
54
|
-
return /*#__PURE__*/
|
|
49
|
+
return /*#__PURE__*/React.createElement(_material.MenuItem, {
|
|
55
50
|
key: option.value,
|
|
56
51
|
value: option.value
|
|
57
52
|
}, option.label);
|
|
58
|
-
})), error && /*#__PURE__*/
|
|
53
|
+
})), error && /*#__PURE__*/React.createElement(_material.FormHelperText, null, errorMessage)));
|
|
59
54
|
};
|
|
60
|
-
var _default = SimpleSelect;
|
|
61
|
-
// { value: "option1", label: "Option 1" },
|
|
62
|
-
// { value: "option2", label: "Option 2" },
|
|
63
|
-
// // ... other options
|
|
64
|
-
// ];
|
|
65
|
-
// export const MyForm = () => {
|
|
66
|
-
// const validateForm = (values, mandatoryFields) => {
|
|
67
|
-
// let errors = {};
|
|
68
|
-
// if (mandatoryFields) {
|
|
69
|
-
// mandatoryFields.forEach((field) => {
|
|
70
|
-
// if (!values[field]) errors[field] = "Required";
|
|
71
|
-
// });
|
|
72
|
-
// }
|
|
73
|
-
// return errors;
|
|
74
|
-
// };
|
|
75
|
-
// const validate = (values) => {
|
|
76
|
-
// const errors = validateForm(values, ["text", "select"]);
|
|
77
|
-
// return errors;
|
|
78
|
-
// };
|
|
79
|
-
// const Submit = (values) => {
|
|
80
|
-
// console.log(values, "values");
|
|
81
|
-
// };
|
|
82
|
-
// return (
|
|
83
|
-
// <Form onSubmit={Submit} validate={validate}>
|
|
84
|
-
// {({ handleSubmit }) => (
|
|
85
|
-
// <form onSubmit={handleSubmit}>
|
|
86
|
-
// {/* Other form fields */}
|
|
87
|
-
// <Field
|
|
88
|
-
// name="text"
|
|
89
|
-
// render={({ input, meta }) => (
|
|
90
|
-
// <Input
|
|
91
|
-
// autoFocus="autofocus"
|
|
92
|
-
// isRequired
|
|
93
|
-
// {...input}
|
|
94
|
-
// // isDisabled={props.type === 'edit' && true}
|
|
95
|
-
// size="normal"
|
|
96
|
-
// placeholder="Test Cycle Name"
|
|
97
|
-
// fullWidth
|
|
98
|
-
// label="Name"
|
|
99
|
-
// error={meta.touched && meta.error ? true : false}
|
|
100
|
-
// errorMessage={meta.touched && meta.error ? meta.error : null}
|
|
101
|
-
// />
|
|
102
|
-
// )}
|
|
103
|
-
// />
|
|
104
|
-
// <Field
|
|
105
|
-
// name="select"
|
|
106
|
-
// render={({ input, meta }) => (
|
|
107
|
-
// <MUISelectField
|
|
108
|
-
// {...input}
|
|
109
|
-
// // isDisabled={props.type === 'edit' && true}
|
|
110
|
-
// options={options}
|
|
111
|
-
// error={meta.touched && meta.error}
|
|
112
|
-
// errorMessage={meta.touched && meta.error ? meta.error : null}
|
|
113
|
-
// />
|
|
114
|
-
// )}
|
|
115
|
-
// />
|
|
116
|
-
// <button type="submit">Submit</button>
|
|
117
|
-
// </form>
|
|
118
|
-
// )}
|
|
119
|
-
// </Form>
|
|
120
|
-
// );
|
|
121
|
-
// };
|
|
55
|
+
var _default = SimpleSelect;
|
|
122
56
|
exports.default = _default;
|
package/components/text/index.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _material = require("@mui/material");
|
|
11
|
-
var _excluded = ["children", "bold", "semibold", "color", "variant", "link", "fontWeight", "sx"];
|
|
11
|
+
var _excluded = ["children", "bold", "semibold", "color", "variant", "link", "fontWeight", "sx", "component"];
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
14
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -43,9 +43,12 @@ var Text = function Text(_ref) {
|
|
|
43
43
|
link = _ref.link,
|
|
44
44
|
fontWeight = _ref.fontWeight,
|
|
45
45
|
sx = _ref.sx,
|
|
46
|
+
_ref$component = _ref.component,
|
|
47
|
+
component = _ref$component === void 0 ? "p" : _ref$component,
|
|
46
48
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
47
49
|
var theme = (0, _material.useTheme)();
|
|
48
50
|
return /*#__PURE__*/_react.default.createElement(_material.Typography, _extends({
|
|
51
|
+
component: component,
|
|
49
52
|
variant: variant === "title" ? "h6" : variant === "subtitle" ? "body2" : variant,
|
|
50
53
|
fontWeight: bold ? "bold" : semibold || variant === "title" ? 600 : fontWeight,
|
|
51
54
|
color: link ? "primary" : getColor(color, theme)
|
|
@@ -58,7 +61,7 @@ var Text = function Text(_ref) {
|
|
|
58
61
|
Text.propTypes = {
|
|
59
62
|
bold: _propTypes.default.bool,
|
|
60
63
|
semibold: _propTypes.default.bool,
|
|
61
|
-
variant: _propTypes.default.oneOf(["
|
|
64
|
+
variant: _propTypes.default.oneOf(["body1", "body2", "button", "caption", "h1", "h2", "h3", "h4", "h5", "h6", "inherit", "overline", "subtitle1", "subtitle2", "subtitle", "title"])
|
|
62
65
|
};
|
|
63
66
|
var _default = Text;
|
|
64
67
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tenjin-ui-kit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.57",
|
|
4
4
|
"repository": {
|
|
5
|
-
"url": "https://gitlab.com/yethi/react/tenjin-ui-kit.git"
|
|
5
|
+
"url": "git+https://gitlab.com/yethi/react/tenjin-ui-kit.git"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@floating-ui/dom": "^1.2.1",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"final-form": "^4.20.9",
|
|
24
24
|
"material-ui-popup-state": "^5.0.8",
|
|
25
25
|
"moment": "^2.29.4",
|
|
26
|
+
"npm-run-all": "^4.1.5",
|
|
26
27
|
"react-beautiful-dnd": "^13.1.1",
|
|
27
28
|
"react-dnd": "^16.0.1",
|
|
28
29
|
"react-dnd-html5-backend": "^16.0.1",
|
|
@@ -49,7 +50,9 @@
|
|
|
49
50
|
"storybook": "start-storybook -p 6006 -s public",
|
|
50
51
|
"build-storybook": "build-storybook -s public",
|
|
51
52
|
"clean": "rimraf dist",
|
|
52
|
-
"compile": "npm run clean && cross-env NODE_ENV=production babel src/package --out-dir dist --copy-files --ignore __tests__,spec.js,test.js,stories.js,__snapshots__"
|
|
53
|
+
"compile": "npm run clean && cross-env NODE_ENV=production babel src/package --out-dir dist --copy-files --ignore __tests__,spec.js,test.js,stories.js,__snapshots__",
|
|
54
|
+
"copy-and-publish": "copy package.json dist && copy README.md dist && cd dist && npm publish --tag dev",
|
|
55
|
+
"publish-dev": "npm-run-all compile copy-and-publish"
|
|
53
56
|
},
|
|
54
57
|
"eslintConfig": {
|
|
55
58
|
"extends": [
|