@evoke-platform/ui-components 1.0.0-dev.120 → 1.0.0-dev.122
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/LICENSE +21 -0
- package/dist/published/components/core/Snackbar/Snackbar.js +4 -3
- package/dist/published/components/custom/FormField/FormField.d.ts +3 -0
- package/dist/published/components/custom/FormField/FormField.js +3 -3
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +12 -13
- package/dist/published/stories/FormField.stories.d.ts +1 -0
- package/dist/published/stories/FormField.stories.js +22 -0
- package/package.json +4 -3
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 System Automation Corporation
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the “Software”), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -10,7 +10,7 @@ const styles = {
|
|
10
10
|
display: 'flex',
|
11
11
|
backgroundColor: 'white',
|
12
12
|
minHeight: '40px',
|
13
|
-
width: '
|
13
|
+
width: '400px',
|
14
14
|
padding: '7px',
|
15
15
|
border: '1px solid #919EAB7A',
|
16
16
|
borderRadius: '8px',
|
@@ -23,9 +23,9 @@ const styles = {
|
|
23
23
|
}
|
24
24
|
};
|
25
25
|
export const Snackbar = (props) => {
|
26
|
-
const { handleClose, error, message } = props;
|
26
|
+
const { handleClose, error, message, autoHideDuration, action } = props;
|
27
27
|
return (React.createElement(UIThemeProvider, null,
|
28
|
-
React.createElement(MUISnackbar, Object.assign({ autoHideDuration: 6000, onClose: () => handleClose(), anchorOrigin: {
|
28
|
+
React.createElement(MUISnackbar, Object.assign({ autoHideDuration: autoHideDuration !== null && autoHideDuration !== void 0 ? autoHideDuration : 6000, onClose: () => handleClose(), anchorOrigin: {
|
29
29
|
vertical: 'bottom',
|
30
30
|
horizontal: 'center',
|
31
31
|
} }, props),
|
@@ -34,6 +34,7 @@ export const Snackbar = (props) => {
|
|
34
34
|
error ?
|
35
35
|
React.createElement(InfoRounded, { sx: Object.assign(Object.assign({}, styles.icon), { color: '#A22723' }) }) : React.createElement(CheckCircle, { sx: Object.assign(Object.assign({}, styles.icon), { color: '#229A16' }) }),
|
36
36
|
React.createElement(Typography, { fontSize: '14px', fontWeight: 400, sx: { marginRight: '3px' } }, (message !== null && message !== void 0 ? message : '')),
|
37
|
+
action,
|
37
38
|
React.createElement(IconButton, { size: "small", "aria-label": "close", color: "inherit", sx: { marginLeft: 'auto', marginRight: '15px' }, onClick: () => handleClose() },
|
38
39
|
React.createElement(Close, { fontSize: "small" })))))));
|
39
40
|
};
|
@@ -14,6 +14,9 @@ export declare type FormFieldProps = {
|
|
14
14
|
size?: 'small' | 'medium';
|
15
15
|
placeholder?: string;
|
16
16
|
mask?: string;
|
17
|
+
isMultiLineText?: boolean;
|
18
|
+
rows?: number;
|
19
|
+
inputMaskPlaceholderChar?: string;
|
17
20
|
};
|
18
21
|
export declare type ObjectProperty = {
|
19
22
|
id: string;
|
@@ -5,7 +5,7 @@ import FileUploadControl from './FileUpload/FileUpload';
|
|
5
5
|
import InputFieldComponent from './InputFieldComponent/InputFieldComponent';
|
6
6
|
import Select from './Select/Select';
|
7
7
|
const FormField = (props) => {
|
8
|
-
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage, onBlur, mask, max, min } = props;
|
8
|
+
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage, onBlur, mask, max, min, isMultiLineText, rows, inputMaskPlaceholderChar, } = props;
|
9
9
|
const id = property.id;
|
10
10
|
let control;
|
11
11
|
const commonProps = {
|
@@ -22,7 +22,7 @@ const FormField = (props) => {
|
|
22
22
|
size,
|
23
23
|
placeholder,
|
24
24
|
min,
|
25
|
-
max
|
25
|
+
max,
|
26
26
|
};
|
27
27
|
switch (property.type) {
|
28
28
|
case 'boolean':
|
@@ -41,7 +41,7 @@ const FormField = (props) => {
|
|
41
41
|
control = React.createElement(Select, Object.assign({}, commonProps));
|
42
42
|
break;
|
43
43
|
default:
|
44
|
-
control = React.createElement(InputFieldComponent, Object.assign({}, commonProps, { mask: mask }));
|
44
|
+
control = (React.createElement(InputFieldComponent, Object.assign({}, commonProps, { mask: mask, inputMaskPlaceholderChar: inputMaskPlaceholderChar, isMultiLineText: isMultiLineText, rows: rows })));
|
45
45
|
break;
|
46
46
|
}
|
47
47
|
return control;
|
package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js
CHANGED
@@ -27,7 +27,7 @@ export const NumericFormat = (props) => {
|
|
27
27
|
};
|
28
28
|
const InputFieldComponent = (props) => {
|
29
29
|
var _a;
|
30
|
-
const { property, defaultValue, error, errorMessage, onBlur, readOnly, required, size, placeholder, mask, min, max } = props;
|
30
|
+
const { property, defaultValue, error, errorMessage, onBlur, readOnly, required, size, placeholder, mask, min, max, isMultiLineText, rows, inputMaskPlaceholderChar, } = props;
|
31
31
|
const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : '');
|
32
32
|
const [inputValue, setInputValue] = useState('');
|
33
33
|
const id = property.id;
|
@@ -70,17 +70,16 @@ const InputFieldComponent = (props) => {
|
|
70
70
|
backgroundColor: '#f4f6f8',
|
71
71
|
},
|
72
72
|
}
|
73
|
-
: undefined, error: error, errorMessage: errorMessage, value: value, onChange: !readOnly ? handleChange : undefined, InputProps: Object.assign(Object.assign({}, InputProps), { readOnly: readOnly }), required: required, fullWidth: true, onBlur: onBlur, placeholder: placeholder, style: { background: 'white', borderRadius: '8px' }, size: size !== null && size !== void 0 ? size : 'medium', type: property.type === 'integer' ? 'number' : 'text', multiline: property.type === '
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
'
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
: undefined, error: error, errorMessage: errorMessage, InputProps: Object.assign(Object.assign({}, InputProps), { readOnly: readOnly }), fullWidth: true, type: property.type === 'integer' ? 'number' : 'text' })));
|
73
|
+
: undefined, error: error, errorMessage: errorMessage, value: value, onChange: !readOnly ? handleChange : undefined, InputProps: Object.assign(Object.assign({}, InputProps), { readOnly: readOnly }), required: required, fullWidth: true, onBlur: onBlur, placeholder: placeholder, style: { background: 'white', borderRadius: '8px' }, size: size !== null && size !== void 0 ? size : 'medium', type: property.type === 'integer' ? 'number' : 'text', multiline: property.type === 'text' && !readOnly && isMultiLineText, rows: isMultiLineText ? (rows ? rows : 3) : undefined })) : (React.createElement(InputMask, { mask: mask, maskChar: inputMaskPlaceholderChar !== null && inputMaskPlaceholderChar !== void 0 ? inputMaskPlaceholderChar : '_', value: value, onChange: !readOnly ? handleChange : undefined, onBlur: onBlur, alwaysShowMask: true }, () => (React.createElement(TextField, { id: id, sx: readOnly
|
74
|
+
? {
|
75
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
76
|
+
border: 'none',
|
77
|
+
},
|
78
|
+
'.MuiOutlinedInput-root': {
|
79
|
+
borderRadius: '8px',
|
80
|
+
backgroundColor: '#f4f6f8',
|
81
|
+
},
|
82
|
+
}
|
83
|
+
: undefined, error: error, errorMessage: errorMessage, InputProps: Object.assign(Object.assign({}, InputProps), { readOnly: readOnly }), fullWidth: true, type: property.type === 'integer' ? 'number' : 'text', multiline: property.type === 'text' && !readOnly && isMultiLineText, rows: isMultiLineText ? (rows ? rows : 3) : undefined }))));
|
85
84
|
};
|
86
85
|
export default InputFieldComponent;
|
@@ -2,6 +2,7 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
2
|
declare const _default: ComponentMeta<(props: import("../components/custom/FormField/FormField").FormFieldProps) => any>;
|
3
3
|
export default _default;
|
4
4
|
export declare const InputField: ComponentStory<(props: import("../components/custom/FormField/FormField").FormFieldProps) => any>;
|
5
|
+
export declare const MaskedInput: ComponentStory<(props: import("../components/custom/FormField/FormField").FormFieldProps) => any>;
|
5
6
|
export declare const ChoicesSelectField: ComponentStory<(props: import("../components/custom/FormField/FormField").FormFieldProps) => any>;
|
6
7
|
export declare const DatePickerField: ComponentStory<(props: import("../components/custom/FormField/FormField").FormFieldProps) => any>;
|
7
8
|
export declare const BooleanField: ComponentStory<(props: import("../components/custom/FormField/FormField").FormFieldProps) => any>;
|
@@ -23,6 +23,28 @@ InputField.args = {
|
|
23
23
|
locale: 'string',
|
24
24
|
size: 'small',
|
25
25
|
placeholder: 'string',
|
26
|
+
isMultiLineText: true,
|
27
|
+
rows: 5,
|
28
|
+
};
|
29
|
+
export const MaskedInput = FormFieldTemplate.bind({});
|
30
|
+
MaskedInput.args = {
|
31
|
+
mask: '999-99-9999',
|
32
|
+
inputMaskPlaceholderChar: '#',
|
33
|
+
property: {
|
34
|
+
id: 'ssn',
|
35
|
+
name: 'SS Number',
|
36
|
+
type: 'text',
|
37
|
+
required: true,
|
38
|
+
},
|
39
|
+
onChange: (id, value) => console.log('id= ', id, 'Value= ', value),
|
40
|
+
defaultValue: '123-45-6789',
|
41
|
+
error: false,
|
42
|
+
required: true,
|
43
|
+
readOnly: false,
|
44
|
+
selectOptions: [],
|
45
|
+
locale: 'string',
|
46
|
+
size: 'small',
|
47
|
+
placeholder: 'string',
|
26
48
|
};
|
27
49
|
export const ChoicesSelectField = FormFieldTemplate.bind({});
|
28
50
|
ChoicesSelectField.args = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@evoke-platform/ui-components",
|
3
|
-
"version": "1.0.0-dev.
|
3
|
+
"version": "1.0.0-dev.122",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/published/index.js",
|
6
6
|
"module": "dist/published/index.js",
|
@@ -74,7 +74,8 @@
|
|
74
74
|
"@react-querybuilder/material": "^5.4.1",
|
75
75
|
"lodash-es": "^4.17.21",
|
76
76
|
"react-dropzone": "^14.2.2",
|
77
|
-
"react-input-mask": "^
|
77
|
+
"react-input-mask": "^2.0.4",
|
78
|
+
"@types/react-input-mask": "^3.0.2",
|
78
79
|
"react-querybuilder": "^6.0.2",
|
79
80
|
"react-number-format": "^4.9.3"
|
80
81
|
},
|
@@ -85,4 +86,4 @@
|
|
85
86
|
"verbose": true,
|
86
87
|
"testEnvironment": "jsdom"
|
87
88
|
}
|
88
|
-
}
|
89
|
+
}
|