@evoke-platform/ui-components 1.6.0-testing.13 → 1.6.0-testing.14

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.
Files changed (67) hide show
  1. package/dist/published/components/custom/FormField/AddressFieldComponent/addressFieldComponent.js +1 -1
  2. package/dist/published/components/custom/FormField/BooleanSelect/BooleanSelect.js +3 -3
  3. package/dist/published/components/custom/FormField/DatePickerSelect/DatePickerSelect.js +7 -1
  4. package/dist/published/components/custom/FormField/DateTimePickerSelect/DateTimePickerSelect.js +7 -1
  5. package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +6 -3
  6. package/dist/published/components/custom/FormField/TimePickerSelect/TimePickerSelect.js +13 -3
  7. package/dist/published/components/custom/FormV2/FormRenderer.d.ts +19 -0
  8. package/dist/published/components/custom/FormV2/FormRenderer.js +183 -0
  9. package/dist/published/components/custom/FormV2/components/AccordionSections.d.ts +4 -0
  10. package/dist/published/components/custom/FormV2/components/AccordionSections.js +131 -0
  11. package/dist/published/components/custom/FormV2/components/ActionButtons.d.ts +19 -0
  12. package/dist/published/components/custom/FormV2/components/ActionButtons.js +106 -0
  13. package/dist/published/components/custom/FormV2/components/FieldWrapper.d.ts +24 -0
  14. package/dist/published/components/custom/FormV2/components/FieldWrapper.js +100 -0
  15. package/dist/published/components/custom/FormV2/components/FormContext.d.ts +12 -0
  16. package/dist/published/components/custom/FormV2/components/FormContext.js +8 -0
  17. package/dist/published/components/custom/FormV2/components/FormFieldTypes/AddressFields.d.ts +17 -0
  18. package/dist/published/components/custom/FormV2/components/FormFieldTypes/AddressFields.js +50 -0
  19. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.d.ts +14 -0
  20. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/ActionDialog.js +88 -0
  21. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DocumentViewerCell.d.ts +13 -0
  22. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DocumentViewerCell.js +140 -0
  23. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableField.d.ts +17 -0
  24. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableField.js +233 -0
  25. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableFieldInput.d.ts +40 -0
  26. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/DropdownRepeatableFieldInput.js +95 -0
  27. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.d.ts +12 -0
  28. package/dist/published/components/custom/FormV2/components/FormFieldTypes/CollectionFiles/RepeatableField.js +526 -0
  29. package/dist/published/components/custom/FormV2/components/FormFieldTypes/Criteria.d.ts +12 -0
  30. package/dist/published/components/custom/FormV2/components/FormFieldTypes/Criteria.js +93 -0
  31. package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.d.ts +16 -0
  32. package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/Document.js +73 -0
  33. package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/DocumentList.d.ts +13 -0
  34. package/dist/published/components/custom/FormV2/components/FormFieldTypes/DocumentFiles/DocumentList.js +179 -0
  35. package/dist/published/components/custom/FormV2/components/FormFieldTypes/Image.d.ts +12 -0
  36. package/dist/published/components/custom/FormV2/components/FormFieldTypes/Image.js +108 -0
  37. package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.d.ts +16 -0
  38. package/dist/published/components/custom/FormV2/components/FormFieldTypes/UserProperty.js +129 -0
  39. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/InstanceLookup.d.ts +15 -0
  40. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/InstanceLookup.js +226 -0
  41. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.d.ts +4 -0
  42. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/ObjectPropertyInput.js +439 -0
  43. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.d.ts +29 -0
  44. package/dist/published/components/custom/FormV2/components/FormFieldTypes/relatedObjectFiles/RelatedObjectInstance.js +74 -0
  45. package/dist/published/components/custom/FormV2/components/FormSections.d.ts +4 -0
  46. package/dist/published/components/custom/FormV2/components/FormSections.js +104 -0
  47. package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.d.ts +2 -0
  48. package/dist/published/components/custom/FormV2/components/RecursiveEntryRenderer.js +209 -0
  49. package/dist/published/components/custom/FormV2/components/TabNav.d.ts +10 -0
  50. package/dist/published/components/custom/FormV2/components/TabNav.js +23 -0
  51. package/dist/published/components/custom/FormV2/components/ValidationFiles/Validation.d.ts +3 -0
  52. package/dist/published/components/custom/FormV2/components/ValidationFiles/Validation.js +176 -0
  53. package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.d.ts +10 -0
  54. package/dist/published/components/custom/FormV2/components/ValidationFiles/ValidationErrorDisplay.js +45 -0
  55. package/dist/published/components/custom/FormV2/components/types.d.ts +131 -0
  56. package/dist/published/components/custom/FormV2/components/types.js +1 -0
  57. package/dist/published/components/custom/FormV2/components/utils.d.ts +47 -0
  58. package/dist/published/components/custom/FormV2/components/utils.js +434 -0
  59. package/dist/published/components/custom/FormV2/index.d.ts +1 -0
  60. package/dist/published/components/custom/FormV2/index.js +1 -0
  61. package/dist/published/components/custom/index.d.ts +1 -0
  62. package/dist/published/components/custom/index.js +1 -0
  63. package/dist/published/index.d.ts +2 -2
  64. package/dist/published/index.js +2 -2
  65. package/dist/published/theme/hooks.d.ts +7 -0
  66. package/dist/published/theme/hooks.js +9 -0
  67. package/package.json +4 -2
