tenjin-ui-kit 0.2.183 → 0.2.185
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,32 @@ 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
|
|
149
|
+
backgroundColor: "white",
|
|
150
|
+
height: "2.188rem",
|
|
151
|
+
margin: 0,
|
|
152
|
+
width: "100%",
|
|
153
|
+
border: "1px solid #949494",
|
|
154
|
+
borderRadius: "4px",
|
|
155
|
+
boxShadow: "0px 2px 4px rgba(0, 0, 0, 0.1)"
|
|
132
156
|
},
|
|
133
|
-
size: "small",
|
|
134
|
-
autoFocus: false,
|
|
135
157
|
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
158
|
onChange: function onChange(e) {
|
|
143
159
|
return setSearchText(e.target.value);
|
|
144
160
|
},
|
|
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, {
|
|
161
|
+
onKeyDown: handleKeyDown
|
|
162
|
+
})), isClearOption && !loading && /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
152
163
|
value: ""
|
|
153
164
|
}, /*#__PURE__*/_react.default.createElement("em", {
|
|
154
165
|
style: {
|
|
@@ -171,66 +182,5 @@ var SimpleSelect = function SimpleSelect(_ref) {
|
|
|
171
182
|
}, option.label);
|
|
172
183
|
})), error && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, errorMessage), helperText && /*#__PURE__*/_react.default.createElement(_material.FormHelperText, null, helperText)));
|
|
173
184
|
};
|
|
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
|
-
// };
|
|
185
|
+
var _default = SimpleSelect;
|
|
236
186
|
exports.default = _default;
|