@nuskin/marketing-components 1.34.1 → 1.36.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/carousel/Carousel.d.ts +6 -0
- package/dist/carousel/CarouselLayout.styled.d.ts +50 -0
- package/dist/{column-control/hooks/useColumnControl.d.ts → carousel/hooks/useCarouselLayout.d.ts} +4 -5
- package/dist/carousel/hooks/useCarouselResize.d.ts +6 -0
- package/dist/carousel/index.d.ts +2 -0
- package/dist/carousel/mocks/MockContentCard.d.ts +20 -0
- package/dist/carousel/mocks/MockProductCard.d.ts +9 -0
- package/dist/carousel/mocks/index.d.ts +7 -0
- package/dist/carousel/shared.d.ts +27 -0
- package/dist/carousel/specs/Carousel.spec.d.ts +1 -0
- package/dist/carousel/specs/useCarouselResize.spec.d.ts +1 -0
- package/dist/carousel/specs/utils.spec.d.ts +1 -0
- package/dist/carousel/types.d.ts +56 -0
- package/dist/carousel/utils.d.ts +47 -0
- package/dist/column-control/ColumnControl.d.ts +1 -1
- package/dist/column-control/ColumnControl.stories.d.ts +6 -6
- package/dist/column-control/ColumnControl.styled.d.ts +2 -9
- package/dist/column-control/index.d.ts +1 -2
- package/dist/column-control/mocks/MockContentCard.d.ts +2 -9
- package/dist/column-control/mocks/MockProductCard.d.ts +1 -1
- package/dist/column-control/mocks/index.d.ts +3 -5
- package/dist/column-control/specs/ColumnControl.spec.d.ts +1 -1
- package/dist/column-control/types.d.ts +9 -29
- package/dist/column-control/utils.d.ts +9 -67
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/utils/deviceConstants.d.ts +13 -0
- package/dist/utils/viewportLayoutUtils.d.ts +4 -0
- package/package.json +1 -1
- package/dist/column-control/Carousel.d.ts +0 -6
- package/dist/column-control/hooks/useColumnControlResize.d.ts +0 -6
- package/dist/column-control/shared.d.ts +0 -37
- /package/dist/{column-control → carousel}/Carousel.stories.d.ts +0 -0
- /package/dist/{column-control → carousel}/mocks/MockHeroBanner.d.ts +0 -0
- /package/dist/{column-control → carousel}/mocks/mockAssets.d.ts +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CarouselProps } from './types';
|
|
2
|
+
import 'slick-carousel/slick/slick.css';
|
|
3
|
+
import 'slick-carousel/slick/slick-theme.css';
|
|
4
|
+
/** Carousel layout: slider with arrows and dots. Uses shared hook and UI with carousel container. */
|
|
5
|
+
export declare function Carousel<T = unknown>(props: CarouselProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default Carousel;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export declare const CarouselContainer: import("@emotion/styled").StyledComponent<{
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
as?: React.ElementType;
|
|
4
|
+
} & {
|
|
5
|
+
gap: number;
|
|
6
|
+
height: string;
|
|
7
|
+
columnHeight: string;
|
|
8
|
+
maxColumnHeight?: number;
|
|
9
|
+
isVariableWidth: boolean;
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
dotsInside?: boolean;
|
|
12
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
13
|
+
export declare const SlideSection: import("@emotion/styled").StyledComponent<{
|
|
14
|
+
theme?: import("@emotion/react").Theme;
|
|
15
|
+
as?: React.ElementType;
|
|
16
|
+
} & {
|
|
17
|
+
useFlexLayout: boolean;
|
|
18
|
+
stackedVerticalGap: number;
|
|
19
|
+
stackedItemHeight: string;
|
|
20
|
+
stackedItemMaxHeight?: number;
|
|
21
|
+
slideWidth?: string;
|
|
22
|
+
flexBasis?: string;
|
|
23
|
+
isVariableWidth: boolean;
|
|
24
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
25
|
+
export declare const SlideInner: import("@emotion/styled").StyledComponent<{
|
|
26
|
+
theme?: import("@emotion/react").Theme;
|
|
27
|
+
as?: React.ElementType;
|
|
28
|
+
} & {
|
|
29
|
+
stackedItemHeight: string;
|
|
30
|
+
stackedItemMaxHeight?: number;
|
|
31
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
32
|
+
export declare const SlideContentInner: import("@emotion/styled").StyledComponent<{
|
|
33
|
+
theme?: import("@emotion/react").Theme;
|
|
34
|
+
as?: React.ElementType;
|
|
35
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
36
|
+
export declare const ArrowButton: import("@emotion/styled").StyledComponent<{
|
|
37
|
+
theme?: import("@emotion/react").Theme;
|
|
38
|
+
as?: React.ElementType;
|
|
39
|
+
} & {
|
|
40
|
+
direction: "prev" | "next";
|
|
41
|
+
fullWidth?: boolean;
|
|
42
|
+
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
43
|
+
export declare const InnerWrapper: import("@emotion/styled").StyledComponent<{
|
|
44
|
+
theme?: import("@emotion/react").Theme;
|
|
45
|
+
as?: React.ElementType;
|
|
46
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
47
|
+
export declare const EmptyPlaceholderWrapper: import("@emotion/styled").StyledComponent<{
|
|
48
|
+
theme?: import("@emotion/react").Theme;
|
|
49
|
+
as?: React.ElementType;
|
|
50
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
package/dist/{column-control/hooks/useColumnControl.d.ts → carousel/hooks/useCarouselLayout.d.ts}
RENAMED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { CarouselProps } from '../types';
|
|
3
3
|
import type { SliderRefInstance } from '../shared';
|
|
4
|
-
/** Shared hook for
|
|
5
|
-
export declare function
|
|
4
|
+
/** Shared hook for carousel layout behavior. */
|
|
5
|
+
export declare function useCarouselLayout<T>(props: CarouselProps<T>): {
|
|
6
6
|
gapPx: number;
|
|
7
7
|
containerHeight: string;
|
|
8
8
|
stackedItemHeight: string;
|
|
9
9
|
stackedItemMaxHeight: number;
|
|
10
10
|
isVariableWidth: boolean;
|
|
11
11
|
containerClassName: string;
|
|
12
|
-
layout: "grid" | "carousel";
|
|
13
12
|
effectiveFullWidth: boolean;
|
|
14
13
|
parent$: Record<string, unknown> | undefined;
|
|
15
14
|
$: Record<string, unknown> | undefined;
|
|
@@ -23,7 +22,7 @@ export declare function useColumnControl<T>(props: ColumnControlProps<T>): {
|
|
|
23
22
|
hasSlides: boolean;
|
|
24
23
|
isStackedViewport: boolean;
|
|
25
24
|
isTabletGridViewport: boolean;
|
|
26
|
-
preset: import("..").
|
|
25
|
+
preset: import("..").CarouselPreset;
|
|
27
26
|
showArrowsOnDesktop: boolean;
|
|
28
27
|
slidesToShow: number;
|
|
29
28
|
slidesLength: number;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** Image height preset for story variants (px). */
|
|
3
|
+
declare const IMAGE_HEIGHTS: {
|
|
4
|
+
readonly short: 120;
|
|
5
|
+
readonly medium: 200;
|
|
6
|
+
readonly tall: 320;
|
|
7
|
+
};
|
|
8
|
+
/** Mock content card for ColumnControl/carousel stories. Optional image, content, and CTA. */
|
|
9
|
+
export interface MockContentCardProps {
|
|
10
|
+
imageSrc?: string;
|
|
11
|
+
imageAlt?: string;
|
|
12
|
+
/** Image area height: preset name or px number. Default 'medium'. */
|
|
13
|
+
imageHeight?: keyof typeof IMAGE_HEIGHTS | number;
|
|
14
|
+
title?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
ctaText?: string;
|
|
17
|
+
ctaHref?: string;
|
|
18
|
+
}
|
|
19
|
+
declare const MockContentCard: React.FC<MockContentCardProps>;
|
|
20
|
+
export default MockContentCard;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** Mock product card for ColumnControl/carousel slide content only. */
|
|
3
|
+
export interface MockProductCardProps {
|
|
4
|
+
imageSrc: string;
|
|
5
|
+
imageAlt?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const MockProductCard: React.FC<MockProductCardProps>;
|
|
9
|
+
export default MockProductCard;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as MockProductCard } from './MockProductCard';
|
|
2
|
+
export type { MockProductCardProps } from './MockProductCard';
|
|
3
|
+
export { default as MockContentCard } from './MockContentCard';
|
|
4
|
+
export type { MockContentCardProps } from './MockContentCard';
|
|
5
|
+
export { default as MockHeroBanner } from './MockHeroBanner';
|
|
6
|
+
export type { MockHeroBannerProps } from './MockHeroBanner';
|
|
7
|
+
export { MOCK_ASSETS } from './mockAssets';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const Slider: any;
|
|
3
|
+
declare const CarouselContainer: any;
|
|
4
|
+
declare const ArrowButton: any;
|
|
5
|
+
declare const InnerWrapper: any;
|
|
6
|
+
declare const SlideSection: any;
|
|
7
|
+
declare const SlideInner: any;
|
|
8
|
+
declare const SlideContentInner: any;
|
|
9
|
+
export { Slider, CarouselContainer, ArrowButton, InnerWrapper, SlideSection, SlideInner, SlideContentInner };
|
|
10
|
+
export interface SliderRefInstance {
|
|
11
|
+
slickPrev: () => void;
|
|
12
|
+
slickNext: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function getSlideKey(index: number): string;
|
|
15
|
+
export declare function renderSlidesContent<T>(params: {
|
|
16
|
+
slidesForRender: T[];
|
|
17
|
+
renderSlide: (slide: T, index: number) => React.ReactNode;
|
|
18
|
+
presetColumns: number;
|
|
19
|
+
gap: number;
|
|
20
|
+
isVariableWidth: boolean;
|
|
21
|
+
getSlideWidth: (index: number) => string;
|
|
22
|
+
stackedVerticalGap: number;
|
|
23
|
+
stackedItemHeight: string;
|
|
24
|
+
stackedItemMaxHeight?: number;
|
|
25
|
+
useFlexLayout?: boolean;
|
|
26
|
+
$?: Record<string, unknown>;
|
|
27
|
+
}): import("react/jsx-runtime").JSX.Element[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** Gap between columns/slides: preset name → px (none: 0, small: 8, medium: 12, large: 16) */
|
|
3
|
+
export type GapPreset = 'none' | 'small' | 'medium' | 'large';
|
|
4
|
+
export declare const GAP_PRESET_VALUES: Record<GapPreset, number>;
|
|
5
|
+
/** Resolve gap to pixels. Accepts preset name or legacy number (for backward compatibility). */
|
|
6
|
+
export declare function getGapPx(gap?: GapPreset | number): number;
|
|
7
|
+
export type CarouselPreset = 'single-full' | 'two-equal' | 'two-small-large' | 'three-equal' | 'three-small-medium-large' | 'four-equal';
|
|
8
|
+
export type Alignment = 'left' | 'center' | 'right';
|
|
9
|
+
/** Render callback: consumer renders each slide from their data. */
|
|
10
|
+
export type CarouselRenderSlide<T = unknown> = (slide: T, index: number) => React.ReactNode;
|
|
11
|
+
export type CarouselProps<T = unknown> = Readonly<{
|
|
12
|
+
/** Slide data (CMS/consumer shape). Rendered via renderSlide. */
|
|
13
|
+
slides: T[];
|
|
14
|
+
/** Called to render each slide. Receives slide data and index. */
|
|
15
|
+
renderSlide: CarouselRenderSlide<T>;
|
|
16
|
+
preset?: CarouselPreset;
|
|
17
|
+
/** Convenience props that override autoplay.enabled */
|
|
18
|
+
autoplayEnabled?: boolean;
|
|
19
|
+
/** Autoplay interval in seconds (e.g. 3 = 3s). Passed to slider as ms internally. */
|
|
20
|
+
autoplayDuration?: number;
|
|
21
|
+
/** Convenience props that override navigation.showArrows */
|
|
22
|
+
showArrows?: boolean;
|
|
23
|
+
/** Convenience props that override navigation.showPagination */
|
|
24
|
+
showPagination?: boolean;
|
|
25
|
+
onSlideChange?: (index: number) => void;
|
|
26
|
+
className?: string;
|
|
27
|
+
slickSettings?: any;
|
|
28
|
+
/** Spacing between columns/slides: 'none'|'small'|'medium'|'large' (0,8,12,16px) or legacy number */
|
|
29
|
+
gap?: GapPreset | number;
|
|
30
|
+
height?: string;
|
|
31
|
+
fullWidth?: boolean;
|
|
32
|
+
emptyBlockParentClass?: string;
|
|
33
|
+
/** Override empty placeholder label. Defaults: "Add items to the column control" (grid) or "Add items to the carousel" (carousel). */
|
|
34
|
+
emptyPlaceholderText?: string;
|
|
35
|
+
/** Position of slider dots: 'inside' overlays within the slider; 'outside' places them below as part of the height. Defaults to 'inside'. */
|
|
36
|
+
dotsPosition?: 'inside' | 'outside';
|
|
37
|
+
isEditing?: boolean;
|
|
38
|
+
parent$?: Record<string, unknown>;
|
|
39
|
+
$?: Record<string, unknown>;
|
|
40
|
+
}>;
|
|
41
|
+
export interface CarouselSlideProps {
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
isActive: boolean;
|
|
44
|
+
preset: CarouselPreset;
|
|
45
|
+
alignment: Alignment;
|
|
46
|
+
index: number;
|
|
47
|
+
slideCount: number;
|
|
48
|
+
}
|
|
49
|
+
export { DEVICE_SIZES, MAX_SLIDE_HEIGHT_PX } from '../utils/deviceConstants';
|
|
50
|
+
import { DEVICE_SIZES } from '../utils/deviceConstants';
|
|
51
|
+
export type DeviceSize = keyof typeof DEVICE_SIZES;
|
|
52
|
+
export declare const MIN_SLIDE_WIDTH_PX = 280;
|
|
53
|
+
export declare const MIN_SLIDE_HEIGHT_PX = 320;
|
|
54
|
+
/** Minimum height (px) for empty placeholder slots in column control/carousel. */
|
|
55
|
+
export declare const MIN_EMPTY_PLACEHOLDER_HEIGHT_PX = 220;
|
|
56
|
+
export declare const MAX_ALLOWED_COLUMN_CONTROL_ITEMS = 4;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { CarouselProps } from './types';
|
|
3
|
+
export { getPresetColumns } from '../utils/viewportLayoutUtils';
|
|
4
|
+
export declare function unwrapComponent<T>(mod: T): any;
|
|
5
|
+
export declare const EmptyPlaceholder: React.FC<Readonly<{
|
|
6
|
+
emptyBlockParentClass?: string;
|
|
7
|
+
text?: string;
|
|
8
|
+
}>>;
|
|
9
|
+
export declare function isVariableWidthPreset(preset: CarouselProps['preset'], windowWidth: number): boolean;
|
|
10
|
+
export declare function getVariableSlideWidth(preset: CarouselProps['preset'], index: number, windowWidth: number): string;
|
|
11
|
+
export declare function getSlidesToShowByViewport(windowWidth: number, presetColumns: number): number;
|
|
12
|
+
export declare function buildCarouselResponsiveSettings(params: {
|
|
13
|
+
presetColumns: number;
|
|
14
|
+
slidesLength: number;
|
|
15
|
+
isEditing: boolean;
|
|
16
|
+
shouldShowDots: boolean;
|
|
17
|
+
}): ({
|
|
18
|
+
breakpoint: 600;
|
|
19
|
+
settings: {
|
|
20
|
+
slidesToShow: number;
|
|
21
|
+
slidesToScroll: number;
|
|
22
|
+
swipeToSlide: boolean;
|
|
23
|
+
arrows: boolean;
|
|
24
|
+
dots: boolean;
|
|
25
|
+
variableWidth: boolean;
|
|
26
|
+
};
|
|
27
|
+
} | {
|
|
28
|
+
breakpoint: 768;
|
|
29
|
+
settings: {
|
|
30
|
+
slidesToShow: number;
|
|
31
|
+
slidesToScroll: number;
|
|
32
|
+
swipeToSlide: boolean;
|
|
33
|
+
arrows: boolean;
|
|
34
|
+
dots: boolean;
|
|
35
|
+
variableWidth: boolean;
|
|
36
|
+
};
|
|
37
|
+
} | {
|
|
38
|
+
breakpoint: 1024;
|
|
39
|
+
settings: {
|
|
40
|
+
slidesToShow: number;
|
|
41
|
+
slidesToScroll: number;
|
|
42
|
+
swipeToSlide: boolean;
|
|
43
|
+
arrows: boolean;
|
|
44
|
+
dots: boolean;
|
|
45
|
+
variableWidth: boolean;
|
|
46
|
+
};
|
|
47
|
+
})[];
|
|
@@ -3,11 +3,11 @@ import ColumnControl from './ColumnControl';
|
|
|
3
3
|
declare const meta: Meta<typeof ColumnControl>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof ColumnControl>;
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
6
|
+
export declare const TwoByOne: Story;
|
|
7
|
+
export declare const ThreeByOne: Story;
|
|
8
|
+
export declare const FourByOne: Story;
|
|
9
|
+
export declare const TwoByTwo: Story;
|
|
10
|
+
export declare const ThreeByTwo: Story;
|
|
11
|
+
export declare const FourByTwo: Story;
|
|
12
12
|
export declare const EmptyState: Story;
|
|
13
13
|
export declare const FewerSlidesThanPreset: Story;
|
|
@@ -6,7 +6,6 @@ export declare const ColumnControlContainer: import("@emotion/styled").StyledCom
|
|
|
6
6
|
height: string;
|
|
7
7
|
columnHeight: string;
|
|
8
8
|
maxColumnHeight?: number;
|
|
9
|
-
isVariableWidth: boolean;
|
|
10
9
|
fullWidth?: boolean;
|
|
11
10
|
dotsInside?: boolean;
|
|
12
11
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
@@ -26,7 +25,8 @@ export declare const SlideSection: import("@emotion/styled").StyledComponent<{
|
|
|
26
25
|
stackedItemMaxHeight?: number;
|
|
27
26
|
slideWidth?: string;
|
|
28
27
|
flexBasis?: string;
|
|
29
|
-
|
|
28
|
+
gap: number;
|
|
29
|
+
columns: number;
|
|
30
30
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
|
|
31
31
|
export declare const SlideInner: import("@emotion/styled").StyledComponent<{
|
|
32
32
|
theme?: import("@emotion/react").Theme;
|
|
@@ -39,13 +39,6 @@ export declare const SlideContentInner: import("@emotion/styled").StyledComponen
|
|
|
39
39
|
theme?: import("@emotion/react").Theme;
|
|
40
40
|
as?: React.ElementType;
|
|
41
41
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
42
|
-
export declare const ArrowButton: import("@emotion/styled").StyledComponent<{
|
|
43
|
-
theme?: import("@emotion/react").Theme;
|
|
44
|
-
as?: React.ElementType;
|
|
45
|
-
} & {
|
|
46
|
-
direction: "prev" | "next";
|
|
47
|
-
fullWidth?: boolean;
|
|
48
|
-
}, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
|
|
49
42
|
export declare const InnerWrapper: import("@emotion/styled").StyledComponent<{
|
|
50
43
|
theme?: import("@emotion/react").Theme;
|
|
51
44
|
as?: React.ElementType;
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
declare const IMAGE_HEIGHTS: {
|
|
4
|
-
readonly short: 120;
|
|
5
|
-
readonly medium: 200;
|
|
6
|
-
readonly tall: 320;
|
|
7
|
-
};
|
|
8
|
-
/** Mock content card for ColumnControl/carousel stories. Optional image, content, and CTA. */
|
|
2
|
+
type ImageHeightPreset = 'short' | 'medium' | 'tall';
|
|
9
3
|
export interface MockContentCardProps {
|
|
10
4
|
imageSrc?: string;
|
|
11
5
|
imageAlt?: string;
|
|
12
|
-
|
|
13
|
-
imageHeight?: keyof typeof IMAGE_HEIGHTS | number;
|
|
6
|
+
imageHeight?: ImageHeightPreset | number;
|
|
14
7
|
title?: string;
|
|
15
8
|
description?: string;
|
|
16
9
|
ctaText?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
/** Mock product card for ColumnControl/carousel slide content only. */
|
|
3
2
|
export interface MockProductCardProps {
|
|
4
3
|
imageSrc: string;
|
|
5
4
|
imageAlt?: string;
|
|
6
5
|
title?: string;
|
|
6
|
+
eyebrow?: string;
|
|
7
7
|
}
|
|
8
8
|
declare const MockProductCard: React.FC<MockProductCardProps>;
|
|
9
9
|
export default MockProductCard;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
export { default as MockProductCard } from './MockProductCard';
|
|
2
|
-
export type { MockProductCardProps } from './MockProductCard';
|
|
3
1
|
export { default as MockContentCard } from './MockContentCard';
|
|
4
2
|
export type { MockContentCardProps } from './MockContentCard';
|
|
5
|
-
export { default as
|
|
6
|
-
export type {
|
|
7
|
-
export { MOCK_ASSETS } from '
|
|
3
|
+
export { default as MockProductCard } from './MockProductCard';
|
|
4
|
+
export type { MockProductCardProps } from './MockProductCard';
|
|
5
|
+
export { MOCK_ASSETS } from '../../carousel/mocks/mockAssets';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -4,6 +4,7 @@ export type GapPreset = 'none' | 'small' | 'medium' | 'large';
|
|
|
4
4
|
export declare const GAP_PRESET_VALUES: Record<GapPreset, number>;
|
|
5
5
|
/** Resolve gap to pixels. Accepts preset name or legacy number (for backward compatibility). */
|
|
6
6
|
export declare function getGapPx(gap?: GapPreset | number): number;
|
|
7
|
+
export type ColumnControlGridLayout = '2x1' | '3x1' | '4x1' | '2x2' | '3x2' | '4x2';
|
|
7
8
|
export type SlidePreset = 'single-full' | 'two-equal' | 'two-small-large' | 'three-equal' | 'three-small-medium-large' | 'four-equal';
|
|
8
9
|
export type Alignment = 'left' | 'center' | 'right';
|
|
9
10
|
/** Render callback: consumer renders each slide from their data. */
|
|
@@ -13,29 +14,18 @@ export type ColumnControlProps<T = unknown> = Readonly<{
|
|
|
13
14
|
slides: T[];
|
|
14
15
|
/** Called to render each slide. Receives slide data and index. */
|
|
15
16
|
renderSlide: RenderSlideCallback<T>;
|
|
17
|
+
/** Preset-based sizing is deprecated. Use ColumnControl (grid) with layout. */
|
|
16
18
|
preset?: SlidePreset;
|
|
17
|
-
/**
|
|
18
|
-
layout?:
|
|
19
|
-
/** Convenience props that override autoplay.enabled */
|
|
20
|
-
autoplayEnabled?: boolean;
|
|
21
|
-
/** Autoplay interval in seconds (e.g. 3 = 3s). Passed to slider as ms internally. */
|
|
22
|
-
autoplayDuration?: number;
|
|
23
|
-
/** Convenience props that override navigation.showArrows */
|
|
24
|
-
showArrows?: boolean;
|
|
25
|
-
/** Convenience props that override navigation.showPagination */
|
|
26
|
-
showPagination?: boolean;
|
|
27
|
-
onSlideChange?: (index: number) => void;
|
|
19
|
+
/** Grid layout for ColumnControl (grid) mode: "<columns>x<rows>" (e.g. "3x2"). */
|
|
20
|
+
layout?: ColumnControlGridLayout;
|
|
28
21
|
className?: string;
|
|
29
|
-
slickSettings?: any;
|
|
30
22
|
/** Spacing between columns/slides: 'none'|'small'|'medium'|'large' (0,8,12,16px) or legacy number */
|
|
31
23
|
gap?: GapPreset | number;
|
|
32
24
|
height?: string;
|
|
33
25
|
fullWidth?: boolean;
|
|
34
26
|
emptyBlockParentClass?: string;
|
|
35
|
-
/** Override empty placeholder label. Defaults: "Add items to the column control"
|
|
27
|
+
/** Override empty placeholder label. Defaults: "Add items to the column control". */
|
|
36
28
|
emptyPlaceholderText?: string;
|
|
37
|
-
/** Position of slider dots: 'inside' overlays within the slider; 'outside' places them below as part of the height. Defaults to 'inside'. */
|
|
38
|
-
dotsPosition?: 'inside' | 'outside';
|
|
39
29
|
isEditing?: boolean;
|
|
40
30
|
parent$?: Record<string, unknown>;
|
|
41
31
|
$?: Record<string, unknown>;
|
|
@@ -48,21 +38,11 @@ export interface ColumnControlSlideProps {
|
|
|
48
38
|
index: number;
|
|
49
39
|
slideCount: number;
|
|
50
40
|
}
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
readonly EXTRA_SMALL: 480;
|
|
54
|
-
readonly SMALL: 600;
|
|
55
|
-
readonly MEDIUM: 768;
|
|
56
|
-
readonly LARGE: 1024;
|
|
57
|
-
readonly EXTRA_LARGE: 1200;
|
|
58
|
-
readonly ULTRA_LARGE: 1440;
|
|
59
|
-
readonly SUPER_LARGE: 1920;
|
|
60
|
-
};
|
|
41
|
+
export { DEVICE_SIZES, MAX_SLIDE_HEIGHT_PX } from '../utils/deviceConstants';
|
|
42
|
+
import { DEVICE_SIZES } from '../utils/deviceConstants';
|
|
61
43
|
export type DeviceSize = keyof typeof DEVICE_SIZES;
|
|
62
44
|
export declare const MIN_SLIDE_WIDTH_PX = 280;
|
|
63
45
|
export declare const MIN_SLIDE_HEIGHT_PX = 320;
|
|
64
|
-
/**
|
|
65
|
-
export declare const MAX_SLIDE_HEIGHT_PX = 750;
|
|
66
|
-
/** Minimum height (px) for empty placeholder slots in column control/carousel. */
|
|
46
|
+
/** Minimum height (px) for empty placeholder slots in column control. */
|
|
67
47
|
export declare const MIN_EMPTY_PLACEHOLDER_HEIGHT_PX = 220;
|
|
68
|
-
export declare const MAX_ALLOWED_COLUMN_CONTROL_ITEMS =
|
|
48
|
+
export declare const MAX_ALLOWED_COLUMN_CONTROL_ITEMS = 8;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ColumnControlGridLayout, SlidePreset } from './types';
|
|
3
|
+
import { getPresetColumns } from '../utils/viewportLayoutUtils';
|
|
3
4
|
export interface ViewportLayoutState {
|
|
4
5
|
isStackedViewport: boolean;
|
|
5
6
|
isTabletGridViewport: boolean;
|
|
@@ -9,74 +10,15 @@ export interface ViewportLayoutState {
|
|
|
9
10
|
containerHeight: string;
|
|
10
11
|
}
|
|
11
12
|
export declare function getViewportLayoutState(isGridLayout: boolean, windowWidth: number, gapPx: number, height?: string): ViewportLayoutState;
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
shouldShowDots: boolean;
|
|
13
|
+
export interface GridDimensions {
|
|
14
|
+
columns: number;
|
|
15
|
+
rows: number;
|
|
16
16
|
}
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
17
|
+
export declare function getGridDimensions(layout: ColumnControlGridLayout | undefined): GridDimensions;
|
|
18
|
+
export declare function getMaxChildrenForLayout(layout: ColumnControlGridLayout | undefined): number;
|
|
19
|
+
export declare function mapPresetToGridLayout(preset: SlidePreset | undefined): ColumnControlGridLayout;
|
|
19
20
|
export declare const EmptyPlaceholder: React.FC<Readonly<{
|
|
20
21
|
emptyBlockParentClass?: string;
|
|
21
22
|
text?: string;
|
|
22
23
|
}>>;
|
|
23
|
-
export
|
|
24
|
-
export declare function isVariableWidthPreset(preset: ColumnControlProps['preset'], windowWidth: number): boolean;
|
|
25
|
-
export declare function getVariableSlideWidth(preset: ColumnControlProps['preset'], index: number, windowWidth: number): string;
|
|
26
|
-
export declare function getSlidesToShowByViewport(windowWidth: number, presetColumns: number): number;
|
|
27
|
-
/** Sentinel used in the slides array to represent an empty slot when slides.length < preset. */
|
|
28
|
-
export declare const EMPTY_SLIDE_SENTINEL: {
|
|
29
|
-
readonly __emptyPlaceholder: true;
|
|
30
|
-
};
|
|
31
|
-
export declare function isEmptySlide(slide: unknown): slide is typeof EMPTY_SLIDE_SENTINEL;
|
|
32
|
-
/** Type guard: true when slide is a real slide (not the empty placeholder sentinel). */
|
|
33
|
-
export declare function isRealSlide<T>(slide: T | typeof EMPTY_SLIDE_SENTINEL): slide is T;
|
|
34
|
-
/** Pads the slides array with EMPTY_SLIDE_SENTINEL so length equals targetCount when slides.length < targetCount. */
|
|
35
|
-
export declare function padSlidesToPreset<T>(slides: T[], targetCount: number): (T | typeof EMPTY_SLIDE_SENTINEL)[];
|
|
36
|
-
export declare function getSlidesForRender<T>(params: {
|
|
37
|
-
isGridLayout: boolean;
|
|
38
|
-
isStackedViewport: boolean;
|
|
39
|
-
isTabletGridViewport: boolean;
|
|
40
|
-
gridSlides: T[];
|
|
41
|
-
presetColumns: number;
|
|
42
|
-
slidesToShow: number;
|
|
43
|
-
}): T[];
|
|
44
|
-
export declare function buildResponsiveSettings(params: {
|
|
45
|
-
isGridLayout: boolean;
|
|
46
|
-
presetSlidesToShow: number;
|
|
47
|
-
gridSlides: unknown[];
|
|
48
|
-
presetColumns: number;
|
|
49
|
-
shouldShowDots: boolean;
|
|
50
|
-
/** When set (e.g. after padding to preset), use this as the slide count cap so placeholders are visible. */
|
|
51
|
-
effectiveSlidesCount?: number;
|
|
52
|
-
}): ({
|
|
53
|
-
breakpoint: 600;
|
|
54
|
-
settings: {
|
|
55
|
-
slidesToShow: number;
|
|
56
|
-
slidesToScroll: number;
|
|
57
|
-
swipeToSlide: boolean;
|
|
58
|
-
arrows: boolean;
|
|
59
|
-
dots: boolean;
|
|
60
|
-
variableWidth: boolean;
|
|
61
|
-
};
|
|
62
|
-
} | {
|
|
63
|
-
breakpoint: 768;
|
|
64
|
-
settings: {
|
|
65
|
-
slidesToShow: number;
|
|
66
|
-
slidesToScroll: number;
|
|
67
|
-
swipeToSlide: boolean;
|
|
68
|
-
arrows: boolean;
|
|
69
|
-
dots: boolean;
|
|
70
|
-
variableWidth: boolean;
|
|
71
|
-
};
|
|
72
|
-
} | {
|
|
73
|
-
breakpoint: 1024;
|
|
74
|
-
settings: {
|
|
75
|
-
slidesToShow: number;
|
|
76
|
-
slidesToScroll: number;
|
|
77
|
-
swipeToSlide: boolean;
|
|
78
|
-
arrows: boolean;
|
|
79
|
-
dots: boolean;
|
|
80
|
-
variableWidth: boolean;
|
|
81
|
-
};
|
|
82
|
-
})[];
|
|
24
|
+
export { getPresetColumns };
|
package/dist/index.d.ts
CHANGED