@raketa-builder/builder 0.22.0 → 0.24.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.
package/dist/index.js CHANGED
@@ -219,11 +219,11 @@ var require_dist = __commonJS({
219
219
  var import_react34 = __toESM2(require("react"));
220
220
  var import_jsx_runtime34 = require("react/jsx-runtime");
221
221
  var Button5 = (_a) => {
222
- var _b = _a, { type, size, variant, className } = _b, props = __objRest2(_b, ["type", "size", "variant", "className"]);
222
+ var _b = _a, { as = "button", size, variant, className } = _b, rest = __objRest2(_b, ["as", "size", "variant", "className"]);
223
+ const Component2 = as;
223
224
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
224
- "button",
225
+ Component2,
225
226
  __spreadValues2({
226
- type,
227
227
  className: cn13(
228
228
  "r-reset",
229
229
  "r-reset-button",
@@ -232,7 +232,7 @@ var require_dist = __commonJS({
232
232
  `r-button-${variant}`,
233
233
  className
234
234
  )
235
- }, props)
235
+ }, rest)
236
236
  );
237
237
  };
238
238
  Button5.defaultProps = {
@@ -285,8 +285,8 @@ var require_dist = __commonJS({
285
285
  var import_react52 = __toESM2(require("react"));
286
286
  var import_jsx_runtime52 = require("react/jsx-runtime");
287
287
  var Input2 = (_a) => {
288
- var _b = _a, { className } = _b, props = __objRest2(_b, ["className"]);
289
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("input", __spreadValues2({ className: cn13("r-reset", "r-input", className) }, props));
288
+ var _b = _a, { className } = _b, rest = __objRest2(_b, ["className"]);
289
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("input", __spreadValues2({ className: cn13("r-reset", "r-input", className) }, rest));
290
290
  };
291
291
  var Input_default = Input2;
292
292
  var import_react62 = __toESM2(require("react"));
@@ -457,11 +457,28 @@ var require_dist = __commonJS({
457
457
  }, props)
458
458
  );
459
459
  };
460
+ var FooterBar = (_a) => {
461
+ var _b = _a, { className } = _b, props = __objRest2(_b, ["className"]);
462
+ return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", __spreadValues2({ className: cn13("r-reset", "r-modal-footer-bar", className) }, props));
463
+ };
460
464
  var Content = (_a) => {
461
465
  var _b = _a, { className } = _b, props = __objRest2(_b, ["className"]);
462
466
  return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)("div", __spreadValues2({ className: cn13("r-reset", "r-modal-content", className) }, props));
463
467
  };
464
- var Modal2 = ({ title: title2, children, onClose }) => {
468
+ var Modal2 = (_a) => {
469
+ var _b = _a, {
470
+ title: title2,
471
+ children,
472
+ customWrapper,
473
+ FooterContent,
474
+ onClose
475
+ } = _b, rest = __objRest2(_b, [
476
+ "title",
477
+ "children",
478
+ "customWrapper",
479
+ "FooterContent",
480
+ "onClose"
481
+ ]);
465
482
  const handleKeyUp = ({ key }) => {
466
483
  if (key === "Escape")
467
484
  onClose();
@@ -472,15 +489,17 @@ var require_dist = __commonJS({
472
489
  document.removeEventListener("keyup", handleKeyUp);
473
490
  };
474
491
  });
492
+ const ModalWrapper = customWrapper ? customWrapper : Wrapper;
475
493
  return /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_react172.default.Fragment, { children: [
476
494
  /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Overlay, { onClick: onClose }),
477
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(Inner, { children: [
495
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(ModalWrapper, __spreadProps2(__spreadValues2({}, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(Inner, { children: [
478
496
  /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(TitleBar2, { children: [
479
497
  /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Title2, { children: title2 }),
480
498
  /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(CloseButton, { type: "button", onClick: onClose, children: "\xD7" })
481
499
  ] }),
482
- /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Content, { children })
483
- ] }) })
500
+ /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(Content, { children }),
501
+ FooterContent && /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(FooterBar, { children: /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(FooterContent, {}) })
502
+ ] }) }))
484
503
  ] });
