@nuskin/marketing-components 1.21.1 → 1.22.1

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.
@@ -0,0 +1,6 @@
1
+ import type { ColumnControlProps } 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 ColumnControl. */
5
+ export declare function Carousel<T = unknown>(props: Readonly<Omit<ColumnControlProps<T>, 'layout'>>): import("react/jsx-runtime").JSX.Element;
6
+ export default Carousel;
@@ -1,9 +1,14 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
- import ColumnControl from './ColumnControl';
3
- declare const meta: Meta<typeof ColumnControl>;
2
+ import { Carousel } from './Carousel';
3
+ declare const meta: Meta<typeof Carousel>;
4
4
  export default meta;
5
- type Story = StoryObj<typeof ColumnControl>;
6
- export declare const AutoplayDemo: Story;
7
- export declare const ProductCards: Story;
8
- export declare const ContentCards: Story;
9
- export declare const HeroBanners: Story;
5
+ type Story = StoryObj<typeof Carousel>;
6
+ export declare const SingleFull: Story;
7
+ export declare const TwoEqual: Story;
8
+ export declare const TwoSmallLarge: Story;
9
+ export declare const ThreeEqual: Story;
10
+ export declare const ThreeSmallMediumLarge: Story;
11
+ export declare const FourEqual: Story;
12
+ export declare const Autoplay: Story;
13
+ export declare const EmptyState: Story;
14
+ export declare const FewerSlidesThanPreset: Story;
@@ -1,6 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { ColumnControlProps } from './types';
3
- import 'slick-carousel/slick/slick.css';
4
- import 'slick-carousel/slick/slick-theme.css';
5
3
  declare const _default: React.FC<ColumnControlProps>;
6
4
  export default _default;
@@ -3,7 +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 GridDemo: Story;
7
- export declare const WithProductCardMocks: Story;
8
- export declare const WithContentCardMocks: Story;
9
- export declare const WithHeroBannerMocks: Story;
6
+ export declare const SingleFull: Story;
7
+ export declare const TwoEqual: Story;
8
+ export declare const TwoSmallLarge: Story;
9
+ export declare const ThreeEqual: Story;
10
+ export declare const ThreeSmallMediumLarge: Story;
11
+ export declare const FourEqual: Story;
12
+ export declare const EmptyState: Story;
13
+ export declare const FewerSlidesThanPreset: Story;
@@ -8,6 +8,7 @@ export declare const ColumnControlContainer: import("@emotion/styled").StyledCom
8
8
  maxColumnHeight?: number;
9
9
  isVariableWidth: boolean;
10
10
  fullWidth?: boolean;
