@zengenti/contensis-react-base 3.2.1-beta.3 → 3.2.1-beta.5
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/contensis-react-base.js +1 -1
- package/cjs/forms.js +65 -16
- package/cjs/forms.js.map +1 -1
- package/cjs/{sagas-3d3cdceb.js → sagas-497c6e94.js} +6 -1
- package/cjs/sagas-497c6e94.js.map +1 -0
- package/cjs/search.js +1 -1
- package/esm/contensis-react-base.js +1 -1
- package/esm/forms.js +64 -16
- package/esm/forms.js.map +1 -1
- package/esm/{sagas-d5dfdf9d.js → sagas-b654d1a6.js} +6 -1
- package/esm/sagas-b654d1a6.js.map +1 -0
- package/esm/search.js +2 -2
- package/package.json +1 -1
- package/cjs/sagas-3d3cdceb.js.map +0 -1
- package/esm/sagas-d5dfdf9d.js.map +0 -1
package/esm/forms.js
CHANGED
|
@@ -6,6 +6,7 @@ import React, { createContext, useState, useEffect, useRef } from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useSelector, useDispatch } from 'react-redux';
|
|
8
8
|
import styled, { ThemeProvider as ThemeProvider$1, css } from 'styled-components';
|
|
9
|
+
import Markdown from 'markdown-to-jsx';
|
|
9
10
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-1789f0cf.js';
|
|
10
11
|
|
|
11
12
|
const ACTION_PREFIX = '@FORM2/';
|
|
@@ -555,8 +556,6 @@ const getFieldType = field => {
|
|
|
555
556
|
return 'textarea';
|
|
556
557
|
} else if (field.dataType === 'string' && field.editor && field.editor.id === 'list-dropdown') {
|
|
557
558
|
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
559
|
} else if (field.dataType === 'stringArray' || field.dataType === 'boolean') {
|
|
561
560
|
return 'checkbox';
|
|
562
561
|
} else if (field.dataType === 'string' && field.validations && field.validations.allowedValues) {
|
|
@@ -570,7 +569,9 @@ const getFieldType = field => {
|
|
|
570
569
|
} else if (field.dataFormat === 'entry') {
|
|
571
570
|
return 'entryPicker';
|
|
572
571
|
}
|
|
573
|
-
if (field.dataFormat === 'quote') return '
|
|
572
|
+
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') {
|
|
573
|
+
return 'hidden';
|
|
574
|
+
} else return 'textfield';
|
|
574
575
|
};
|
|
575
576
|
|
|
576
577
|
const sagas = [takeEvery(SUBMIT_FORM_SUCCESS, onFormSuccess), takeEvery(SUBMIT_FORM_FOR_VALIDATION, doValidateForm), takeEvery(SUBMIT_FORM, onSubmitForm), takeEvery(SET_FORM_ID, doFetchForm),
|
|
@@ -1016,7 +1017,7 @@ const TextfieldStyled = styled.div.withConfig({
|
|
|
1016
1017
|
})(["", ";"], ({
|
|
1017
1018
|
isHidden
|
|
1018
1019
|
}) => {
|
|
1019
|
-
return css(["display:", ";"], isHidden ? 'none' : 'block');
|
|
1020
|
+
return css(["display:", ";position:relative;"], isHidden ? 'none' : 'block');
|
|
1020
1021
|
});
|
|
1021
1022
|
const Textfield = ({
|
|
1022
1023
|
className,
|
|
@@ -1032,7 +1033,8 @@ const Textfield = ({
|
|
|
1032
1033
|
defaultLanguage,
|
|
1033
1034
|
placeholder,
|
|
1034
1035
|
isHidden,
|
|
1035
|
-
useDefaultTheme
|
|
1036
|
+
useDefaultTheme,
|
|
1037
|
+
instructions
|
|
1036
1038
|
}) => {
|
|
1037
1039
|
const [hasCharLimit, setCharLimit] = useState(false);
|
|
1038
1040
|
const isRequired = validations && validations.required ? true : false;
|
|
@@ -1045,6 +1047,7 @@ const Textfield = ({
|
|
|
1045
1047
|
useEffect(() => {
|
|
1046
1048
|
if (formValidationSent) setA11yInvalid(doA11yValidation(_, field, true));
|
|
1047
1049
|
}, [formValidationSent]);
|
|
1050
|
+
const [isVisible, setVisible] = React.useState(false);
|
|
1048
1051
|
return /*#__PURE__*/React.createElement(TextfieldStyled, {
|
|
1049
1052
|
className: className,
|
|
1050
1053
|
isHidden: isHidden
|
|
@@ -1065,7 +1068,7 @@ const Textfield = ({
|
|
|
1065
1068
|
}
|
|
1066
1069
|
}, /*#__PURE__*/React.createElement("input", {
|
|
1067
1070
|
className: "text-field__input",
|
|
1068
|
-
type: type,
|
|
1071
|
+
type: (isVisible != null ? isVisible : 'text') || type,
|
|
1069
1072
|
defaultValue: defaultValueText,
|
|
1070
1073
|
placeholder: placeholderText,
|
|
1071
1074
|
"aria-invalid": a11yInvalid,
|
|
@@ -1107,6 +1110,35 @@ const Textfield = ({
|
|
|
1107
1110
|
}, /*#__PURE__*/React.createElement("path", {
|
|
1108
1111
|
fill: "#333",
|
|
1109
1112
|
d: "m2 8 4.418 4.667L14 4.659l-1.246-1.326-6.336 6.692-3.18-3.332L2 8Z"
|
|
1113
|
+
}))), instructions && /*#__PURE__*/React.createElement(Markdown, {
|
|
1114
|
+
className: "text-field__input--markdown"
|
|
1115
|
+
}, instructions), id === 'password' && /*#__PURE__*/React.createElement("button", {
|
|
1116
|
+
className: "text-input__button--pw",
|
|
1117
|
+
type: "button",
|
|
1118
|
+
onClick: () => setVisible(!isVisible),
|
|
1119
|
+
"aria-label": `${isVisible ? 'Hide' : 'Show'} Password.`
|
|
1120
|
+
}, isVisible ? /*#__PURE__*/React.createElement("svg", {
|
|
1121
|
+
width: "15",
|
|
1122
|
+
height: "15",
|
|
1123
|
+
viewBox: "0 0 15 15",
|
|
1124
|
+
fill: "none",
|
|
1125
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1126
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1127
|
+
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",
|
|
1128
|
+
fill: "currentColor",
|
|
1129
|
+
"fill-rule": "evenodd",
|
|
1130
|
+
"clip-rule": "evenodd"
|
|
1131
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
1132
|
+
width: "15",
|
|
1133
|
+
height: "15",
|
|
1134
|
+
viewBox: "0 0 15 15",
|
|
1135
|
+
fill: "none",
|
|
1136
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
1137
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1138
|
+
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",
|
|
1139
|
+
fill: "currentColor",
|
|
1140
|
+
"fill-rule": "evenodd",
|
|
1141
|
+
"clip-rule": "evenodd"
|
|
1110
1142
|
}))));
|
|
1111
1143
|
};
|
|
1112
1144
|
Textfield.propTypes = {
|
|
@@ -5106,10 +5138,12 @@ const FormComposer = ({
|
|
|
5106
5138
|
case 'number':
|
|
5107
5139
|
case 'textfield':
|
|
5108
5140
|
{
|
|
5141
|
+
var _field$editor, _field$editor$instruc;
|
|
5142
|
+
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
5143
|
return /*#__PURE__*/React.createElement(Textfield, {
|
|
5110
5144
|
key: `${field.id}-${idx}`,
|
|
5111
5145
|
field: field,
|
|
5112
|
-
type: field.type,
|
|
5146
|
+
type: field.id === 'password' ? 'password' : field.type,
|
|
5113
5147
|
id: field.id,
|
|
5114
5148
|
label: field.name && field.name[defaultLanguage],
|
|
5115
5149
|
formId: formId,
|
|
@@ -5120,7 +5154,8 @@ const FormComposer = ({
|
|
|
5120
5154
|
defaultValue: formData && formData[field.id] || field.default,
|
|
5121
5155
|
placeholder: field.editor,
|
|
5122
5156
|
errors: errors,
|
|
5123
|
-
useDefaultTheme: useDefaultTheme
|
|
5157
|
+
useDefaultTheme: useDefaultTheme,
|
|
5158
|
+
instructions: instructions
|
|
5124
5159
|
});
|
|
5125
5160
|
}
|
|
5126
5161
|
case 'textarea':
|
|
@@ -5241,7 +5276,7 @@ const FormComposer = ({
|
|
|
5241
5276
|
}
|
|
5242
5277
|
case 'country':
|
|
5243
5278
|
{
|
|
5244
|
-
var _field$default, _field$
|
|
5279
|
+
var _field$default, _field$editor2, _field$editor2$proper, _field$editor2$proper2;
|
|
5245
5280
|
return /*#__PURE__*/React.createElement(CountrySelect, {
|
|
5246
5281
|
key: `${field.id}-${idx}`,
|
|
5247
5282
|
formId: formId,
|
|
@@ -5250,18 +5285,29 @@ const FormComposer = ({
|
|
|
5250
5285
|
label: field.name && field.name[defaultLanguage],
|
|
5251
5286
|
validations: field.validations,
|
|
5252
5287
|
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$
|
|
5288
|
+
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
5289
|
});
|
|
5255
5290
|
}
|
|
5256
|
-
case '
|
|
5291
|
+
case 'content':
|
|
5257
5292
|
{
|
|
5293
|
+
var _editor$instructions;
|
|
5294
|
+
const {
|
|
5295
|
+
name,
|
|
5296
|
+
editor
|
|
5297
|
+
} = field || {};
|
|
5298
|
+
const instructions = editor === null || editor === void 0 ? void 0 : (_editor$instructions = editor.instructions) === null || _editor$instructions === void 0 ? void 0 : _editor$instructions[defaultLanguage];
|
|
5258
5299
|
return /*#__PURE__*/React.createElement("span", {
|
|
5259
|
-
className: "
|
|
5300
|
+
className: "form__content",
|
|
5260
5301
|
"data-form": "title",
|
|
5261
5302
|
style: {
|
|
5262
5303
|
display: 'block'
|
|
5263
|
-
}
|
|
5264
|
-
|
|
5304
|
+
},
|
|
5305
|
+
key: `${field.id}-${idx}`
|
|
5306
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
5307
|
+
className: "form__content--title"
|
|
5308
|
+
}, name === null || name === void 0 ? void 0 : name[defaultLanguage]), instructions && /*#__PURE__*/React.createElement(Markdown, {
|
|
5309
|
+
className: "form__content--markdown"
|
|
5310
|
+
}, instructions));
|
|
5265
5311
|
}
|
|
5266
5312
|
}
|
|
5267
5313
|
});
|
|
@@ -5432,7 +5478,9 @@ const Form = ({
|
|
|
5432
5478
|
useDefaultTheme: useDefaultTheme,
|
|
5433
5479
|
entries: entries,
|
|
5434
5480
|
setDateRangeValues: _setDateRangeValues
|
|
5435
|
-
}), pagingInfo.
|
|
5481
|
+
}), pagingInfo.pageCount >= 2 && /*#__PURE__*/React.createElement("div", {
|
|
5482
|
+
className: "form__btns"
|
|
5483
|
+
}, pagingInfo.pageIndex > 0 && /*#__PURE__*/React.createElement(Button, {
|
|
5436
5484
|
className: "form__btn--prev",
|
|
5437
5485
|
type: "button",
|
|
5438
5486
|
text: "Go Back",
|
|
@@ -5454,7 +5502,7 @@ const Form = ({
|
|
|
5454
5502
|
if (onCustomSubmit) onCustomSubmit();
|
|
5455
5503
|
},
|
|
5456
5504
|
useDefaultTheme: useDefaultTheme
|
|
5457
|
-
})), (status === null || status === void 0 ? void 0 : status.isLoading) && !(status !== null && status !== void 0 && status.hasSuccess) && /*#__PURE__*/React.createElement(Loader, {
|
|
5505
|
+
}))), (status === null || status === void 0 ? void 0 : status.isLoading) && !(status !== null && status !== void 0 && status.hasSuccess) && /*#__PURE__*/React.createElement(Loader, {
|
|
5458
5506
|
className: "loading",
|
|
5459
5507
|
height: 24,
|
|
5460
5508
|
width: 24,
|