tenjin-ui-kit 0.3.73 → 0.3.76
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/README.md +13 -13
- package/components/RightContext/index.css +20 -20
- package/components/browsingTestCaseLayout/style.css +82 -82
- package/components/combobox/index.js +116 -116
- package/components/input/index.js +27 -33
- package/components/optionMenu/index.js +25 -25
- package/http/index.js +1 -1
- package/package.json +127 -125
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Tenjin UI Kit
|
|
2
|
-
|
|
3
|
-
The Tenjin UI kit ships a set of pre-built components that can be used while building user interfaces for Tenjin.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
In the project directory, you can run:
|
|
8
|
-
|
|
9
|
-
npm install tenjin-ui-kit
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
The [Tenjin UI Kit](https://tenjin-ui-kit.netlify.app) storybook gives clear documentation on how to use the Tenjin UI Kit.
|
|
1
|
+
# Tenjin UI Kit
|
|
2
|
+
|
|
3
|
+
The Tenjin UI kit ships a set of pre-built components that can be used while building user interfaces for Tenjin.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
npm install tenjin-ui-kit
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
The [Tenjin UI Kit](https://tenjin-ui-kit.netlify.app) storybook gives clear documentation on how to use the Tenjin UI Kit.
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
.contextContainer {
|
|
2
|
-
z-index: 1;
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 500px;
|
|
5
|
-
background: #673ab7;
|
|
6
|
-
}
|
|
7
|
-
.rightClick {
|
|
8
|
-
z-index: 12;
|
|
9
|
-
position: fixed;
|
|
10
|
-
background: rgb(240, 200, 1);
|
|
11
|
-
}
|
|
12
|
-
.menuElement {
|
|
13
|
-
color: #222222;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
padding: 17px 36px;
|
|
16
|
-
}
|
|
17
|
-
.menuElement:hover {
|
|
18
|
-
color: #fff;
|
|
19
|
-
background: #009688;
|
|
20
|
-
}
|
|
1
|
+
.contextContainer {
|
|
2
|
+
z-index: 1;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 500px;
|
|
5
|
+
background: #673ab7;
|
|
6
|
+
}
|
|
7
|
+
.rightClick {
|
|
8
|
+
z-index: 12;
|
|
9
|
+
position: fixed;
|
|
10
|
+
background: rgb(240, 200, 1);
|
|
11
|
+
}
|
|
12
|
+
.menuElement {
|
|
13
|
+
color: #222222;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
padding: 17px 36px;
|
|
16
|
+
}
|
|
17
|
+
.menuElement:hover {
|
|
18
|
+
color: #fff;
|
|
19
|
+
background: #009688;
|
|
20
|
+
}
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--box-width: 200px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
body {
|
|
6
|
-
margin: 40px;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.wrapper {
|
|
10
|
-
background-color: #fff;
|
|
11
|
-
color: #444;
|
|
12
|
-
display: flex;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.box {
|
|
16
|
-
background-color: #444;
|
|
17
|
-
color: #fff;
|
|
18
|
-
border-radius: 5px;
|
|
19
|
-
padding: 20px;
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
|
|
22
|
-
box-sizing: border-box;
|
|
23
|
-
|
|
24
|
-
flex: 1 1 auto;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.handler {
|
|
28
|
-
width: 20px;
|
|
29
|
-
padding: 0;
|
|
30
|
-
cursor: ew-resize;
|
|
31
|
-
flex: 0 0 auto;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.handler::before {
|
|
35
|
-
content: "";
|
|
36
|
-
display: block;
|
|
37
|
-
width: 2px;
|
|
38
|
-
height: calc(100vh - 34px);
|
|
39
|
-
background: #c0c0c0;
|
|
40
|
-
margin: 0 auto;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.arrowButton {
|
|
44
|
-
display: flex;
|
|
45
|
-
justify-content: flex-end;
|
|
46
|
-
/* transition: 0.4s; */
|
|
47
|
-
width: 100%;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.verticalText {
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
justify-content: center;
|
|
54
|
-
writing-mode: vertical-lr;
|
|
55
|
-
text-orientation: mixed;
|
|
56
|
-
transform: rotate(180deg);
|
|
57
|
-
font-size: 1.3rem;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.leftWrapper {
|
|
61
|
-
background-color: #fff;
|
|
62
|
-
color: black;
|
|
63
|
-
border-radius: 5px;
|
|
64
|
-
padding: 0rem 0.5rem;
|
|
65
|
-
font-size: 12px;
|
|
66
|
-
box-sizing: border-box;
|
|
67
|
-
flex: 1 1 auto;
|
|
68
|
-
min-width: var(--box-width);
|
|
69
|
-
flex-grow: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.rightWrapper {
|
|
73
|
-
background-color: #fff;
|
|
74
|
-
color: black;
|
|
75
|
-
border-radius: 5px;
|
|
76
|
-
padding: 0rem 0.5rem;
|
|
77
|
-
font-size: 12px;
|
|
78
|
-
box-sizing: border-box;
|
|
79
|
-
flex: 1 1 auto;
|
|
80
|
-
min-width: var(--box-width);
|
|
81
|
-
flex-grow: 1;
|
|
82
|
-
}
|
|
1
|
+
:root {
|
|
2
|
+
--box-width: 200px;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
body {
|
|
6
|
+
margin: 40px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.wrapper {
|
|
10
|
+
background-color: #fff;
|
|
11
|
+
color: #444;
|
|
12
|
+
display: flex;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.box {
|
|
16
|
+
background-color: #444;
|
|
17
|
+
color: #fff;
|
|
18
|
+
border-radius: 5px;
|
|
19
|
+
padding: 20px;
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
|
|
24
|
+
flex: 1 1 auto;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.handler {
|
|
28
|
+
width: 20px;
|
|
29
|
+
padding: 0;
|
|
30
|
+
cursor: ew-resize;
|
|
31
|
+
flex: 0 0 auto;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.handler::before {
|
|
35
|
+
content: "";
|
|
36
|
+
display: block;
|
|
37
|
+
width: 2px;
|
|
38
|
+
height: calc(100vh - 34px);
|
|
39
|
+
background: #c0c0c0;
|
|
40
|
+
margin: 0 auto;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.arrowButton {
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: flex-end;
|
|
46
|
+
/* transition: 0.4s; */
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.verticalText {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
writing-mode: vertical-lr;
|
|
55
|
+
text-orientation: mixed;
|
|
56
|
+
transform: rotate(180deg);
|
|
57
|
+
font-size: 1.3rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.leftWrapper {
|
|
61
|
+
background-color: #fff;
|
|
62
|
+
color: black;
|
|
63
|
+
border-radius: 5px;
|
|
64
|
+
padding: 0rem 0.5rem;
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
flex: 1 1 auto;
|
|
68
|
+
min-width: var(--box-width);
|
|
69
|
+
flex-grow: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rightWrapper {
|
|
73
|
+
background-color: #fff;
|
|
74
|
+
color: black;
|
|
75
|
+
border-radius: 5px;
|
|
76
|
+
padding: 0rem 0.5rem;
|
|
77
|
+
font-size: 12px;
|
|
78
|
+
box-sizing: border-box;
|
|
79
|
+
flex: 1 1 auto;
|
|
80
|
+
min-width: var(--box-width);
|
|
81
|
+
flex-grow: 1;
|
|
82
|
+
}
|
|
@@ -219,144 +219,144 @@ const Combobox = _ref5 => {
|
|
|
219
219
|
}, helperText));
|
|
220
220
|
};
|
|
221
221
|
Combobox.propTypes = {
|
|
222
|
-
/**
|
|
223
|
-
* Array of option objects to display in the dropdown.
|
|
224
|
-
* Each option should be an object containing at minimum the key specified by `by` prop
|
|
225
|
-
* and the key specified by `labelKey` prop.
|
|
226
|
-
*
|
|
227
|
-
* @example
|
|
228
|
-
* options={[
|
|
229
|
-
* { id: 1, label: "Option 1", value: "opt1" },
|
|
230
|
-
* { id: 2, label: "Option 2", value: "opt2" }
|
|
231
|
-
* ]}
|
|
222
|
+
/**
|
|
223
|
+
* Array of option objects to display in the dropdown.
|
|
224
|
+
* Each option should be an object containing at minimum the key specified by `by` prop
|
|
225
|
+
* and the key specified by `labelKey` prop.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* options={[
|
|
229
|
+
* { id: 1, label: "Option 1", value: "opt1" },
|
|
230
|
+
* { id: 2, label: "Option 2", value: "opt2" }
|
|
231
|
+
* ]}
|
|
232
232
|
*/
|
|
233
233
|
options: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
234
|
-
/**
|
|
235
|
-
* Controlled selected value. When provided, the component operates in controlled mode.
|
|
236
|
-
* Should be one of the objects from the `options` array.
|
|
237
|
-
* The component will match this object to options using the `by` prop.
|
|
238
|
-
*
|
|
239
|
-
* @example
|
|
240
|
-
* selected={{ id: 1, label: "Option 1" }}
|
|
234
|
+
/**
|
|
235
|
+
* Controlled selected value. When provided, the component operates in controlled mode.
|
|
236
|
+
* Should be one of the objects from the `options` array.
|
|
237
|
+
* The component will match this object to options using the `by` prop.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* selected={{ id: 1, label: "Option 1" }}
|
|
241
241
|
*/
|
|
242
242
|
selected: _propTypes.default.object,
|
|
243
|
-
/**
|
|
244
|
-
* Default value for uncontrolled mode. Can be either:
|
|
245
|
-
* - A complete option object from the options array
|
|
246
|
-
* - A primitive value (string/number) matching the `by` key of an option
|
|
247
|
-
*
|
|
248
|
-
* The component will automatically find and select the matching option from the options array.
|
|
249
|
-
* This prop is only used for initial render and is ignored if `selected` prop is provided.
|
|
250
|
-
*
|
|
251
|
-
* @example
|
|
252
|
-
* // Using a primitive ID
|
|
253
|
-
* defaultValue={1}
|
|
254
|
-
*
|
|
255
|
-
* // Using a complete object
|
|
256
|
-
* defaultValue={{ id: 1, label: "Option 1" }}
|
|
243
|
+
/**
|
|
244
|
+
* Default value for uncontrolled mode. Can be either:
|
|
245
|
+
* - A complete option object from the options array
|
|
246
|
+
* - A primitive value (string/number) matching the `by` key of an option
|
|
247
|
+
*
|
|
248
|
+
* The component will automatically find and select the matching option from the options array.
|
|
249
|
+
* This prop is only used for initial render and is ignored if `selected` prop is provided.
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* // Using a primitive ID
|
|
253
|
+
* defaultValue={1}
|
|
254
|
+
*
|
|
255
|
+
* // Using a complete object
|
|
256
|
+
* defaultValue={{ id: 1, label: "Option 1" }}
|
|
257
257
|
*/
|
|
258
258
|
defaultValue: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string, _propTypes.default.number]),
|
|
259
|
-
/**
|
|
260
|
-
* Label text to display above the combobox input field.
|
|
261
|
-
* If not provided, no label will be rendered.
|
|
262
|
-
*
|
|
263
|
-
* @example
|
|
264
|
-
* label="Select a category"
|
|
259
|
+
/**
|
|
260
|
+
* Label text to display above the combobox input field.
|
|
261
|
+
* If not provided, no label will be rendered.
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* label="Select a category"
|
|
265
265
|
*/
|
|
266
266
|
label: _propTypes.default.string,
|
|
267
|
-
/**
|
|
268
|
-
* HTML id attribute for the input element.
|
|
269
|
-
* Useful for accessibility (connecting labels) and form handling.
|
|
270
|
-
*
|
|
271
|
-
* @example
|
|
272
|
-
* id="category-select"
|
|
267
|
+
/**
|
|
268
|
+
* HTML id attribute for the input element.
|
|
269
|
+
* Useful for accessibility (connecting labels) and form handling.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* id="category-select"
|
|
273
273
|
*/
|
|
274
274
|
id: _propTypes.default.string,
|
|
275
|
-
/**
|
|
276
|
-
* Indicates if the field is required.
|
|
277
|
-
* When true, displays a red asterisk (*) next to the label.
|
|
278
|
-
* Note: This is only visual - you must handle validation separately.
|
|
279
|
-
*
|
|
280
|
-
* @example
|
|
281
|
-
* isRequired={true}
|
|
275
|
+
/**
|
|
276
|
+
* Indicates if the field is required.
|
|
277
|
+
* When true, displays a red asterisk (*) next to the label.
|
|
278
|
+
* Note: This is only visual - you must handle validation separately.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* isRequired={true}
|
|
282
282
|
*/
|
|
283
283
|
isRequired: _propTypes.default.bool,
|
|
284
|
-
/**
|
|
285
|
-
* Callback function invoked when the selected value changes.
|
|
286
|
-
* Receives the complete selected option object as its argument (not just the ID).
|
|
287
|
-
* Called with `null` when selection is cleared.
|
|
288
|
-
*
|
|
289
|
-
* @param {Object|null} selectedOption - The complete selected option object or null
|
|
290
|
-
*
|
|
291
|
-
* @example
|
|
292
|
-
* onChange={(option) => {
|
|
293
|
-
* console.log("Selected:", option);
|
|
294
|
-
* // option will be like: { id: 1, label: "Option 1", value: "opt1" }
|
|
295
|
-
* }}
|
|
284
|
+
/**
|
|
285
|
+
* Callback function invoked when the selected value changes.
|
|
286
|
+
* Receives the complete selected option object as its argument (not just the ID).
|
|
287
|
+
* Called with `null` when selection is cleared.
|
|
288
|
+
*
|
|
289
|
+
* @param {Object|null} selectedOption - The complete selected option object or null
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* onChange={(option) => {
|
|
293
|
+
* console.log("Selected:", option);
|
|
294
|
+
* // option will be like: { id: 1, label: "Option 1", value: "opt1" }
|
|
295
|
+
* }}
|
|
296
296
|
*/
|
|
297
297
|
onChange: _propTypes.default.func,
|
|
298
|
-
/**
|
|
299
|
-
* Error state flag. When true:
|
|
300
|
-
* - Input border becomes red
|
|
301
|
-
* - Helper text (if provided) becomes red
|
|
302
|
-
* - Dropdown icon becomes red
|
|
303
|
-
* Use this to indicate validation errors.
|
|
304
|
-
*
|
|
305
|
-
* @example
|
|
306
|
-
* error={formErrors.category !== undefined}
|
|
298
|
+
/**
|
|
299
|
+
* Error state flag. When true:
|
|
300
|
+
* - Input border becomes red
|
|
301
|
+
* - Helper text (if provided) becomes red
|
|
302
|
+
* - Dropdown icon becomes red
|
|
303
|
+
* Use this to indicate validation errors.
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* error={formErrors.category !== undefined}
|
|
307
307
|
*/
|
|
308
308
|
error: _propTypes.default.bool,
|
|
309
|
-
/**
|
|
310
|
-
* Helper text displayed below the input field.
|
|
311
|
-
* Can be used for:
|
|
312
|
-
* - Field descriptions/instructions (when error is false)
|
|
313
|
-
* - Error messages (when error is true)
|
|
314
|
-
* Color automatically adjusts based on error state.
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* helperText={error ? "Please select a category" : "Choose your preferred category"}
|
|
309
|
+
/**
|
|
310
|
+
* Helper text displayed below the input field.
|
|
311
|
+
* Can be used for:
|
|
312
|
+
* - Field descriptions/instructions (when error is false)
|
|
313
|
+
* - Error messages (when error is true)
|
|
314
|
+
* Color automatically adjusts based on error state.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* helperText={error ? "Please select a category" : "Choose your preferred category"}
|
|
318
318
|
*/
|
|
319
319
|
helperText: _propTypes.default.string,
|
|
320
|
-
/**
|
|
321
|
-
* Loading state flag. When true:
|
|
322
|
-
* - Displays a loading spinner instead of dropdown arrow
|
|
323
|
-
* - Shows "Loading..." placeholder text
|
|
324
|
-
* - Disables the input (prevents user interaction)
|
|
325
|
-
* - Prevents dropdown from opening
|
|
326
|
-
* - Input background becomes gray
|
|
327
|
-
*
|
|
328
|
-
* Use this when fetching options from an API or performing async operations.
|
|
329
|
-
*
|
|
330
|
-
* @example
|
|
331
|
-
* loading={isLoadingOptions}
|
|
320
|
+
/**
|
|
321
|
+
* Loading state flag. When true:
|
|
322
|
+
* - Displays a loading spinner instead of dropdown arrow
|
|
323
|
+
* - Shows "Loading..." placeholder text
|
|
324
|
+
* - Disables the input (prevents user interaction)
|
|
325
|
+
* - Prevents dropdown from opening
|
|
326
|
+
* - Input background becomes gray
|
|
327
|
+
*
|
|
328
|
+
* Use this when fetching options from an API or performing async operations.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* loading={isLoadingOptions}
|
|
332
332
|
*/
|
|
333
333
|
loading: _propTypes.default.bool,
|
|
334
|
-
/**
|
|
335
|
-
* Property name to use as the unique identifier for options.
|
|
336
|
-
* Used for:
|
|
337
|
-
* - Comparing options for equality (isOptionEqualToValue)
|
|
338
|
-
* - Matching defaultValue when it's a primitive
|
|
339
|
-
* - React keys in the options list
|
|
340
|
-
*
|
|
341
|
-
* Each option object must have this property and it should be unique.
|
|
342
|
-
*
|
|
343
|
-
* @default "id"
|
|
344
|
-
* @example
|
|
345
|
-
* by="userId"
|
|
346
|
-
* // Then options would be: [{ userId: 1, name: "John" }, ...]
|
|
334
|
+
/**
|
|
335
|
+
* Property name to use as the unique identifier for options.
|
|
336
|
+
* Used for:
|
|
337
|
+
* - Comparing options for equality (isOptionEqualToValue)
|
|
338
|
+
* - Matching defaultValue when it's a primitive
|
|
339
|
+
* - React keys in the options list
|
|
340
|
+
*
|
|
341
|
+
* Each option object must have this property and it should be unique.
|
|
342
|
+
*
|
|
343
|
+
* @default "id"
|
|
344
|
+
* @example
|
|
345
|
+
* by="userId"
|
|
346
|
+
* // Then options would be: [{ userId: 1, name: "John" }, ...]
|
|
347
347
|
*/
|
|
348
348
|
by: _propTypes.default.string,
|
|
349
|
-
/**
|
|
350
|
-
* Property name to use for displaying option text.
|
|
351
|
-
* This value is shown in:
|
|
352
|
-
* - The dropdown options list
|
|
353
|
-
* - The input field when an option is selected
|
|
354
|
-
* - The filtered search results
|
|
355
|
-
*
|
|
356
|
-
* @default "label"
|
|
357
|
-
* @example
|
|
358
|
-
* labelKey="name"
|
|
359
|
-
* // Then options would be: [{ id: 1, name: "Option 1" }, ...]
|
|
349
|
+
/**
|
|
350
|
+
* Property name to use for displaying option text.
|
|
351
|
+
* This value is shown in:
|
|
352
|
+
* - The dropdown options list
|
|
353
|
+
* - The input field when an option is selected
|
|
354
|
+
* - The filtered search results
|
|
355
|
+
*
|
|
356
|
+
* @default "label"
|
|
357
|
+
* @example
|
|
358
|
+
* labelKey="name"
|
|
359
|
+
* // Then options would be: [{ id: 1, name: "Option 1" }, ...]
|
|
360
360
|
*/
|
|
361
361
|
labelKey: _propTypes.default.string
|
|
362
362
|
};
|
|
@@ -34,7 +34,7 @@ const Input = _ref => {
|
|
|
34
34
|
autoFocus,
|
|
35
35
|
onBlurDelay,
|
|
36
36
|
onChange,
|
|
37
|
-
|
|
37
|
+
validationRegex = null,
|
|
38
38
|
...rest
|
|
39
39
|
} = _ref;
|
|
40
40
|
const inputRef = (0, _react.useRef)(null);
|
|
@@ -44,43 +44,36 @@ const Input = _ref => {
|
|
|
44
44
|
const showError = message => setLocalErrorMessage(message);
|
|
45
45
|
const clearError = () => setLocalErrorMessage("");
|
|
46
46
|
const validateRestrictiveCharacters = e => {
|
|
47
|
-
|
|
48
|
-
let {
|
|
47
|
+
const {
|
|
49
48
|
value
|
|
50
|
-
} = e.target;
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
} = e.target; //similar to e.target.value but destructured for clarity
|
|
50
|
+
|
|
51
|
+
// If no validationRegex is provided, just call onChange and return
|
|
52
|
+
if (!validationRegex) {
|
|
53
|
+
onChange?.(e);
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
|
-
const
|
|
56
|
+
const validationPattern = new RegExp(
|
|
57
|
+
// Create a new RegExp to ensure the global flag is present
|
|
58
|
+
validationRegex.source, validationRegex.flags.includes("g") ? validationRegex.flags : `${validationRegex.flags}g`);
|
|
59
|
+
const filteredValue = value.replace(validationPattern, ""); // Remove invalid characters from the input value
|
|
56
60
|
if (filteredValue !== value) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
if (onChange) {
|
|
64
|
-
onChange({
|
|
65
|
-
...e,
|
|
66
|
-
target: {
|
|
67
|
-
...e.target,
|
|
68
|
-
value: filteredValue
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
61
|
+
// If the filtered value is different from the original value, it means there are invalid characters
|
|
62
|
+
const invalidCharacters = [...new Set(value.match(validationPattern) || []) // Get unique invalid characters and store them in an array using spread operator and Set to ensure uniqueness
|
|
63
|
+
];
|
|
64
|
+
showError(
|
|
65
|
+
// Show an error message based on the number of invalid characters found
|
|
66
|
+
invalidCharacters.length === 1 ? `The character ${invalidCharacters[0]} is not allowed.` : `The characters ${invalidCharacters.join(" ")} are not allowed.`);
|
|
72
67
|
} else {
|
|
73
|
-
clearError();
|
|
74
|
-
if (onChange) {
|
|
75
|
-
onChange({
|
|
76
|
-
...e,
|
|
77
|
-
target: {
|
|
78
|
-
...e.target,
|
|
79
|
-
value
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
68
|
+
clearError(); // Clear the error message if there are no invalid characters
|
|
83
69
|
}
|
|
70
|
+
onChange?.({
|
|
71
|
+
...e,
|
|
72
|
+
target: {
|
|
73
|
+
...e.target,
|
|
74
|
+
value: filteredValue
|
|
75
|
+
} // Call onChange with the filtered value to ensure that the input value is updated correctly
|
|
76
|
+
});
|
|
84
77
|
};
|
|
85
78
|
return /*#__PURE__*/_react.default.createElement(_FormControl.default, {
|
|
86
79
|
variant: "standard",
|
|
@@ -155,6 +148,7 @@ Input.propTypes = {
|
|
|
155
148
|
isDisabled: _propTypes.default.bool,
|
|
156
149
|
readOnly: _propTypes.default.bool,
|
|
157
150
|
// Added readOnly prop type
|
|
158
|
-
autoFocus: _propTypes.default.bool
|
|
151
|
+
autoFocus: _propTypes.default.bool,
|
|
152
|
+
validationRegex: _propTypes.default.instanceOf(RegExp)
|
|
159
153
|
};
|
|
160
154
|
var _default = exports.default = Input;
|
|
@@ -12,31 +12,31 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
12
12
|
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); }
|
|
13
13
|
const ITEM_HEIGHT = 500;
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
*
|
|
17
|
-
* @param {{
|
|
18
|
-
* options: Array<{
|
|
19
|
-
* name: String | Number,
|
|
20
|
-
* displayName: String,
|
|
21
|
-
* onClick: (name: String | Number, optionId: String | Number) => void,
|
|
22
|
-
* visibility?: boolean,
|
|
23
|
-
* divider?: boolean
|
|
24
|
-
* }>,
|
|
25
|
-
* optionId?: String | Number,
|
|
26
|
-
* }} props
|
|
27
|
-
* @description
|
|
28
|
-
* options: provide this object in an array for options
|
|
29
|
-
* {
|
|
30
|
-
* name, displayName , onClick, visibility, divider
|
|
31
|
-
* }
|
|
32
|
-
* name: name for Menuoption it will act like ID
|
|
33
|
-
* displayname: To display name
|
|
34
|
-
* onClick: Accepts a callbac function, this function will provide name in parameter
|
|
35
|
-
* visibility: (optional) if set to false, the option will be disabled
|
|
36
|
-
* divider: (optional) if set to true, a divider line will be displayed after the MenuItem
|
|
37
|
-
*
|
|
38
|
-
* optionId: Provide an option ID to get it as 2nd parameter of callback function
|
|
39
|
-
* @returns An option component
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param {{
|
|
18
|
+
* options: Array<{
|
|
19
|
+
* name: String | Number,
|
|
20
|
+
* displayName: String,
|
|
21
|
+
* onClick: (name: String | Number, optionId: String | Number) => void,
|
|
22
|
+
* visibility?: boolean,
|
|
23
|
+
* divider?: boolean
|
|
24
|
+
* }>,
|
|
25
|
+
* optionId?: String | Number,
|
|
26
|
+
* }} props
|
|
27
|
+
* @description
|
|
28
|
+
* options: provide this object in an array for options
|
|
29
|
+
* {
|
|
30
|
+
* name, displayName , onClick, visibility, divider
|
|
31
|
+
* }
|
|
32
|
+
* name: name for Menuoption it will act like ID
|
|
33
|
+
* displayname: To display name
|
|
34
|
+
* onClick: Accepts a callbac function, this function will provide name in parameter
|
|
35
|
+
* visibility: (optional) if set to false, the option will be disabled
|
|
36
|
+
* divider: (optional) if set to true, a divider line will be displayed after the MenuItem
|
|
37
|
+
*
|
|
38
|
+
* optionId: Provide an option ID to get it as 2nd parameter of callback function
|
|
39
|
+
* @returns An option component
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
42
|
const OptionMenu = _ref => {
|
package/http/index.js
CHANGED
|
@@ -122,7 +122,7 @@ const parseAxiosError = error => {
|
|
|
122
122
|
...parsedError,
|
|
123
123
|
status: error.response.status,
|
|
124
124
|
statusText: error.response.statusText,
|
|
125
|
-
message: error.response.status === 503 ? error.response.data.message ?? "A network error occurred. Please try again" : error.response.status === 401 ? "Authentication Failed" : error.response.data ? error.response.data.message
|
|
125
|
+
message: error.response.status === 503 ? error.response.data.message ?? "A network error occurred. Please try again" : error.response.status === 401 ? "Authentication Failed" : error.response.data ? error.response.data.message || error.response.data.detail || "An unexpected error occurred while processing your request. Please try again. If problem persists, please contact Tenjin support" : "An unexpected error occurred while processing your request. Please try again. If problem persists, please contact Tenjin support"
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
return parsedError;
|
package/package.json
CHANGED
|
@@ -1,125 +1,127 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tenjin-ui-kit",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"repository": {
|
|
5
|
-
"url": "git+https://gitlab.com/yethi/react/tenjin-ui-kit.git"
|
|
6
|
-
},
|
|
7
|
-
"dependencies": {
|
|
8
|
-
"@floating-ui/dom": "^1.2.1",
|
|
9
|
-
"@mantine/core": "^5.10.1",
|
|
10
|
-
"@mantine/hooks": "^5.10.1",
|
|
11
|
-
"@mantine/rte": "^5.10.1",
|
|
12
|
-
"@mui/icons-material": "^5.11.0",
|
|
13
|
-
"@mui/styles": "^5.11.2",
|
|
14
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
15
|
-
"@testing-library/react": "^13.4.0",
|
|
16
|
-
"@testing-library/user-event": "^13.5.0",
|
|
17
|
-
"aria-hidden": "^1.2.2",
|
|
18
|
-
"axios": "^0.26.0",
|
|
19
|
-
"clsx": "^1.2.1",
|
|
20
|
-
"d3-hierarchy": "^3.1.2",
|
|
21
|
-
"feather-icons": "^4.29.0",
|
|
22
|
-
"final-form": "^4.20.9",
|
|
23
|
-
"material-ui-popup-state": "^5.0.8",
|
|
24
|
-
"moment": "^2.29.4",
|
|
25
|
-
"npm-run-all": "^4.1.5",
|
|
26
|
-
"react-beautiful-dnd": "^13.1.1",
|
|
27
|
-
"react-dnd": "^16.0.1",
|
|
28
|
-
"react-dnd-html5-backend": "^16.0.1",
|
|
29
|
-
"react-dropzone": "^14.2.3",
|
|
30
|
-
"react-feather": "^2.0.10",
|
|
31
|
-
"react-final-form": "^6.5.9",
|
|
32
|
-
"react-flow-renderer": "^10.3.17",
|
|
33
|
-
"react-icons": "^4.10.1",
|
|
34
|
-
"react-moment": "^1.1.3",
|
|
35
|
-
"react-scripts": "5.0.1",
|
|
36
|
-
"react-select": "^5.7.4",
|
|
37
|
-
"react-sortable-hoc": "^2.0.0",
|
|
38
|
-
"reactflow": "^11.6.1",
|
|
39
|
-
"storybook-react-context": "^0.6.0",
|
|
40
|
-
"styled-components": "^5.3.9",
|
|
41
|
-
"uuid": "^9.0.0",
|
|
42
|
-
"web-vitals": "^2.1.4"
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"start": "react-scripts start",
|
|
46
|
-
"build": "react-scripts build",
|
|
47
|
-
"test": "react-scripts test",
|
|
48
|
-
"eject": "react-scripts eject",
|
|
49
|
-
"storybook": "start-storybook -p 6006 -s public",
|
|
50
|
-
"build-storybook": "build-storybook -s public",
|
|
51
|
-
"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
|
-
"copy-and-publish-dev": "copy package.json dist && copy README.md dist && cd dist && npm publish --tag dev",
|
|
54
|
-
"copy-and-publish": "
|
|
55
|
-
"publish-dev": "npm-run-all compile copy-and-publish-dev",
|
|
56
|
-
"publish-prod": "npm-run-all compile copy-and-publish"
|
|
57
|
-
},
|
|
58
|
-
"eslintConfig": {
|
|
59
|
-
"extends": [
|
|
60
|
-
"react-app",
|
|
61
|
-
"react-app/jest"
|
|
62
|
-
],
|
|
63
|
-
"overrides": [
|
|
64
|
-
{
|
|
65
|
-
"files": [
|
|
66
|
-
"**/*.stories.*"
|
|
67
|
-
],
|
|
68
|
-
"rules": {
|
|
69
|
-
"import/no-anonymous-default-export": "off"
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
"browserslist": {
|
|
75
|
-
"production": [
|
|
76
|
-
">0.2%",
|
|
77
|
-
"not dead",
|
|
78
|
-
"not op_mini all"
|
|
79
|
-
],
|
|
80
|
-
"development": [
|
|
81
|
-
"last 1 chrome version",
|
|
82
|
-
"last 1 firefox version",
|
|
83
|
-
"last 1 safari version"
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
"devDependencies": {
|
|
87
|
-
"@babel/cli": "^7.20.7",
|
|
88
|
-
"@babel/preset-env": "^7.20.2",
|
|
89
|
-
"@babel/preset-react": "^7.18.6",
|
|
90
|
-
"@emotion/react": "^11.10.5",
|
|
91
|
-
"@emotion/styled": "^11.10.5",
|
|
92
|
-
"@mui/material": "^5.11.3",
|
|
93
|
-
"@storybook/addon-actions": "^6.5.15",
|
|
94
|
-
"@storybook/addon-essentials": "^6.5.15",
|
|
95
|
-
"@storybook/addon-interactions": "^6.5.15",
|
|
96
|
-
"@storybook/addon-links": "^6.5.15",
|
|
97
|
-
"@storybook/builder-webpack5": "^6.5.15",
|
|
98
|
-
"@storybook/manager-webpack5": "^6.5.15",
|
|
99
|
-
"@storybook/node-logger": "^6.5.15",
|
|
100
|
-
"@storybook/preset-create-react-app": "^4.1.2",
|
|
101
|
-
"@storybook/react": "^6.5.15",
|
|
102
|
-
"@storybook/testing-library": "^0.0.13",
|
|
103
|
-
"ajv": "^8.20.0",
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"react
|
|
109
|
-
"react-
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"@
|
|
117
|
-
"@
|
|
118
|
-
"@
|
|
119
|
-
"@
|
|
120
|
-
"@testing-library/
|
|
121
|
-
"react": "^
|
|
122
|
-
"
|
|
123
|
-
"react
|
|
124
|
-
|
|
125
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "tenjin-ui-kit",
|
|
3
|
+
"version": "0.3.76",
|
|
4
|
+
"repository": {
|
|
5
|
+
"url": "git+https://gitlab.com/yethi/react/tenjin-ui-kit.git"
|
|
6
|
+
},
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@floating-ui/dom": "^1.2.1",
|
|
9
|
+
"@mantine/core": "^5.10.1",
|
|
10
|
+
"@mantine/hooks": "^5.10.1",
|
|
11
|
+
"@mantine/rte": "^5.10.1",
|
|
12
|
+
"@mui/icons-material": "^5.11.0",
|
|
13
|
+
"@mui/styles": "^5.11.2",
|
|
14
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
15
|
+
"@testing-library/react": "^13.4.0",
|
|
16
|
+
"@testing-library/user-event": "^13.5.0",
|
|
17
|
+
"aria-hidden": "^1.2.2",
|
|
18
|
+
"axios": "^0.26.0",
|
|
19
|
+
"clsx": "^1.2.1",
|
|
20
|
+
"d3-hierarchy": "^3.1.2",
|
|
21
|
+
"feather-icons": "^4.29.0",
|
|
22
|
+
"final-form": "^4.20.9",
|
|
23
|
+
"material-ui-popup-state": "^5.0.8",
|
|
24
|
+
"moment": "^2.29.4",
|
|
25
|
+
"npm-run-all": "^4.1.5",
|
|
26
|
+
"react-beautiful-dnd": "^13.1.1",
|
|
27
|
+
"react-dnd": "^16.0.1",
|
|
28
|
+
"react-dnd-html5-backend": "^16.0.1",
|
|
29
|
+
"react-dropzone": "^14.2.3",
|
|
30
|
+
"react-feather": "^2.0.10",
|
|
31
|
+
"react-final-form": "^6.5.9",
|
|
32
|
+
"react-flow-renderer": "^10.3.17",
|
|
33
|
+
"react-icons": "^4.10.1",
|
|
34
|
+
"react-moment": "^1.1.3",
|
|
35
|
+
"react-scripts": "5.0.1",
|
|
36
|
+
"react-select": "^5.7.4",
|
|
37
|
+
"react-sortable-hoc": "^2.0.0",
|
|
38
|
+
"reactflow": "^11.6.1",
|
|
39
|
+
"storybook-react-context": "^0.6.0",
|
|
40
|
+
"styled-components": "^5.3.9",
|
|
41
|
+
"uuid": "^9.0.0",
|
|
42
|
+
"web-vitals": "^2.1.4"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"start": "react-scripts start",
|
|
46
|
+
"build": "react-scripts build",
|
|
47
|
+
"test": "react-scripts test",
|
|
48
|
+
"eject": "react-scripts eject",
|
|
49
|
+
"storybook": "start-storybook -p 6006 -s public",
|
|
50
|
+
"build-storybook": "build-storybook -s public",
|
|
51
|
+
"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
|
+
"copy-and-publish-dev": "copy package.json dist && copy README.md dist && cd dist && npm publish --tag dev",
|
|
54
|
+
"copy-and-publish": "cp package.json dist && cp README.md dist && cd dist && npm publish",
|
|
55
|
+
"publish-dev": "npm-run-all compile copy-and-publish-dev",
|
|
56
|
+
"publish-prod": "npm-run-all compile copy-and-publish"
|
|
57
|
+
},
|
|
58
|
+
"eslintConfig": {
|
|
59
|
+
"extends": [
|
|
60
|
+
"react-app",
|
|
61
|
+
"react-app/jest"
|
|
62
|
+
],
|
|
63
|
+
"overrides": [
|
|
64
|
+
{
|
|
65
|
+
"files": [
|
|
66
|
+
"**/*.stories.*"
|
|
67
|
+
],
|
|
68
|
+
"rules": {
|
|
69
|
+
"import/no-anonymous-default-export": "off"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"browserslist": {
|
|
75
|
+
"production": [
|
|
76
|
+
">0.2%",
|
|
77
|
+
"not dead",
|
|
78
|
+
"not op_mini all"
|
|
79
|
+
],
|
|
80
|
+
"development": [
|
|
81
|
+
"last 1 chrome version",
|
|
82
|
+
"last 1 firefox version",
|
|
83
|
+
"last 1 safari version"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"devDependencies": {
|
|
87
|
+
"@babel/cli": "^7.20.7",
|
|
88
|
+
"@babel/preset-env": "^7.20.2",
|
|
89
|
+
"@babel/preset-react": "^7.18.6",
|
|
90
|
+
"@emotion/react": "^11.10.5",
|
|
91
|
+
"@emotion/styled": "^11.10.5",
|
|
92
|
+
"@mui/material": "^5.11.3",
|
|
93
|
+
"@storybook/addon-actions": "^6.5.15",
|
|
94
|
+
"@storybook/addon-essentials": "^6.5.15",
|
|
95
|
+
"@storybook/addon-interactions": "^6.5.15",
|
|
96
|
+
"@storybook/addon-links": "^6.5.15",
|
|
97
|
+
"@storybook/builder-webpack5": "^6.5.15",
|
|
98
|
+
"@storybook/manager-webpack5": "^6.5.15",
|
|
99
|
+
"@storybook/node-logger": "^6.5.15",
|
|
100
|
+
"@storybook/preset-create-react-app": "^4.1.2",
|
|
101
|
+
"@storybook/react": "^6.5.15",
|
|
102
|
+
"@storybook/testing-library": "^0.0.13",
|
|
103
|
+
"ajv": "^8.20.0",
|
|
104
|
+
"postcss": "^8.5.28",
|
|
105
|
+
"babel-plugin-named-exports-order": "^0.0.2",
|
|
106
|
+
"cross-env": "^7.0.3",
|
|
107
|
+
"prop-types": "^15.8.1",
|
|
108
|
+
"react": "^18.2.0",
|
|
109
|
+
"react-dom": "^18.2.0",
|
|
110
|
+
"react-router-dom": "^6.6.1",
|
|
111
|
+
"rimraf": "^3.0.2",
|
|
112
|
+
"webpack": "^5.75.0",
|
|
113
|
+
"@mui/lab": "5.0.0-alpha.116"
|
|
114
|
+
},
|
|
115
|
+
"peerDependencies": {
|
|
116
|
+
"@emotion/react": "^11.10.5",
|
|
117
|
+
"@emotion/styled": "^11.10.5",
|
|
118
|
+
"@mui/lab": "5.0.0-alpha.116",
|
|
119
|
+
"@mui/material": "^5.11.3",
|
|
120
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
121
|
+
"@testing-library/react": "^13.4.0",
|
|
122
|
+
"@testing-library/user-event": "^13.5.0",
|
|
123
|
+
"react": "^18.2.0",
|
|
124
|
+
"react-dom": "^18.2.0",
|
|
125
|
+
"react-router-dom": "^6.6.1"
|
|
126
|
+
}
|
|
127
|
+
}
|