485
504
  };
486
505
  var Modal_default = Modal2;
@@ -1757,7 +1776,6 @@ var ButtonSettings = ({ label, hint, value, onChange }) => {
1757
1776
  label: "Type",
1758
1777
  options: buttonStyles,
1759
1778
  value: value.type,
1760
- placeholder: "",
1761
1779
  onChange: (type) => onChange(mergeSettings(value, "type", type))
1762
1780
  }
1763
1781
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/builder",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -68,7 +68,6 @@ const ButtonSettings = ({ label, hint, value, onChange }) => {
68
68
  label="Type"
69
69
  options={buttonStyles}
70
70
  value={value.type}
71
- placeholder=""
72
71
  onChange={(type) => onChange(mergeSettings(value, "type", type))}
73
72
  />
74
73
 
package/src/index.js CHANGED
@@ -10,11 +10,8 @@ import ImageInput from "./pickers/ImagePicker/ImageInput";
10
10
  import Dialog from "./dialogs/Dialog";
11
11
  import Img from "./lib/Image";
12
12
  import List from "./List";
13
- import Container from "./Container";
14
- import EmbeddedVideo from "./EmbeddedVideo";
15
13
  import MediaManager from "./MediaManager";
16
14
  import ListInput from "./ListInput";
17
- import imageSrc from "./helpers/imageSrc";
18
15
  import Button from "./forms/Button";
19
16
  import ButtonSettings from "./forms/ButtonSettings";
20
17
  import LinkSettings from "./forms/LinkSettings";
