@scbt-ecom/ui 0.65.0 → 0.66.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-BC0CWE5w.js → index-CywQGF6V.js} +9393 -9354
- package/dist/index-CywQGF6V.js.map +1 -0
- package/dist/shared/types/dicriminatedUnion.d.ts +7 -0
- package/dist/shared/types/index.d.ts +2 -0
- package/dist/shared/types/keysOf.d.ts +5 -0
- package/dist/shared/ui/carousel/CarouselBase.d.ts +29 -0
- package/dist/shared/ui/carousel/index.d.ts +3 -0
- package/dist/shared/ui/carousel/model/helpers.d.ts +9 -0
- package/dist/shared/ui/carousel/model/hooks/index.d.ts +3 -0
- package/dist/shared/ui/carousel/model/hooks/useArrowNavigation.d.ts +12 -0
- package/dist/shared/ui/carousel/model/hooks/useCarousel.d.ts +12 -0
- package/dist/shared/ui/carousel/model/hooks/useDotsNavigation.d.ts +15 -0
- package/dist/shared/ui/carousel/model/index.d.ts +3 -0
- package/dist/shared/ui/carousel/model/types.d.ts +27 -0
- package/dist/shared/ui/carousel/ui/ArrowNavigationButton.d.ts +13 -0
- package/dist/shared/ui/carousel/ui/CarouselContent.d.ts +16 -0
- package/dist/shared/ui/carousel/ui/CarouselSlide.d.ts +10 -0
- package/dist/shared/ui/carousel/ui/ContainerWithNavigation.d.ts +16 -0
- package/dist/shared/ui/carousel/ui/DotsNavigations.d.ts +13 -0
- package/dist/shared/ui/carousel/ui/index.d.ts +5 -0
- package/dist/shared/ui/carousel/ui/slideVariants/SlideFullScreen.d.ts +19 -0
- package/dist/shared/ui/carousel/ui/slideVariants/SlideOnlyImage.d.ts +11 -0
- package/dist/shared/ui/carousel/ui/slideVariants/SlideProductCard.d.ts +20 -0
- package/dist/shared/ui/carousel/ui/slideVariants/index.d.ts +3 -0
- package/dist/shared/ui/index.d.ts +1 -0
- package/dist/ui.js +2468 -861
- package/dist/ui.js.map +1 -1
- package/dist/widget.js +1 -1
- package/package.json +4 -1
- package/dist/index-BC0CWE5w.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type DiscriminatedUnion<Discriminator extends keyof Union, Union extends {
|
|
2
|
+
[Key in Discriminator]: unknown;
|
|
3
|
+
}> = Union extends {
|
|
4
|
+
[Key in Discriminator]: infer Value;
|
|
5
|
+
} ? Value extends Union[Discriminator] ? Extract<Union, {
|
|
6
|
+
[Key in Discriminator]: Value;
|
|
7
|
+
}> : never : never;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { EmblaOptionsType } from 'embla-carousel';
|
|
3
|
+
import { AutoplayOptionsType } from 'embla-carousel-autoplay';
|
|
4
|
+
import { DotsOptions, NavArrowOptions } from './model';
|
|
5
|
+
import { ArrowNavigationButtonClasses, CarouselContentClasses } from './ui';
|
|
6
|
+
import { ContainerWithNavigationClasses } from './ui/ContainerWithNavigation';
|
|
7
|
+
type CarouselClasses = {
|
|
8
|
+
root?: string;
|
|
9
|
+
header?: string;
|
|
10
|
+
heading?: string;
|
|
11
|
+
arrowsNavWrapper?: string;
|
|
12
|
+
arrowLeftClasses?: ArrowNavigationButtonClasses;
|
|
13
|
+
arrowRightClasses?: ArrowNavigationButtonClasses;
|
|
14
|
+
containerWithNavClasses?: ContainerWithNavigationClasses;
|
|
15
|
+
carouselContentClasses?: CarouselContentClasses;
|
|
16
|
+
};
|
|
17
|
+
export interface CarouselBaseProps extends HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
heading?: string;
|
|
20
|
+
carouselOptions?: EmblaOptionsType;
|
|
21
|
+
dotsOptions?: DotsOptions;
|
|
22
|
+
navArrowOptions?: NavArrowOptions;
|
|
23
|
+
autoPlayOptions?: AutoplayOptionsType;
|
|
24
|
+
setVisibleIndex: (index: number) => void;
|
|
25
|
+
visibleIndex: number;
|
|
26
|
+
classes?: CarouselClasses;
|
|
27
|
+
}
|
|
28
|
+
export declare const CarouselBase: ({ dotsOptions, navArrowOptions, carouselOptions, heading, autoPlayOptions, setVisibleIndex, visibleIndex, children, classes, ...props }: CarouselBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EmblaOptionsType } from 'embla-carousel';
|
|
2
|
+
import { AutoplayOptionsType } from 'embla-carousel-autoplay';
|
|
3
|
+
import { CarouselSlideVariant, DotsOptions, NavArrowOptions } from './types';
|
|
4
|
+
import { DiscriminatedUnion } from '../../../types';
|
|
5
|
+
export declare const defaultCarouselOptions: EmblaOptionsType;
|
|
6
|
+
export declare const defaultDotsOptions: DotsOptions;
|
|
7
|
+
export declare const defaultNavArrowOptions: NavArrowOptions;
|
|
8
|
+
export declare const defaultAutoPlayOptions: AutoplayOptionsType;
|
|
9
|
+
export declare const renderSlideVariant: (props: DiscriminatedUnion<"variant", CarouselSlideVariant>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EmblaCarouselType } from 'embla-carousel';
|
|
2
|
+
import { NavigationMode } from '../types';
|
|
3
|
+
type UseArrowNavigationProps = {
|
|
4
|
+
emblaApi: EmblaCarouselType | undefined;
|
|
5
|
+
navigationHandler?: (emblaApi: EmblaCarouselType) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const useArrowNavigation: ({ emblaApi, navigationHandler }: UseArrowNavigationProps) => {
|
|
8
|
+
prevBtnDisabled: boolean;
|
|
9
|
+
nextBtnDisabled: boolean;
|
|
10
|
+
onClickNavigationButton: (mode: NavigationMode) => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EmblaCarouselType, EmblaOptionsType } from 'embla-carousel';
|
|
2
|
+
import { AutoplayOptionsType } from 'embla-carousel-autoplay';
|
|
3
|
+
type UseCarouselProps = {
|
|
4
|
+
carouselOptions: EmblaOptionsType;
|
|
5
|
+
autoPlayOptions?: AutoplayOptionsType;
|
|
6
|
+
};
|
|
7
|
+
export declare const useCarousel: ({ carouselOptions, autoPlayOptions }: UseCarouselProps) => {
|
|
8
|
+
emblaRef: import('embla-carousel-react').EmblaViewportRefType;
|
|
9
|
+
emblaApi: EmblaCarouselType | undefined;
|
|
10
|
+
navigationHandler: (emblaApi: EmblaCarouselType) => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EmblaCarouselType } from 'embla-carousel';
|
|
2
|
+
type UseDotsNavigationProps = {
|
|
3
|
+
emblaApi: EmblaCarouselType | undefined;
|
|
4
|
+
navigationHandler: (emblaApi: EmblaCarouselType) => void;
|
|
5
|
+
setVisibleIndex: (index: number) => void;
|
|
6
|
+
};
|
|
7
|
+
export type UseDotsNavigationReturn = {
|
|
8
|
+
scrollSnaps: number[];
|
|
9
|
+
onClickDot: (index: number) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const useDotsNavigation: ({ emblaApi, navigationHandler, setVisibleIndex }: UseDotsNavigationProps) => {
|
|
12
|
+
scrollSnaps: number[];
|
|
13
|
+
onClickDot: (index: number) => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CarouselSlideProps, SlideFullScreenProps, SlideOnlyImageProps, SlideProductCardProps } from '../ui';
|
|
2
|
+
export type DotsOptions = {
|
|
3
|
+
position?: 'bot-left' | 'center' | 'bot-right';
|
|
4
|
+
deskVisible?: boolean;
|
|
5
|
+
mobVisible?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type NavArrowOptions = {
|
|
8
|
+
position?: 'center' | 'top-right';
|
|
9
|
+
deskVisible?: boolean;
|
|
10
|
+
mobVisible?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type NavigationMode = 'next' | 'prev';
|
|
13
|
+
export type ImageProps = {
|
|
14
|
+
src: string;
|
|
15
|
+
alt: string;
|
|
16
|
+
};
|
|
17
|
+
interface SlideFullScreen extends SlideFullScreenProps, CarouselSlideProps {
|
|
18
|
+
variant: 'fullScreen';
|
|
19
|
+
}
|
|
20
|
+
interface SlideOnlyImage extends SlideOnlyImageProps, CarouselSlideProps {
|
|
21
|
+
variant: 'onlyImage';
|
|
22
|
+
}
|
|
23
|
+
interface SlideProductCard extends SlideProductCardProps, CarouselSlideProps {
|
|
24
|
+
variant: 'productCard';
|
|
25
|
+
}
|
|
26
|
+
export type CarouselSlideVariant = SlideFullScreen | SlideOnlyImage | SlideProductCard;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { NavigationMode } from '../model';
|
|
3
|
+
export type ArrowNavigationButtonClasses = {
|
|
4
|
+
button?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
};
|
|
7
|
+
interface ArrowNavigationButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'onClick'> {
|
|
8
|
+
mode: NavigationMode;
|
|
9
|
+
onClick: (mode: NavigationMode) => void;
|
|
10
|
+
classes?: ArrowNavigationButtonClasses;
|
|
11
|
+
}
|
|
12
|
+
export declare const ArrowNavigationButton: ({ mode, onClick, children, classes, ...props }: ArrowNavigationButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DotsOptions, UseDotsNavigationReturn } from '../model';
|
|
3
|
+
import { DotsNavigationsClasses } from './DotsNavigations';
|
|
4
|
+
export type CarouselContentClasses = {
|
|
5
|
+
dotsClasses?: DotsNavigationsClasses;
|
|
6
|
+
slidesOverlay?: string;
|
|
7
|
+
slidesWrapper?: string;
|
|
8
|
+
};
|
|
9
|
+
export interface CarouselContentProps {
|
|
10
|
+
classes?: CarouselContentClasses;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
dotsProps: UseDotsNavigationReturn;
|
|
13
|
+
dotsOptions: DotsOptions;
|
|
14
|
+
visibleIndex: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const CarouselContent: import('react').ForwardRefExoticComponent<CarouselContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CarouselSlideVariant } from '../model';
|
|
2
|
+
import { DiscriminatedUnion } from '../../../types';
|
|
3
|
+
export type CarouselSlideClasses = {
|
|
4
|
+
root?: string;
|
|
5
|
+
slide?: string;
|
|
6
|
+
};
|
|
7
|
+
export type CarouselSlideProps = {
|
|
8
|
+
classes?: CarouselSlideClasses;
|
|
9
|
+
};
|
|
10
|
+
export declare const CarouselSlide: ({ classes, ...props }: DiscriminatedUnion<"variant", CarouselSlideVariant>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NavigationMode } from '../model';
|
|
3
|
+
import { ArrowNavigationButtonClasses } from './ArrowNavigationButton';
|
|
4
|
+
export type ContainerWithNavigationClasses = {
|
|
5
|
+
wrapper?: string;
|
|
6
|
+
arrowLeftClasses?: ArrowNavigationButtonClasses;
|
|
7
|
+
arrowRightClasses?: ArrowNavigationButtonClasses;
|
|
8
|
+
};
|
|
9
|
+
export interface ContainerWithNavigationProps {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
prevBtnDisabled: boolean;
|
|
12
|
+
nextBtnDisabled: boolean;
|
|
13
|
+
onClickNavigationButton: (mode: NavigationMode) => void;
|
|
14
|
+
classes?: ContainerWithNavigationClasses;
|
|
15
|
+
}
|
|
16
|
+
export declare const ContainerWithNavigation: ({ children, prevBtnDisabled, nextBtnDisabled, onClickNavigationButton, classes }: ContainerWithNavigationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DotsOptions } from '../model';
|
|
2
|
+
export type DotsNavigationsClasses = {
|
|
3
|
+
dotsWrapper?: string;
|
|
4
|
+
dot?: string;
|
|
5
|
+
};
|
|
6
|
+
interface DotsNavigationsProps extends Pick<DotsOptions, 'position'> {
|
|
7
|
+
scrollSnaps: number[];
|
|
8
|
+
onClickDot: (index: number) => void;
|
|
9
|
+
visibleIndex: number;
|
|
10
|
+
classes?: DotsNavigationsClasses;
|
|
11
|
+
}
|
|
12
|
+
export declare const DotsNavigations: ({ scrollSnaps, visibleIndex, onClickDot, position, classes, ...props }: DotsNavigationsProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ImageProps } from '../../model';
|
|
2
|
+
type SlideFullScreenClasses = {
|
|
3
|
+
root?: string;
|
|
4
|
+
wrapper?: string;
|
|
5
|
+
numeric?: string;
|
|
6
|
+
textWrapper?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
image?: string;
|
|
10
|
+
};
|
|
11
|
+
export interface SlideFullScreenProps {
|
|
12
|
+
slideIndex: number;
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
imgProps?: ImageProps;
|
|
16
|
+
slideClasses?: SlideFullScreenClasses;
|
|
17
|
+
}
|
|
18
|
+
export declare const SlideFullScreen: ({ slideIndex, title, imgProps, description, slideClasses }: SlideFullScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ImageProps } from '../../model';
|
|
2
|
+
type SlideOnlyImageClasses = {
|
|
3
|
+
root?: string;
|
|
4
|
+
image?: string;
|
|
5
|
+
};
|
|
6
|
+
export interface SlideOnlyImageProps {
|
|
7
|
+
imgProps?: ImageProps;
|
|
8
|
+
slideClasses?: SlideOnlyImageClasses;
|
|
9
|
+
}
|
|
10
|
+
export declare const SlideOnlyImage: ({ imgProps, slideClasses }: SlideOnlyImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ButtonProps } from '../../../button';
|
|
2
|
+
import { ImageProps } from '../../model';
|
|
3
|
+
type SlideProductCardClasses = {
|
|
4
|
+
root?: string;
|
|
5
|
+
wrapper?: string;
|
|
6
|
+
textWrapper?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
image?: string;
|
|
10
|
+
button?: string;
|
|
11
|
+
};
|
|
12
|
+
export interface SlideProductCardProps {
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
imgProps?: ImageProps;
|
|
16
|
+
buttonProps?: ButtonProps;
|
|
17
|
+
slideClasses?: SlideProductCardClasses;
|
|
18
|
+
}
|
|
19
|
+
export declare const SlideProductCard: ({ title, imgProps, description, buttonProps, slideClasses }: SlideProductCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|