@bigbinary/neeto-themes-frontend 1.2.3 → 1.2.4
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.cjs.js +275 -68
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +273 -69
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs.js
CHANGED
|
@@ -12,9 +12,9 @@ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
|
12
12
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
13
13
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
14
14
|
var reactI18next = require('react-i18next');
|
|
15
|
-
require('@babel/runtime/helpers/asyncToGenerator');
|
|
16
|
-
require('@babel/runtime/regenerator');
|
|
17
|
-
require('@bigbinary/neetoui/Toastr');
|
|
15
|
+
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
16
|
+
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
17
|
+
var Toastr = require('@bigbinary/neetoui/Toastr');
|
|
18
18
|
var reactQuery = require('react-query');
|
|
19
19
|
var axios = require('axios');
|
|
20
20
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
@@ -30,8 +30,8 @@ var formik = require('formik');
|
|
|
30
30
|
var jsxRuntime = require('react/jsx-runtime');
|
|
31
31
|
var neetoImageUploaderFrontend = require('@bigbinary/neeto-image-uploader-frontend');
|
|
32
32
|
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
33
|
-
var ColorPicker = require('@bigbinary/neetoui/ColorPicker');
|
|
34
33
|
var Select = require('@bigbinary/neetoui/Select');
|
|
34
|
+
var ColorPicker = require('@bigbinary/neetoui/ColorPicker');
|
|
35
35
|
var antd = require('antd');
|
|
36
36
|
var Switch = require('@bigbinary/neetoui/Switch');
|
|
37
37
|
var Input = require('@bigbinary/neetoui/formik/Input');
|
|
@@ -62,6 +62,9 @@ function _interopNamespace(e) {
|
|
|
62
62
|
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
63
63
|
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
64
64
|
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
|
65
|
+
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
66
|
+
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
67
|
+
var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
|
|
65
68
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
66
69
|
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
67
70
|
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
@@ -70,8 +73,8 @@ var Popover__default = /*#__PURE__*/_interopDefaultLegacy(Popover);
|
|
|
70
73
|
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
71
74
|
var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
|
|
72
75
|
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
73
|
-
var ColorPicker__default = /*#__PURE__*/_interopDefaultLegacy(ColorPicker);
|
|
74
76
|
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
77
|
+
var ColorPicker__default = /*#__PURE__*/_interopDefaultLegacy(ColorPicker);
|
|
75
78
|
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
76
79
|
var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
|
|
77
80
|
var Search__default = /*#__PURE__*/_interopDefaultLegacy(Search);
|
|
@@ -100,6 +103,52 @@ var useThemeStore = zustand.create(reactUtils.withImmutableActions(function (set
|
|
|
100
103
|
};
|
|
101
104
|
}));
|
|
102
105
|
|
|
106
|
+
var getImageFromUrl = function getImageFromUrl(source) {
|
|
107
|
+
var image = new Image();
|
|
108
|
+
image.crossOrigin = "anonymous";
|
|
109
|
+
image.src = source;
|
|
110
|
+
return new Promise(function (resolve) {
|
|
111
|
+
image.onload = function () {
|
|
112
|
+
resolve(image);
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
var getDominantColorFromUrl = /*#__PURE__*/function () {
|
|
117
|
+
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(imageUrl) {
|
|
118
|
+
var image, context, c;
|
|
119
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
120
|
+
while (1) switch (_context.prev = _context.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
_context.prev = 0;
|
|
123
|
+
_context.next = 3;
|
|
124
|
+
return getImageFromUrl(imageUrl);
|
|
125
|
+
case 3:
|
|
126
|
+
image = _context.sent;
|
|
127
|
+
context = document.createElement("canvas").getContext("2d");
|
|
128
|
+
context === null || context === void 0 || context.drawImage(image, 0, 0, 1, 1);
|
|
129
|
+
c = context === null || context === void 0 ? void 0 : context.getImageData(0, 0, 1, 1).data;
|
|
130
|
+
if (!c) {
|
|
131
|
+
_context.next = 9;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
return _context.abrupt("return", "#".concat(((1 << 24) + (c[0] << 16) + (c[1] << 8) + c[2]).toString(16).slice(1)));
|
|
135
|
+
case 9:
|
|
136
|
+
return _context.abrupt("return", null);
|
|
137
|
+
case 12:
|
|
138
|
+
_context.prev = 12;
|
|
139
|
+
_context.t0 = _context["catch"](0);
|
|
140
|
+
Toastr__default["default"].error(_context.t0);
|
|
141
|
+
return _context.abrupt("return", null);
|
|
142
|
+
case 16:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context.stop();
|
|
145
|
+
}
|
|
146
|
+
}, _callee, null, [[0, 12]]);
|
|
147
|
+
}));
|
|
148
|
+
return function getDominantColorFromUrl(_x) {
|
|
149
|
+
return _ref.apply(this, arguments);
|
|
150
|
+
};
|
|
151
|
+
}();
|
|
103
152
|
var scrollElementIntoView = function scrollElementIntoView(elementId) {
|
|
104
153
|
var elementToScroll = document.getElementById(elementId);
|
|
105
154
|
elementToScroll === null || elementToScroll === void 0 || elementToScroll.scrollIntoView({
|
|
@@ -238,6 +287,8 @@ var setTheme = function setTheme(theme, variableNamesMap, themeConfig) {
|
|
|
238
287
|
var overlayOpacity = Number(property.value);
|
|
239
288
|
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_opacity")), Math.abs(overlayOpacity / 100), variableNamesMap);
|
|
240
289
|
setVariable(neetoCist.snakeToCamelCase("".concat(property.key, "_overlay_color")), overlayOpacity < 0 ? BLACK : WHITE, variableNamesMap);
|
|
290
|
+
} else if (property.kind === "radius") {
|
|
291
|
+
setVariable(attribute, "".concat(property.value, "px"), variableNamesMap);
|
|
241
292
|
} else {
|
|
242
293
|
setVariable(attribute, property.value, variableNamesMap);
|
|
243
294
|
}
|
|
@@ -424,6 +475,12 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
|
|
|
424
475
|
kind: "slider",
|
|
425
476
|
key: key
|
|
426
477
|
};
|
|
478
|
+
case "radius":
|
|
479
|
+
return {
|
|
480
|
+
value: defaultValue,
|
|
481
|
+
kind: "radius",
|
|
482
|
+
key: key
|
|
483
|
+
};
|
|
427
484
|
case "boolean":
|
|
428
485
|
return {
|
|
429
486
|
value: String(defaultValue),
|
|
@@ -436,6 +493,12 @@ var buildInitialValues = function buildInitialValues(theme, themePropertiesSchem
|
|
|
436
493
|
kind: "position_selector",
|
|
437
494
|
key: key
|
|
438
495
|
};
|
|
496
|
+
case "alignment_block":
|
|
497
|
+
return {
|
|
498
|
+
value: defaultValue,
|
|
499
|
+
kind: "alignment_block",
|
|
500
|
+
key: key
|
|
501
|
+
};
|
|
439
502
|
default:
|
|
440
503
|
return null;
|
|
441
504
|
}
|
|
@@ -453,23 +516,26 @@ var buildImageData = function buildImageData(values, themePropertiesSchema) {
|
|
|
453
516
|
}, {});
|
|
454
517
|
};
|
|
455
518
|
var isPropertyVisible = function isPropertyVisible(key, formikValues, themePropertiesSchema) {
|
|
456
|
-
var _findBy;
|
|
457
519
|
var property = neetoCist.findBy({
|
|
458
520
|
key: key
|
|
459
521
|
}, themePropertiesSchema);
|
|
460
522
|
if (neetoCist.isNotPresent(property)) return false;
|
|
523
|
+
if (property !== null && property !== void 0 && property.hidden) return false;
|
|
461
524
|
var conditionalKey = property === null || property === void 0 ? void 0 : property.dependsOn;
|
|
462
525
|
if (neetoCist.isNotPresent(conditionalKey)) return true;
|
|
463
|
-
var
|
|
526
|
+
var dependentPropertySchema = neetoCist.findBy({
|
|
464
527
|
key: conditionalKey
|
|
465
528
|
}, themePropertiesSchema);
|
|
466
|
-
|
|
529
|
+
var dependentProperty = neetoCist.findBy({
|
|
530
|
+
key: conditionalKey
|
|
531
|
+
}, formikValues.properties);
|
|
532
|
+
if (dependentPropertySchema.kind === "image") {
|
|
467
533
|
var _formikValues$snakeTo;
|
|
468
534
|
return neetoCist.isPresent((_formikValues$snakeTo = formikValues[neetoCist.snakeToCamelCase(conditionalKey)]) === null || _formikValues$snakeTo === void 0 ? void 0 : _formikValues$snakeTo.url);
|
|
535
|
+
} else if (dependentPropertySchema.kind === "boolean") {
|
|
536
|
+
return (dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value) !== "false";
|
|
469
537
|
}
|
|
470
|
-
return neetoCist.isPresent(
|
|
471
|
-
key: conditionalKey
|
|
472
|
-
}, formikValues.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value);
|
|
538
|
+
return neetoCist.isPresent(dependentProperty === null || dependentProperty === void 0 ? void 0 : dependentProperty.value);
|
|
473
539
|
};
|
|
474
540
|
var buildLabel = function buildLabel(key, kind) {
|
|
475
541
|
return i18next.t("neetoThemes.properties.".concat(neetoCist.snakeToCamelCase(kind), ".").concat(neetoCist.snakeToCamelCase(key)));
|
|
@@ -497,6 +563,32 @@ var Card$2 = function Card(_ref) {
|
|
|
497
563
|
});
|
|
498
564
|
};
|
|
499
565
|
|
|
566
|
+
var SelectBlock = function SelectBlock(_ref) {
|
|
567
|
+
var label = _ref.label,
|
|
568
|
+
_ref$placeholder = _ref.placeholder,
|
|
569
|
+
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
570
|
+
value = _ref.value,
|
|
571
|
+
options = _ref.options,
|
|
572
|
+
onChange = _ref.onChange;
|
|
573
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
574
|
+
className: "flex items-center justify-between py-3 first:pt-0 last:pb-0",
|
|
575
|
+
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
576
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
577
|
+
"data-cy": "logo-field-labels",
|
|
578
|
+
style: "body2",
|
|
579
|
+
children: label
|
|
580
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
581
|
+
className: "w-40",
|
|
582
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Select__default["default"], {
|
|
583
|
+
onChange: onChange,
|
|
584
|
+
options: options,
|
|
585
|
+
placeholder: placeholder,
|
|
586
|
+
value: value
|
|
587
|
+
})
|
|
588
|
+
})]
|
|
589
|
+
});
|
|
590
|
+
};
|
|
591
|
+
|
|
500
592
|
var DESIGN_SCREENS = {
|
|
501
593
|
THEMES: "Themes",
|
|
502
594
|
Customize: "Customize"
|
|
@@ -504,6 +596,7 @@ var DESIGN_SCREENS = {
|
|
|
504
596
|
var ONE_MEGABYTE = 1;
|
|
505
597
|
|
|
506
598
|
var ImageBlock = function ImageBlock(_ref) {
|
|
599
|
+
var _findBy;
|
|
507
600
|
var label = _ref.label,
|
|
508
601
|
name = _ref.name,
|
|
509
602
|
_ref$imageData = _ref.imageData,
|
|
@@ -511,22 +604,73 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
511
604
|
_ref$uploadConfig = _ref.uploadConfig,
|
|
512
605
|
uploadConfig = _ref$uploadConfig === void 0 ? {
|
|
513
606
|
maxImageSize: ONE_MEGABYTE
|
|
514
|
-
} : _ref$uploadConfig
|
|
607
|
+
} : _ref$uploadConfig,
|
|
608
|
+
attribute = _ref.attribute;
|
|
609
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
610
|
+
t = _useTranslation.t;
|
|
515
611
|
var _useFormikContext = formik.useFormikContext(),
|
|
516
|
-
setFieldValue = _useFormikContext.setFieldValue
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
612
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
613
|
+
values = _useFormikContext.values;
|
|
614
|
+
var _useConfigStore = useConfigStore(function (store) {
|
|
615
|
+
return {
|
|
616
|
+
themePropertiesSchema: store["themePropertiesSchema"]
|
|
617
|
+
};
|
|
618
|
+
}, shallow.shallow),
|
|
619
|
+
themePropertiesSchema = _useConfigStore.themePropertiesSchema;
|
|
620
|
+
var propertySchema = neetoCist.findBy({
|
|
621
|
+
key: attribute
|
|
622
|
+
}, themePropertiesSchema);
|
|
623
|
+
var enablePositionChanger = (propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.enablePositionChanger) || false;
|
|
624
|
+
var options = propertySchema === null || propertySchema === void 0 ? void 0 : propertySchema.options;
|
|
625
|
+
var positionKeyInSchema = neetoCist.findBy({
|
|
626
|
+
key: "".concat(name, "_position")
|
|
627
|
+
}, themePropertiesSchema);
|
|
628
|
+
var isPositionChangerVisible = enablePositionChanger && (imageData === null || imageData === void 0 ? void 0 : imageData.url) && neetoCist.isPresent(positionKeyInSchema);
|
|
629
|
+
var positionKeyIndex = neetoCist.findIndexBy({
|
|
630
|
+
key: "".concat(name, "_position")
|
|
631
|
+
}, values.properties);
|
|
632
|
+
var handleImageChange = /*#__PURE__*/function () {
|
|
633
|
+
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(image) {
|
|
634
|
+
var dominantColor;
|
|
635
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
636
|
+
while (1) switch (_context.prev = _context.next) {
|
|
637
|
+
case 0:
|
|
638
|
+
_context.prev = 0;
|
|
639
|
+
if (!(ramda.isEmpty(image.signedId) || ramda.isEmpty(image.url))) {
|
|
640
|
+
_context.next = 4;
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
setFieldValue(name, {
|
|
644
|
+
signedId: null,
|
|
645
|
+
url: image.url
|
|
646
|
+
});
|
|
647
|
+
return _context.abrupt("return");
|
|
648
|
+
case 4:
|
|
649
|
+
_context.next = 6;
|
|
650
|
+
return getDominantColorFromUrl(image.url);
|
|
651
|
+
case 6:
|
|
652
|
+
dominantColor = _context.sent;
|
|
653
|
+
setFieldValue(name, {
|
|
654
|
+
signedId: image.signedId,
|
|
655
|
+
url: image.url,
|
|
656
|
+
dominantColor: dominantColor
|
|
657
|
+
});
|
|
658
|
+
_context.next = 13;
|
|
659
|
+
break;
|
|
660
|
+
case 10:
|
|
661
|
+
_context.prev = 10;
|
|
662
|
+
_context.t0 = _context["catch"](0);
|
|
663
|
+
Toastr__default["default"].error(_context.t0);
|
|
664
|
+
case 13:
|
|
665
|
+
case "end":
|
|
666
|
+
return _context.stop();
|
|
667
|
+
}
|
|
668
|
+
}, _callee, null, [[0, 10]]);
|
|
669
|
+
}));
|
|
670
|
+
return function handleImageChange(_x) {
|
|
671
|
+
return _ref2.apply(this, arguments);
|
|
672
|
+
};
|
|
673
|
+
}();
|
|
530
674
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
531
675
|
className: "space-y-3 py-3 first:pt-0 last:pb-0",
|
|
532
676
|
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
@@ -537,12 +681,25 @@ var ImageBlock = function ImageBlock(_ref) {
|
|
|
537
681
|
style: "body2",
|
|
538
682
|
children: label
|
|
539
683
|
})
|
|
540
|
-
}), /*#__PURE__*/
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
684
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
685
|
+
className: "space-y-3 divide-y divide-gray-200",
|
|
686
|
+
children: [/*#__PURE__*/react.createElement(neetoImageUploaderFrontend.ImageUploader, {
|
|
687
|
+
uploadConfig: uploadConfig,
|
|
688
|
+
className: "h-40 w-full",
|
|
689
|
+
key: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
690
|
+
src: imageData === null || imageData === void 0 ? void 0 : imageData.url,
|
|
691
|
+
onUploadComplete: handleImageChange
|
|
692
|
+
}), isPositionChangerVisible && /*#__PURE__*/jsxRuntime.jsx(SelectBlock, {
|
|
693
|
+
label: buildLabel("".concat(name, "Position"), "image"),
|
|
694
|
+
options: options || POSITION_OPTIONS,
|
|
695
|
+
placeholder: t("neetoThemes.common.left"),
|
|
696
|
+
value: neetoCist.toLabelAndValue((_findBy = neetoCist.findBy({
|
|
697
|
+
key: "".concat(name, "_position")
|
|
698
|
+
}, values.properties)) === null || _findBy === void 0 ? void 0 : _findBy.value),
|
|
699
|
+
onChange: function onChange(option) {
|
|
700
|
+
return setFieldValue("properties[".concat(positionKeyIndex, "].value"), option.value);
|
|
701
|
+
}
|
|
702
|
+
})]
|
|
546
703
|
})]
|
|
547
704
|
});
|
|
548
705
|
};
|
|
@@ -559,6 +716,7 @@ var Images = function Images(_ref) {
|
|
|
559
716
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
560
717
|
className: "divide-y divide-gray-200",
|
|
561
718
|
children: /*#__PURE__*/jsxRuntime.jsx(ImageBlock, {
|
|
719
|
+
attribute: attribute,
|
|
562
720
|
imageData: imageData,
|
|
563
721
|
name: key
|
|
564
722
|
})
|
|
@@ -566,6 +724,54 @@ var Images = function Images(_ref) {
|
|
|
566
724
|
});
|
|
567
725
|
};
|
|
568
726
|
|
|
727
|
+
var AlignmentBlock = function AlignmentBlock(_ref) {
|
|
728
|
+
var label = _ref.label,
|
|
729
|
+
name = _ref.name;
|
|
730
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
731
|
+
className: "flex items-center justify-between gap-2 py-3 first:pt-0 last:pb-0",
|
|
732
|
+
"data-cy": utils.joinHyphenCase(label),
|
|
733
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
734
|
+
"data-cy": "style-fields-labels",
|
|
735
|
+
style: "body2",
|
|
736
|
+
children: label
|
|
737
|
+
}), /*#__PURE__*/jsxRuntime.jsx(formik.Field, {
|
|
738
|
+
name: name,
|
|
739
|
+
children: function children(_ref2) {
|
|
740
|
+
var value = _ref2.field.value,
|
|
741
|
+
setFieldValue = _ref2.form.setFieldValue;
|
|
742
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
743
|
+
className: "flex items-center gap-3",
|
|
744
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
745
|
+
"data-cy": "alignment-left",
|
|
746
|
+
icon: neetoIcons.LeftAlign,
|
|
747
|
+
size: "large",
|
|
748
|
+
style: value === "left" ? "primary" : "text",
|
|
749
|
+
tooltipProps: {
|
|
750
|
+
content: "Left align",
|
|
751
|
+
position: "bottom"
|
|
752
|
+
},
|
|
753
|
+
onClick: function onClick() {
|
|
754
|
+
return setFieldValue(name, "left");
|
|
755
|
+
}
|
|
756
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
757
|
+
"data-cy": "alignment-center",
|
|
758
|
+
icon: neetoIcons.CenterAlign,
|
|
759
|
+
size: "large",
|
|
760
|
+
style: value === "center" ? "primary" : "text",
|
|
761
|
+
tooltipProps: {
|
|
762
|
+
content: "Center align",
|
|
763
|
+
position: "bottom"
|
|
764
|
+
},
|
|
765
|
+
onClick: function onClick() {
|
|
766
|
+
return setFieldValue(name, "center");
|
|
767
|
+
}
|
|
768
|
+
})]
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
})]
|
|
772
|
+
});
|
|
773
|
+
};
|
|
774
|
+
|
|
569
775
|
var ColorBlock = function ColorBlock(_ref) {
|
|
570
776
|
var label = _ref.label,
|
|
571
777
|
_ref$color = _ref.color,
|
|
@@ -625,32 +831,6 @@ var FontPickerBlock = function FontPickerBlock(_ref) {
|
|
|
625
831
|
});
|
|
626
832
|
};
|
|
627
833
|
|
|
628
|
-
var SelectBlock = function SelectBlock(_ref) {
|
|
629
|
-
var label = _ref.label,
|
|
630
|
-
_ref$placeholder = _ref.placeholder,
|
|
631
|
-
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
632
|
-
value = _ref.value,
|
|
633
|
-
options = _ref.options,
|
|
634
|
-
onChange = _ref.onChange;
|
|
635
|
-
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
636
|
-
className: "flex items-center justify-between py-3 first:pt-0 last:pb-0",
|
|
637
|
-
"data-cy": "theme-style-".concat(utils.joinHyphenCase(label)),
|
|
638
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
639
|
-
"data-cy": "logo-field-labels",
|
|
640
|
-
style: "body2",
|
|
641
|
-
children: label
|
|
642
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
643
|
-
className: "w-40",
|
|
644
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Select__default["default"], {
|
|
645
|
-
onChange: onChange,
|
|
646
|
-
options: options,
|
|
647
|
-
placeholder: placeholder,
|
|
648
|
-
value: value
|
|
649
|
-
})
|
|
650
|
-
})]
|
|
651
|
-
});
|
|
652
|
-
};
|
|
653
|
-
|
|
654
834
|
var SliderBlock = function SliderBlock(_ref) {
|
|
655
835
|
var label = _ref.label,
|
|
656
836
|
onChange = _ref.onChange,
|
|
@@ -747,7 +927,7 @@ var Properties = function Properties(_ref) {
|
|
|
747
927
|
}
|
|
748
928
|
};
|
|
749
929
|
react.useEffect(function () {
|
|
750
|
-
onPropertiesChange === null || onPropertiesChange === void 0 || onPropertiesChange(values,
|
|
930
|
+
onPropertiesChange === null || onPropertiesChange === void 0 || onPropertiesChange(values, handleChange, handleColorChange);
|
|
751
931
|
setTheme(values);
|
|
752
932
|
setThemeState({
|
|
753
933
|
previewingTheme: values
|
|
@@ -786,11 +966,26 @@ var Properties = function Properties(_ref) {
|
|
|
786
966
|
onChange: handleColorChange(key)
|
|
787
967
|
}, key);
|
|
788
968
|
}), neetoCist.filterBy({
|
|
789
|
-
kind: "
|
|
969
|
+
kind: "radius"
|
|
790
970
|
}, values.properties).map(function (_ref6) {
|
|
791
971
|
var key = _ref6.key,
|
|
792
972
|
value = _ref6.value,
|
|
793
973
|
kind = _ref6.kind;
|
|
974
|
+
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(SliderBlock, {
|
|
975
|
+
label: buildLabel(key, kind),
|
|
976
|
+
max: 50,
|
|
977
|
+
min: 0,
|
|
978
|
+
value: Number(value) || 0,
|
|
979
|
+
onChange: function onChange(radius) {
|
|
980
|
+
return handleChange(key, radius, "".concat(radius, "px"));
|
|
981
|
+
}
|
|
982
|
+
}, key);
|
|
983
|
+
}), neetoCist.filterBy({
|
|
984
|
+
kind: "overlay_opacity"
|
|
985
|
+
}, values.properties).map(function (_ref7) {
|
|
986
|
+
var key = _ref7.key,
|
|
987
|
+
value = _ref7.value,
|
|
988
|
+
kind = _ref7.kind;
|
|
794
989
|
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(SliderBlock, {
|
|
795
990
|
label: buildLabel(key, kind),
|
|
796
991
|
marks: OVERLAY_OPACITY_SLIDER_MARKS,
|
|
@@ -803,11 +998,11 @@ var Properties = function Properties(_ref) {
|
|
|
803
998
|
}, key);
|
|
804
999
|
}), neetoCist.filterBy({
|
|
805
1000
|
kind: "position_selector"
|
|
806
|
-
}, values.properties).map(function (
|
|
1001
|
+
}, values.properties).map(function (_ref8) {
|
|
807
1002
|
var _findBy;
|
|
808
|
-
var key =
|
|
809
|
-
kind =
|
|
810
|
-
value =
|
|
1003
|
+
var key = _ref8.key,
|
|
1004
|
+
kind = _ref8.kind,
|
|
1005
|
+
value = _ref8.value;
|
|
811
1006
|
var index = neetoCist.findIndexBy({
|
|
812
1007
|
key: key
|
|
813
1008
|
}, values.properties);
|
|
@@ -825,10 +1020,10 @@ var Properties = function Properties(_ref) {
|
|
|
825
1020
|
}, key);
|
|
826
1021
|
}), neetoCist.filterBy({
|
|
827
1022
|
kind: "boolean"
|
|
828
|
-
}, values.properties).map(function (
|
|
829
|
-
var key =
|
|
830
|
-
kind =
|
|
831
|
-
value =
|
|
1023
|
+
}, values.properties).map(function (_ref9) {
|
|
1024
|
+
var key = _ref9.key,
|
|
1025
|
+
kind = _ref9.kind,
|
|
1026
|
+
value = _ref9.value;
|
|
832
1027
|
var index = neetoCist.findIndexBy({
|
|
833
1028
|
key: key
|
|
834
1029
|
}, values.properties);
|
|
@@ -839,6 +1034,18 @@ var Properties = function Properties(_ref) {
|
|
|
839
1034
|
return setFieldValue("properties[".concat(index, "].value"), String(e.target.checked));
|
|
840
1035
|
}
|
|
841
1036
|
}, key);
|
|
1037
|
+
}), neetoCist.filterBy({
|
|
1038
|
+
kind: "alignment_block"
|
|
1039
|
+
}, values.properties).map(function (_ref10) {
|
|
1040
|
+
var key = _ref10.key,
|
|
1041
|
+
kind = _ref10.kind;
|
|
1042
|
+
var index = neetoCist.findIndexBy({
|
|
1043
|
+
key: key
|
|
1044
|
+
}, values.properties);
|
|
1045
|
+
return isPropertyVisible(key, values, themePropertiesSchema) && /*#__PURE__*/jsxRuntime.jsx(AlignmentBlock, {
|
|
1046
|
+
label: buildLabel(key, kind),
|
|
1047
|
+
name: "properties[".concat(index, "].value")
|
|
1048
|
+
});
|
|
842
1049
|
})]
|
|
843
1050
|
})
|
|
844
1051
|
});
|