@sonic-equipment/ui 0.0.104 → 0.0.105
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
|
@@ -7831,7 +7831,22 @@ function Select({ isDisabled = false, label, onChange, options, placeholder, sel
|
|
|
7831
7831
|
var styles$Q = {"modal-overlay":"modal-module-rVFJc","modal-fade":"modal-module-63Uyl","is-full-screen":"modal-module-uwets","modal":"modal-module-6vlFt","content":"modal-module-FJxzx","modal-slide":"modal-module-jkAe7","modal-delayed-fade":"modal-module-WOZ01","close":"modal-module-7zIZE","modal-zoom":"modal-module-aPJ7X"};
|
|
7832
7832
|
|
|
7833
7833
|
function Modal({ children, className, hasCloseButton, isDismissable, isFullScreen, isKeyboardDismissDisabled, isOpen, onOpenChange, shouldCloseOnInteractOutside = true, }) {
|
|
7834
|
-
return (jsx(ModalOverlay, {
|
|
7834
|
+
return (jsx(ModalOverlay, { ref: ref => {
|
|
7835
|
+
ref?.addEventListener('click', e => {
|
|
7836
|
+
if ((!e.target || ref.contains(e.target)) &&
|
|
7837
|
+
ref !== e.target)
|
|
7838
|
+
return;
|
|
7839
|
+
e.preventDefault();
|
|
7840
|
+
e.stopPropagation();
|
|
7841
|
+
});
|
|
7842
|
+
ref?.addEventListener('touchend', e => {
|
|
7843
|
+
if ((!e.target || ref.contains(e.target)) &&
|
|
7844
|
+
ref !== e.target)
|
|
7845
|
+
return;
|
|
7846
|
+
e.preventDefault();
|
|
7847
|
+
e.stopPropagation();
|
|
7848
|
+
});
|
|
7849
|
+
}, className: clsx(styles$Q['modal-overlay'], className), isDismissable: isDismissable, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, shouldCloseOnInteractOutside: () => shouldCloseOnInteractOutside, children: jsxs(Modal$1, { className: clsx(styles$Q.modal, {
|
|
7835
7850
|
[styles$Q['is-full-screen']]: isFullScreen,
|
|
7836
7851
|
}), children: [hasCloseButton && (jsx("div", { className: styles$Q.close, children: jsx(IconButton, { color: "secondary", isDisabled: !isDismissable, onClick: () => onOpenChange(false), children: jsx(StrokeCloseboxIcon, {}) }) })), jsx("div", { className: styles$Q.content, children: children })] }) }));
|
|
7837
7852
|
}
|
|
@@ -8735,19 +8750,35 @@ function ImageLightbox({ images, initialSelectedIndex = 0, variant = 'sm', }) {
|
|
|
8735
8750
|
const nextEl = useRef(null);
|
|
8736
8751
|
const prevEl = useRef(null);
|
|
8737
8752
|
const mainSwiperRef = useRef(null);
|
|
8738
|
-
const [
|
|
8739
|
-
|
|
8740
|
-
|
|
8753
|
+
const [scrollFromTopPercentage, setScrollFromTopPercentage] = useState(0.5);
|
|
8754
|
+
const { close, isOpen, open } = useDisclosure(false);
|
|
8755
|
+
function handleZoom(e) {
|
|
8756
|
+
const target = e.target;
|
|
8757
|
+
const clientRect = target?.getBoundingClientRect();
|
|
8758
|
+
if (!clientRect)
|
|
8759
|
+
return;
|
|
8760
|
+
const height = clientRect.height;
|
|
8761
|
+
const clientY = e.clientY - clientRect.top;
|
|
8762
|
+
const scrollPercentage = clientY / height;
|
|
8763
|
+
setScrollFromTopPercentage(scrollPercentage);
|
|
8764
|
+
open();
|
|
8741
8765
|
}
|
|
8742
8766
|
return (jsxs("div", { className: clsx(styles$q['image-lightbox'], styles$q[variant]), children: [jsx(Swiper, { watchSlidesProgress: true, className: styles$q['thumbs-swiper'], direction: variant === 'sm' ? 'horizontal' : 'vertical', modules: [Thumb], onSwiper: swiper => setThumbsSwiper(swiper), slidesPerView: "auto", spaceBetween: 8, children: images.map((image, index) => (jsx(SwiperSlide, { className: styles$q.slide, children: jsx("div", { className: styles$q.thumb, children: jsx(Image, { className: styles$q.image, fit: "contain", height: 80, image: image, title: "Image", width: 80 }) }) }, index))) }), jsxs("div", { className: styles$q['main-swiper'], children: [jsx(Swiper, { initialSlide: initialSelectedIndex, modules: [Thumb, Navigation], navigation: {
|
|
8743
8767
|
nextEl: nextEl.current,
|
|
8744
8768
|
prevEl: prevEl.current,
|
|
8745
|
-
}, onActiveIndexChange: swiper => setCurrentIndex(swiper.activeIndex), onBeforeInit: swiper => (mainSwiperRef.current = swiper), slidesPerView: 1, thumbs: { swiper: thumbsSwiper }, children: images.map((image, index) => (jsx(SwiperSlide, { className: styles$q.slide, children: jsx("button", { className: styles$q['active-image'], onClick: handleZoom, type: "button", children: jsx(Image, { className: styles$q.image, fit: "contain", image: image, title: "Image" }) }) }, index))) }), jsx("div", { className: styles$q.pagination, children: jsx(Pagination$1, { contained: true, currentPage: currentIndex + 1, numberOfPages: images.length, onChange: pageNumber => mainSwiperRef.current?.slideTo(pageNumber - 1) }) }), variant === 'lg' && (jsxs(Fragment, { children: [jsx(CarouselNavigationButton, { ref: prevEl, className: clsx(styles$q['navigation-button'], styles$q['navigation-button-prev']), direction: "previous" }), jsx(CarouselNavigationButton, { ref: nextEl, className: clsx(styles$q['navigation-button'], styles$q['navigation-button-next']), direction: "next" })] }))] }), jsx(ZoomImage, { currentImage: images[currentIndex], isZoomed:
|
|
8769
|
+
}, onActiveIndexChange: swiper => setCurrentIndex(swiper.activeIndex), onBeforeInit: swiper => (mainSwiperRef.current = swiper), slidesPerView: 1, thumbs: { swiper: thumbsSwiper }, children: images.map((image, index) => (jsx(SwiperSlide, { className: styles$q.slide, children: jsx("button", { className: styles$q['active-image'], onClick: handleZoom, type: "button", children: jsx(Image, { className: styles$q.image, fit: "contain", image: image, title: "Image" }) }) }, index))) }), jsx("div", { className: styles$q.pagination, children: jsx(Pagination$1, { contained: true, currentPage: currentIndex + 1, numberOfPages: images.length, onChange: pageNumber => mainSwiperRef.current?.slideTo(pageNumber - 1) }) }), variant === 'lg' && (jsxs(Fragment, { children: [jsx(CarouselNavigationButton, { ref: prevEl, className: clsx(styles$q['navigation-button'], styles$q['navigation-button-prev']), direction: "previous" }), jsx(CarouselNavigationButton, { ref: nextEl, className: clsx(styles$q['navigation-button'], styles$q['navigation-button-next']), direction: "next" })] }))] }), jsx(ZoomImage, { currentImage: images[currentIndex], isZoomed: isOpen, onClose: close, scrollFromTopPercentage: scrollFromTopPercentage })] }));
|
|
8746
8770
|
}
|
|
8747
|
-
function ZoomImage({ currentImage, isZoomed, onClose, }) {
|
|
8771
|
+
function ZoomImage({ currentImage, isZoomed, onClose, scrollFromTopPercentage, }) {
|
|
8748
8772
|
if (!isZoomed || !currentImage)
|
|
8749
8773
|
return null;
|
|
8750
|
-
return (jsx(Modal, { className: styles$q['zoomed-overlay'], hasCloseButton: true, isDismissable: true, isFullScreen: true, isKeyboardDismissDisabled: false, isOpen: isZoomed, onOpenChange:
|
|
8774
|
+
return (jsx(Modal, { className: styles$q['zoomed-overlay'], hasCloseButton: true, isDismissable: true, isFullScreen: true, isKeyboardDismissDisabled: false, isOpen: isZoomed, onOpenChange: onClose, children: jsx("div", { ref: element => {
|
|
8775
|
+
setTimeout(() => {
|
|
8776
|
+
if (!element)
|
|
8777
|
+
return;
|
|
8778
|
+
element.scrollTo(0, element.scrollHeight * scrollFromTopPercentage -
|
|
8779
|
+
element.clientHeight / 2);
|
|
8780
|
+
}, 100);
|
|
8781
|
+
}, className: styles$q['zoomed-container'], onClick: onClose, children: jsx(Image, { className: styles$q['zoomed-image'], image: currentImage, title: currentImage.altText }) }) }));
|
|
8751
8782
|
}
|
|
8752
8783
|
|
|
8753
8784
|
var styles$p = {"image-lightbox-modal":"product-detail-images-module-N3Ms-"};
|
package/dist/styles.css
CHANGED
|
@@ -2874,6 +2874,8 @@
|
|
|
2874
2874
|
|
|
2875
2875
|
.card-carousel-module-DxKOG.card-carousel-module-8uKSt {
|
|
2876
2876
|
--slide-width: var(--slide-width-narrow);
|
|
2877
|
+
|
|
2878
|
+
max-height: calc(var(--slide-width) * 1.8177);
|
|
2877
2879
|
}
|
|
2878
2880
|
|
|
2879
2881
|
.card-carousel-module-DxKOG.card-carousel-module-l-ylK {
|
|
@@ -2930,6 +2932,8 @@
|
|
|
2930
2932
|
|
|
2931
2933
|
.card-carousel-module-DxKOG.card-carousel-module-8uKSt {
|
|
2932
2934
|
--slide-width: var(--slide-width-narrow);
|
|
2935
|
+
|
|
2936
|
+
max-height: calc(var(--slide-width) * 1.8177);
|
|
2933
2937
|
}
|
|
2934
2938
|
|
|
2935
2939
|
.card-carousel-module-DxKOG.card-carousel-module-l-ylK {
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { CarouselProps } from 'carousel/carousel';
|
|
3
|
-
interface PromoCardCarouselProps {
|
|
4
|
-
cardWidth?: 'normal' | 'narrow' | 'auto';
|
|
5
|
-
hasOverflow?: boolean;
|
|
6
|
-
promoCards: ReactNode[];
|
|
7
|
-
promosPerView?: CarouselProps['slidesPerView'];
|
|
8
|
-
}
|
|
9
|
-
export declare function PromoCardCarousel({ promoCards }: PromoCardCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export {};
|