@@ -0,0 +1,29 @@
1
+ import { Action, EvokeForm, Obj, ObjectInstance, TableViewLayout } from '@evoke-platform/context';
2
+ import React, { ComponentType } from 'react';
3
+ import { BaseProps, SimpleEditorProps } from '../../types';
4
+ export type RelatedObjectInstanceProps = BaseProps & {
5
+ relatedObject: Obj | undefined;
6
+ id: string;
7
+ setSelectedInstance: (selectedInstance: ObjectInstance) => void;
8
+ handleChangeObjectProperty: (propertyId: string, instance?: any) => void;
9
+ handleClose: () => void;
10
+ mode: 'default' | 'existingOnly' | 'newOnly';
11
+ setSnackbarError: React.Dispatch<React.SetStateAction<{
12
+ showAlert: boolean;
13
+ message?: string;
14
+ isError: boolean;
15
+ }>>;
16
+ nestedFieldsView?: boolean;
17
+ displayOption?: 'dropdown' | 'dialogBox';
18
+ setOptions: (options: ObjectInstance[]) => void;
19
+ options: ObjectInstance[];
20
+ filter?: Record<string, unknown>;
21
+ layout?: TableViewLayout;
22
+ fieldHeight?: 'small' | 'medium';
23
+ richTextEditor?: ComponentType<SimpleEditorProps>;
24
+ form?: EvokeForm;
25
+ action?: Action;
26
+ selectedInstance?: ObjectInstance;
27
+ };
28
+ declare const RelatedObjectInstance: (props: RelatedObjectInstanceProps) => React.JSX.Element;
29
+ export default RelatedObjectInstance;
@@ -0,0 +1,74 @@
1
+ import { InfoRounded } from '@mui/icons-material';
2
+ import React, { useState } from 'react';
3
+ import { Alert, Button, FormControlLabel, Radio, RadioGroup } from '../../../../../core';
4
+ import { Box, Grid } from '../../../../../layout';
5
+ import InstanceLookup from './InstanceLookup';
6
+ const styles = {
7
+ actionButtons: {
8
+ padding: '8px 8px 24px 8px',
9
+ marginRight: '18px',
10
+ display: 'flex',
11
+ justifyContent: 'flex-end',
12
+ alignItems: 'center',
13
+ },
14
+ };
15
+ const RelatedObjectInstance = (props) => {
16
+ const { relatedObject, id, setSelectedInstance, handleChangeObjectProperty, handleClose, nestedFieldsView, mode, displayOption, filter, layout, form, } = props;
17
+ const [errors, setErrors] = useState([]);
18
+ const [selectedRow, setSelectedRow] = useState();
19
+ const [relationType, setRelationType] = useState(displayOption === 'dropdown' ? 'new' : 'existing');
20
+ const linkExistingInstance = async () => {
21
+ if (selectedRow) {
22
+ setSelectedInstance(selectedRow);
23
+ handleChangeObjectProperty(id, selectedRow);
24
+ }
25
+ onClose();
26
+ };
27
+ const onClose = () => {
28
+ handleClose();
29
+ setErrors([]);
30
+ };
31
+ return (React.createElement(Box, { sx: {
32
+ background: nestedFieldsView ? '#F4F6F8' : 'none',
33
+ borderRadius: '8px',
34
+ } },
35
+ React.createElement(Box, { sx: {
36
+ padding: '8px 24px 0px',
37
+ '.MuiInputBase-root': { background: '#FFFF', borderRadius: '8px' },
38
+ } },
39
+ !nestedFieldsView &&
40
+ displayOption !== 'dropdown' &&
41
+ mode !== 'existingOnly' &&
42
+ mode !== 'newOnly' &&
43
+ form && (React.createElement(Grid, { container: true },
44
+ React.createElement(Grid, { container: true, item: true },
45
+ React.createElement(RadioGroup, { row: true, "aria-labelledby": "related-object-link-type", onChange: (event) => {
46
+ event.target.value === 'existing' && setErrors([]);
47
+ setRelationType(event.target.value);
48
+ }, value: relationType },
49
+ React.createElement(FormControlLabel, { value: "existing", control: React.createElement(Radio, { sx: { '&.Mui-checked': { color: 'primary' } } }), label: "Existing" }),
50
+ React.createElement(FormControlLabel, { value: "new", control: React.createElement(Radio, { sx: { '&.Mui-checked': { color: 'primary' } } }), label: "New" }))))),
51
+ errors?.length ? (React.createElement(Alert, { severity: "error", sx: { margin: '10px 0', borderRadius: '8px' }, icon: React.createElement(InfoRounded, { sx: { color: '#A22723' } }) }, errors.length === 1 ? (React.createElement(React.Fragment, null,
52
+ "There is ",
53
+ React.createElement("strong", null, "1"),
54
+ " error")) : (React.createElement(React.Fragment, null,
55
+ "There are ",
56
+ React.createElement("strong", null, errors.length),
57
+ " errors")))) : undefined,
58
+ (relationType === 'new' || mode === 'newOnly') && form ? (React.createElement(Box, { id: 'related-object-wrapper', sx: { width: '100%' } })) : (relatedObject &&
59
+ mode !== 'newOnly' && (React.createElement(React.Fragment, null,
60
+ React.createElement(InstanceLookup, { colspan: 12, nestedFieldsView: nestedFieldsView, setRelationType: setRelationType, object: relatedObject, setSelectedInstance: setSelectedRow, mode: mode, filter: filter, layout: layout }))))),
61
+ relationType !== 'new' && mode !== 'newOnly' && (React.createElement(Box, { sx: styles.actionButtons },
62
+ React.createElement(Button, { onClick: onClose, color: 'inherit', sx: {
63
+ border: '1px solid #ced4da',
64
+ width: '75px',
65
+ marginRight: '0px',
66
+ color: 'black',
67
+ } }, "Cancel"),
68
+ React.createElement(Button, { sx: {
69
+ marginLeft: '8px',
70
+ width: '85px',
71
+ '&:hover': { boxShadow: 'none' },
72
+ }, onClick: linkExistingInstance, variant: "contained", disabled: !selectedRow, "aria-label": `Add` }, "Add")))));
73
+ };
74
+ export default RelatedObjectInstance;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SectionsProps } from './types';
3
+ declare function FormSections(props: SectionsProps): React.JSX.Element;
4
+ export default FormSections;
@@ -0,0 +1,104 @@
1
+ import RadioButtonCheckedIcon from '@mui/icons-material/RadioButtonChecked';
2
+ import { TabContext, TabPanel } from '@mui/lab';
3
+ import React, { useRef, useState } from 'react';
4
+ import { Tab, Tabs, Typography } from '../../../core';
5
+ import { Box } from '../../../layout';
6
+ import { RecursiveEntryRenderer } from './RecursiveEntryRenderer';
7
+ import TabNav from './TabNav';
8
+ import { getErrorCountForSection, scrollIntoViewWithOffset } from './utils';
9
+ function FormSections(props) {
10
+ const { entry, errors, handleChange, showSubmitError, fieldHeight, richTextEditor, instance, expandedSections, setExpandedSections, expandAll, setExpandAll, parameters, triggerFieldReset, } = props;
11
+ const tabPanelsRef = useRef(null);
12
+ const [tabValue, setTabValue] = useState(0);
13
+ const handleTabChange = (type, newValue) => {
14
+ setTabValue(Number(newValue));
15
+ if (tabPanelsRef.current && type === 'buttonNav') {
16
+ scrollIntoViewWithOffset(tabPanelsRef.current, 170);
17
+ }
18
+ };
19
+ const prevTabLabel = tabValue > 0 ? entry.sections[tabValue - 1].label : '';
20
+ const nextTabLabel = tabValue < entry.sections.length - 1 ? entry.sections[tabValue + 1].label : '';
21
+ return (React.createElement(React.Fragment, null,
22
+ React.createElement(TabContext, { value: tabValue?.toString() || '0' },
23
+ React.createElement(Box, { sx: {
24
+ display: 'flex',
25
+ minHeight: '150px',
26
+ } },
27
+ React.createElement(Tabs, { value: tabValue?.toString(), onChange: (e, value) => handleTabChange('tabNav', value), orientation: "vertical", sx: {
28
+ overflow: 'visible',
29
+ paddingTop: '10px',
30
+ flex: 1,
31
+ borderRight: '1px solid #e9ecef',
32
+ minWidth: '190px',
33
+ maxWidth: '264px',
34
+ }, TabIndicatorProps: {
35
+ sx: {
36
+ display: 'none',
37
+ },
38
+ } }, entry.sections.map((section, sectionIndex) => {
39
+ const errorCount = getErrorCountForSection(section, errors);
40
+ const isSelected = tabValue?.toString() === sectionIndex.toString();
41
+ return (React.createElement(Tab, { disableRipple: true, key: section.label + sectionIndex, label: React.createElement(Box, { sx: {
42
+ display: 'flex',
43
+ alignItems: 'center',
44
+ width: '100%',
45
+ minWidth: '168px',
46
+ justifyContent: 'space-between',
47
+ } },
48
+ React.createElement(Box, { sx: { display: 'flex', alignItems: 'center' } },
49
+ React.createElement(Box, { sx: { width: '28px', display: 'flex' } }, isSelected ? (React.createElement(RadioButtonCheckedIcon, { color: errorCount > 0 && showSubmitError ? 'error' : 'primary', sx: {
50
+ fontSize: 'medium',
51
+ } })) : (React.createElement(Box, { sx: {
52
+ width: '8px',
53
+ height: '8px',
54
+ borderRadius: '50%',
55
+ backgroundColor: '#dfe3e8',
56
+ marginLeft: '4.25px',
57
+ } }))),
58
+ React.createElement(Typography, { sx: {
59
+ fontSize: '16px',
60
+ fontWeight: isSelected ? 'bold' : 'normal',
61
+ } }, section.label)),
62
+ errorCount > 0 && showSubmitError && (React.createElement(Box, { sx: {
63
+ ml: 1,
64
+ bgcolor: '#FF4842',
65
+ color: 'white',
66
+ borderRadius: '50%',
67
+ minWidth: '20px',
68
+ minHeight: '20px',
69
+ display: 'flex',
70
+ justifyContent: 'center',
71
+ alignItems: 'center',
72
+ fontSize: '12px',
73
+ margin: '0px',
74
+ marginRight: '16px',
75
+ } }, errorCount))), value: sectionIndex.toString(), tabIndex: -1, sx: {
76
+ textAlign: 'left',
77
+ display: 'flex',
78
+ textTransform: 'none',
79
+ color: '#212B36',
80
+ '&.Mui-selected': {
81
+ fontWeight: 'bold',
82
+ color: '#212B36',
83
+ },
84
+ padding: '14px 10px 14px 4px',
85
+ } }));
86
+ })),
87
+ entry.sections.map((section, sectionIndex) => (React.createElement(TabPanel, { key: section.label + sectionIndex, value: sectionIndex.toString(), ref: tabPanelsRef, sx: {
88
+ padding: '10px 20px 0px 40px',
89
+ width: '100%',
90
+ flex: 4,
91
+ } },
92
+ React.createElement(Box, { sx: {
93
+ display: 'flex',
94
+ flexDirection: 'column',
95
+ justifyContent: section.entries && section?.entries.length > 0 ? 'space-between' : 'flex-end',
96
+ height: '100%',
97
+ } },
98
+ React.createElement(Box, null, section.entries &&
99
+ section.entries.map((sectionEntry, index) => {
100
+ return (React.createElement(RecursiveEntryRenderer, { key: sectionEntry.type + index, entry: sectionEntry, handleChange: handleChange, errors: errors, showSubmitError: showSubmitError, fieldHeight: fieldHeight, richTextEditor: richTextEditor, instance: instance, expandedSections: expandedSections, setExpandedSections: setExpandedSections, expandAll: expandAll, setExpandAll: setExpandAll, parameters: parameters, triggerFieldReset: triggerFieldReset }));
101
+ })),
102
+ React.createElement(TabNav, { prevTabLabel: prevTabLabel, nextTabLabel: nextTabLabel, numberOfTabs: entry.sections.length, tabValue: tabValue, handleTabChange: handleTabChange })))))))));
103
+ }
104
+ export default FormSections;
@@ -0,0 +1,2 @@
1
+ import { EntryRendererProps } from './types';
2
+ export declare function RecursiveEntryRenderer(props: EntryRendererProps): any;
@@ -0,0 +1,209 @@
1
+ import { useApiServices, useAuthenticationContext, } from '@evoke-platform/context';
2
+ import { WarningRounded } from '@mui/icons-material';
3
+ import { cloneDeep } from 'lodash';
4
+ import React, { useEffect, useMemo } from 'react';
5
+ import { useResponsive } from '../../../../theme';
6
+ import { useFormContext } from '../../../../theme/hooks';
7
+ import { TextField, Typography } from '../../../core';
8
+ import { Box } from '../../../layout';
9
+ import FormField from '../../FormField';
10
+ import AccordionSections from './AccordionSections';
11
+ import FieldWrapper from './FieldWrapper';
12
+ import AddressFields from './FormFieldTypes/AddressFields';
13
+ import DropdownRepeatableField from './FormFieldTypes/CollectionFiles/DropdownRepeatableField';
14
+ import RepeatableField from './FormFieldTypes/CollectionFiles/RepeatableField';
15
+ import Criteria from './FormFieldTypes/Criteria';
16
+ import { Document } from './FormFieldTypes/DocumentFiles/Document';
17
+ import { Image } from './FormFieldTypes/Image';
18
+ import ObjectPropertyInput from './FormFieldTypes/relatedObjectFiles/ObjectPropertyInput';
19
+ import UserProperty from './FormFieldTypes/UserProperty';
20
+ import FormSections from './FormSections';
21
+ import { entryIsVisible, fetchCollectionData, getEntryId, isAddressProperty, isOptionEqualToValue, updateCriteriaInputs, } from './utils';
22
+ function getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors, validation) {
23
+ return {
24
+ inputId: entryId,
25
+ inputType: fieldDefinition.type,
26
+ label: display?.label || fieldDefinition.name || 'default',
27
+ description: display?.description,
28
+ tooltip: display?.tooltip,
29
+ value: fieldValue,
30
+ maxLength: validation && 'maxLength' in validation ? validation.maxLength : 0,
31
+ required: entry.display?.required || false,
32
+ showCharCount: display?.charCount,
33
+ prefix: display?.prefix,
34
+ suffix: display?.suffix,
35
+ viewOnly: entry.type === 'readonlyField',
36
+ fieldHeight,
37
+ errorMessage: errors?.[entryId]?.message,
38
+ };
39
+ }
40
+ export function RecursiveEntryRenderer(props) {
41
+ const { handleChange, errors, showSubmitError, fieldHeight, instance, richTextEditor, expandedSections, setExpandedSections, expandAll, setExpandAll, parameters, entry, triggerFieldReset, } = props;
42
+ const { fetchedOptions, setFetchedOptions, object, getValues } = useFormContext();
43
+ // If the entry is hidden, clear its value and any nested values, and skip rendering
44
+ if (!entryIsVisible(entry, getValues(), instance)) {
45
+ return null;
46
+ }
47
+ const apiServices = useApiServices();
48
+ const userAccount = useAuthenticationContext()?.account;
49
+ const { smallerThan, isXs } = useResponsive();
50
+ const entryId = getEntryId(entry) || 'defaultId';
51
+ const display = 'display' in entry ? entry.display : undefined;
52
+ const fieldValue = entry.type === 'readonlyField' ? instance?.[entryId] : getValues(entryId);
53
+ const initialMiddleObjectInstances = fetchedOptions[`${entryId}InitialMiddleObjectInstances`];
54
+ const middleObject = fetchedOptions[`${entryId}MiddleObject`];
55
+ const fieldDefinition = useMemo(() => {
56
+ let def;
57
+ if (entry.type === 'input') {
58
+ def = parameters?.find((param) => param.id === entry.parameterId);
59
+ }
60
+ else if (entry.type === 'readonlyField') {
61
+ def = isAddressProperty(entry.propertyId)
62
+ ? object?.properties?.find((prop) => prop.id === entry.propertyId.split('.')[0])
63
+ : object?.properties?.find((prop) => prop.id === entry.propertyId);
64
+ }
65
+ else if (entry.type === 'inputField') {
66
+ def = entry.input;
67
+ }
68
+ else {
69
+ return undefined;
70
+ }
71
+ if (def?.enum && def.type === 'string') {
72
+ const cloned = cloneDeep(def);
73
+ // single select must be made to be type choices for label and error handling
74
+ cloned.type = 'choices';
75
+ return cloned;
76
+ }
77
+ return def;
78
+ }, [entry, parameters, object]);
79
+ const validation = fieldDefinition?.validation || {};
80
+ useEffect(() => {
81
+ if (fieldDefinition?.type === 'collection' && fieldDefinition?.manyToManyPropertyId && instance) {
82
+ fetchCollectionData(apiServices, fieldDefinition, setFetchedOptions, instance.id, fetchedOptions, initialMiddleObjectInstances);
83
+ }
84
+ }, [fieldDefinition, instance]);
85
+ if (entry.type === 'content') {
86
+ return (React.createElement(Box, { dangerouslySetInnerHTML: { __html: entry.html }, sx: {
87
+ fontFamily: 'Roboto, Helvetica, Arial, sans-serif',
88
+ } }));
89
+ }
90
+ else if ((entry.type === 'input' || entry.type === 'readonlyField' || entry.type === 'inputField') &&
91
+ fieldDefinition) {
92
+ if (isAddressProperty(entryId)) {
93
+ return (React.createElement(AddressFields, { entry: entry, errors: errors, handleChange: handleChange, fieldHeight: fieldHeight, parameters: parameters, instance: instance, entryId: entryId, fieldDefinition: fieldDefinition }));
94
+ }
95
+ else if (fieldDefinition.type === 'image') {
96
+ return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors) },
97
+ React.createElement(Image, { id: entryId, handleChange: handleChange, canUpdateProperty: entry.type !== 'readonlyField', error: !!errors[entryId], value: fieldValue, hasDescription: !!display?.description })));
98
+ }
99
+ else if (fieldDefinition.type === 'object') {
100
+ return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors) },
101
+ React.createElement(ObjectPropertyInput, { instance: instance, fieldDefinition: fieldDefinition, id: entryId, handleChangeObjectProperty: handleChange, mode: display?.mode || 'default', error: !!errors[entryId], displayOption: display?.relatedObjectDisplay || 'dialogBox', initialValue: fieldValue, parameters: parameters, readOnly: entry.type === 'readonlyField', filter: validation?.criteria
102
+ ? updateCriteriaInputs(validation.criteria, getValues(), userAccount)
103
+ : undefined, sortBy: typeof display?.defaultValue === 'object' && 'sortBy' in display.defaultValue
104
+ ? display?.defaultValue.sortBy
105
+ : undefined, orderBy: typeof display?.defaultValue === 'object' && 'orderBy' in display.defaultValue
106
+ ? display?.defaultValue.orderBy
107
+ : undefined, fieldHeight: fieldHeight, richTextEditor: richTextEditor, defaultValueCriteria: typeof display?.defaultValue === 'object' && 'criteria' in display.defaultValue
108
+ ? display?.defaultValue?.criteria
109
+ : undefined, viewLayout: display?.viewLayout, hasDescription: !!display?.description })));
110
+ }
111
+ else if (fieldDefinition.type === 'user') {
112
+ return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors) },
113
+ React.createElement(UserProperty, { id: entryId, value: fieldValue, handleChange: handleChange, error: !!errors[entryId], readOnly: entry.type === 'readonlyField', fieldHeight: fieldHeight, hasDescription: !!display?.description })));
114
+ }
115
+ else if (fieldDefinition.type === 'collection') {
116
+ return fieldDefinition?.manyToManyPropertyId ? (middleObject && initialMiddleObjectInstances && (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors) },
117
+ React.createElement(DropdownRepeatableField, { initialMiddleObjectInstances: fetchedOptions[`${entryId}MiddleObjectInstances`] || initialMiddleObjectInstances, fieldDefinition: fieldDefinition, id: entryId, middleObject: middleObject, instance: instance, readOnly: entry.type === 'readonlyField', fieldHeight: fieldHeight, criteria: validation?.criteria, hasDescription: !!display?.description })))) : (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors) },
118
+ React.createElement(RepeatableField, { fieldDefinition: fieldDefinition, canUpdateProperty: entry.type !== 'readonlyField', criteria: validation?.criteria, viewLayout: display?.viewLayout, instance: instance })));
119
+ }
120
+ else if (fieldDefinition.type === 'richText') {
121
+ return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors) }, richTextEditor ? (React.createElement(richTextEditor, {
122
+ id: entryId,
123
+ value: fieldValue,
124
+ handleUpdate: (value) => handleChange(entryId, value),
125
+ format: 'rtf',
126
+ disabled: entry.type === 'readonlyField',
127
+ rows: display?.rowCount,
128
+ hasError: !!errors[entryId],
129
+ })) : (React.createElement(FormField, { id: entryId, property: fieldDefinition, defaultValue: fieldValue || getValues(entryId), onChange: handleChange, readOnly: entry.type === 'readonlyField', placeholder: display?.placeholder, error: !!errors[entryId], errorMessage: errors[entryId]?.message, isMultiLineText: !!display?.rowCount, rows: display?.rowCount, size: fieldHeight }))));
130
+ }
131
+ else if (fieldDefinition.type === 'document') {
132
+ return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors) },
133
+ React.createElement(Document, { id: entryId, handleChange: handleChange, error: !!errors[entryId], value: fieldValue, instance: instance, canUpdateProperty: !(entry.type === 'readonlyField'), hasDescription: !!display?.description })));
134
+ }
135
+ else if (fieldDefinition.type === 'criteria') {
136
+ return (React.createElement(FieldWrapper, { ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors) },
137
+ React.createElement(Criteria, { key: triggerFieldReset ? `${entryId}-reset-true` : `${entryId}-reset-false`, fieldDefinition: fieldDefinition, value: fieldValue, handleChange: handleChange, canUpdateProperty: !(entry.type === 'readonlyField'), error: !!errors[entryId] })));
138
+ }
139
+ else {
140
+ // Add `aria-describedby` to ensure screen readers read the description
141
+ // when the input is tabbed into.
142
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
+ const additionalProps = {};
144
+ if (fieldDefinition.enum && display?.description) {
145
+ additionalProps.renderInput = (params) => (React.createElement(TextField, { ...params, inputProps: {
146
+ ...params.inputProps,
147
+ 'aria-describedby': `${entryId}-description`,
148
+ } }));
149
+ }
150
+ else if (display?.description) {
151
+ additionalProps.inputProps = {
152
+ 'aria-describedby': `${entryId}-description`,
153
+ };
154
+ }
155
+ return (React.createElement(FieldWrapper
156
+ /*
157
+ * Key remounts the field if a value is changed.
158
+ * Needed to clear certain fields on discard changes.
159
+ */
160
+ , {
161
+ /*
162
+ * Key remounts the field if a value is changed.
163
+ * Needed to clear certain fields on discard changes.
164
+ */
165
+ key: (fieldDefinition.type === 'choices' ||
166
+ fieldDefinition?.type === 'time' ||
167
+ fieldDefinition?.type === 'boolean') &&
168
+ triggerFieldReset
169
+ ? `${entryId}-reset-true`
170
+ : `${entryId}-reset-false`, ...getFieldWrapperProps(fieldDefinition, entry, entryId, fieldValue, display, fieldHeight, errors), errorMessage: undefined },
171
+ React.createElement(FormField, { id: entryId,
172
+ // TODO: Ideally the FormField prop should be called parameter but can't change the name for backwards compatibility reasons
173
+ property: fieldDefinition, defaultValue: fieldValue || getValues(entryId), onChange: handleChange, readOnly: entry.type === 'readonlyField', placeholder: display?.placeholder, mask: validation?.mask, isOptionEqualToValue: isOptionEqualToValue, error: !!errors[entryId], errorMessage: errors[entryId]?.message, isMultiLineText: !!display?.rowCount, rows: display?.rowCount, required: entry.display?.required || false, getOptionLabel: (option) => {
174
+ if (typeof option === 'string') {
175
+ return (entry?.enumWithLabels?.find((e) => e.value === option)
176
+ ?.label ?? option);
177
+ }
178
+ else {
179
+ return (entry?.enumWithLabels?.find((e) => e.value === option.value)?.label ?? String(option.value));
180
+ }
181
+ }, size: fieldHeight, sortBy: display?.choicesDisplay?.sortBy && display.choicesDisplay.sortBy, displayOption: fieldDefinition.type === 'boolean'
182
+ ? display?.booleanDisplay
183
+ : display?.choicesDisplay?.type && display.choicesDisplay.type, label: display?.label, description: display?.description, tooltip: display?.tooltip, selectOptions: entry?.enumWithLabels &&
184
+ entry.enumWithLabels, additionalProps: additionalProps, isCombobox: fieldDefinition.nonStrictEnum, strictlyTrue: fieldDefinition.strictlyTrue })));
185
+ }
186
+ }
187
+ else if (entry.type === 'columns') {
188
+ return (React.createElement(Box, { sx: { display: 'flex', alignItems: 'flex-start', gap: '30px', flexDirection: isXs ? 'column' : 'row' } }, entry.columns.map((column, colIndex) => (
189
+ // calculating the width like this rather than flex={column.width} to prevent collections from being too wide
190
+ React.createElement(Box, { key: colIndex, sx: { width: isXs ? '100%' : `calc(${(column.width / 12) * 100}% - 15px)` } }, column.entries?.map((columnEntry, entryIndex) => {
191
+ return (React.createElement(RecursiveEntryRenderer, { key: entryIndex + (columnEntry?.parameterId ?? ''), entry: columnEntry, handleChange: handleChange, errors: errors, fieldHeight: fieldHeight, richTextEditor: richTextEditor, instance: instance, expandedSections: expandedSections, setExpandedSections: setExpandedSections, expandAll: expandAll, setExpandAll: setExpandAll, parameters: parameters, triggerFieldReset: triggerFieldReset }));
192
+ }))))));
193
+ }
194
+ else if (entry.type === 'sections') {
195
+ return smallerThan('md') ? (React.createElement(AccordionSections, { entry: entry, handleChange: handleChange, fieldHeight: fieldHeight, richTextEditor: richTextEditor, instance: instance, expandedSections: expandedSections, setExpandedSections: setExpandedSections, expandAll: expandAll, setExpandAll: setExpandAll, errors: errors, parameters: parameters, triggerFieldReset: triggerFieldReset })) : (React.createElement(FormSections, { entry: entry, errors: errors, handleChange: handleChange, showSubmitError: showSubmitError, fieldHeight: fieldHeight, richTextEditor: richTextEditor, instance: instance, expandedSections: expandedSections, setExpandedSections: setExpandedSections, expandAll: expandAll, setExpandAll: setExpandAll, parameters: parameters }));
196
+ }
197
+ else if (!fieldDefinition) {
198
+ return (React.createElement(Box, { sx: {
199
+ display: 'flex',
200
+ backgroundColor: '#ffc1073b',
201
+ borderRadius: '8px',
202
+ padding: '16.5px 14px',
203
+ marginTop: '6px',
204
+ } },
205
+ React.createElement(WarningRounded, { sx: { paddingRight: '8px' }, color: "warning" }),
206
+ React.createElement(Typography, { variant: "body2", color: "textSecondary" }, "This field was not configured correctly")));
207
+ }
208
+ return null;
209
+ }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ type TabNavProps = {
3
+ numberOfTabs: number;
4
+ tabValue: number;
5
+ handleTabChange: (type: 'tabNav' | 'buttonNav', newValue: number) => void;
6
+ prevTabLabel?: string;
7
+ nextTabLabel?: string;
8
+ };
9
+ declare function TabNav(props: TabNavProps): React.JSX.Element;
10
+ export default TabNav;
@@ -0,0 +1,23 @@
1
+ import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew';
2
+ import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
3
+ import React from 'react';
4
+ import { Button } from '../../../core';
5
+ import { Box } from '../../../layout';
6
+ function TabNav(props) {
7
+ const { numberOfTabs, tabValue, handleTabChange, prevTabLabel, nextTabLabel } = props;
8
+ const isFirstTab = tabValue === 0;
9
+ const isLastTab = tabValue === numberOfTabs - 1;
10
+ return (React.createElement(Box, { sx: {
11
+ display: 'flex',
12
+ justifyContent: isFirstTab ? 'flex-end' : 'space-between',
13
+ paddingTop: '10px',
14
+ paddingBottom: '20px',
15
+ } },
16
+ !isFirstTab && (React.createElement(Button, { onClick: () => handleTabChange('buttonNav', tabValue - 1), sx: { color: 'black', backgroundColor: '#dfe3e8', '&:hover': { backgroundColor: '#d0d4d9' } }, "aria-label": `Navigate to previous tab ${prevTabLabel}` },
17
+ React.createElement(ArrowBackIosNewIcon, { sx: { fontSize: 'medium', marginRight: 1 } }),
18
+ prevTabLabel ?? 'Previous tab')),
19
+ !isLastTab && (React.createElement(Button, { onClick: () => handleTabChange('buttonNav', tabValue + 1), sx: { color: 'black', backgroundColor: '#dfe3e8', '&:hover': { backgroundColor: '#d0d4d9' } }, "aria-label": `Navigate to next tab ${nextTabLabel}` },
20
+ nextTabLabel ?? 'Next tab',
21
+ React.createElement(ArrowForwardIosIcon, { sx: { fontSize: 'medium', marginLeft: 1 } })))));
22
+ }
23
+ export default TabNav;
@@ -0,0 +1,3 @@
1
+ import { FormEntry, InputParameter } from '@evoke-platform/context';
2
+ import { FieldValues, UseFormRegister } from 'react-hook-form';
3
+ export declare const handleValidation: (entries: FormEntry[], register: UseFormRegister<FieldValues>, formValues: FieldValues, parameters?: InputParameter[], instance?: FieldValues) => void;