@bigbinary/neeto-form-frontend 3.3.0 → 3.3.2

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/dist/index.js CHANGED
@@ -2812,7 +2812,10 @@ var Email = function Email(_ref) {
2812
2812
  title: /*#__PURE__*/jsxs("div", {
2813
2813
  className: "flex gap-2",
2814
2814
  children: [t("neetoForm.domainRestriction.label"), /*#__PURE__*/jsx(HelpPopover, _objectSpread$r({
2815
- description: t("neetoForm.domainRestriction.popoverDescription")
2815
+ description: t("neetoForm.domainRestriction.popoverDescription"),
2816
+ popoverProps: {
2817
+ position: "top"
2818
+ }
2816
2819
  }, domainRestrictionHelpDocUrl && {
2817
2820
  helpLinkProps: {
2818
2821
  href: domainRestrictionHelpDocUrl
@@ -2980,6 +2983,13 @@ var Options = function Options(_ref) {
2980
2983
  var questionProps = _ref.questionProps;
2981
2984
  var _useTranslation = useTranslation(),
2982
2985
  t = _useTranslation.t;
2986
+ var _useBuildFormStore = useBuildFormStore(function (store) {
2987
+ var _store$formState;
2988
+ return {
2989
+ selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"]
2990
+ };
2991
+ }, shallow),
2992
+ selectedLanguage = _useBuildFormStore.selectedLanguage;
2983
2993
  var _useField = useField("optionsAttributes"),
2984
2994
  _useField2 = _slicedToArray(_useField, 3),
2985
2995
  optionsAttributes = _useField2[0].value;
@@ -2989,11 +2999,18 @@ var Options = function Options(_ref) {
2989
2999
  _ref2$optionLabelProp = _ref2.optionLabelProps,
2990
3000
  optionLabelProps = _ref2$optionLabelProp === void 0 ? {} : _ref2$optionLabelProp,
2991
3001
  _ref2$freezeOptions = _ref2.freezeOptions,
2992
- freezeOptions = _ref2$freezeOptions === void 0 ? false : _ref2$freezeOptions;
3002
+ freezeOptions = _ref2$freezeOptions === void 0 ? false : _ref2$freezeOptions,
3003
+ _ref2$disableAddOptio = _ref2.disableAddOption,
3004
+ disableAddOption = _ref2$disableAddOptio === void 0 ? false : _ref2$disableAddOptio,
3005
+ _ref2$disableRemoveOp = _ref2.disableRemoveOption,
3006
+ disableRemoveOption = _ref2$disableRemoveOp === void 0 ? false : _ref2$disableRemoveOp;
2993
3007
  var handleRemoveOption = function handleRemoveOption(index) {
2994
3008
  var nextOptions = formHelpers.destroyFromList(optionsAttributes, index);
2995
3009
  setOptionsAttributes(nextOptions);
2996
3010
  };
3011
+ var isManageOptionDisabled = isFunction$1(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
3012
+ var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
3013
+ var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
2997
3014
  return /*#__PURE__*/jsx("div", {
2998
3015
  className: "w-full",
2999
3016
  children: /*#__PURE__*/jsx(FieldArray, {
@@ -3014,12 +3031,12 @@ var Options = function Options(_ref) {
3014
3031
  "data-cy": "neeto-form-engine-option-".concat(index),
3015
3032
  children: [/*#__PURE__*/jsx(InputWithMaxLength, {
3016
3033
  required: true,
3017
- disabled: freezeOptions,
3034
+ disabled: isManageOptionDisabled,
3018
3035
  name: "optionsAttributes.".concat(index, ".label"),
3019
3036
  placeholder: t("neetoForm.questions.common.questionFields.field.numberedOption", {
3020
3037
  number: index + 1
3021
3038
  })
3022
- }), !freezeOptions && /*#__PURE__*/jsx(Button$1, {
3039
+ }), !isRemoveOptionDisabled && /*#__PURE__*/jsx(Button$1, {
3023
3040
  "data-cy": "neeto-form-engine-delete-option-button",
3024
3041
  icon: Delete,
3025
3042
  size: "small",
@@ -3037,7 +3054,7 @@ var Options = function Options(_ref) {
3037
3054
  })]
3038
3055
  }, "question-option-".concat((_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : index));
3039
3056
  })
3040
- }), !freezeOptions && /*#__PURE__*/jsx("div", {
3057
+ }), !isAddOptionDisabled && /*#__PURE__*/jsx("div", {
3041
3058
  className: "mt-3 w-full",
3042
3059
  children: /*#__PURE__*/jsx(Button$1, {
3043
3060
  "data-cy": "neeto-form-engine-add-option-button",