@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 CHANGED
@@ -565,8 +565,6 @@ const getFieldType = field => {
565
565
  return 'textarea';
566
566
  } else if (field.dataType === 'string' && field.editor && field.editor.id === 'list-dropdown') {
567
567
  return 'dropdown';
568
- } 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') {
569
- return 'hidden';
570
568
  } else if (field.dataType === 'stringArray' || field.dataType === 'boolean') {
571
569
  return 'checkbox';
572
570
  } else if (field.dataType === 'string' && field.validations && field.validations.allowedValues) {
@@ -580,7 +578,9 @@ const getFieldType = field => {
580
578
  } else if (field.dataFormat === 'entry') {
581
579
  return 'entryPicker';
582
580
  }
583
- if (field.dataFormat === 'quote') return 'title';else return 'textfield';
581
+ 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') {
582
+ return 'hidden';
583
+ } else return 'textfield';
584
584
  };
585
585
 
586
586
  const sagas = [effects.takeEvery(SUBMIT_FORM_SUCCESS, onFormSuccess), effects.takeEvery(SUBMIT_FORM_FOR_VALIDATION, doValidateForm), effects.takeEvery(SUBMIT_FORM, onSubmitForm), effects.takeEvery(SET_FORM_ID, doFetchForm),
@@ -1020,13 +1020,15 @@ CharacterLimit.propTypes = {
1020
1020
  useDefaultTheme: PropTypes__default["default"].bool
1021
1021
  };
1022
1022
 
1023
+ // import Markdown from 'markdown-to-jsx';
1024
+
1023
1025
  const TextfieldStyled = styled__default["default"].div.withConfig({
1024
1026
  displayName: "textfield__TextfieldStyled",
1025
1027
  componentId: "sc-whkw86-0"
1026
1028
  })(["", ";"], ({
1027
1029
  isHidden
1028
1030
  }) => {
1029
- return styled.css(["display:", ";"], isHidden ? 'none' : 'block');
1031
+ return styled.css(["display:", ";position:relative;"], isHidden ? 'none' : 'block');
1030
1032
  });
1031
1033
  const Textfield = ({
1032
1034
  className,
@@ -1042,7 +1044,8 @@ const Textfield = ({
1042
1044
  defaultLanguage,
1043
1045
  placeholder,
1044
1046
  isHidden,
1045
- useDefaultTheme
1047
+ useDefaultTheme,
1048
+ instructions
1046
1049
  }) => {
1047
1050
  const [hasCharLimit, setCharLimit] = React.useState(false);
1048
1051
  const isRequired = validations && validations.required ? true : false;
@@ -1055,6 +1058,7 @@ const Textfield = ({
1055
1058
  React.useEffect(() => {
1056
1059
  if (formValidationSent) setA11yInvalid(doA11yValidation(_, field, true));
1057
1060
  }, [formValidationSent]);
1061
+ const [isVisible, setVisible] = React__default["default"].useState(false);
1058
1062
  return /*#__PURE__*/React__default["default"].createElement(TextfieldStyled, {
1059
1063
  className: className,
1060
1064
  isHidden: isHidden
@@ -1075,7 +1079,7 @@ const Textfield = ({
1075
1079
  }
1076
1080
  }, /*#__PURE__*/React__default["default"].createElement("input", {
1077
1081
  className: "text-field__input",
1078
- type: type,
1082
+ type: (isVisible != null ? isVisible : 'text') || type,
1079
1083
  defaultValue: defaultValueText,
1080
1084
  placeholder: placeholderText,
1081
1085
  "aria-invalid": a11yInvalid,
@@ -1117,6 +1121,33 @@ const Textfield = ({
1117
1121
  }, /*#__PURE__*/React__default["default"].createElement("path", {
1118
1122
  fill: "#333",
1119
1123
  d: "m2 8 4.418 4.667L14 4.659l-1.246-1.326-6.336 6.692-3.18-3.332L2 8Z"
1124
+ }))), id === 'password' && /*#__PURE__*/React__default["default"].createElement("button", {
1125
+ className: "text-input__button--pw",
1126
+ type: "button",
1127
+ onClick: () => setVisible(!isVisible),
1128
+ "aria-label": `${isVisible ? 'Hide' : 'Show'} Password.`
1129
+ }, isVisible ? /*#__PURE__*/React__default["default"].createElement("svg", {
1130
+ width: "15",
1131
+ height: "15",
1132
+ viewBox: "0 0 15 15",
1133
+ fill: "none",
1134
+ xmlns: "http://www.w3.org/2000/svg"
1135
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
1136
+ 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",
1137
+ fill: "currentColor",
1138
+ "fill-rule": "evenodd",
1139
+ "clip-rule": "evenodd"
1140
+ })) : /*#__PURE__*/React__default["default"].createElement("svg", {
1141
+ width: "15",
1142
+ height: "15",
1143
+ viewBox: "0 0 15 15",
1144
+ fill: "none",
1145
+ xmlns: "http://www.w3.org/2000/svg"
1146
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
1147
+ 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",
1148
+ fill: "currentColor",
1149
+ "fill-rule": "evenodd",
1150
+ "clip-rule": "evenodd"
1120
1151
  }))));
1121
1152
  };
1122
1153
  Textfield.propTypes = {
@@ -5097,6 +5128,8 @@ const CountrySelectStyled = styled__default["default"].div.withConfig({
5097
5128
  return styled.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);}"]);
5098
5129
  });
5099
5130
 
5131
+ // import Markdown from 'markdown-to-jsx';
5132
+
5100
5133
  const FormComposer = ({
5101
5134
  fields,
5102
5135
  formData,
@@ -5116,10 +5149,12 @@ const FormComposer = ({
5116
5149
  case 'number':
5117
5150
  case 'textfield':
5118
5151
  {
5152
+ var _field$editor, _field$editor$instruc;
5153
+ 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];
5119
5154
  return /*#__PURE__*/React__default["default"].createElement(Textfield, {
5120
5155
  key: `${field.id}-${idx}`,
5121
5156
  field: field,
5122
- type: field.type,
5157
+ type: field.id === 'password' ? 'password' : field.type,
5123
5158
  id: field.id,
5124
5159
  label: field.name && field.name[defaultLanguage],
5125
5160
  formId: formId,
@@ -5130,7 +5165,8 @@ const FormComposer = ({
5130
5165
  defaultValue: formData && formData[field.id] || field.default,
5131
5166
  placeholder: field.editor,
5132
5167
  errors: errors,
5133
- useDefaultTheme: useDefaultTheme
5168
+ useDefaultTheme: useDefaultTheme,
5169
+ instructions: instructions
5134
5170
  });
5135
5171
  }
5136
5172
  case 'textarea':
@@ -5251,7 +5287,7 @@ const FormComposer = ({
5251
5287
  }
5252
5288
  case 'country':
5253
5289
  {
5254
- var _field$default, _field$editor, _field$editor$propert, _field$editor$propert2;
5290
+ var _field$default, _field$editor2, _field$editor2$proper, _field$editor2$proper2;
5255
5291
  return /*#__PURE__*/React__default["default"].createElement(CountrySelect, {
5256
5292
  key: `${field.id}-${idx}`,
5257
5293
  formId: formId,
@@ -5260,18 +5296,27 @@ const FormComposer = ({
5260
5296
  label: field.name && field.name[defaultLanguage],
5261
5297
  validations: field.validations,
5262
5298
  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]),
5263
- placeholder: field === null || field === void 0 ? void 0 : (_field$editor = field.editor) === null || _field$editor === void 0 ? void 0 : (_field$editor$propert = _field$editor.properties) === null || _field$editor$propert === void 0 ? void 0 : (_field$editor$propert2 = _field$editor$propert.placeholderText) === null || _field$editor$propert2 === void 0 ? void 0 : _field$editor$propert2[defaultLanguage]
5299
+ 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]
5264
5300
  });
5265
5301
  }
5266
- case 'title':
5302
+ case 'content':
5267
5303
  {
5304
+ var _editor$instructions;
5305
+ const {
5306
+ name,
5307
+ editor
5308
+ } = field || {};
5309
+ editor === null || editor === void 0 ? void 0 : (_editor$instructions = editor.instructions) === null || _editor$instructions === void 0 ? void 0 : _editor$instructions[defaultLanguage];
5268
5310
  return /*#__PURE__*/React__default["default"].createElement("span", {
5269
- className: "form__title",
5311
+ className: "form__content",
5270
5312
  "data-form": "title",
5271
5313
  style: {
5272
5314
  display: 'block'
5273
- }
5274
- }, field.name && field.name[defaultLanguage]);
5315
+ },
5316
+ key: `${field.id}-${idx}`
5317
+ }, /*#__PURE__*/React__default["default"].createElement("span", {
5318
+ className: "form__content--title"
5319
+ }, name === null || name === void 0 ? void 0 : name[defaultLanguage]));
5275
5320
  }
5276
5321
  }
5277
5322
  });
@@ -5442,7 +5487,9 @@ const Form = ({
5442
5487
  useDefaultTheme: useDefaultTheme,
5443
5488
  entries: entries,
5444
5489
  setDateRangeValues: _setDateRangeValues
5445
- }), pagingInfo.pageIndex > 0 && /*#__PURE__*/React__default["default"].createElement(Button, {
5490
+ }), pagingInfo.pageCount >= 2 && /*#__PURE__*/React__default["default"].createElement("div", {
5491
+ className: "form__btns"
5492
+ }, pagingInfo.pageIndex > 0 && /*#__PURE__*/React__default["default"].createElement(Button, {
5446
5493
  className: "form__btn--prev",
5447
5494
  type: "button",
5448
5495
  text: "Go Back",
@@ -5464,7 +5511,7 @@ const Form = ({
5464
5511
  if (onCustomSubmit) onCustomSubmit();
5465
5512
  },
5466
5513
  useDefaultTheme: useDefaultTheme
5467
- })), (status === null || status === void 0 ? void 0 : status.isLoading) && !(status !== null && status !== void 0 && status.hasSuccess) && /*#__PURE__*/React__default["default"].createElement(Loader, {
5514
+ }))), (status === null || status === void 0 ? void 0 : status.isLoading) && !(status !== null && status !== void 0 && status.hasSuccess) && /*#__PURE__*/React__default["default"].createElement(Loader, {
5468
5515
  className: "loading",
5469
5516
  height: 24,
5470
5517
  width: 24,