@bigbinary/neeto-themes-frontend 4.2.5 → 4.2.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.
@@ -251,7 +251,8 @@ var Card$2 = function Card(_ref) {
251
251
  name = _ref.name,
252
252
  className = _ref.className,
253
253
  helpPopoverProps = _ref.helpPopoverProps,
254
- required = _ref.required;
254
+ required = _ref.required,
255
+ dataTestid = _ref.dataTestid;
255
256
  var _useExpandedSection = useExpandedSection(),
256
257
  expandedSection = _useExpandedSection.expandedSection,
257
258
  setExpandedSection = _useExpandedSection.setExpandedSection;
@@ -265,7 +266,7 @@ var Card$2 = function Card(_ref) {
265
266
  var triggerId = "neeto-themes-section-".concat(sectionId, "-trigger");
266
267
  var contentId = "neeto-themes-section-".concat(sectionId, "-content");
267
268
  return /*#__PURE__*/jsxs("div", {
268
- "data-testid": "theme-".concat(hyphenate(title), "-properties"),
269
+ "data-testid": dataTestid || "theme-".concat(hyphenate(title), "-properties"),
269
270
  className: classnames("neeto-themes-nano-section border-border border-b pt-2 transition-all duration-300 last:border-none", className, {
270
271
  "pb-2": !isOpen,
271
272
  "pb-3": isOpen
@@ -449,6 +450,7 @@ var CustomCSS = function CustomCSS(_ref) {
449
450
  id: "css-editor",
450
451
  children: /*#__PURE__*/jsx(Card$2, {
451
452
  name: "customcss",
453
+ dataTestid: isCustomCssScreen ? undefined : "theme-custom-css-properties",
452
454
  helpPopoverProps: isEnabled ? customCssHelpPopoverProps : {
453
455
  title: t("neetoThemes.common.proFeature.customCSS.title"),
454
456
  description: t("neetoThemes.common.proFeature.customCSS.description")
@@ -754,10 +756,11 @@ var buildSystemThemeCopy = function buildSystemThemeCopy(systemTheme) {
754
756
  var AlignmentBlock = withT(function (_ref) {
755
757
  var t = _ref.t,
756
758
  label = _ref.label,
757
- name = _ref.name;
759
+ name = _ref.name,
760
+ dataTestid = _ref.dataTestid;
758
761
  return /*#__PURE__*/jsxs("div", {
759
762
  className: "flex items-center justify-between gap-2",
760
- "data-testid": joinHyphenCase(label),
763
+ "data-testid": dataTestid || joinHyphenCase(label),
761
764
  children: [/*#__PURE__*/jsx(Typography, {
762
765
  "data-testid": "style-fields-labels",
763
766
  variant: "body2",
@@ -803,10 +806,11 @@ var ColorBlock = function ColorBlock(_ref) {
803
806
  _ref$color = _ref.color,
804
807
  color = _ref$color === void 0 ? "#FFFFFF" : _ref$color,
805
808
  onChange = _ref.onChange,
806
- showTransparencyControl = _ref.showTransparencyControl;
809
+ showTransparencyControl = _ref.showTransparencyControl,
810
+ dataTestid = _ref.dataTestid;
807
811
  return /*#__PURE__*/jsxs("div", {
808
812
  className: "flex min-h-9 items-center justify-between",
809
- "data-testid": "theme-style-".concat(joinHyphenCase(label)),
813
+ "data-testid": dataTestid || "theme-style-".concat(joinHyphenCase(label)),
810
814
  children: [/*#__PURE__*/jsx(Label, {
811
815
  "data-testid": "style-fields-labels",
812
816
  children: label
@@ -826,10 +830,11 @@ var FontPickerBlock = function FontPickerBlock(_ref) {
826
830
  placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
827
831
  value = _ref.value,
828
832
  options = _ref.options,
829
- onChange = _ref.onChange;
833
+ onChange = _ref.onChange,
834
+ dataTestid = _ref.dataTestid;
830
835
  return /*#__PURE__*/jsxs("div", {
831
836
  className: "flex items-center justify-between",
832
- "data-testid": "theme-style-".concat(joinHyphenCase(label)),
837
+ "data-testid": dataTestid || "theme-style-".concat(joinHyphenCase(label)),
833
838
  children: [/*#__PURE__*/jsx(Label, {
834
839
  "data-testid": "style-fields-labels",
835
840
  children: label
@@ -862,10 +867,11 @@ var SelectBlock = function SelectBlock(_ref) {
862
867
  placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
863
868
  value = _ref.value,
864
869
  options = _ref.options,
865
- onChange = _ref.onChange;
870
+ onChange = _ref.onChange,
871
+ dataTestid = _ref.dataTestid;
866
872
  return /*#__PURE__*/jsxs("div", {
867
873
  className: "flex min-h-9 items-center justify-between gap-3",
868
- "data-testid": "theme-style-".concat(joinHyphenCase(label)),
874
+ "data-testid": dataTestid || "theme-style-".concat(joinHyphenCase(label)),
869
875
  children: [/*#__PURE__*/jsx(Label, {
870
876
  "data-testid": "logo-field-labels",
871
877
  children: label
@@ -889,10 +895,11 @@ var SliderBlock = function SliderBlock(_ref) {
889
895
  onChange = _ref.onChange,
890
896
  value = _ref.value,
891
897
  min = _ref.min,
892
- max = _ref.max;
898
+ max = _ref.max,
899
+ dataTestid = _ref.dataTestid;
893
900
  return /*#__PURE__*/jsxs("div", {
894
901
  className: "flex min-h-9 items-center justify-between gap-3",
895
- "data-testid": "theme-style-".concat(joinHyphenCase(label)),
902
+ "data-testid": dataTestid || "theme-style-".concat(joinHyphenCase(label)),
896
903
  children: [/*#__PURE__*/jsx(Label, {
897
904
  "data-testid": "style-fields-labels",
898
905
  children: label
@@ -906,7 +913,7 @@ var SliderBlock = function SliderBlock(_ref) {
906
913
  });
907
914
  };
908
915
 
909
- var _excluded = ["label", "name", "asCheckbox"];
916
+ var _excluded = ["label", "name", "asCheckbox", "dataTestid"];
910
917
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
911
918
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
912
919
  var SwitchBlock = function SwitchBlock(_ref) {
@@ -914,6 +921,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
914
921
  name = _ref.name,
915
922
  _ref$asCheckbox = _ref.asCheckbox,
916
923
  asCheckbox = _ref$asCheckbox === void 0 ? false : _ref$asCheckbox,
924
+ dataTestid = _ref.dataTestid,
917
925
  inputProps = _objectWithoutProperties(_ref, _excluded);
918
926
  var _useTranslation = useTranslation(),
919
927
  t = _useTranslation.t,
@@ -923,7 +931,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
923
931
  if (asCheckbox) {
924
932
  return /*#__PURE__*/jsxs("div", {
925
933
  className: "flex min-h-9 items-center gap-2",
926
- "data-testid": "theme-style-content-background",
934
+ "data-testid": dataTestid || "theme-style-content-background",
927
935
  children: [/*#__PURE__*/jsx(Checkbox, _objectSpread$1(_objectSpread$1({}, _objectSpread$1({
928
936
  label: label,
929
937
  name: name
@@ -937,7 +945,7 @@ var SwitchBlock = function SwitchBlock(_ref) {
937
945
  }
938
946
  return /*#__PURE__*/jsxs("div", {
939
947
  className: "flex min-h-9 items-center justify-between",
940
- "data-testid": "theme-style-content-background",
948
+ "data-testid": dataTestid || "theme-style-content-background",
941
949
  children: [/*#__PURE__*/jsxs("div", {
942
950
  className: "inline-flex items-center gap-4",
943
951
  children: [/*#__PURE__*/jsx(Label, {
@@ -968,10 +976,11 @@ var TextBlock = function TextBlock(_ref) {
968
976
  value = _ref.value,
969
977
  onChange = _ref.onChange,
970
978
  placeholder = _ref.placeholder,
971
- error = _ref.error;
979
+ error = _ref.error,
980
+ dataTestid = _ref.dataTestid;
972
981
  return /*#__PURE__*/jsxs("div", {
973
982
  className: "flex flex-col gap-2",
974
- "data-testid": "theme-style-".concat(joinHyphenCase(label)),
983
+ "data-testid": dataTestid || "theme-style-".concat(joinHyphenCase(label)),
975
984
  children: [/*#__PURE__*/jsx(Label, {
976
985
  "data-testid": "style-fields-labels",
977
986
  children: label
@@ -1066,7 +1075,7 @@ var Properties = function Properties(_ref) {
1066
1075
  };
1067
1076
  return order(a.key) - order(b.key);
1068
1077
  }).map(function (_ref3) {
1069
- var _findBy3;
1078
+ var _findBy4, _findBy5, _findBy6, _findBy7, _findBy8;
1070
1079
  var key = _ref3.key,
1071
1080
  value = _ref3.value,
1072
1081
  kind = _ref3.kind;
@@ -1075,7 +1084,7 @@ var Properties = function Properties(_ref) {
1075
1084
  switch (kind) {
1076
1085
  case "text_input":
1077
1086
  {
1078
- var _errors$properties;
1087
+ var _errors$properties, _findBy3;
1079
1088
  var index = findIndexBy({
1080
1089
  key: key
1081
1090
  }, values.properties);
@@ -1086,6 +1095,9 @@ var Properties = function Properties(_ref) {
1086
1095
  label: buildLabel(key, kind),
1087
1096
  name: "properties[".concat(index, "].value"),
1088
1097
  value: value || "",
1098
+ dataTestid: (_findBy3 = findBy({
1099
+ key: key
1100
+ }, themePropertiesSchema)) === null || _findBy3 === void 0 ? void 0 : _findBy3.dataTestid,
1089
1101
  onChange: function onChange(e) {
1090
1102
  return setFieldValue("properties[".concat(index, "].value"), e.target.value);
1091
1103
  }
@@ -1096,6 +1108,9 @@ var Properties = function Properties(_ref) {
1096
1108
  label: buildLabel(key, kind),
1097
1109
  options: FONT_OPTIONS,
1098
1110
  value: value || "",
1111
+ dataTestid: (_findBy4 = findBy({
1112
+ key: key
1113
+ }, themePropertiesSchema)) === null || _findBy4 === void 0 ? void 0 : _findBy4.dataTestid,
1099
1114
  onChange: function onChange(newValue) {
1100
1115
  return handleChange(key, newValue);
1101
1116
  }
@@ -1104,9 +1119,12 @@ var Properties = function Properties(_ref) {
1104
1119
  return /*#__PURE__*/jsx(ColorBlock, {
1105
1120
  color: value,
1106
1121
  label: buildLabel(key, kind),
1107
- showTransparencyControl: ((_findBy3 = findBy({
1122
+ dataTestid: (_findBy5 = findBy({
1108
1123
  key: key
1109
- }, themePropertiesSchema)) === null || _findBy3 === void 0 ? void 0 : _findBy3.showTransparencyControl) || false,
1124
+ }, themePropertiesSchema)) === null || _findBy5 === void 0 ? void 0 : _findBy5.dataTestid,
1125
+ showTransparencyControl: ((_findBy6 = findBy({
1126
+ key: key
1127
+ }, themePropertiesSchema)) === null || _findBy6 === void 0 ? void 0 : _findBy6.showTransparencyControl) || false,
1110
1128
  onChange: handleColorChange(key)
1111
1129
  }, key);
1112
1130
  case "radius":
@@ -1115,6 +1133,9 @@ var Properties = function Properties(_ref) {
1115
1133
  max: 50,
1116
1134
  min: 0,
1117
1135
  value: Number(value) || 0,
1136
+ dataTestid: (_findBy7 = findBy({
1137
+ key: key
1138
+ }, themePropertiesSchema)) === null || _findBy7 === void 0 ? void 0 : _findBy7.dataTestid,
1118
1139
  onChange: function onChange(radius) {
1119
1140
  return handleChange(key, radius, "".concat(radius, "px"));
1120
1141
  }
@@ -1126,25 +1147,31 @@ var Properties = function Properties(_ref) {
1126
1147
  max: HUNDRED,
1127
1148
  min: negate(HUNDRED),
1128
1149
  value: Number(value) || 0,
1150
+ dataTestid: (_findBy8 = findBy({
1151
+ key: key
1152
+ }, themePropertiesSchema)) === null || _findBy8 === void 0 ? void 0 : _findBy8.dataTestid,
1129
1153
  onChange: function onChange(opacity) {
1130
1154
  return handleOverlayChange(key, opacity);
1131
1155
  }
1132
1156
  }, key);
1133
1157
  case "position_selector":
1134
1158
  {
1135
- var _findBy4;
1159
+ var _findBy9, _findBy0;
1136
1160
  var _index = findIndexBy({
1137
1161
  key: key
1138
1162
  }, values.properties);
1139
- var options = (_findBy4 = findBy({
1163
+ var options = (_findBy9 = findBy({
1140
1164
  key: key
1141
- }, themePropertiesSchema)) === null || _findBy4 === void 0 || (_findBy4 = _findBy4.options) === null || _findBy4 === void 0 ? void 0 : _findBy4.map(toCapitalizedOption);
1165
+ }, themePropertiesSchema)) === null || _findBy9 === void 0 || (_findBy9 = _findBy9.options) === null || _findBy9 === void 0 ? void 0 : _findBy9.map(toCapitalizedOption);
1142
1166
  return /*#__PURE__*/createElement(SelectBlock, {
1143
1167
  value: value,
1144
1168
  key: key,
1145
1169
  label: buildLabel(key, kind),
1146
1170
  options: options || POSITION_OPTIONS,
1147
1171
  placeholder: "left",
1172
+ dataTestid: (_findBy0 = findBy({
1173
+ key: key
1174
+ }, themePropertiesSchema)) === null || _findBy0 === void 0 ? void 0 : _findBy0.dataTestid,
1148
1175
  onChange: function onChange(newValue) {
1149
1176
  return setFieldValue("properties[".concat(_index, "].value"), newValue);
1150
1177
  }
@@ -1152,18 +1179,21 @@ var Properties = function Properties(_ref) {
1152
1179
  }
1153
1180
  case "boolean":
1154
1181
  {
1155
- var _findBy5;
1182
+ var _findBy1, _findBy10;
1156
1183
  var _index2 = findIndexBy({
1157
1184
  key: key
1158
1185
  }, values.properties);
1159
- var renderAsCheckbox = ((_findBy5 = findBy({
1186
+ var renderAsCheckbox = ((_findBy1 = findBy({
1160
1187
  key: key
1161
- }, themePropertiesSchema)) === null || _findBy5 === void 0 ? void 0 : _findBy5.renderAsCheckbox) || false;
1188
+ }, themePropertiesSchema)) === null || _findBy1 === void 0 ? void 0 : _findBy1.renderAsCheckbox) || false;
1162
1189
  return /*#__PURE__*/jsx(SwitchBlock, {
1163
1190
  asCheckbox: renderAsCheckbox,
1164
1191
  checked: value !== "false",
1165
1192
  label: buildLabel(key, kind),
1166
1193
  name: snakeToCamelCase(key),
1194
+ dataTestid: (_findBy10 = findBy({
1195
+ key: key
1196
+ }, themePropertiesSchema)) === null || _findBy10 === void 0 ? void 0 : _findBy10.dataTestid,
1167
1197
  onCheckedChange: function onCheckedChange(checked) {
1168
1198
  return setFieldValue("properties[".concat(_index2, "].value"), String(checked));
1169
1199
  }
@@ -1171,12 +1201,16 @@ var Properties = function Properties(_ref) {
1171
1201
  }
1172
1202
  case "alignment_block":
1173
1203
  {
1204
+ var _findBy11;
1174
1205
  var _index3 = findIndexBy({
1175
1206
  key: key
1176
1207
  }, values.properties);
1177
1208
  return /*#__PURE__*/jsx(AlignmentBlock, {
1178
1209
  label: buildLabel(key, kind),
1179
- name: "properties[".concat(_index3, "].value")
1210
+ name: "properties[".concat(_index3, "].value"),
1211
+ dataTestid: (_findBy11 = findBy({
1212
+ key: key
1213
+ }, themePropertiesSchema)) === null || _findBy11 === void 0 ? void 0 : _findBy11.dataTestid
1180
1214
  }, key);
1181
1215
  }
1182
1216
  default:
@@ -1299,7 +1333,7 @@ var ImageBlock = function ImageBlock(_ref) {
1299
1333
  };
1300
1334
 
1301
1335
  var Images = function Images(_ref) {
1302
- var _values$coverImage;
1336
+ var _findBy, _values$coverImage;
1303
1337
  var attribute = _ref.attribute,
1304
1338
  className = _ref.className,
1305
1339
  onPropertiesChange = _ref.onPropertiesChange,
@@ -1310,16 +1344,21 @@ var Images = function Images(_ref) {
1310
1344
  values = _useFormikContext.values;
1311
1345
  var _useConfigStore = useConfigStore(function (store) {
1312
1346
  return {
1313
- helpPopoverProps: store["helpPopoverProps"]
1347
+ helpPopoverProps: store["helpPopoverProps"],
1348
+ themePropertiesSchema: store["themePropertiesSchema"]
1314
1349
  };
1315
1350
  }, shallow),
1316
- helpPopoverProps = _useConfigStore.helpPopoverProps;
1351
+ helpPopoverProps = _useConfigStore.helpPopoverProps,
1352
+ themePropertiesSchema = _useConfigStore.themePropertiesSchema;
1317
1353
  var key = snakeToCamelCase(attribute);
1318
1354
  var title = buildLabel(key, "image");
1319
1355
  var imageData = values[key];
1320
1356
  return /*#__PURE__*/jsxs(Card$2, {
1321
1357
  className: className,
1322
1358
  title: title,
1359
+ dataTestid: (_findBy = findBy({
1360
+ key: attribute
1361
+ }, themePropertiesSchema)) === null || _findBy === void 0 ? void 0 : _findBy.dataTestid,
1323
1362
  helpPopoverProps: helpPopoverProps[key],
1324
1363
  name: key,
1325
1364
  children: [/*#__PURE__*/jsx(ImageBlock, {
@@ -1351,6 +1390,7 @@ var ThemeMeta = function ThemeMeta(_ref) {
1351
1390
  return /*#__PURE__*/jsx(Card$2, {
1352
1391
  className: className,
1353
1392
  required: true,
1393
+ dataTestid: "theme-name-properties",
1354
1394
  helpPopoverProps: nameHelpPopoverProps,
1355
1395
  name: "name",
1356
1396
  title: t("neetoThemes.common.name"),
@@ -1565,6 +1605,7 @@ var Customize = function Customize(_ref) {
1565
1605
  className: classnames({
1566
1606
  hidden: isCustomCssScreen
1567
1607
  }),
1608
+ dataTestid: "theme-style-properties",
1568
1609
  helpPopoverProps: styleHelpPopoverProps,
1569
1610
  name: "style",
1570
1611
  title: t("neetoThemes.common.style"),
@@ -1602,6 +1643,7 @@ var Customize = function Customize(_ref) {
1602
1643
  content: t("neetoThemes.build.leftSideBar.themes.themeOptions.setAsGlobalTheme.tooltipContent"),
1603
1644
  children: /*#__PURE__*/jsx(Switch, {
1604
1645
  checked: values.shouldSetAsGlobalTheme,
1646
+ dataTestId: "set-as-default-theme",
1605
1647
  disabled: isThemeGlobalTheme,
1606
1648
  name: "shouldSetAsGlobalTheme",
1607
1649
  size: "lg",