@@ -40,13 +37,10 @@ export {
40
37
  Dialog,
41
38
  Img,
42
39
  List,
43
- Container,
44
- EmbeddedVideo,
45
40
  MediaManager,
46
41
  ImagePicker,
47
42
  ImageInput,
48
43
  ListInput,
49
- imageSrc,
50
44
  Button,
51
45
  ButtonSettings,
52
46
  LinkSettings,
package/src/Container.js DELETED
@@ -1,15 +0,0 @@
1
- import React from "react";
2
-
3
- const Container = ({ settings, className, children }) => {
4
- const { containerID, ...restSettings } = settings || {};
5
-
6
- const cssClasses = [...Object.values(restSettings), className].join(" ");
7
-
8
- return (
9
- <div id={containerID} className={cssClasses}>
10
- {children}
11
- </div>
12
- );
13
- };
14
-
15
- export default Container;
@@ -1,150 +0,0 @@
1
- import React from "react";
2
-
3
- const VimeoEmbed = ({ videoId, autoplay }) => (
4
- <iframe
5
- frameBorder="0"
6
- allowFullScreen="0"
7
- src={`https://player.vimeo.com/video/${videoId}?color=ffffff&title=0&byline=0&portrait=0&autoplay=${
8
- autoplay === true ? "1" : "0"
9
- }`}
10
- className="content"
11
- allow="autoplay"
12
- />
13
- );
14
-
15
- const YoukuEmbed = ({ videoId, autoplay }) => (
16
- <iframe
17
- height="0"
18
- width="0"
19
- src={`https://player.youku.com/embed/${videoId}?autoplay=${
20
- autoplay === true ? "1" : "0"
21
- }`}
22
- frameBorder="0"
23
- allowFullScreen
24
- className="content"
25
- allow="autoplay"
26
- />
27
- );
28
-
29
- const YouTubeEmbed = ({ videoId, autoplay }) => (
30
- <iframe
31
- frameBorder="0"
32
- allowFullScreen
33
- src={`https://youtube.com/embed/${videoId}?autoplay=${
34
- autoplay === true ? "1" : "0"
35
- }`}
36
- className="content"
37
- allow="autoplay"
38
- />
39
- );
40
-
41
- const YouTubeNoCookieEmbed = ({ videoId, autoplay }) => (
42
- <iframe
43
- frameBorder="0"
44
- allowFullScreen
45
- src={`https://www.youtube-nocookie.com/embed/${videoId}?autoplay=${
46
- autoplay === true ? "1" : "0"
47
- }`}
48
- className="content"
49
- allow="autoplay"
50
- />
51
- );
52
-
53
- const WistiaEmbed = ({ videoId, autoplay }) => (
54
- <iframe
55
- frameBorder="0"
56
- allowFullScreen
57
- src={`https://fast.wistia.net/embed/iframe/${videoId}${
58
- autoplay ? "?autoPlay=true" : ""
59
- }`}
60
- className="content"
61
- allow="autoplay"
62
- />
63
- );
64
-
65
- const videoType = (url) => {
66
- if (url.includes("youtu")) return "youtube";
67
- if (url.includes("vimeo")) return "vimeo";
68
- if (url.includes("youku")) return "youku";
69
- if (url.includes("wistia")) return "wistia";
70
- };
71
-
72
- const youtubeId = (url) => {
73
- let matches = url.match(
74
- /(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/
75
- )
76
-
77
- if (matches && matches[5]) {
78
- return matches[5]
79
- }
80
-
81
- matches = url.match(/youtu\.be\/|youtube\.com\/shorts\/(?<id>.*)(\?.*)?/)
82
-
83
- return matches?.groups?.id || ''
84
- }
85
-
86
- const vimeoId = (url) => {
87
- const matches = url.match(/http(s?):\/\/(www\.)?vimeo\.com\/(\d+)($|\/)/);
88
- return matches !== "" && matches !== null ? matches[3] : "";
89
- };
90
-
91
- const youkuId = (url) => {
92
- const matches = url.match(
93
- /http(s?):\/\/v\.youku\.com\/v_show\/id_([A-Za-z0-9=]+)\.html/
94
- );
95
- return matches !== "" && matches !== null ? matches[2] : "";
96
- };
97
-
98
- const wistiaId = (url) => {
99
- const matches = url.match(
100
- /http(s?):\/\/fast\.wistia\.net\/embed\/iframe\/(.*)($|\?)/
101
- );
102
- return matches !== "" && matches !== null ? matches[2] : "";
103
- };
104
-
105
- const videoId = (url) => {
106
- if (videoType(url) === "youtube") return youtubeId(url);
107
- if (videoType(url) === "vimeo") return vimeoId(url);
108
- if (videoType(url) === "youku") return youkuId(url);
109
- if (videoType(url) === "wistia") return wistiaId(url);
110
- };
111
-
112
- const VideoComponentType = (vType, noCookieDomains) => {
113
- const components = {
114
- youtube: YouTubeEmbed,
115
- vimeo: VimeoEmbed,
116
- youku: YoukuEmbed,
117
- wistia: WistiaEmbed,
118
- };
119
-
120
- const noCookiesComponents = {
121
- youtube: YouTubeNoCookieEmbed,
122
- vimeo: VimeoEmbed,
123
- youku: YoukuEmbed,
124
- wistia: WistiaEmbed,
125
- };
126
-
127
- if (noCookieDomains) {
128
- return noCookiesComponents[vType];
129
- } else {
130
- return components[vType];
131
- }
132
- };
133
-
134
- const EmbeddedVideo = ({
135
- videoUrl,
136
- autoplay = false,
137
- noCookieDomains = false,
138
- }) => {
139
- const vType = videoType(videoUrl);
140
- const vId = videoId(videoUrl);
141
- const VideoComponent = VideoComponentType(vType, noCookieDomains);
142
-
143
- if (VideoComponent) {
144
- return <VideoComponent videoId={vId} autoplay={autoplay} />;
145
- }
146
-
147
- return null;
148
- };
149
-
150
- export default EmbeddedVideo;