@raketa-builder/support 0.10.0 → 0.12.0

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @raketa-builder/support@0.10.0 build
2
+ > @raketa-builder/support@0.12.0 build
3
3
  > tsup src/index.js --format cjs --loader ".js=jsx"
4
4
 
5
5
  CLI Building entry: src/index.js
@@ -7,5 +7,5 @@ CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v6.5.0
8
8
  CLI Target: es6
9
9
  CJS Build start
10
- CJS dist/index.js 20.78 KB
11
- CJS ⚡️ Build success in 106ms
10
+ CJS dist/index.js 21.30 KB
11
+ CJS ⚡️ Build success in 83ms
package/dist/index.js CHANGED
@@ -56,6 +56,7 @@ __export(src_exports, {
56
56
  Container: () => Container_default,
57
57
  EmbeddedVideo: () => EmbeddedVideo_default,
58
58
  Image: () => Image_default,
59
+ extractImageValue: () => extractImageValue_default,
59
60
  imagePlaceholder: () => imagePlaceholder_default,
60
61
  imageSrc: () => imageSrc_default,
61
62
  isImagePresent: () => isImagePresent_default,
@@ -436,8 +437,10 @@ var AdminWidgetMinimal = ({
436
437
  onSelectWidget,
437
438
  selectedWidgets
438
439
  }) => {
440
+ var _a;
439
441
  const currentWidget = library[widget.component];
440
442
  const currentAdminWidget = adminLibrary[widget.component];
443
+ const containerSettings = ((_a = widget == null ? void 0 : widget.settings) == null ? void 0 : _a.containerSettings) || {};
441
444
  const isSelected = selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
442
445
  if (!currentWidget || !currentAdminWidget) {
443
446
  console.error(`Unknown widget: ${widget.component}`);
@@ -466,7 +469,7 @@ var AdminWidgetMinimal = ({
466
469
  !isSelected && !deprecated(currentAdminWidget) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconButton_default, { onClick: handleCopyWidget })
467
470
  ] }),
468
471
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AdminWidgetLabel, { "data-widget-label": true, children: title(currentAdminWidget) }),
469
- import_react5.default.createElement(currentWidget, widget.settings)
472
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Container_default, { settings: containerSettings, children: import_react5.default.createElement(currentWidget, widget.settings) })
470
473
  ] });
471
474
  };
472
475
  AdminWidgetMinimal.defaultProps = {
@@ -602,12 +605,22 @@ var AdminPageRender = ({
602
605
  ] });
603
606
  };
604
607
  var AdminPageRender_default = AdminPageRender;
608
+
609
+ // src/extractImageValue.js
610
+ function extractImageValue(value) {
611
+ if (!value) {
612
+ return null;
613
+ }
614
+ return value.hasOwnProperty("image") ? value.image : value;
615
+ }
616
+ var extractImageValue_default = extractImageValue;
605
617
  // Annotate the CommonJS export names for ESM import in node:
606
618
  0 && (module.exports = {
607
619
  AdminPageRender,
608
620
  Container,
609
621
  EmbeddedVideo,
610
622
  Image,
623
+ extractImageValue,
611
624
  imagePlaceholder,
612
625
  imageSrc,
613
626
  isImagePresent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/support",
3
- "version": "0.10.0",
3
+ "version": "0.12.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable no-undef */
2
2
  import React from "react";
3
3
  import IconButton from "./IconButton";
4
+ import Container from "../Container";
4
5
 
5
6
  function cn() {
6
7
  return Array.from(arguments).filter(Boolean).map(String).join(" ");
@@ -42,6 +43,7 @@ const AdminWidgetMinimal = ({
42
43
  }) => {
43
44
  const currentWidget = library[widget.component];
44
45
  const currentAdminWidget = adminLibrary[widget.component];
46
+ const containerSettings = widget?.settings?.containerSettings || {};
45
47
 
46
48
  const isSelected =
47
49
  selectedWidgets.filter((w) => w === widget.widgetId).length > 0;
@@ -82,7 +84,9 @@ const AdminWidgetMinimal = ({
82
84
  {title(currentAdminWidget)}
83
85
  </AdminWidgetLabel>
84
86
 
85
- {React.createElement(currentWidget, widget.settings)}
87
+ <Container settings={containerSettings}>
88
+ {React.createElement(currentWidget, widget.settings)}
89
+ </Container>
86
90
  </AdminWidgetWrapper>
87
91
  );
88
92
  };
@@ -0,0 +1,9 @@
1
+ function extractImageValue(value) {
2
+ if (!value) {
3
+ return null;
4
+ }
5
+
6
+ return value.hasOwnProperty("image") ? value.image : value;
7
+ }
8
+
9
+ export default extractImageValue;
package/src/index.js CHANGED
@@ -6,12 +6,14 @@ import EmbeddedVideo from "./EmbeddedVideo";
6
6
  import toHTML from "./toHTML";
7
7
  import isImagePresent from "./isImagePresent";
8
8
  import AdminPageRender from "./AdminPageRender";
9
+ import extractImageValue from "./extractImageValue";
9
10
 
10
11
  export {
11
12
  Image,
12
13
  imageSrc,
13
14
  imagePlaceholder,
14
15
  isImagePresent,
16
+ extractImageValue,
15
17
  Container,
16
18
  EmbeddedVideo,
17
19
  toHTML,