@opensite/ui 0.8.2 → 0.8.3

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,7 +1,7 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var React = require('react');
4
+ var React5 = require('react');
5
5
  var clsx = require('clsx');
6
6
  var tailwindMerge = require('tailwind-merge');
7
7
  var classVarianceAuthority = require('class-variance-authority');
@@ -26,7 +26,7 @@ function _interopNamespace(e) {
26
26
  return Object.freeze(n);
27
27
  }
28
28
 
29
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
29
+ var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
30
30
 
31
31
  // components/blocks/carousel/carousel-image-hero.tsx
32
32
  function cn(...inputs) {
@@ -107,7 +107,7 @@ function useNavigation({
107
107
  href,
108
108
  onClick
109
109
  } = {}) {
110
- const linkType = React__namespace.useMemo(() => {
110
+ const linkType = React5__namespace.useMemo(() => {
111
111
  if (!href || href.trim() === "") {
112
112
  return onClick ? "none" : "none";
113
113
  }
@@ -128,7 +128,7 @@ function useNavigation({
128
128
  return "internal";
129
129
  }
130
130
  }, [href, onClick]);
131
- const normalizedHref = React__namespace.useMemo(() => {
131
+ const normalizedHref = React5__namespace.useMemo(() => {
132
132
  if (!href || href.trim() === "") {
133
133
  return void 0;
134
134
  }
@@ -146,7 +146,7 @@ function useNavigation({
146
146
  return trimmed;
147
147
  }
148
148
  }, [href, linkType]);
149
- const target = React__namespace.useMemo(() => {
149
+ const target = React5__namespace.useMemo(() => {
150
150
  switch (linkType) {
151
151
  case "external":
152
152
  return "_blank";
@@ -159,7 +159,7 @@ function useNavigation({
159
159
  return void 0;
160
160
  }
161
161
  }, [linkType]);
162
- const rel = React__namespace.useMemo(() => {
162
+ const rel = React5__namespace.useMemo(() => {
163
163
  if (linkType === "external") {
164
164
  return "noopener noreferrer";
165
165
  }
@@ -168,7 +168,7 @@ function useNavigation({
168
168
  const isExternal = linkType === "external";
169
169
  const isInternal = linkType === "internal";
170
170
  const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
171
- const handleClick = React__namespace.useCallback(
171
+ const handleClick = React5__namespace.useCallback(
172
172
  (event) => {
173
173
  if (onClick) {
174
174
  try {
@@ -352,7 +352,7 @@ var buttonVariants = classVarianceAuthority.cva(baseStyles, {
352
352
  size: "default"
353
353
  }
354
354
  });
355
- var Pressable = React__namespace.forwardRef(
355
+ var Pressable = React5__namespace.forwardRef(
356
356
  ({
357
357
  children,
358
358
  className,
@@ -459,7 +459,7 @@ var maxWidthStyles = {
459
459
  "4xl": "max-w-[1536px]",
460
460
  full: "max-w-full"
461
461
  };
462
- var Container = React__namespace.default.forwardRef(
462
+ var Container = React5__namespace.default.forwardRef(
463
463
  ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
464
464
  const Component = as;
465
465
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -764,7 +764,7 @@ var spacingStyles = {
764
764
  };
765
765
  var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
766
766
  var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
767
- var Section = React__namespace.default.forwardRef(
767
+ var Section = React5__namespace.default.forwardRef(
768
768
  ({
769
769
  id,
770
770
  title,
@@ -834,7 +834,7 @@ function CarouselImageHero({
834
834
  images,
835
835
  autoPlayInterval = 7500,
836
836
  className,
837
- containerClassName = "mx-auto w-full max-w-7xl relative z-10 rounded-2xl overflow-hidden shadow-xl",
837
+ containerClassName = "mx-none md:mx-auto w-screen md:w-full max-w-screen md:max-w-7xl relative z-10 rounded-none md:rounded-2xl overflow-hidden shadow-none md:shadow-xl",
838
838
  contentClassName,
839
839
  badgeClassName,
840
840
  headingClassName,
@@ -844,19 +844,33 @@ function CarouselImageHero({
844
844
  indicatorsClassName,
845
845
  optixFlowConfig,
846
846
  background,
847
- spacing,
847
+ spacing = "py-0 md:py-32",
848
848
  pattern,
849
849
  patternOpacity
850
850
  }) {
851
- const [currentImageIndex, setCurrentImageIndex] = React__namespace.useState(0);
852
- React__namespace.useEffect(() => {
853
- const interval = setInterval(() => {
854
- setCurrentImageIndex(
855
- (prevIndex) => (prevIndex + 1) % (images?.length ?? 1)
856
- );
857
- }, autoPlayInterval);
858
- return () => clearInterval(interval);
859
- }, [images?.length, autoPlayInterval]);
851
+ const [currentImageIndex, setCurrentImageIndex] = React5__namespace.useState(0);
852
+ const intervalRef = React5__namespace.useRef(null);
853
+ const goToNext = React5__namespace.useCallback(() => {
854
+ setCurrentImageIndex((prevIndex) => (prevIndex + 1) % (images?.length ?? 1));
855
+ }, [images?.length]);
856
+ const resetInterval = React5__namespace.useCallback(() => {
857
+ if (intervalRef.current) {
858
+ clearInterval(intervalRef.current);
859
+ }
860
+ intervalRef.current = setInterval(goToNext, autoPlayInterval);
861
+ }, [goToNext, autoPlayInterval]);
862
+ const goToSlide = React5__namespace.useCallback((index) => {
863
+ setCurrentImageIndex(index);
864
+ resetInterval();
865
+ }, [resetInterval]);
866
+ React5__namespace.useEffect(() => {
867
+ resetInterval();
868
+ return () => {
869
+ if (intervalRef.current) {
870
+ clearInterval(intervalRef.current);
871
+ }
872
+ };
873
+ }, [resetInterval]);
860
874
  const renderActions = () => {
861
875
  if (actionsSlot) return actionsSlot;
862
876
  if (!actions || actions.length === 0) return null;
@@ -890,12 +904,15 @@ function CarouselImageHero({
890
904
  {
891
905
  background,
892
906
  spacing,
893
- className: cn("relative min-h-[600px] overflow-hidden", className),
907
+ className: cn(
908
+ "relative min-h-screen md:min-h-[600px] overflow-hidden",
909
+ className
910
+ ),
894
911
  pattern,
895
912
  patternOpacity,
896
913
  containerClassName,
897
914
  children: [
898
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("absolute inset-0", imageClassName), children: [
915
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("absolute inset-0 bg-black", imageClassName), children: [
899
916
  images?.map((image, index) => /* @__PURE__ */ jsxRuntime.jsxs(
900
917
  "div",
901
918
  {
@@ -928,7 +945,7 @@ function CarouselImageHero({
928
945
  children: images?.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
929
946
  "button",
930
947
  {
931
- onClick: () => setCurrentImageIndex(index),
948
+ onClick: () => goToSlide(index),
932
949
  className: cn(
933
950
  "flex h-4 w-4 items-center justify-center rounded-full transition-colors",
934
951
  index === currentImageIndex ? "bg-white" : "bg-white/50 hover:bg-white/80"
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import * as React from 'react';
3
- import React__default from 'react';
2
+ import * as React5 from 'react';
3
+ import React5__default from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { cva } from 'class-variance-authority';
@@ -86,7 +86,7 @@ function useNavigation({
86
86
  href,
87
87
  onClick
88
88
  } = {}) {
89
- const linkType = React.useMemo(() => {
89
+ const linkType = React5.useMemo(() => {
90
90
  if (!href || href.trim() === "") {
91
91
  return onClick ? "none" : "none";
92
92
  }
@@ -107,7 +107,7 @@ function useNavigation({
107
107
  return "internal";
108
108
  }
109
109
  }, [href, onClick]);
110
- const normalizedHref = React.useMemo(() => {
110
+ const normalizedHref = React5.useMemo(() => {
111
111
  if (!href || href.trim() === "") {
112
112
  return void 0;
113
113
  }
@@ -125,7 +125,7 @@ function useNavigation({
125
125
  return trimmed;
126
126
  }
127
127
  }, [href, linkType]);
128
- const target = React.useMemo(() => {
128
+ const target = React5.useMemo(() => {
129
129
  switch (linkType) {
130
130
  case "external":
131
131
  return "_blank";
@@ -138,7 +138,7 @@ function useNavigation({
138
138
  return void 0;
139
139
  }
140
140
  }, [linkType]);
141
- const rel = React.useMemo(() => {
141
+ const rel = React5.useMemo(() => {
142
142
  if (linkType === "external") {
143
143
  return "noopener noreferrer";
144
144
  }
@@ -147,7 +147,7 @@ function useNavigation({
147
147
  const isExternal = linkType === "external";
148
148
  const isInternal = linkType === "internal";
149
149
  const shouldUseRouter = isInternal && typeof normalizedHref === "string" && normalizedHref.startsWith("/");
150
- const handleClick = React.useCallback(
150
+ const handleClick = React5.useCallback(
151
151
  (event) => {
152
152
  if (onClick) {
153
153
  try {
@@ -331,7 +331,7 @@ var buttonVariants = cva(baseStyles, {
331
331
  size: "default"
332
332
  }
333
333
  });
334
- var Pressable = React.forwardRef(
334
+ var Pressable = React5.forwardRef(
335
335
  ({
336
336
  children,
337
337
  className,
@@ -438,7 +438,7 @@ var maxWidthStyles = {
438
438
  "4xl": "max-w-[1536px]",
439
439
  full: "max-w-full"
440
440
  };
441
- var Container = React__default.forwardRef(
441
+ var Container = React5__default.forwardRef(
442
442
  ({ children, maxWidth = "xl", className, as = "div", ...props }, ref) => {
443
443
  const Component = as;
444
444
  return /* @__PURE__ */ jsx(
@@ -743,7 +743,7 @@ var spacingStyles = {
743
743
  };
744
744
  var predefinedSpacings = ["none", "sm", "md", "lg", "xl"];
745
745
  var isPredefinedSpacing = (spacing) => predefinedSpacings.includes(spacing);
746
- var Section = React__default.forwardRef(
746
+ var Section = React5__default.forwardRef(
747
747
  ({
748
748
  id,
749
749
  title,
@@ -813,7 +813,7 @@ function CarouselImageHero({
813
813
  images,
814
814
  autoPlayInterval = 7500,
815
815
  className,
816
- containerClassName = "mx-auto w-full max-w-7xl relative z-10 rounded-2xl overflow-hidden shadow-xl",
816
+ containerClassName = "mx-none md:mx-auto w-screen md:w-full max-w-screen md:max-w-7xl relative z-10 rounded-none md:rounded-2xl overflow-hidden shadow-none md:shadow-xl",
817
817
  contentClassName,
818
818
  badgeClassName,
819
819
  headingClassName,
@@ -823,19 +823,33 @@ function CarouselImageHero({
823
823
  indicatorsClassName,
824
824
  optixFlowConfig,
825
825
  background,
826
- spacing,
826
+ spacing = "py-0 md:py-32",
827
827
  pattern,
828
828
  patternOpacity
829
829
  }) {
830
- const [currentImageIndex, setCurrentImageIndex] = React.useState(0);
831
- React.useEffect(() => {
832
- const interval = setInterval(() => {
833
- setCurrentImageIndex(
834
- (prevIndex) => (prevIndex + 1) % (images?.length ?? 1)
835
- );
836
- }, autoPlayInterval);
837
- return () => clearInterval(interval);
838
- }, [images?.length, autoPlayInterval]);
830
+ const [currentImageIndex, setCurrentImageIndex] = React5.useState(0);
831
+ const intervalRef = React5.useRef(null);
832
+ const goToNext = React5.useCallback(() => {
833
+ setCurrentImageIndex((prevIndex) => (prevIndex + 1) % (images?.length ?? 1));
834
+ }, [images?.length]);
835
+ const resetInterval = React5.useCallback(() => {
836
+ if (intervalRef.current) {
837
+ clearInterval(intervalRef.current);
838
+ }
839
+ intervalRef.current = setInterval(goToNext, autoPlayInterval);
840
+ }, [goToNext, autoPlayInterval]);
841
+ const goToSlide = React5.useCallback((index) => {
842
+ setCurrentImageIndex(index);
843
+ resetInterval();
844
+ }, [resetInterval]);
845
+ React5.useEffect(() => {
846
+ resetInterval();
847
+ return () => {
848
+ if (intervalRef.current) {
849
+ clearInterval(intervalRef.current);
850
+ }
851
+ };
852
+ }, [resetInterval]);
839
853
  const renderActions = () => {
840
854
  if (actionsSlot) return actionsSlot;
841
855
  if (!actions || actions.length === 0) return null;
@@ -869,12 +883,15 @@ function CarouselImageHero({
869
883
  {
870
884
  background,
871
885
  spacing,
872
- className: cn("relative min-h-[600px] overflow-hidden", className),
886
+ className: cn(
887
+ "relative min-h-screen md:min-h-[600px] overflow-hidden",
888
+ className
889
+ ),
873
890
  pattern,
874
891
  patternOpacity,
875
892
  containerClassName,
876
893
  children: [
877
- /* @__PURE__ */ jsxs("div", { className: cn("absolute inset-0", imageClassName), children: [
894
+ /* @__PURE__ */ jsxs("div", { className: cn("absolute inset-0 bg-black", imageClassName), children: [
878
895
  images?.map((image, index) => /* @__PURE__ */ jsxs(
879
896
  "div",
880
897
  {
@@ -907,7 +924,7 @@ function CarouselImageHero({
907
924
  children: images?.map((_, index) => /* @__PURE__ */ jsx(
908
925
  "button",
909
926
  {
910
- onClick: () => setCurrentImageIndex(index),
927
+ onClick: () => goToSlide(index),
911
928
  className: cn(
912
929
  "flex h-4 w-4 items-center justify-center rounded-full transition-colors",
913
930
  index === currentImageIndex ? "bg-white" : "bg-white/50 hover:bg-white/80"
package/dist/registry.cjs CHANGED
@@ -18788,7 +18788,7 @@ function CarouselImageHero({
18788
18788
  images,
18789
18789
  autoPlayInterval = 7500,
18790
18790
  className,
18791
- containerClassName = "mx-auto w-full max-w-7xl relative z-10 rounded-2xl overflow-hidden shadow-xl",
18791
+ containerClassName = "mx-none md:mx-auto w-screen md:w-full max-w-screen md:max-w-7xl relative z-10 rounded-none md:rounded-2xl overflow-hidden shadow-none md:shadow-xl",
18792
18792
  contentClassName,
18793
18793
  badgeClassName,
18794
18794
  headingClassName,
@@ -18798,19 +18798,33 @@ function CarouselImageHero({
18798
18798
  indicatorsClassName,
18799
18799
  optixFlowConfig,
18800
18800
  background,
18801
- spacing,
18801
+ spacing = "py-0 md:py-32",
18802
18802
  pattern,
18803
18803
  patternOpacity
18804
18804
  }) {
18805
18805
  const [currentImageIndex, setCurrentImageIndex] = React52__namespace.useState(0);
18806
+ const intervalRef = React52__namespace.useRef(null);
18807
+ const goToNext = React52__namespace.useCallback(() => {
18808
+ setCurrentImageIndex((prevIndex) => (prevIndex + 1) % (images?.length ?? 1));
18809
+ }, [images?.length]);
18810
+ const resetInterval = React52__namespace.useCallback(() => {
18811
+ if (intervalRef.current) {
18812
+ clearInterval(intervalRef.current);
18813
+ }
18814
+ intervalRef.current = setInterval(goToNext, autoPlayInterval);
18815
+ }, [goToNext, autoPlayInterval]);
18816
+ const goToSlide = React52__namespace.useCallback((index) => {
18817
+ setCurrentImageIndex(index);
18818
+ resetInterval();
18819
+ }, [resetInterval]);
18806
18820
  React52__namespace.useEffect(() => {
18807
- const interval = setInterval(() => {
18808
- setCurrentImageIndex(
18809
- (prevIndex) => (prevIndex + 1) % (images?.length ?? 1)
18810
- );
18811
- }, autoPlayInterval);
18812
- return () => clearInterval(interval);
18813
- }, [images?.length, autoPlayInterval]);
18821
+ resetInterval();
18822
+ return () => {
18823
+ if (intervalRef.current) {
18824
+ clearInterval(intervalRef.current);
18825
+ }
18826
+ };
18827
+ }, [resetInterval]);
18814
18828
  const renderActions = () => {
18815
18829
  if (actionsSlot) return actionsSlot;
18816
18830
  if (!actions || actions.length === 0) return null;
@@ -18844,12 +18858,15 @@ function CarouselImageHero({
18844
18858
  {
18845
18859
  background,
18846
18860
  spacing,
18847
- className: cn("relative min-h-[600px] overflow-hidden", className),
18861
+ className: cn(
18862
+ "relative min-h-screen md:min-h-[600px] overflow-hidden",
18863
+ className
18864
+ ),
18848
18865
  pattern,
18849
18866
  patternOpacity,
18850
18867
  containerClassName,
18851
18868
  children: [
18852
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("absolute inset-0", imageClassName), children: [
18869
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("absolute inset-0 bg-black", imageClassName), children: [
18853
18870
  images?.map((image, index) => /* @__PURE__ */ jsxRuntime.jsxs(
18854
18871
  "div",
18855
18872
  {
@@ -18882,7 +18899,7 @@ function CarouselImageHero({
18882
18899
  children: images?.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
18883
18900
  "button",
18884
18901
  {
18885
- onClick: () => setCurrentImageIndex(index),
18902
+ onClick: () => goToSlide(index),
18886
18903
  className: cn(
18887
18904
  "flex h-4 w-4 items-center justify-center rounded-full transition-colors",
18888
18905
  index === currentImageIndex ? "bg-white" : "bg-white/50 hover:bg-white/80"
package/dist/registry.js CHANGED
@@ -18748,7 +18748,7 @@ function CarouselImageHero({
18748
18748
  images,
18749
18749
  autoPlayInterval = 7500,
18750
18750
  className,
18751
- containerClassName = "mx-auto w-full max-w-7xl relative z-10 rounded-2xl overflow-hidden shadow-xl",
18751
+ containerClassName = "mx-none md:mx-auto w-screen md:w-full max-w-screen md:max-w-7xl relative z-10 rounded-none md:rounded-2xl overflow-hidden shadow-none md:shadow-xl",
18752
18752
  contentClassName,
18753
18753
  badgeClassName,
18754
18754
  headingClassName,
@@ -18758,19 +18758,33 @@ function CarouselImageHero({
18758
18758
  indicatorsClassName,
18759
18759
  optixFlowConfig,
18760
18760
  background,
18761
- spacing,
18761
+ spacing = "py-0 md:py-32",
18762
18762
  pattern,
18763
18763
  patternOpacity
18764
18764
  }) {
18765
18765
  const [currentImageIndex, setCurrentImageIndex] = React52.useState(0);
18766
+ const intervalRef = React52.useRef(null);
18767
+ const goToNext = React52.useCallback(() => {
18768
+ setCurrentImageIndex((prevIndex) => (prevIndex + 1) % (images?.length ?? 1));
18769
+ }, [images?.length]);
18770
+ const resetInterval = React52.useCallback(() => {
18771
+ if (intervalRef.current) {
18772
+ clearInterval(intervalRef.current);
18773
+ }
18774
+ intervalRef.current = setInterval(goToNext, autoPlayInterval);
18775
+ }, [goToNext, autoPlayInterval]);
18776
+ const goToSlide = React52.useCallback((index) => {
18777
+ setCurrentImageIndex(index);
18778
+ resetInterval();
18779
+ }, [resetInterval]);
18766
18780
  React52.useEffect(() => {
18767
- const interval = setInterval(() => {
18768
- setCurrentImageIndex(
18769
- (prevIndex) => (prevIndex + 1) % (images?.length ?? 1)
18770
- );
18771
- }, autoPlayInterval);
18772
- return () => clearInterval(interval);
18773
- }, [images?.length, autoPlayInterval]);
18781
+ resetInterval();
18782
+ return () => {
18783
+ if (intervalRef.current) {
18784
+ clearInterval(intervalRef.current);
18785
+ }
18786
+ };
18787
+ }, [resetInterval]);
18774
18788
  const renderActions = () => {
18775
18789
  if (actionsSlot) return actionsSlot;
18776
18790
  if (!actions || actions.length === 0) return null;
@@ -18804,12 +18818,15 @@ function CarouselImageHero({
18804
18818
  {
18805
18819
  background,
18806
18820
  spacing,
18807
- className: cn("relative min-h-[600px] overflow-hidden", className),
18821
+ className: cn(
18822
+ "relative min-h-screen md:min-h-[600px] overflow-hidden",
18823
+ className
18824
+ ),
18808
18825
  pattern,
18809
18826
  patternOpacity,
18810
18827
  containerClassName,
18811
18828
  children: [
18812
- /* @__PURE__ */ jsxs("div", { className: cn("absolute inset-0", imageClassName), children: [
18829
+ /* @__PURE__ */ jsxs("div", { className: cn("absolute inset-0 bg-black", imageClassName), children: [
18813
18830
  images?.map((image, index) => /* @__PURE__ */ jsxs(
18814
18831
  "div",
18815
18832
  {
@@ -18842,7 +18859,7 @@ function CarouselImageHero({
18842
18859
  children: images?.map((_, index) => /* @__PURE__ */ jsx(
18843
18860
  "button",
18844
18861
  {
18845
- onClick: () => setCurrentImageIndex(index),
18862
+ onClick: () => goToSlide(index),
18846
18863
  className: cn(
18847
18864
  "flex h-4 w-4 items-center justify-center rounded-full transition-colors",
18848
18865
  index === currentImageIndex ? "bg-white" : "bg-white/50 hover:bg-white/80"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensite/ui",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "Foundational UI component library for OpenSite Semantic Site Builder with tree-shakable exports and abstract styling",
5
5
  "keywords": [
6
6
  "react",