@bigbinary/neeto-themes-frontend 4.0.14 → 4.0.15

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.
@@ -104,6 +104,10 @@
104
104
  }
105
105
  }
106
106
  },
107
+ "validations": {
108
+ "invalidUrl": "Please enter a valid URL",
109
+ "nameRequired": "Name is required"
110
+ },
107
111
  "form": {
108
112
  "build": {
109
113
  "logoPosition": "Logo position",
@@ -7,7 +7,7 @@ import { useTranslation, Trans } from 'react-i18next';
7
7
  import { B as BASE_URL, b as scrollElementIntoView, c as setCustomCSS, g as getDominantColorFromUrl, i as isEditThemeRoute, d as isFunction, e as isNewThemeRoute } from './index-JpAFUrB8.js';
8
8
  import { useQuery, useQueryClient } from '@tanstack/react-query';
9
9
  import axios from 'axios';
10
- import { Q as QUERY_KEYS, a as useConfigStore, b as useThemeStore, u as useThemeUtils, P as POSITION_OPTIONS, H as HUNDRED, O as OVERLAY_OPACITY_SLIDER_MARKS, F as FONT_OPTIONS, T as THEME_VALIDATION_SCHEMA } from './useThemeUtils-0tkceuqS.js';
10
+ import { Q as QUERY_KEYS, a as useConfigStore, b as useThemeStore, u as useThemeUtils, P as POSITION_OPTIONS, H as HUNDRED, O as OVERLAY_OPACITY_SLIDER_MARKS, F as FONT_OPTIONS, T as THEME_VALIDATION_SCHEMA } from './useThemeUtils-BaUtDOWd.js';
11
11
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
12
12
  import classnames from 'classnames';
13
13
  import { joinHyphenCase, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
@@ -897,7 +897,8 @@ var TextBlock = function TextBlock(_ref) {
897
897
  type = _ref$type === void 0 ? "text" : _ref$type,
898
898
  value = _ref.value,
899
899
  onChange = _ref.onChange,
900
- placeholder = _ref.placeholder;
900
+ placeholder = _ref.placeholder,
901
+ error = _ref.error;
901
902
  return /*#__PURE__*/jsxs("div", {
902
903
  className: "flex items-center justify-between",
903
904
  "data-testid": "theme-style-".concat(joinHyphenCase(label)),
@@ -908,6 +909,7 @@ var TextBlock = function TextBlock(_ref) {
908
909
  }), /*#__PURE__*/jsx("div", {
909
910
  className: "w-40",
910
911
  children: /*#__PURE__*/jsx(Input, {
912
+ error: error,
911
913
  name: name,
912
914
  onChange: onChange,
913
915
  placeholder: placeholder,
@@ -936,7 +938,8 @@ var Properties = function Properties(_ref) {
936
938
  setThemeState = _useThemeStore.setThemeState;
937
939
  var _useFormikContext = useFormikContext(),
938
940
  setFieldValue = _useFormikContext.setFieldValue,
939
- values = _useFormikContext.values;
941
+ values = _useFormikContext.values,
942
+ errors = _useFormikContext.errors;
940
943
  var _useThemeUtils = useThemeUtils(),
941
944
  setVariable = _useThemeUtils.setVariable,
942
945
  setTheme = _useThemeUtils.setTheme;
@@ -1006,10 +1009,13 @@ var Properties = function Properties(_ref) {
1006
1009
  switch (kind) {
1007
1010
  case "text_input":
1008
1011
  {
1012
+ var _errors$properties;
1009
1013
  var index = findIndexBy({
1010
1014
  key: key
1011
1015
  }, values.properties);
1016
+ var error = errors === null || errors === void 0 || (_errors$properties = errors.properties) === null || _errors$properties === void 0 || (_errors$properties = _errors$properties[index]) === null || _errors$properties === void 0 ? void 0 : _errors$properties.value;
1012
1017
  return /*#__PURE__*/jsx(TextBlock, {
1018
+ error: error,
1013
1019
  label: buildLabel(key, kind),
1014
1020
  name: "properties[".concat(index, "].value"),
1015
1021
  value: value || "",
@@ -1421,8 +1427,8 @@ var Customize = function Customize(_ref) {
1421
1427
  onSubmit: onSubmit
1422
1428
  },
1423
1429
  children: function children(_ref5) {
1424
- var _values$name;
1425
1430
  var dirty = _ref5.dirty,
1431
+ isValid = _ref5.isValid,
1426
1432
  values = _ref5.values,
1427
1433
  setFieldValue = _ref5.setFieldValue;
1428
1434
  return /*#__PURE__*/jsxs("div", {
@@ -1503,7 +1509,7 @@ var Customize = function Customize(_ref) {
1503
1509
  loading: isSubmitting,
1504
1510
  ref: submitBtnRef,
1505
1511
  type: "submit",
1506
- disabled: !dirty && (themeData === null || themeData === void 0 ? void 0 : themeData.id) || isSubmitting || isNotPresent(values === null || values === void 0 || (_values$name = values.name) === null || _values$name === void 0 ? void 0 : _values$name.trim())
1512
+ disabled: !dirty && (themeData === null || themeData === void 0 ? void 0 : themeData.id) || isSubmitting || !isValid
1507
1513
  })]
1508
1514
  }), /*#__PURE__*/jsx(Popover, {
1509
1515
  appendTo: function appendTo() {