@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/README.md CHANGED
@@ -129,18 +129,18 @@ The engine adds setup for form on backend and allows us to attach forms to any m
129
129
  site_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SITE_KEY"] %>
130
130
  secret_key: <%= ENV["FORM_NANO_RECAPTCHA_V2_SECRET_KEY"] %>
131
131
  ```
132
- 3. Include the site key in `global_props`
133
- ```ruby
134
- module ApplicationHelper
135
- def get_client_props
136
- # other variables
137
- custom_props = {
138
- # other props
139
- form_nano_recaptcha_v2_site_key: Rails.application.secrets.form_nano.dig(:recaptcha_v2, :site_key)
140
- }
141
- end
132
+ 3. Include the site key in `global_props`
133
+ ```ruby
134
+ module ApplicationHelper
135
+ def get_client_props
136
+ # other variables
137
+ custom_props = {
138
+ # other props
139
+ form_nano_recaptcha_v2_site_key: Rails.application.secrets.form_nano.dig(:recaptcha_v2, :site_key)
140
+ }
142
141
  end
143
- ```
142
+ end
143
+ ```
144
144
 
145
145
  ## Frontend package
146
146
  The frontend package allows us to create forms across neeto products.
package/dist/index.cjs.js CHANGED
@@ -2898,7 +2898,10 @@ var Email = function Email(_ref) {
2898
2898
  title: /*#__PURE__*/jsxRuntime.jsxs("div", {
2899
2899
  className: "flex gap-2",
2900
2900
  children: [t("neetoForm.domainRestriction.label"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], _objectSpread$r({
2901
- description: t("neetoForm.domainRestriction.popoverDescription")
2901
+ description: t("neetoForm.domainRestriction.popoverDescription"),
2902
+ popoverProps: {
2903
+ position: "top"
2904
+ }
2902
2905
  }, domainRestrictionHelpDocUrl && {
2903
2906
  helpLinkProps: {
2904
2907
  href: domainRestrictionHelpDocUrl
@@ -3066,6 +3069,13 @@ var Options = function Options(_ref) {
3066
3069
  var questionProps = _ref.questionProps;
3067
3070
  var _useTranslation = reactI18next.useTranslation(),
3068
3071
  t = _useTranslation.t;
3072
+ var _useBuildFormStore = useBuildFormStore(function (store) {
3073
+ var _store$formState;
3074
+ return {
3075
+ selectedLanguage: (_store$formState = store["formState"]) === null || _store$formState === void 0 ? void 0 : _store$formState["selectedLanguage"]
3076
+ };
3077
+ }, shallow.shallow),
3078
+ selectedLanguage = _useBuildFormStore.selectedLanguage;
3069
3079
  var _useField = formik.useField("optionsAttributes"),
3070
3080
  _useField2 = _slicedToArray__default["default"](_useField, 3),
3071
3081
  optionsAttributes = _useField2[0].value;
@@ -3075,11 +3085,18 @@ var Options = function Options(_ref) {
3075
3085
  _ref2$optionLabelProp = _ref2.optionLabelProps,
3076
3086
  optionLabelProps = _ref2$optionLabelProp === void 0 ? {} : _ref2$optionLabelProp,
3077
3087
  _ref2$freezeOptions = _ref2.freezeOptions,
3078
- freezeOptions = _ref2$freezeOptions === void 0 ? false : _ref2$freezeOptions;
3088
+ freezeOptions = _ref2$freezeOptions === void 0 ? false : _ref2$freezeOptions,
3089
+ _ref2$disableAddOptio = _ref2.disableAddOption,
3090
+ disableAddOption = _ref2$disableAddOptio === void 0 ? false : _ref2$disableAddOptio,
3091
+ _ref2$disableRemoveOp = _ref2.disableRemoveOption,
3092
+ disableRemoveOption = _ref2$disableRemoveOp === void 0 ? false : _ref2$disableRemoveOp;
3079
3093
  var handleRemoveOption = function handleRemoveOption(index) {
3080
3094
  var nextOptions = formHelpers.destroyFromList(optionsAttributes, index);
3081
3095
  setOptionsAttributes(nextOptions);
3082
3096
  };
3097
+ var isManageOptionDisabled = isFunction$1(freezeOptions) ? freezeOptions(selectedLanguage) : freezeOptions;
3098
+ var isAddOptionDisabled = disableAddOption || isManageOptionDisabled;
3099
+ var isRemoveOptionDisabled = disableRemoveOption || isManageOptionDisabled;
3083
3100
  return /*#__PURE__*/jsxRuntime.jsx("div", {
3084
3101
  className: "w-full",
3085
3102
  children: /*#__PURE__*/jsxRuntime.jsx(formik.FieldArray, {
@@ -3100,12 +3117,12 @@ var Options = function Options(_ref) {
3100
3117
  "data-cy": "neeto-form-engine-option-".concat(index),
3101
3118
  children: [/*#__PURE__*/jsxRuntime.jsx(InputWithMaxLength, {
3102
3119
  required: true,
3103
- disabled: freezeOptions,
3120
+ disabled: isManageOptionDisabled,
3104
3121
  name: "optionsAttributes.".concat(index, ".label"),
3105
3122
  placeholder: t("neetoForm.questions.common.questionFields.field.numberedOption", {
3106
3123
  number: index + 1
3107
3124
  })
3108
- }), !freezeOptions && /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
3125
+ }), !isRemoveOptionDisabled && /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
3109
3126
  "data-cy": "neeto-form-engine-delete-option-button",
3110
3127
  icon: Delete__default["default"],
3111
3128
  size: "small",
@@ -3123,7 +3140,7 @@ var Options = function Options(_ref) {
3123
3140
  })]
3124
3141
  }, "question-option-".concat((_option$id = option.id) !== null && _option$id !== void 0 ? _option$id : index));
3125
3142
  })
3126
- }), !freezeOptions && /*#__PURE__*/jsxRuntime.jsx("div", {
3143
+ }), !isAddOptionDisabled && /*#__PURE__*/jsxRuntime.jsx("div", {
3127
3144
  className: "mt-3 w-full",
3128
3145
  children: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
3129
3146
  "data-cy": "neeto-form-engine-add-option-button",