@weaverse/react 0.7.3 → 0.7.7

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/context.ts
2
2
  import { Weaverse } from "@weaverse/core";
3
- import { createContext as createContext4 } from "react";
3
+ import { createContext as createContext3 } from "react";
4
4
 
5
5
  // src/elements/button.tsx
6
6
  import * as React from "react";
@@ -220,7 +220,7 @@ var Image = React5.forwardRef(
220
220
  }
221
221
  );
222
222
  Image.defaultProps = {
223
- src: "https://ucarecdn.com/1cdc9d39-ca62-492e-8ec7-f1a86b241a90/",
223
+ src: "https://ucarecdn.com/c413b8fe-ceec-4948-9c42-a0434c4ca920/",
224
224
  alt: "Image alt text",
225
225
  objectFit: "cover",
226
226
  objectPosition: "center",
@@ -390,20 +390,9 @@ import React10, { forwardRef as forwardRef8 } from "react";
390
390
  var Placeholder = forwardRef8(
391
391
  (props, ref) => {
392
392
  let { element, children, ...rest } = props;
393
- let style = {
394
- position: "absolute",
395
- height: "100%",
396
- width: "100%",
397
- display: "flex",
398
- flexDirection: "column",
399
- alignItems: "center",
400
- justifyContent: "center",
401
- color: "#374151",
402
- pointerEvents: "none",
403
- zIndex: 1
404
- };
405
393
  return /* @__PURE__ */ React10.createElement("div", {
406
- style,
394
+ "data-wv-type": "placeholder",
395
+ style: { display: "none" },
407
396
  ref,
408
397
  ...rest
409
398
  }, /* @__PURE__ */ React10.createElement("div", {
@@ -498,108 +487,190 @@ var instagram_default = Instagram;
498
487
  // src/elements/accordion/index.tsx
499
488
  import React12, { createContext, forwardRef as forwardRef10, useState as useState2 } from "react";
500
489
  var AccordionContext = createContext({
501
- active: null,
490
+ iconName: "arrow",
491
+ active: [],
502
492
  setActive: () => {
503
493
  }
504
494
  });
505
495
  var Accordion = forwardRef10(
506
496
  (props, ref) => {
507
- const { items, children, ...rest } = props;
508
- const [active, setActive] = useState2(null);
497
+ const { iconName, children, ...rest } = props;
498
+ const [active, setActive] = useState2([]);
509
499
  const setOpenAccordion = (id) => {
510
- if (id === active) {
511
- setActive(null);
500
+ if (active.includes(id)) {
501
+ setActive(active.filter((_id) => _id !== id));
512
502
  } else {
513
- setActive(id);
503
+ setActive([...active, id]);
514
504
  }
515
505
  };
516
506
  return /* @__PURE__ */ React12.createElement("div", {
517
507
  ref,
518
508
  ...rest
519
509
  }, /* @__PURE__ */ React12.createElement(AccordionContext.Provider, {
520
- value: { active, setActive: setOpenAccordion }
510
+ value: { active, setActive: setOpenAccordion, iconName }
521
511
  }, children));
522
512
  }
523
513
  );
524
514
  Accordion.defaultProps = {
525
- items: [
526
- {
527
- id: 1,
528
- headerText: "Header 1",
529
- childrenId: true
530
- },
531
- {
532
- id: 2,
533
- headerText: "Header 2"
534
- }
535
- ],
515
+ iconName: "arrow",
536
516
  css: {
537
517
  "@desktop": {
538
518
  display: "flex",
539
519
  flexDirection: "column",
540
- gap: 4,
541
- ".wv-accordion-header": {
542
- borderRadius: 4,
543
- padding: 12,
544
- marginBottom: 4,
545
- border: "1px solid #76A9FA",
546
- "&.active": {
547
- color: "blue"
548
- },
549
- '&.active + [data-wv-type="accordion.content"]': {
550
- maxHeight: "var(--max-height, inherit)"
520
+ gap: 4
521
+ }
522
+ }
523
+ };
524
+ var accordion_default = Accordion;
525
+
526
+ // src/elements/accordion/AccordionWrapper.tsx
527
+ import React14, { forwardRef as forwardRef11, useContext as useContext5 } from "react";
528
+
529
+ // src/elements/accordion/Icon.tsx
530
+ import React13, { useContext as useContext4 } from "react";
531
+ var ICONS = {
532
+ caret: {
533
+ animationType: "rotate90",
534
+ css: {
535
+ position: "absolute!important",
536
+ left: 5,
537
+ top: 2,
538
+ width: 0,
539
+ height: 0,
540
+ borderTop: "6px solid transparent",
541
+ borderBottom: "6px solid transparent",
542
+ borderLeft: "6px solid #1F2A37"
543
+ }
544
+ },
545
+ arrow: {
546
+ animationType: "rotate90",
547
+ css: {
548
+ border: "solid #1F2A37",
549
+ borderWidth: "0 1px 1px 0",
550
+ display: "inline-block",
551
+ transform: "rotate(-45deg) translate(15%, -15%)",
552
+ padding: 4
553
+ }
554
+ },
555
+ plus: {
556
+ animationType: "custom",
557
+ css: {
558
+ display: "inline-block",
559
+ top: -6,
560
+ width: 15,
561
+ height: 1,
562
+ backgroundColor: "#1F2A37",
563
+ "&:after": {
564
+ position: "absolute",
565
+ content: "",
566
+ top: -7,
567
+ left: 7,
568
+ width: 1,
569
+ height: 15,
570
+ backgroundColor: "#1F2A37",
571
+ transition: "all 0.3s ease-in-out 0s"
572
+ },
573
+ "&.active": {
574
+ "&:after": {
575
+ transform: "rotate(90deg)"
551
576
  }
552
577
  }
553
578
  }
554
579
  }
555
580
  };
556
- var accordion_default = Accordion;
581
+ var rotateAnimation = {
582
+ transition: "all 0.3s ease-in-out 0s",
583
+ transform: "rotate(90deg)"
584
+ };
585
+ function Icon(props) {
586
+ let { name, active = false, style, ...rest } = props;
587
+ let { stitchesInstance } = useContext4(WeaverseContext);
588
+ const { animationType, css } = ICONS[name];
589
+ if (active && animationType === "rotate90") {
590
+ style = { ...rotateAnimation, ...style };
591
+ }
592
+ let { className } = stitchesInstance.css(css)();
593
+ if (active)
594
+ className += " active";
595
+ return /* @__PURE__ */ React13.createElement("span", {
596
+ style,
597
+ ...rest
598
+ }, /* @__PURE__ */ React13.createElement("i", {
599
+ className
600
+ }));
601
+ }
602
+ var Icon_default = Icon;
557
603
 
558
604
  // src/elements/accordion/AccordionWrapper.tsx
559
- import React13, { forwardRef as forwardRef11, useContext as useContext4 } from "react";
560
605
  var AccordionWrapper = forwardRef11((props, ref) => {
561
- const { ["data-wv-id"]: wvId, headerText, children, ...rest } = props;
562
- const { active, setActive } = useContext4(AccordionContext);
563
- return /* @__PURE__ */ React13.createElement("div", {
606
+ const { ["data-wv-id"]: wvId, name, children, ...rest } = props;
607
+ const { iconName, active, setActive } = useContext5(AccordionContext);
608
+ const isActive = active.includes(wvId);
609
+ return /* @__PURE__ */ React14.createElement("div", {
564
610
  ref,
565
611
  ...rest
566
- }, /* @__PURE__ */ React13.createElement("div", {
612
+ }, /* @__PURE__ */ React14.createElement("div", {
567
613
  onClick: () => setActive(wvId),
568
- className: `wv-accordion-header ${active === wvId ? "active" : ""}`
569
- }, headerText), children);
614
+ className: `wv-acc-header ${isActive ? "active" : ""}`
615
+ }, /* @__PURE__ */ React14.createElement("span", null, name), /* @__PURE__ */ React14.createElement(Icon_default, {
616
+ className: "wv-acc-icon",
617
+ active: isActive,
618
+ name: iconName
619
+ })), children);
570
620
  });
571
621
  AccordionWrapper.defaultProps = {
572
- headerText: "Header text",
622
+ name: "Accordion item",
573
623
  css: {
574
624
  "@desktop": {
575
- maxHeight: "100%"
625
+ maxHeight: "100%",
626
+ ".wv-acc-icon": {
627
+ position: "absolute",
628
+ right: 16,
629
+ width: 16,
630
+ height: 16,
631
+ transition: "all 0.3s ease-in-out 0s"
632
+ },
633
+ ".wv-acc-header": {
634
+ display: "flex",
635
+ alignItems: "center",
636
+ borderRadius: 4,
637
+ padding: 12,
638
+ marginBottom: 4,
639
+ border: "1px solid #76A9FA",
640
+ cursor: "pointer",
641
+ '&.active + [data-wv-type="accordion.content"]': {
642
+ maxHeight: "var(--max-height, inherit)"
643
+ }
644
+ }
576
645
  }
577
646
  }
578
647
  };
579
648
  var AccordionWrapper_default = AccordionWrapper;
580
649
 
581
650
  // src/elements/accordion/AccordionContent.tsx
582
- import React14, { forwardRef as forwardRef12 } from "react";
583
- var AccordionContent = forwardRef12((props, ref) => {
584
- const { rows, columns, gap, rowSize, children, ...rest } = props;
585
- let style = {
586
- "--rows": rows,
587
- "--columns": columns,
588
- "--gap": gap + "px",
589
- "--row-size": rowSize + "px",
590
- "--col-size": "calc((var(--grid-size) - calc(var(--columns) - 1) * var(--gap)) / var(--columns))",
591
- "--max-height": rows * rowSize + gap * (rowSize - 1) + "px"
592
- };
593
- return /* @__PURE__ */ React14.createElement("div", {
594
- ref,
595
- ...rest,
596
- style
597
- }, React14.Children.count(children) > 0 ? children : /* @__PURE__ */ React14.createElement(Placeholder_default, {
598
- element: "Accordion"
599
- }, "Item Content"));
600
- });
651
+ import React15, { forwardRef as forwardRef12 } from "react";
652
+ var AccordionContent = forwardRef12(
653
+ (props, ref) => {
654
+ const { rows, columns, gap, rowSize, children, ...rest } = props;
655
+ let style = {
656
+ "--rows": rows,
657
+ "--columns": columns,
658
+ "--gap": gap + "px",
659
+ "--row-size": rowSize + "px",
660
+ "--col-size": "calc((var(--grid-size) - calc(var(--columns) - 1) * var(--gap)) / var(--columns))",
661
+ "--max-height": rows * rowSize + gap * (rowSize - 1) + "px"
662
+ };
663
+ return /* @__PURE__ */ React15.createElement("div", {
664
+ ref,
665
+ ...rest,
666
+ style
667
+ }, React15.Children.count(children) > 0 ? children : /* @__PURE__ */ React15.createElement(Placeholder_default, {
668
+ element: "Accordion Content"
669
+ }, "Please drag and drop an element here"));
670
+ }
671
+ );
601
672
  AccordionContent.defaultProps = {
602
- rows: 2,
673
+ rows: 3,
603
674
  columns: 12,
604
675
  gap: 4,
605
676
  rowSize: 48,
@@ -621,34 +692,33 @@ AccordionContent.defaultProps = {
621
692
  var AccordionContent_default = AccordionContent;
622
693
 
623
694
  // src/elements/tab/index.tsx
624
- import React16, { createContext as createContext2, forwardRef as forwardRef13, useState as useState4 } from "react";
695
+ import React17, { createContext as createContext2, forwardRef as forwardRef13, useState as useState4 } from "react";
625
696
 
626
697
  // src/elements/tab/TabHeaderWrapper.tsx
627
- import React15, { useContext as useContext5, useEffect as useEffect3, useState as useState3 } from "react";
698
+ import React16, { useContext as useContext6, useEffect as useEffect3, useState as useState3 } from "react";
628
699
  function TabHeader(props) {
629
700
  const { wvId } = props;
630
- const { active, setActive } = useContext5(TabContext);
631
- const { itemInstances } = useContext5(WeaverseContext);
701
+ const { active, setActive } = useContext6(TabContext);
702
+ const { itemInstances } = useContext6(WeaverseContext);
632
703
  const instance = itemInstances.get(wvId);
633
704
  let [data, setData] = useState3(instance.data);
634
705
  useEffect3(() => {
635
706
  let update = (data2) => setData({ ...data2 });
636
707
  instance.subscribe(update);
637
708
  }, []);
638
- const text = data.headerText;
639
- return /* @__PURE__ */ React15.createElement("div", {
709
+ return /* @__PURE__ */ React16.createElement("div", {
640
710
  onClick: () => setActive(wvId),
641
711
  className: `wv-tab-header${active === wvId ? " active" : ""}`
642
- }, text);
712
+ }, data.name);
643
713
  }
644
714
  function TabHeaderWrapper(props) {
645
- const { itemInstances } = useContext5(WeaverseContext);
715
+ const { itemInstances } = useContext6(WeaverseContext);
646
716
  const instance = itemInstances.get(props.wvId);
647
717
  const data = instance.data;
648
718
  const childIds = data.childIds;
649
- return /* @__PURE__ */ React15.createElement("div", {
650
- className: "wv-tab-headerWrapper"
651
- }, childIds.map((id) => /* @__PURE__ */ React15.createElement(TabHeader, {
719
+ return /* @__PURE__ */ React16.createElement("div", {
720
+ className: "wv-tab-header-wrapper"
721
+ }, childIds.map((id) => /* @__PURE__ */ React16.createElement(TabHeader, {
652
722
  key: id,
653
723
  wvId: id
654
724
  })));
@@ -663,54 +733,47 @@ var TabContext = createContext2({
663
733
  var Tab = forwardRef13((props, ref) => {
664
734
  var _a, _b, _c;
665
735
  const wvId = props["data-wv-id"];
666
- const { items, children, ...rest } = props;
667
- const defaultActive = (_c = (_b = (_a = React16.Children.toArray(children)) == null ? void 0 : _a[0]) == null ? void 0 : _b.props) == null ? void 0 : _c.id;
736
+ const { fullWidthTabHeader, children, ...rest } = props;
737
+ const defaultActive = (_c = (_b = (_a = React17.Children.toArray(children)) == null ? void 0 : _a[0]) == null ? void 0 : _b.props) == null ? void 0 : _c.id;
668
738
  const [active, setActive] = useState4(defaultActive);
669
739
  const setOpenTab = (id) => {
670
- if (id === active) {
671
- setActive(null);
672
- } else {
740
+ if (id !== active) {
673
741
  setActive(id);
674
742
  }
675
743
  };
676
- return /* @__PURE__ */ React16.createElement("div", {
744
+ return /* @__PURE__ */ React17.createElement("div", {
677
745
  ref,
678
- ...rest
679
- }, /* @__PURE__ */ React16.createElement(TabContext.Provider, {
746
+ ...rest,
747
+ style: {
748
+ "--tab-width": fullWidthTabHeader ? "100%" : "auto"
749
+ }
750
+ }, /* @__PURE__ */ React17.createElement(TabContext.Provider, {
680
751
  value: { active, setActive: setOpenTab }
681
- }, /* @__PURE__ */ React16.createElement(TabHeaderWrapper, {
752
+ }, /* @__PURE__ */ React17.createElement(TabHeaderWrapper, {
682
753
  wvId
683
754
  }), children));
684
755
  });
685
756
  Tab.defaultProps = {
686
- items: [
687
- {
688
- headerText: "Header 1"
689
- },
690
- {
691
- headerText: "Header 2"
692
- },
693
- {
694
- headerText: "Header 2"
695
- }
696
- ],
757
+ fullWidthTabHeader: false,
697
758
  css: {
698
759
  "@desktop": {
699
760
  display: "flex",
700
761
  flexDirection: "column",
701
762
  gap: 4,
702
- "& .wv-tab-headerWrapper": {
763
+ "& .wv-tab-header-wrapper": {
703
764
  width: "100%",
704
765
  display: "flex",
705
766
  marginBottom: 10
706
767
  },
707
768
  "& .wv-tab-header": {
708
- backgroundColor: "#f0f2f3",
709
- padding: "10px 16px",
769
+ backgroundColor: "#fff",
770
+ padding: "15px 24px",
771
+ border: "1px solid #E4E7EB",
710
772
  cursor: "pointer",
773
+ textAlign: "center",
774
+ width: "var(--tab-width, auto)",
711
775
  "&.active": {
712
- backgroundColor: "#0F71FF",
713
- color: "#fff"
776
+ backgroundColor: "#E4E7EB"
714
777
  }
715
778
  }
716
779
  }
@@ -719,10 +782,10 @@ Tab.defaultProps = {
719
782
  var tab_default = Tab;
720
783
 
721
784
  // src/elements/tab/TabContent.tsx
722
- import React17, { forwardRef as forwardRef14, useContext as useContext6 } from "react";
785
+ import React18, { forwardRef as forwardRef14, useContext as useContext7 } from "react";
723
786
  var TabContent = forwardRef14(
724
787
  (props, ref) => {
725
- const { active } = useContext6(TabContext);
788
+ const { active } = useContext7(TabContext);
726
789
  const wvId = props["data-wv-id"];
727
790
  const { rows, columns, gap, rowSize, children, ...rest } = props;
728
791
  let style = {
@@ -734,20 +797,21 @@ var TabContent = forwardRef14(
734
797
  "--max-height": rows * rowSize + gap * (rowSize - 1) + "px",
735
798
  "--content-active": active === wvId ? "grid" : "none"
736
799
  };
737
- return /* @__PURE__ */ React17.createElement("div", {
800
+ return /* @__PURE__ */ React18.createElement("div", {
738
801
  ref,
739
802
  ...rest,
740
803
  style
741
- }, React17.Children.count(children) > 0 ? children : /* @__PURE__ */ React17.createElement(Placeholder_default, {
742
- element: "Tab"
743
- }, "Item Content"));
804
+ }, React18.Children.count(children) > 0 ? children : /* @__PURE__ */ React18.createElement(Placeholder_default, {
805
+ element: "Tab Content"
806
+ }, "Please drag and drop an element here"));
744
807
  }
745
808
  );
746
809
  TabContent.defaultProps = {
747
- rows: 2,
810
+ rows: 3,
748
811
  columns: 12,
749
812
  gap: 4,
750
813
  rowSize: 48,
814
+ name: "Tab header",
751
815
  css: {
752
816
  "@desktop": {
753
817
  width: "100%",
@@ -763,51 +827,91 @@ TabContent.defaultProps = {
763
827
  var TabContent_default = TabContent;
764
828
 
765
829
  // src/elements/slider/index.tsx
766
- import React18, {
767
- createContext as createContext3,
768
- forwardRef as forwardRef15,
769
- useState as useState5
770
- } from "react";
771
- import * as Carousel from "nuka-carousel";
772
- var SliderContext = createContext3({
773
- active: null,
774
- setActive: () => {
775
- }
776
- });
830
+ import React19, { forwardRef as forwardRef15, useContext as useContext8 } from "react";
831
+ import C from "nuka-carousel";
832
+ var Carousel = C.default;
777
833
  var Slider = forwardRef15((props, ref) => {
778
- var _a, _b, _c;
779
- const { children, ...rest } = props;
780
- const defaultActive = (_c = (_b = (_a = React18.Children.toArray(children)) == null ? void 0 : _a[0]) == null ? void 0 : _b.props) == null ? void 0 : _c.id;
781
- const [active, setActive] = useState5(defaultActive);
782
- return /* @__PURE__ */ React18.createElement("div", {
834
+ const { isDesignMode } = useContext8(WeaverseContext);
835
+ const { autoplay, delay, children, ...rest } = props;
836
+ return /* @__PURE__ */ React19.createElement("div", {
783
837
  ...rest,
784
838
  ref
785
- }, /* @__PURE__ */ React18.createElement(SliderContext.Provider, {
786
- value: { active, setActive }
787
- }, children), /* @__PURE__ */ React18.createElement(Carousel.default, null, /* @__PURE__ */ React18.createElement("div", {
788
- className: "slide"
789
- }, "Hi"), /* @__PURE__ */ React18.createElement("div", {
790
- className: "slide"
791
- }, "Hieee"), /* @__PURE__ */ React18.createElement("div", {
792
- className: "slide"
793
- }, "Hixxx"), /* @__PURE__ */ React18.createElement("div", {
794
- className: "slide"
795
- }, "Hi3")));
839
+ }, /* @__PURE__ */ React19.createElement(Carousel, {
840
+ dragging: false,
841
+ renderCenterLeftControls: (props2) => /* @__PURE__ */ React19.createElement("button", {
842
+ className: "wv-slider-btn",
843
+ onClick: props2.previousSlide,
844
+ disabled: (isDesignMode || !autoplay) && props2.currentSlide === 0
845
+ }, /* @__PURE__ */ React19.createElement("i", {
846
+ className: "wv-slider-arrow wv-slider-arrow-left"
847
+ })),
848
+ renderCenterRightControls: (props2) => /* @__PURE__ */ React19.createElement("button", {
849
+ className: "wv-slider-btn",
850
+ onClick: props2.nextSlide,
851
+ disabled: (isDesignMode || !autoplay) && props2.slideCount === props2.currentSlide
852
+ }, /* @__PURE__ */ React19.createElement("i", {
853
+ className: "wv-slider-arrow wv-slider-arrow-right"
854
+ })),
855
+ wrapAround: !isDesignMode,
856
+ autoplay: !isDesignMode && autoplay,
857
+ autoplayInterval: delay * 1e3
858
+ }, children));
796
859
  });
797
860
  Slider.defaultProps = {
861
+ fullWidth: true,
862
+ autoplay: true,
863
+ delay: 3,
798
864
  css: {
799
- "@desktop": {}
865
+ "@desktop": {
866
+ "& .wv-slider-btn": {
867
+ borderRadius: "100%",
868
+ width: 40,
869
+ height: 40,
870
+ background: "#fff",
871
+ border: "none",
872
+ cursor: "pointer",
873
+ "&[disabled]": {
874
+ cursor: "not-allowed"
875
+ },
876
+ "&:hover .wv-slider-arrow": {
877
+ borderColor: "#999"
878
+ },
879
+ "& .wv-slider-arrow": {
880
+ border: "solid black",
881
+ borderWidth: "0 1px 1px 0",
882
+ display: "inline-block",
883
+ padding: 5
884
+ },
885
+ "& .wv-slider-arrow-right": {
886
+ transform: "rotate(-45deg)",
887
+ marginRight: 5
888
+ },
889
+ "& .wv-slider-arrow-left": {
890
+ transform: "rotate(135deg)",
891
+ marginLeft: 5
892
+ }
893
+ }
894
+ }
800
895
  }
801
896
  };
802
897
  var slider_default = Slider;
803
898
 
804
899
  // src/elements/slider/SliderContent.tsx
805
- import React19, { forwardRef as forwardRef16, useContext as useContext7 } from "react";
900
+ import React20, { forwardRef as forwardRef16, useContext as useContext9 } from "react";
806
901
  var SliderContent = forwardRef16(
807
902
  (props, ref) => {
808
- const { active } = useContext7(SliderContext);
809
- const wvId = props["data-wv-id"];
810
- const { rows, columns, gap, rowSize, children, ...rest } = props;
903
+ const { isDesignMode } = useContext9(WeaverseContext);
904
+ const {
905
+ mediaUrl,
906
+ targetLink,
907
+ openInNewTab,
908
+ rows,
909
+ columns,
910
+ gap,
911
+ rowSize,
912
+ children,
913
+ ...rest
914
+ } = props;
811
915
  let style = {
812
916
  "--rows": rows,
813
917
  "--columns": columns,
@@ -815,19 +919,28 @@ var SliderContent = forwardRef16(
815
919
  "--row-size": rowSize + "px",
816
920
  "--col-size": "calc((var(--grid-size) - calc(var(--columns) - 1) * var(--gap)) / var(--columns))",
817
921
  "--max-height": rows * rowSize + gap * (rowSize - 1) + "px",
818
- "--content-active": active === wvId ? "grid" : "none"
922
+ "--background-url": `url(${mediaUrl}`
819
923
  };
820
- return /* @__PURE__ */ React19.createElement("div", {
821
- ref,
924
+ const handleClick = () => {
925
+ if (!isDesignMode && targetLink) {
926
+ window.open(targetLink, openInNewTab ? "_blank" : "_self");
927
+ }
928
+ };
929
+ return /* @__PURE__ */ React20.createElement("div", {
822
930
  ...rest,
823
- style
824
- }, React19.Children.count(children) > 0 ? children : /* @__PURE__ */ React19.createElement(Placeholder_default, {
825
- element: "Slider"
826
- }, "Slider Content"));
931
+ style,
932
+ onClick: handleClick
933
+ }, React20.Children.count(children) > 0 ? children : /* @__PURE__ */ React20.createElement(Placeholder_default, {
934
+ element: "Slider Content"
935
+ }, "Please drag and drop an element here"));
827
936
  }
828
937
  );
829
938
  SliderContent.defaultProps = {
830
- rows: 2,
939
+ name: "Slider",
940
+ mediaUrl: "",
941
+ openInNewTab: false,
942
+ targetLink: "https://myshop.com",
943
+ rows: 4,
831
944
  columns: 12,
832
945
  gap: 4,
833
946
  rowSize: 48,
@@ -835,18 +948,56 @@ SliderContent.defaultProps = {
835
948
  "@desktop": {
836
949
  width: "100%",
837
950
  maxWidth: "var(--grid-size)",
838
- display: "var(--content-active, none)",
951
+ display: "grid",
839
952
  gridTemplateRows: "repeat(var(--rows), var(--row-size))",
840
953
  gridTemplateColumns: "repeat(var(--columns), minmax(0, var(--col-size)))",
841
954
  gap: "var(--gap)",
842
- borderRadius: 4
955
+ borderRadius: 4,
956
+ backgroundImage: "var(--background-url, none)"
843
957
  }
844
958
  }
845
959
  };
846
960
  var SliderContent_default = SliderContent;
847
961
 
962
+ // src/elements/custom-html.tsx
963
+ import React21, { forwardRef as forwardRef17, useContext as useContext10 } from "react";
964
+ var CustomHTML = forwardRef17(
965
+ (props, ref) => {
966
+ const { content, children, ...rest } = props;
967
+ const { isDesignMode } = useContext10(WeaverseContext);
968
+ const style = {
969
+ "--pointer-events": isDesignMode ? "none" : "auto"
970
+ };
971
+ if (!content)
972
+ return /* @__PURE__ */ React21.createElement("div", {
973
+ ref,
974
+ ...rest
975
+ }, /* @__PURE__ */ React21.createElement(Placeholder_default, {
976
+ element: "Custom HTML"
977
+ }, "Please add your custom HTML codes."));
978
+ return /* @__PURE__ */ React21.createElement("div", {
979
+ ref,
980
+ ...rest,
981
+ style,
982
+ dangerouslySetInnerHTML: { __html: content }
983
+ });
984
+ }
985
+ );
986
+ CustomHTML.defaultProps = {
987
+ content: "",
988
+ type: "custom.html",
989
+ css: {
990
+ "@desktop": {
991
+ "& > *": {
992
+ pointerEvents: "var(--pointer-events, unset)"
993
+ }
994
+ }
995
+ }
996
+ };
997
+ var custom_html_default = CustomHTML;
998
+
848
999
  // src/elements/index.ts
849
- var elements = {
1000
+ var Elements = {
850
1001
  Countdown: {
851
1002
  Component: countdown_default,
852
1003
  type: "countdown"
@@ -910,33 +1061,36 @@ var elements = {
910
1061
  SliderContent: {
911
1062
  Component: SliderContent_default,
912
1063
  type: "slider.content"
1064
+ },
1065
+ CustomHTML: {
1066
+ Component: custom_html_default,
1067
+ type: "custom.html"
913
1068
  }
914
1069
  };
915
- var elements_default = elements;
916
1070
 
917
1071
  // src/context.ts
918
1072
  var createRootContext = (configs) => {
919
1073
  let rootContext = new Weaverse(configs);
920
- Object.keys(elements_default).forEach((key) => {
921
- rootContext.registerElement(elements_default[key]);
1074
+ Object.keys(Elements).forEach((key) => {
1075
+ rootContext.registerElement(Elements[key]);
922
1076
  });
923
1077
  return rootContext;
924
1078
  };
925
- var WeaverseContext = createContext4({});
1079
+ var WeaverseContext = createContext3({});
926
1080
  var WeaverseContextProvider = WeaverseContext.Provider;
927
1081
  var WeaverseContextConsumer = WeaverseContext.Consumer;
928
1082
 
929
1083
  // src/renderer.tsx
930
1084
  import { isBrowser } from "@weaverse/core";
931
- import React20, { useContext as useContext8, useEffect as useEffect4, useRef, useState as useState6 } from "react";
1085
+ import React22, { useContext as useContext11, useEffect as useEffect4, useRef, useState as useState5 } from "react";
932
1086
 
933
1087
  // src/utils/index.ts
934
- var shortCssObject = (css) => {
1088
+ function shortCssObject(css) {
935
1089
  return {
936
1090
  "@desktop": css["@desktop"],
937
1091
  "@mobile": css["@mobile"]
938
1092
  };
939
- };
1093
+ }
940
1094
  function generateItemClass(instance, stitchesInstance) {
941
1095
  var _a, _b, _c, _d;
942
1096
  let { css, className: cls = "" } = instance.data;
@@ -956,7 +1110,7 @@ function generateItemClass(instance, stitchesInstance) {
956
1110
  // src/renderer.tsx
957
1111
  var WeaverseRoot = ({ context }) => {
958
1112
  var _a, _b;
959
- let [, setData] = useState6(context.projectData);
1113
+ let [, setData] = useState5(context.projectData);
960
1114
  let rootRef = useRef();
961
1115
  let update = () => setData({});
962
1116
  useEffect4(() => {
@@ -968,19 +1122,19 @@ var WeaverseRoot = ({ context }) => {
968
1122
  }, []);
969
1123
  let eventHandlers = ((_a = context == null ? void 0 : context.studioBridge) == null ? void 0 : _a.eventHandlers) || {};
970
1124
  let themeClass = context.stitchesInstance.theme.className;
971
- return ((_b = context.projectData) == null ? void 0 : _b.rootId) ? /* @__PURE__ */ React20.createElement("div", {
1125
+ return ((_b = context.projectData) == null ? void 0 : _b.rootId) ? /* @__PURE__ */ React22.createElement("div", {
972
1126
  className: `weaverse-content-root ${themeClass}`,
973
1127
  ...eventHandlers,
974
1128
  ref: rootRef
975
- }, /* @__PURE__ */ React20.createElement(WeaverseContextProvider, {
1129
+ }, /* @__PURE__ */ React22.createElement(WeaverseContextProvider, {
976
1130
  value: context
977
- }, /* @__PURE__ */ React20.createElement(ItemInstance, {
1131
+ }, /* @__PURE__ */ React22.createElement(ItemInstance, {
978
1132
  id: context.projectData.rootId
979
1133
  }))) : null;
980
1134
  };
981
1135
  var ItemComponent = ({ instance }) => {
982
- let { stitchesInstance, elementInstances } = useContext8(WeaverseContext);
983
- let [data, setData] = useState6(instance.data);
1136
+ let { stitchesInstance, elementInstances } = useContext11(WeaverseContext);
1137
+ let [data, setData] = useState5(instance.data);
984
1138
  let { id, type, childIds = [], css, className, ...rest } = data;
985
1139
  useEffect4(() => {
986
1140
  var _a;
@@ -1002,13 +1156,13 @@ var ItemComponent = ({ instance }) => {
1002
1156
  if (Component.$$typeof === Symbol.for("react.forward_ref")) {
1003
1157
  rest.ref = instance.ref;
1004
1158
  }
1005
- return /* @__PURE__ */ React20.createElement(Component, {
1159
+ return /* @__PURE__ */ React22.createElement(Component, {
1006
1160
  key: id,
1007
1161
  "data-wv-type": type,
1008
1162
  "data-wv-id": id,
1009
1163
  className: generateItemClass(instance, stitchesInstance),
1010
1164
  ...rest
1011
- }, childIds.map((id2) => /* @__PURE__ */ React20.createElement(ItemInstance, {
1165
+ }, childIds.map((id2) => /* @__PURE__ */ React22.createElement(ItemInstance, {
1012
1166
  key: id2,
1013
1167
  id: id2
1014
1168
  })));
@@ -1016,15 +1170,15 @@ var ItemComponent = ({ instance }) => {
1016
1170
  return null;
1017
1171
  };
1018
1172
  var ItemInstance = ({ id }) => {
1019
- let context = useContext8(WeaverseContext);
1173
+ let context = useContext11(WeaverseContext);
1020
1174
  let { itemInstances } = context;
1021
1175
  let instance = itemInstances.get(id);
1022
1176
  if (!instance) {
1023
- return /* @__PURE__ */ React20.createElement("div", {
1177
+ return /* @__PURE__ */ React22.createElement("div", {
1024
1178
  style: { display: "none" }
1025
1179
  }, "Item instance ", id, " not found");
1026
1180
  }
1027
- return /* @__PURE__ */ React20.createElement(ItemComponent, {
1181
+ return /* @__PURE__ */ React22.createElement(ItemComponent, {
1028
1182
  instance
1029
1183
  });
1030
1184
  };