@nuskin/marketing-components 1.24.0 → 1.26.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.
@@ -23,16 +23,17 @@ export interface Button$ {
23
23
  };
24
24
  }
25
25
  export type ButtonType = 'square' | 'rounded';
26
- export interface ButtonContainerEntry {
26
+ export interface ButtonsEntry {
27
27
  button?: ButtonProps;
28
28
  $?: {
29
29
  button?: Record<string, unknown>;
30
30
  };
31
31
  }
32
- export type ButtonContainerBlock = {
33
- container?: ButtonContainerEntry[];
32
+ export type ButtonsBlock = {
33
+ buttons?: ButtonsEntry[];
34
+ $?: Record<string, unknown>;
34
35
  };
35
- export type ButtonBlockProp = ButtonProps | ButtonContainerBlock;
36
+ export type ButtonBlockProp = ButtonProps | ButtonsBlock;
36
37
  export interface ButtonProps {
37
38
  label?: ButtonLabel$;
38
39
  placeholder_text?: string;
@@ -1,14 +1,30 @@
1
1
  export declare const MediaContainer: import("@emotion/styled").StyledComponent<{
2
2
  theme?: import("@emotion/react").Theme;
3
3
  as?: React.ElementType;
4
+ } & {
5
+ bgColor?: string;
4
6
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
7
  export declare const StyledImage: import("@emotion/styled").StyledComponent<{
6
8
  theme?: import("@emotion/react").Theme;
7
9
  as?: React.ElementType;
10
+ } & {
11
+ objectFit?: string;
12
+ focusPoint?: {
13
+ x: number;
14
+ y: number;
15
+ };
16
+ objectPosition?: string;
8
17
  }, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
9
18
  export declare const StyledVideo: import("@emotion/styled").StyledComponent<{
10
19
  theme?: import("@emotion/react").Theme;
11
20
  as?: React.ElementType;
21
+ } & {
22
+ objectFit?: string;
23
+ focusPoint?: {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ objectPosition?: string;
12
28
  }, import("react").DetailedHTMLProps<import("react").VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, {}>;
13
29
  export declare const PictureElement: import("@emotion/styled").StyledComponent<{
14
30
  theme?: import("@emotion/react").Theme;
@@ -13,6 +13,13 @@ export type BynderMediaExtracted = {
13
13
  isResponsive?: boolean;
14
14
  desktopUrl?: string;
15
15
  mobileUrl?: string;
16
+ imageFit?: 'cover' | 'contain' | 'scale-down' | 'none' | 'fill' | null;
17
+ focusPoint?: {
18
+ x: number;
19
+ y: number;
20
+ };
21
+ objectPosition?: string;
22
+ bgColor?: string;
16
23
  };
17
24
  export type BynderImageDataType = {
18
25
  /** selected is manually added, using additionalInfo from bynder */
@@ -4,35 +4,12 @@ export type MediaStyle = 'cover' | 'contain' | 'fill' | 'stretch' | 'none';
4
4
  export type ContentAlignment = 'left' | 'center' | 'right';
5
5
  export type CtaStyle = 'card' | 'button' | 'none';
6
6
  export type LinkTarget = '_self' | '_blank';
7
- export interface MediaProps {
8
- readonly mediaUrl: string;
9
- readonly fallbackMediaUrl?: string;
10
- readonly mediaType?: MediaType;
11
- readonly mediaAlt?: string;
12
- readonly onError?: () => void;
13
- readonly testId?: string;
14
- readonly $?: Record<string, unknown>;
15
- readonly isResponsive?: boolean;
16
- readonly desktopUrl?: string;
17
- readonly mobileUrl?: string;
18
- readonly media_style?: string;
19
- readonly mediaHeight?: number;
20
- }
21
- /** Bynder-extracted media shape (from JSON). */
22
7
  export type BynderMediaType = 'image' | 'gif' | 'video';
23
- export interface BynderMediaExtracted {
24
- url: string;
25
- type: BynderMediaType;
26
- alt: string;
27
- isResponsive?: boolean;
28
- desktopUrl?: string;
29
- mobileUrl?: string;
30
- }
31
8
  export interface ContentCardProps {
32
9
  title?: string;
33
10
  subtitle?: string;
34
11
  body?: string;
35
- media?: MediaProps | string;
12
+ media?: string;
36
13
  cta?: ButtonProps;
37
14
  cta_style?: CtaStyle;
38
15
  content_alignment?: ContentAlignment;
@@ -45,8 +22,12 @@ export interface ContentCardProps {
45
22
  text_color?: string;
46
23
  text_opacity?: number;
47
24
  border_radius?: string;
48
- media_style?: string;
49
25
  isEditing?: boolean;
50
26
  parent$?: Record<string, unknown>;
51
- $?: Record<string, unknown>;
27
+ $?: {
28
+ media?: Record<string, unknown>;
29
+ body?: Record<string, unknown>;
30
+ title?: Record<string, unknown>;
31
+ subtitle?: Record<string, unknown>;
32
+ };
52
33
  }
@@ -1,12 +1,23 @@
1
- import type { ContentAlignment, CtaStyle, LinkTarget, MediaProps, MediaStyle } from '../types';
1
+ import type { ContentAlignment, CtaStyle, LinkTarget } from '../types';
2
+ /**
3
+ * Validates that the value is a hex color (#rgb or #rrggbb).
4
+ * Returns the trimmed hex string, or defaultColor when invalid.
5
+ */
6
+ export declare function validateHex(color: string, defaultColor: string): string;
7
+ /**
8
+ * Converts a hex color to rgba using the given opacity.
9
+ * If hex is invalid or empty, returns defRgba when provided.
10
+ */
11
+ export declare function hexToRgba(hex: string, opacity: number, defaultRgba?: string): string;
12
+ /** Card background as rgba; uses hex default and fallback. */
13
+ export declare function toCardBackgroundRgba(backgroundColor?: string, backgroundOpacity?: number): string;
14
+ /** Card text color as rgba; uses hex default and fallback. */
15
+ export declare function toCardTextRgba(textColor?: string, textOpacity?: number): string;
2
16
  export declare const getMaxHeight: (maxHeight: number) => number;
3
17
  export declare const getTitle: (title: string, isEditing: boolean) => string;
4
18
  /** Normalize content alignment string to 'left' | 'center' | 'right'. */
5
19
  export declare function normalizeContentAlignment(alignment?: string | null): ContentAlignment;
6
- /** Normalize media style string to object-fit value: cover | contain | fill | none. */
7
- export declare function normalizeMediaStyle(value?: string | null): MediaStyle;
8
20
  /** Normalize CTA style string to 'card' | 'button' | 'none'. */
9
21
  export declare function normalizeCtaStyle(value?: string | null): CtaStyle;
10
- export declare function normalizeContentCardMedia(media: MediaProps | string | undefined, $: Record<string, unknown>): MediaProps | undefined;
11
22
  /** Resolve target from open_in_new_tab string. */
12
23
  export declare function resolveTarget(target?: 'Yes' | 'No' | null): LinkTarget | undefined;
@@ -1,4 +1,8 @@
1
1
  import { GradientDepth } from './helpers';
2
+ export declare const MediaLayer: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme;
4
+ as?: React.ElementType;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
2
6
  export declare const Container: import("@emotion/styled").StyledComponent<{
3
7
  theme?: import("@emotion/react").Theme;
4
8
  as?: React.ElementType;
@@ -13,14 +17,6 @@ export declare const GradientOverlay: import("@emotion/styled").StyledComponent<
13
17
  depth: GradientDepth;
14
18
  color: "black" | "white";
15
19
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
16
- export declare const PictureElement: import("@emotion/styled").StyledComponent<{
17
- theme?: import("@emotion/react").Theme;
18
- as?: React.ElementType;
19
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
20
- export declare const SourceElement: import("@emotion/styled").StyledComponent<{
21
- theme?: import("@emotion/react").Theme;
22
- as?: React.ElementType;
23
- }, import("react").DetailedHTMLProps<import("react").SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>, {}>;
24
20
  export declare const Overlay: import("@emotion/styled").StyledComponent<{
25
21
  theme?: import("@emotion/react").Theme;
26
22
  as?: React.ElementType;
@@ -4,17 +4,6 @@ export type TextColor = 'black' | 'white';
4
4
  export declare const FULL_SIZE_PERCENT = "100%";
5
5
  export declare const MOBILE_BREAKPOINT = "(max-width: 768px)";
6
6
  export declare const DESKTOP_BREAKPOINT = "(min-width: 769px)";
7
- export interface ParsedMedia {
8
- type: 'image' | 'gif' | 'video';
9
- url: string;
10
- alt: string;
11
- width?: number;
12
- height?: number;
13
- isResponsive?: boolean;
14
- desktopUrl?: string;
15
- mobileUrl?: string;
16
- }
17
- export declare function parseMedia(media: unknown): ParsedMedia | null;
18
7
  export declare function resolveContentAlignment(contentAlignment?: ContentAlignment): ContentAlignment;
19
8
  export declare function resolveGradientDepth(gradientDepth?: GradientDepth): GradientDepth;
20
9
  export declare function resolveTextColor(textColor?: string): TextColor;
@@ -1,16 +1,7 @@
1
- import { GradientDepth } from "./helpers";
2
- import { ButtonBlockProp } from "../button";
3
- export type MediaSource = {
4
- src: string;
5
- type?: string;
6
- };
1
+ import { GradientDepth } from './helpers';
2
+ import { ButtonBlockProp } from '../button';
7
3
  export type ContentAlignment = 'left' | 'center' | 'right';
8
4
  export type HeroBannerMediaType = 'image' | 'gif' | 'video';
9
- export type Media = {
10
- type: HeroBannerMediaType;
11
- src: string | MediaSource[];
12
- alt?: string;
13
- };
14
5
  export interface HeroBanner$ {
15
6
  [key: string]: unknown;
16
7
  button?: Record<string, unknown>;
@@ -23,7 +14,7 @@ export interface HeroBannerProps {
23
14
  body?: string;
24
15
  brandcaption?: string;
25
16
  button?: ButtonBlockProp;
26
- media?: Media | string | null;
17
+ media?: string;
27
18
  class_name?: string;
28
19
  content_alignment?: ContentAlignment;
29
20
  gradient_enabled?: boolean;