tenjin-ui-kit 0.2.183 → 0.2.184
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.
|
@@ -89,6 +89,18 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
89
89
|
});
|
|
90
90
|
}, [options, searchText, isSearch]);
|
|
91
91
|
var recommendedOptions = isSearch ? displayedOptions : options;
|
|
92
|
+
var typingTimer;
|
|
93
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
94
|
+
clearTimeout(typingTimer);
|
|
95
|
+
if (e.key !== "Escape") {
|
|
96
|
+
if (e.key !== "ArrowDown" && e.key !== "ArrowUp") {
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
}
|
|
99
|
+
typingTimer = setTimeout(function () {
|
|
100
|
+
clearTimeout(typingTimer);
|
|
101
|
+
}, 500);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
92
104
|
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_material.FormControl, {
|
|
93
105
|
sx: {
|
|
94
106
|
minWidth: 120
|
|
@@ -122,33 +134,31 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
122
134
|
}
|
|
123
135
|
}
|
|
124
136
|
}
|
|
125
|
-
}), isSearch && /*#__PURE__*/_react.default.createElement(
|
|
137
|
+
}), isSearch && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", {
|
|
126
138
|
id: "search-box",
|
|
127
|
-
|
|
139
|
+
type: "text",
|
|
140
|
+
autoFocus: true,
|
|
141
|
+
style: {
|
|
142
|
+
paddingLeft: "2.5rem",
|
|
143
|
+
background: 'url("https://static.thenounproject.com/png/101791-200.png") no-repeat left',
|
|
144
|
+
backgroundPosition: "0.875rem center",
|
|
145
|
+
backgroundSize: "1.125rem",
|
|
128
146
|
position: "sticky",
|
|
129
147
|
top: 0,
|
|
130
148
|
zIndex: 9999,
|
|
131
|
-
backgroundColor: "white !important"
|
|
149
|
+
backgroundColor: "white !important",
|
|
150
|
+
height: "2.188rem",
|
|
151
|
+
margin: 0,
|
|
152
|
+
width: "100%",
|
|
153
|
+
border: "1px solid #949494",
|
|
154
|
+
borderRadius: "4px"
|
|
132
155
|
},
|
|
133
|
-
size: "small",
|
|
134
|
-
autoFocus: false,
|
|
135
156
|
placeholder: "Type to search...",
|
|
136
|
-
fullWidth: true,
|
|
137
|
-
InputProps: {
|
|
138
|
-
startAdornment: /*#__PURE__*/_react.default.createElement(_material.InputAdornment, {
|
|
139
|
-
position: "start"
|
|
140
|
-
}, /*#__PURE__*/_react.default.createElement(_Search.default, null))
|
|
141
|
-
},
|
|
142
157
|
onChange: function onChange(e) {
|
|
143
158
|
return setSearchText(e.target.value);
|
|
144
159
|
},
|
|
145
|
-
onKeyDown:
|
|
146
|
-
|
|
147
|
-
// Prevents autoselecting item while typing (default Select behaviour)
|
|
148
|
-
e.stopPropagation();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}), isClearOption && !loading && /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
160
|
+
onKeyDown: handleKeyDown
|
|
161
|
+
})), isClearOption && !loading && /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
152
162
|
value: ""
|
|
153
163
|
}, /*#__PURE__*/_react.default.createElement("em", {
|
|
154
164
|
style: {
|
|
@@ -171,66 +181,5 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
171
181
|
}, option.label);
|
|
172
182
|
})), error && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, errorMessage), helperText && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, helperText)));
|
|
173
183
|
};
|
|
174
|
-
var _default = SimpleSelect;
|
|
175
|
-
// { value: "option1", label: "Option 1" },
|
|
176
|
-
// { value: "option2", label: "Option 2" },
|
|
177
|
-
// // ... other options
|
|
178
|
-
// ];
|
|
179
|
-
// export const MyForm = () => {
|
|
180
|
-
// const validateForm = (values, mandatoryFields) => {
|
|
181
|
-
// let errors = {};
|
|
182
|
-
// if (mandatoryFields) {
|
|
183
|
-
// mandatoryFields.forEach((field) => {
|
|
184
|
-
// if (!values[field]) errors[field] = "Required";
|
|
185
|
-
// });
|
|
186
|
-
// }
|
|
187
|
-
// return errors;
|
|
188
|
-
// };
|
|
189
|
-
// const validate = (values) => {
|
|
190
|
-
// const errors = validateForm(values, ["text", "select"]);
|
|
191
|
-
// return errors;
|
|
192
|
-
// };
|
|
193
|
-
// const Submit = (values) => {
|
|
194
|
-
// console.log(values, "values");
|
|
195
|
-
// };
|
|
196
|
-
// return (
|
|
197
|
-
// <Form onSubmit={Submit} validate={validate}>
|
|
198
|
-
// {({ handleSubmit }) => (
|
|
199
|
-
// <form onSubmit={handleSubmit}>
|
|
200
|
-
// {/* Other form fields */}
|
|
201
|
-
// <Field
|
|
202
|
-
// name="text"
|
|
203
|
-
// render={({ input, meta }) => (
|
|
204
|
-
// <Input
|
|
205
|
-
// autoFocus="autofocus"
|
|
206
|
-
// isRequired
|
|
207
|
-
// {...input}
|
|
208
|
-
// // isDisabled={props.type === 'edit' && true}
|
|
209
|
-
// size="normal"
|
|
210
|
-
// placeholder="Test Cycle Name"
|
|
211
|
-
// fullWidth
|
|
212
|
-
// label="Name"
|
|
213
|
-
// error={meta.touched && meta.error ? true : false}
|
|
214
|
-
// errorMessage={meta.touched && meta.error ? meta.error : null}
|
|
215
|
-
// />
|
|
216
|
-
// )}
|
|
217
|
-
// />
|
|
218
|
-
// <Field
|
|
219
|
-
// name="select"
|
|
220
|
-
// render={({ input, meta }) => (
|
|
221
|
-
// <MUISelectField
|
|
222
|
-
// {...input}
|
|
223
|
-
// // isDisabled={props.type === 'edit' && true}
|
|
224
|
-
// options={options}
|
|
225
|
-
// error={meta.touched && meta.error}
|
|
226
|
-
// errorMessage={meta.touched && meta.error ? meta.error : null}
|
|
227
|
-
// />
|
|
228
|
-
// )}
|
|
229
|
-
// />
|
|
230
|
-
// <button type="submit">Submit</button>
|
|
231
|
-
// </form>
|
|
232
|
-
// )}
|
|
233
|
-
// </Form>
|
|
234
|
-
// );
|
|
235
|
-
// };
|
|
184
|
+
var _default = SimpleSelect;
|
|
236
185
|
exports.default = _default;
|