11
+ dotsInside?: boolean;
11
12
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
12
13
  export declare const TabletGridContainer: import("@emotion/styled").StyledComponent<{
13
14
  theme?: import("@emotion/react").Theme;
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { ColumnControlProps } from '../types';
3
+ import type { SliderRefInstance } from '../shared';
4
+ /** Shared hook for column control (grid) and carousel. Layout drives grid vs carousel behavior. */
5
+ export declare function useColumnControl<T>(props: ColumnControlProps<T>): {
6
+ gapPx: number;
7
+ containerHeight: string;
8
+ stackedItemHeight: string;
9
+ stackedItemMaxHeight: number;
10
+ isVariableWidth: boolean;
11
+ containerClassName: string;
12
+ layout: "grid" | "carousel";
13
+ effectiveFullWidth: boolean;
14
+ parent$: Record<string, unknown> | undefined;
15
+ $: Record<string, unknown> | undefined;
16
+ emptyBlockParentClass: string | undefined;
17
+ emptyPlaceholderText: string;
18
+ sliderRef: React.MutableRefObject<SliderRefInstance | null>;
19
+ sliderSettings: any;
20
+ carouselKey: string;
21
+ renderSlides: (useFlexLayout?: boolean) => import("react/jsx-runtime").JSX.Element[];
22
+ slidesForRender: T[];
23
+ hasSlides: boolean;
24
+ isStackedViewport: boolean;
25
+ isTabletGridViewport: boolean;
26
+ preset: import("..").SlidePreset;
27
+ showArrowsOnDesktop: boolean;
28
+ slidesToShow: number;
29
+ slidesLength: number;
30
+ goToPrevious: () => void | undefined;
31
+ goToNext: () => void | undefined;
32
+ };
@@ -1,2 +1,3 @@
1
1
  export { default as ColumnControl } from './ColumnControl';
2
+ export { Carousel } from './Carousel';
2
3
  export * from './types';
@@ -1,9 +1,20 @@
1
1
  import React from 'react';
2
- /** Mock content card for ColumnControl/carousel slide content only. */
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. */
3
9
  export interface MockContentCardProps {
4
- imageSrc: string;
10
+ imageSrc?: string;
5
11
  imageAlt?: string;
12
+ /** Image area height: preset name or px number. Default 'medium'. */
13
+ imageHeight?: keyof typeof IMAGE_HEIGHTS | number;
6
14
  title?: string;
15
+ description?: string;
16
+ ctaText?: string;
17
+ ctaHref?: string;
7
18
  }
8
19
  declare const MockContentCard: React.FC<MockContentCardProps>;
9
20
  export default MockContentCard;
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ declare const Slider: any;
3
+ declare const ColumnControlContainer: any;
4
+ declare const ArrowButton: any;
5
+ declare const InnerWrapper: any;
6
+ declare const TabletGridContainer: any;
7
+ declare const SlideSection: any;
8
+ declare const SlideInner: any;
9
+ declare const SlideContentInner: any;
10
+ export declare const CONTAINER_CLASS = "column-control-container";
11
+ export { Slider, ColumnControlContainer, ArrowButton, InnerWrapper, TabletGridContainer, SlideSection, SlideInner, SlideContentInner };
12
+ export interface SliderRefInstance {
13
+ slickPrev: () => void;
14
+ slickNext: () => void;
15
+ }
16
+ export declare function getSlideKey(slide: unknown, index: number, isPlaceholder: boolean): string;
17
+ export declare function getSlideContent<T>(slide: T | {
18
+ __emptyPlaceholder: true;
19
+ }, index: number, isPlaceholder: boolean, emptyBlockParentClass: string | undefined, renderSlide: (slide: T, index: number) => React.ReactNode, emptyPlaceholderText?: string): React.ReactNode;
20
+ export declare function renderSlidesContent<T>(params: {
21
+ slidesForRender: (T | {
22
+ __emptyPlaceholder: true;
23
+ })[];
24
+ renderSlide: (slide: T, index: number) => React.ReactNode;
25
+ presetColumns: number;
26
+ gap: number;
27
+ isVariableWidth: boolean;
28
+ getSlideWidth: (index: number) => string;
29
+ stackedVerticalGap: number;
30
+ stackedItemHeight: string;
31
+ stackedItemMaxHeight?: number;
32
+ useFlexLayout?: boolean;
33
+ emptyBlockParentClass?: string;
34
+ emptyPlaceholderText?: string;
35
+ $?: Record<string, unknown>;
36
+ }): import("react/jsx-runtime").JSX.Element[];
37
+ export declare function renderContentOrEmpty(hasSlides: boolean, content: React.ReactNode, emptyBlockParentClass: string | undefined, emptyPlaceholderText?: string, $?: Record<string, unknown>): React.ReactNode;
@@ -32,6 +32,10 @@ export type ColumnControlProps<T = unknown> = Readonly<{
32
32
  height?: string;
33
33
  fullWidth?: boolean;
34
34
  emptyBlockParentClass?: string;
35
+ /** Override empty placeholder label. Defaults: "Add items to the column control" (grid) or "Add items to the carousel" (carousel). */
36
+ 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';
35
39
  isEditing?: boolean;
36
40
  parent$?: Record<string, unknown>;
37
41
  $?: Record<string, unknown>;
@@ -58,5 +62,7 @@ export type DeviceSize = keyof typeof DEVICE_SIZES;
58
62
  export declare const MIN_SLIDE_WIDTH_PX = 280;
59
63
  export declare const MIN_SLIDE_HEIGHT_PX = 320;
60
64
  /** Max height of a slide/card when height is content-driven. Authoring guide recommends designing for 400px. */
61
- export declare const MAX_SLIDE_HEIGHT_PX = 450;
65
+ export declare const MAX_SLIDE_HEIGHT_PX = 650;
66
+ /** Minimum height (px) for empty placeholder slots in column control/carousel. */
67
+ export declare const MIN_EMPTY_PLACEHOLDER_HEIGHT_PX = 220;
62
68
  export declare const MAX_ALLOWED_COLUMN_CONTROL_ITEMS = 4;
@@ -1,5 +1,20 @@
1
1
  import React from 'react';
2
2
  import type { ColumnControlProps } from './types';
3
+ export interface ViewportLayoutState {
4
+ isStackedViewport: boolean;
5
+ isTabletGridViewport: boolean;
6
+ stackedItemHeight: string;
7
+ stackedItemMaxHeight: number;
8
+ stackedVerticalGap: number;
9
+ containerHeight: string;
10
+ }
11
+ export declare function getViewportLayoutState(isGridLayout: boolean, windowWidth: number, gapPx: number, height?: string): ViewportLayoutState;
12
+ export interface SlidesMeta<T> {
13
+ gridSlides: T[];
14
+ slidesToShow: number;
15
+ shouldShowDots: boolean;
16
+ }
17
+ export declare function getSlidesMeta<T>(slides: T[], isGridLayout: boolean, presetColumns: number, presetSlidesToShow: number, effectiveShowPagination: boolean): SlidesMeta<T>;
3
18
  export declare function unwrapComponent<T>(mod: T): any;
4
19
  export declare const EmptyPlaceholder: React.FC<Readonly<{
5
20
  emptyBlockParentClass?: string;
@@ -9,6 +24,15 @@ export declare function getPresetColumns(preset: ColumnControlProps['preset']):
9
24
  export declare function isVariableWidthPreset(preset: ColumnControlProps['preset'], windowWidth: number): boolean;
10
25
  export declare function getVariableSlideWidth(preset: ColumnControlProps['preset'], index: number, windowWidth: number): string;
11
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)[];
12
36
  export declare function getSlidesForRender<T>(params: {
13
37
  isGridLayout: boolean;
14
38
  isStackedViewport: boolean;
@@ -23,6 +47,8 @@ export declare function buildResponsiveSettings(params: {
23
47
  gridSlides: unknown[];
24
48
  presetColumns: number;
25
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;
26
52
  }): ({
27
53
  breakpoint: 600;
28
54
  settings: {