@zengenti/contensis-react-base 3.2.1-beta.4 → 3.2.1-beta.6
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/cjs/forms.js +63 -16
- package/cjs/forms.js.map +1 -1
- package/esm/forms.js +63 -16
- package/esm/forms.js.map +1 -1
- package/package.json +1 -1
package/esm/forms.js
CHANGED
|
@@ -555,8 +555,6 @@ const getFieldType = field => {
|
|
|
555
555
|
return 'textarea';
|
|
556
556
|
} else if (field.dataType === 'string' && field.editor && field.editor.id === 'list-dropdown') {
|
|
557
557
|
return 'dropdown';
|
|
558
|
-
} else if (field !== null && field !== void 0 && (_field$editor = field.editor) !== null && _field$editor !== void 0 && (_field$editor$propert = _field$editor.properties) !== null && _field$editor$propert !== void 0 && _field$editor$propert.readOnly || (field === null || field === void 0 ? void 0 : field.groupId) === 'private' || (field === null || field === void 0 ? void 0 : field.groupId) === 'settings') {
|
|
559
|
-
return 'hidden';
|
|
560
558
|
} else if (field.dataType === 'stringArray' || field.dataType === 'boolean') {
|
|
561
559
|
return 'checkbox';
|
|
562
560
|
} else if (field.dataType === 'string' && field.validations && field.validations.allowedValues) {
|
|
@@ -570,7 +568,9 @@ const getFieldType = field => {
|
|
|
570
568
|
} else if (field.dataFormat === 'entry') {
|
|
571
569
|
return 'entryPicker';
|
|
572
570
|
}
|
|
573
|
-
if (field.dataFormat === 'quote') return '
|
|
571
|
+
if (field.dataFormat === 'quote') return 'content';else if (field !== null && field !== void 0 && (_field$editor = field.editor) !== null && _field$editor !== void 0 && (_field$editor$propert = _field$editor.properties) !== null && _field$editor$propert !== void 0 && _field$editor$propert.readOnly || (field === null || field === void 0 ? void 0 : field.groupId) === 'private' || (field === null || field === void 0 ? void 0 : field.groupId) === 'settings') {
|
|
572
|
+
return 'hidden';
|
|
573
|
+
} else return 'textfield';
|
|
574
574
|
};
|
|
575
575
|
|
|
576
576
|
const sagas = [takeEvery(SUBMIT_FORM_SUCCESS, onFormSuccess), takeEvery(SUBMIT_FORM_FOR_VALIDATION, doValidateForm), takeEvery(SUBMIT_FORM, onSubmitForm), takeEvery(SET_FORM_ID, doFetchForm),
|
|
@@ -1010,13 +1010,15 @@ CharacterLimit.propTypes = {
|
|
|
1010
1010
|
useDefaultTheme: PropTypes.bool
|
|
1011
1011
|
};
|
|
1012
1012
|
|
|
1013
|
+
// import Markdown from 'markdown-to-jsx';
|
|
1014
|
+
|
|
1013
1015
|
const TextfieldStyled = styled.div.withConfig({
|
|
1014
1016
|
displayName: "textfield__TextfieldStyled",
|
|
1015
1017
|
componentId: "sc-whkw86-0"
|
|
1016
1018
|
})(["", ";"], ({
|
|
1017
1019
|
isHidden
|
|
1018
1020
|
}) => {
|
|
1019
|
-
return css(["display:", ";"], isHidden ? 'none' : 'block');
|
|
1021
|
+
return css(["display:", ";position:relative;"], isHidden ? 'none' : 'block');
|
|
1020
1022
|
});
|
|
1021
1023
|
const Textfield = ({
|
|
1022
1024
|
className,
|
|
@@ -1032,7 +1034,8 @@ const Textfield = ({
|
|
|
1032
1034
|
defaultLanguage,
|
|
1033
1035
|
placeholder,
|
|
1034
1036
|
isHidden,
|
|
1035
|
-
useDefaultTheme
|
|
1037
|
+
useDefaultTheme,
|
|
1038
|
+
instructions
|
|
1036
1039
|
}) => {
|
|
1037
1040
|
const [hasCharLimit, setCharLimit] = useState(false);
|
|
1038
1041
|
const isRequired = validations && validations.required ? true : false;
|
|
@@ -1045,6 +1048,7 @@ const Textfield = ({
|
|
|
1045
1048
|
useEffect(() => {
|
|
1046
1049
|
if (formValidationSent) setA11yInvalid(doA11yValidation(_, field, true));
|
|
1047
1050
|
}, [formValidationSent]);
|
|
1051
|
+
const [isVisible, setVisible] = React.useState(false);
|
|
1048
1052
|
return /*#__PURE__*/React.createElement(TextfieldStyled, {
|
|
1049
1053
|
className: className,
|
|
1050
1054
|
isHidden: isHidden
|
|
@@ -1065,7 +1069,7 @@ const Textfield = ({
|
|
|
1065
1069
|
}
|
|
1066
1070
|
}, /*#__PURE__*/React.createElement("input", {
|
|
1067
1071
|
className: "text-field__input",
|
|
1068
|
-
type: type,
|
|
1072
|
+
type: (isVisible != null ? isVisible : 'text') || type,
|
|
1069
1073
|
defaultValue: defaultValueText,
|
|
1070
1074
|
placeholder: placeholderText,
|
|
1071
1075
|
"aria-invalid": a11yInvalid,
|
|
@@ -1107,6 +1111,33 @@ const Textfield = ({
|
|
|
1107
1111
|
}, /*#__PURE__*/React.createElement("path", {
|
|
1108
1112
|
fill: "#333",
|
|
1109
1113
|
d: "m2 8 4.418 4.667L14 4.659l-1.246-1.326-6.336 6.692-3.18-3.332L2 8Z"
|
|
1114
|
+
}))), id === 'password' && /*#__PURE__*/React.createElement("button", {
|
|
1115
|
+
className: "text-input__button--pw",
|
|
1116
|
+
type: "button",
|
|
1117
|
+
onClick: () => setVisible(!isVisible),
|
|
1118
|
+
"aria-label": `${isVisible ? 'Hide' : 'Show'} Password.`
|
|
1119
|
+
}, isVisible ? /*#__PURE__*/React.createElement("svg", {
|
|
1120
|
+
width: "15",
|
|
1121
|
+
height: "15",
|
|
1122
|
+
viewBox: "0 0 15 15",
|
|
1123
|
+
fill: "none",
|
|
1124
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1125
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1126
|
+
d: "M13.3536 2.35355C13.5488 2.15829 13.5488 1.84171 13.3536 1.64645C13.1583 1.45118 12.8417 1.45118 12.6464 1.64645L10.6828 3.61012C9.70652 3.21671 8.63759 3 7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C0.902945 9.08812 2.02314 10.1861 3.36061 10.9323L1.64645 12.6464C1.45118 12.8417 1.45118 13.1583 1.64645 13.3536C1.84171 13.5488 2.15829 13.5488 2.35355 13.3536L4.31723 11.3899C5.29348 11.7833 6.36241 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C14.0971 5.9119 12.9769 4.81391 11.6394 4.06771L13.3536 2.35355ZM9.90428 4.38861C9.15332 4.1361 8.34759 4 7.5 4C4.80285 4 2.52952 5.37816 1.09622 7.50001C1.87284 8.6497 2.89609 9.58106 4.09974 10.1931L9.90428 4.38861ZM5.09572 10.6114L10.9003 4.80685C12.1039 5.41894 13.1272 6.35031 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11C6.65241 11 5.84668 10.8639 5.09572 10.6114Z",
|
|
1127
|
+
fill: "currentColor",
|
|
1128
|
+
"fill-rule": "evenodd",
|
|
1129
|
+
"clip-rule": "evenodd"
|
|
1130
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
1131
|
+
width: "15",
|
|
1132
|
+
height: "15",
|
|
1133
|
+
viewBox: "0 0 15 15",
|
|
1134
|
+
fill: "none",
|
|
1135
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1136
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1137
|
+
d: "M7.5 11C4.80285 11 2.52952 9.62184 1.09622 7.50001C2.52952 5.37816 4.80285 4 7.5 4C10.1971 4 12.4705 5.37816 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11ZM7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C1.65639 10.2936 4.30786 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C13.3436 4.70638 10.6921 3 7.5 3ZM7.5 9.5C8.60457 9.5 9.5 8.60457 9.5 7.5C9.5 6.39543 8.60457 5.5 7.5 5.5C6.39543 5.5 5.5 6.39543 5.5 7.5C5.5 8.60457 6.39543 9.5 7.5 9.5Z",
|
|
1138
|
+
fill: "currentColor",
|
|
1139
|
+
"fill-rule": "evenodd",
|
|
1140
|
+
"clip-rule": "evenodd"
|
|
1110
1141
|
}))));
|
|
1111
1142
|
};
|
|
1112
1143
|
Textfield.propTypes = {
|
|
@@ -5087,6 +5118,8 @@ const CountrySelectStyled = styled.div.withConfig({
|
|
|
5087
5118
|
return css(["display:flex;flex-direction:column;--semantic-type-1:#01010c;--semantic-background-1:#fff;--semantic-active-background-1:#efefef;--semantic-border-1:#949494;.input__label{margin-bottom:4px;}.input__wrapper{position:relative;}.input__listbox{display:none;position:absolute;top:40px;left:0;width:100%;padding:8px;background:var(--semantic-background-1);z-index:99;text-align:left;overflow-y:auto;border:1px solid var(--semantic-border-1);max-height:400px;}.input__listbox.open{display:block;}.input__listbox .option{padding:8px;cursor:default;display:flex;align-items:center;border:none;width:100%;}.input__listbox .option.selected{color:var(--semantic-type-1);background-color:var(--semantic-active-background-1);}.input__listbox .option.active{color:var(--semantic-type-1);background-color:var(--semantic-active-background-1);}"]);
|
|
5088
5119
|
});
|
|
5089
5120
|
|
|
5121
|
+
// import Markdown from 'markdown-to-jsx';
|
|
5122
|
+
|
|
5090
5123
|
const FormComposer = ({
|
|
5091
5124
|
fields,
|
|
5092
5125
|
formData,
|
|
@@ -5106,10 +5139,12 @@ const FormComposer = ({
|
|
|
5106
5139
|
case 'number':
|
|
5107
5140
|
case 'textfield':
|
|
5108
5141
|
{
|
|
5142
|
+
var _field$editor, _field$editor$instruc;
|
|
5143
|
+
const instructions = field === null || field === void 0 ? void 0 : (_field$editor = field.editor) === null || _field$editor === void 0 ? void 0 : (_field$editor$instruc = _field$editor.instructions) === null || _field$editor$instruc === void 0 ? void 0 : _field$editor$instruc[defaultLanguage];
|
|
5109
5144
|
return /*#__PURE__*/React.createElement(Textfield, {
|
|
5110
5145
|
key: `${field.id}-${idx}`,
|
|
5111
5146
|
field: field,
|
|
5112
|
-
type: field.type,
|
|
5147
|
+
type: field.id === 'password' ? 'password' : field.type,
|
|
5113
5148
|
id: field.id,
|
|
5114
5149
|
label: field.name && field.name[defaultLanguage],
|
|
5115
5150
|
formId: formId,
|
|
@@ -5120,7 +5155,8 @@ const FormComposer = ({
|
|
|
5120
5155
|
defaultValue: formData && formData[field.id] || field.default,
|
|
5121
5156
|
placeholder: field.editor,
|
|
5122
5157
|
errors: errors,
|
|
5123
|
-
useDefaultTheme: useDefaultTheme
|
|
5158
|
+
useDefaultTheme: useDefaultTheme,
|
|
5159
|
+
instructions: instructions
|
|
5124
5160
|
});
|
|
5125
5161
|
}
|
|
5126
5162
|
case 'textarea':
|
|
@@ -5241,7 +5277,7 @@ const FormComposer = ({
|
|
|
5241
5277
|
}
|
|
5242
5278
|
case 'country':
|
|
5243
5279
|
{
|
|
5244
|
-
var _field$default, _field$
|
|
5280
|
+
var _field$default, _field$editor2, _field$editor2$proper, _field$editor2$proper2;
|
|
5245
5281
|
return /*#__PURE__*/React.createElement(CountrySelect, {
|
|
5246
5282
|
key: `${field.id}-${idx}`,
|
|
5247
5283
|
formId: formId,
|
|
@@ -5250,18 +5286,27 @@ const FormComposer = ({
|
|
|
5250
5286
|
label: field.name && field.name[defaultLanguage],
|
|
5251
5287
|
validations: field.validations,
|
|
5252
5288
|
defaultValue: formData && formData[field.id] || (field === null || field === void 0 ? void 0 : (_field$default = field.default) === null || _field$default === void 0 ? void 0 : _field$default[defaultLanguage]),
|
|
5253
|
-
placeholder: field === null || field === void 0 ? void 0 : (_field$
|
|
5289
|
+
placeholder: field === null || field === void 0 ? void 0 : (_field$editor2 = field.editor) === null || _field$editor2 === void 0 ? void 0 : (_field$editor2$proper = _field$editor2.properties) === null || _field$editor2$proper === void 0 ? void 0 : (_field$editor2$proper2 = _field$editor2$proper.placeholderText) === null || _field$editor2$proper2 === void 0 ? void 0 : _field$editor2$proper2[defaultLanguage]
|
|
5254
5290
|
});
|
|
5255
5291
|
}
|
|
5256
|
-
case '
|
|
5292
|
+
case 'content':
|
|
5257
5293
|
{
|
|
5294
|
+
var _editor$instructions;
|
|
5295
|
+
const {
|
|
5296
|
+
name,
|
|
5297
|
+
editor
|
|
5298
|
+
} = field || {};
|
|
5299
|
+
editor === null || editor === void 0 ? void 0 : (_editor$instructions = editor.instructions) === null || _editor$instructions === void 0 ? void 0 : _editor$instructions[defaultLanguage];
|
|
5258
5300
|
return /*#__PURE__*/React.createElement("span", {
|
|
5259
|
-
className: "
|
|
5301
|
+
className: "form__content",
|
|
5260
5302
|
"data-form": "title",
|
|
5261
5303
|
style: {
|
|
5262
5304
|
display: 'block'
|
|
5263
|
-
}
|
|
5264
|
-
|
|
5305
|
+
},
|
|
5306
|
+
key: `${field.id}-${idx}`
|
|
5307
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
5308
|
+
className: "form__content--title"
|
|
5309
|
+
}, name === null || name === void 0 ? void 0 : name[defaultLanguage]));
|
|
5265
5310
|
}
|
|
5266
5311
|
}
|
|
5267
5312
|
});
|
|
@@ -5432,7 +5477,9 @@ const Form = ({
|
|
|
5432
5477
|
useDefaultTheme: useDefaultTheme,
|
|
5433
5478
|
entries: entries,
|
|
5434
5479
|
setDateRangeValues: _setDateRangeValues
|
|
5435
|
-
}), pagingInfo.
|
|
5480
|
+
}), pagingInfo.pageCount >= 2 && /*#__PURE__*/React.createElement("div", {
|
|
5481
|
+
className: "form__btns"
|
|
5482
|
+
}, pagingInfo.pageIndex > 0 && /*#__PURE__*/React.createElement(Button, {
|
|
5436
5483
|
className: "form__btn--prev",
|
|
5437
5484
|
type: "button",
|
|
5438
5485
|
text: "Go Back",
|
|
@@ -5454,7 +5501,7 @@ const Form = ({
|
|
|
5454
5501
|
if (onCustomSubmit) onCustomSubmit();
|
|
5455
5502
|
},
|
|
5456
5503
|
useDefaultTheme: useDefaultTheme
|
|
5457
|
-
})), (status === null || status === void 0 ? void 0 : status.isLoading) && !(status !== null && status !== void 0 && status.hasSuccess) && /*#__PURE__*/React.createElement(Loader, {
|
|
5504
|
+
}))), (status === null || status === void 0 ? void 0 : status.isLoading) && !(status !== null && status !== void 0 && status.hasSuccess) && /*#__PURE__*/React.createElement(Loader, {
|
|
5458
5505
|
className: "loading",
|
|
5459
5506
|
height: 24,
|
|
5460
5507
|
width: 24,
|