dune-react 0.0.38 → 0.0.39

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.
@@ -58,34 +58,43 @@ const ImageCarousel = (props) => {
58
58
  style: sectionStyle,
59
59
  css,
60
60
  children: [
61
- /* @__PURE__ */ jsx("div", { className: cn("px-[5%] py-8 md:py-12 lg:py-14", { "shrink-0": isFullscreen }), children: /* @__PURE__ */ jsxs(
61
+ /* @__PURE__ */ jsx(
62
62
  "div",
63
63
  {
64
- className: cn("container", {
65
- "text-center": isHeaderCenter,
66
- "text-left": !isHeaderCenter
64
+ className: cn("px-[5%] py-8 md:py-12 lg:py-14", {
65
+ "shrink-0": isFullscreen
67
66
  }),
68
- children: [
69
- /* @__PURE__ */ jsx("h2", { className: "rb-5 mb-5 text-5xl font-bold md:mb-6 md:text-7xl lg:text-8xl", children: heading }),
70
- /* @__PURE__ */ jsx("p", { className: "md:text-md", children: description })
71
- ]
67
+ children: /* @__PURE__ */ jsxs(
68
+ "div",
69
+ {
70
+ className: cn("container", {
71
+ "text-center": isHeaderCenter,
72
+ "text-left": !isHeaderCenter
73
+ }),
74
+ children: [
75
+ /* @__PURE__ */ jsx("h2", { className: "rb-5 mb-5 text-5xl font-bold md:mb-6 md:text-7xl lg:text-8xl", children: heading }),
76
+ /* @__PURE__ */ jsx("p", { className: "md:text-md", children: description })
77
+ ]
78
+ }
79
+ )
72
80
  }
73
- ) }),
81
+ ),
74
82
  /* @__PURE__ */ jsxs(
75
83
  Carousel,
76
84
  {
77
85
  setApi,
78
- opts: { align: "start" },
79
- className: cn({
86
+ opts: { loop: true, align: "start" },
87
+ className: cn("[&>[data-slot=carousel-content]]:h-full", {
80
88
  "overflow-hidden": slideOverflow === "hidden",
81
- "relative flex-1 min-h-0 [&>[data-slot=carousel-content]]:h-full": isFullscreen
89
+ "max-h-[600px]": !isFullscreen,
90
+ "relative flex-1 min-h-0": isFullscreen
82
91
  }),
83
92
  children: [
84
- /* @__PURE__ */ jsx(CarouselContent, { className: cn("ml-0", { "h-full": isFullscreen }), children: medias.map((media, index) => /* @__PURE__ */ jsx(
93
+ /* @__PURE__ */ jsx(CarouselContent, { className: "ml-0 h-full", children: medias.map((media, index) => /* @__PURE__ */ jsx(
85
94
  CarouselItem,
86
95
  {
87
- className: cn("pl-0", getBasisClass(), {
88
- "relative h-full": isFullscreen,
96
+ className: cn("pl-0 h-full", getBasisClass(), {
97
+ relative: isFullscreen,
89
98
  "pr-6 md:pr-8": slidesPerView !== "1"
90
99
  }),
91
100
  children: hasActiveOpacity ? /* @__PURE__ */ jsx(
@@ -101,7 +110,8 @@ const ImageCarousel = (props) => {
101
110
  src: media.src,
102
111
  alt: media.alt,
103
112
  className: cn("size-full object-cover", {
104
- "absolute inset-0": isFullscreen
113
+ "absolute inset-0": isFullscreen,
114
+ "max-h-[600px]": !isFullscreen
105
115
  })
106
116
  }
107
117
  )
@@ -112,7 +122,8 @@ const ImageCarousel = (props) => {
112
122
  src: media.src,
113
123
  alt: media.alt,
114
124
  className: cn("size-full object-cover", {
115
- "absolute inset-0": isFullscreen
125
+ "absolute inset-0": isFullscreen,
126
+ "max-h-[600px]": !isFullscreen
116
127
  })
117
128
  }
118
129
  )
@@ -63,8 +63,23 @@ function Carousel({
63
63
  onSelect(api);
64
64
  api.on("reInit", onSelect);
65
65
  api.on("select", onSelect);
66
+ const container = api.containerNode();
67
+ let resizeCleanup;
68
+ if (container && container.offsetWidth === 0) {
69
+ const ro = new ResizeObserver((entries) => {
70
+ var _a, _b;
71
+ const w = ((_b = (_a = entries[0]) == null ? void 0 : _a.contentRect) == null ? void 0 : _b.width) ?? 0;
72
+ if (w > 0) {
73
+ ro.disconnect();
74
+ api.reInit();
75
+ }
76
+ });
77
+ ro.observe(container);
78
+ resizeCleanup = () => ro.disconnect();
79
+ }
66
80
  return () => {
67
81
  api == null ? void 0 : api.off("select", onSelect);
82
+ resizeCleanup == null ? void 0 : resizeCleanup();
68
83
  };
69
84
  }, [api, onSelect]);
70
85
  return /* @__PURE__ */ jsx(
@@ -84,7 +99,7 @@ function Carousel({
84
99
  "div",
85
100
  {
86
101
  onKeyDownCapture: handleKeyDown,
87
- className: cn("relative", className),
102
+ className: cn("relative w-full", className),
88
103
  role: "region",
89
104
  "aria-roledescription": "carousel",
90
105
  "data-slot": "carousel",
@@ -102,6 +117,7 @@ function CarouselContent({ className, ...props }) {
102
117
  {
103
118
  ref: carouselRef,
104
119
  className: "overflow-hidden",
120
+ style: { width: "100%" },
105
121
  "data-slot": "carousel-content",
106
122
  children: /* @__PURE__ */ jsx(
107
123
  "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dune-react",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {