@nuskin/marketing-components 1.17.0 → 1.18.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/button/Button.stories.d.ts +24 -8
- package/dist/button/Button.styled.d.ts +44 -0
- package/dist/button/helpers.d.ts +46 -0
- package/dist/button/types.d.ts +34 -11
- package/dist/hero-banner/HeroBanner.d.ts +0 -1
- package/dist/hero-banner/HeroBanner.stories.d.ts +13 -4
- package/dist/hero-banner/HeroBanner.styled.d.ts +21 -1
- package/dist/hero-banner/components/Media.d.ts +10 -0
- package/dist/hero-banner/components/Typography.d.ts +10 -0
- package/dist/hero-banner/components/TypographyFields.d.ts +11 -0
- package/dist/hero-banner/components/specs/Media.spec.d.ts +1 -0
- package/dist/hero-banner/constants.d.ts +6 -0
- package/dist/hero-banner/helpers.d.ts +35 -0
- package/dist/hero-banner/types.d.ts +21 -15
- 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/package.json +1 -1
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
-
|
|
3
|
-
declare const meta: Meta<typeof
|
|
2
|
+
declare function ButtonStory(args: Record<string, unknown>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const meta: Meta<typeof ButtonStory>;
|
|
4
4
|
export default meta;
|
|
5
|
-
type Story = StoryObj<typeof
|
|
5
|
+
type Story = StoryObj<typeof ButtonStory>;
|
|
6
6
|
export declare const Default: Story;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
7
|
+
export declare const AddToCart: Story;
|
|
8
|
+
export declare const BuyNow: Story;
|
|
9
|
+
export declare const ShopNow: Story;
|
|
10
|
+
export declare const LearnMore: Story;
|
|
11
|
+
export declare const ViewDetails: Story;
|
|
12
|
+
export declare const ExternalLink: Story;
|
|
13
|
+
export declare const AbsoluteHttpUrl: Story;
|
|
14
|
+
export declare const AbsoluteHttpsUrl: Story;
|
|
15
|
+
export declare const ProtocolRelativeUrl: Story;
|
|
16
|
+
export declare const SubmitButton: Story;
|
|
17
|
+
export declare const CancelButton: Story;
|
|
18
|
+
export declare const DisabledSubmit: Story;
|
|
19
|
+
export declare const SmallButton: Story;
|
|
20
|
+
export declare const MediumButton: Story;
|
|
21
|
+
export declare const LargeButton: Story;
|
|
22
|
+
export declare const PrimaryButton: Story;
|
|
23
|
+
export declare const SecondaryButton: Story;
|
|
24
|
+
export declare const IconLeft: Story;
|
|
12
25
|
export declare const IconRight: Story;
|
|
26
|
+
export declare const WithPlaceholder: Story;
|
|
27
|
+
export declare const EditingMode: Story;
|
|
28
|
+
export declare const RoundedButton: Story;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ButtonAlignment, ButtonVariant } from './types';
|
|
3
|
+
export declare const ButtonContainer: import("@emotion/styled").StyledComponent<{
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
as?: React.ElementType;
|
|
6
|
+
} & {
|
|
7
|
+
alignment: ButtonAlignment;
|
|
8
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
9
|
+
interface StyledButtonProps {
|
|
10
|
+
$variant: ButtonVariant;
|
|
11
|
+
$buttonWidth: string;
|
|
12
|
+
$buttonType: 'square' | 'rounded';
|
|
13
|
+
$bg: string;
|
|
14
|
+
$hover: string;
|
|
15
|
+
$pressed: string;
|
|
16
|
+
$text: string;
|
|
17
|
+
$border: string;
|
|
18
|
+
$disabledBg: string;
|
|
19
|
+
$disabledText: string;
|
|
20
|
+
$focusRing: string;
|
|
21
|
+
href?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const StyledButton: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Button").ButtonProps, "color" | "fullWidth" | "href" | "className" | "variant" | "onClick" | "type" | "aria-label" | "disabled" | "endIcon" | "size" | "startIcon" | "onFocus" | "onBlur" | "onChange"> & {
|
|
24
|
+
iconOnly?: boolean;
|
|
25
|
+
darkModeEnabled?: boolean;
|
|
26
|
+
startIconName?: import("@nuskin/foundation-ui-components").NsIconProps["name"];
|
|
27
|
+
endIconName?: import("@nuskin/foundation-ui-components").NsIconProps["name"];
|
|
28
|
+
} & {
|
|
29
|
+
children?: React.ReactNode | undefined;
|
|
30
|
+
} & {
|
|
31
|
+
theme?: import("@emotion/react").Theme;
|
|
32
|
+
} & StyledButtonProps, {}, {}>;
|
|
33
|
+
export declare const StyledLabelText: import("@emotion/styled").StyledComponent<{
|
|
34
|
+
theme?: import("@emotion/react").Theme;
|
|
35
|
+
as?: React.ElementType;
|
|
36
|
+
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
37
|
+
interface StyledIconWrapperProps {
|
|
38
|
+
position: 'left' | 'right';
|
|
39
|
+
}
|
|
40
|
+
export declare const StyledIconWrapper: import("@emotion/styled").StyledComponent<{
|
|
41
|
+
theme?: import("@emotion/react").Theme;
|
|
42
|
+
as?: React.ElementType;
|
|
43
|
+
} & StyledIconWrapperProps, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ButtonSize, LinkTarget } from './types';
|
|
2
|
+
export declare const ROUNDED_BORDER_RADIUS = "99px";
|
|
3
|
+
export declare const ICON_MARGIN = 2;
|
|
4
|
+
export declare const FLEX_SHRINK_ZERO = 0;
|
|
5
|
+
export declare const REL_NOOPENER_NOREFERRER = "noopener noreferrer";
|
|
6
|
+
export declare const CSS_WORD_BREAK = "break-word";
|
|
7
|
+
export declare const PROTOCOL_HTTP = "http:";
|
|
8
|
+
export declare const PROTOCOL_HTTPS = "https:";
|
|
9
|
+
export declare const DISABLED_STATE_STRING = "disabled";
|
|
10
|
+
export declare const DEFAULT_VARIANT = "primary";
|
|
11
|
+
export declare const DEFAULT_SIZE = "small";
|
|
12
|
+
export declare const DEFAULT_ALIGNMENT = "left";
|
|
13
|
+
export declare const DEFAULT_ICON_POSITION = "left";
|
|
14
|
+
export declare const DEFAULT_BUTTON_TYPE = "square";
|
|
15
|
+
export declare const DEFAULT_PLACEHOLDER_TEXT = "Enter Label";
|
|
16
|
+
export declare const DEFAULT_TARGET = "No";
|
|
17
|
+
export declare const BUTTON_TYPE_ROUNDED = "rounded";
|
|
18
|
+
export declare const BUTTON_TYPE_SQUARE = "square";
|
|
19
|
+
export declare const BORDER_COLOR_TRANSPARENT = "transparent";
|
|
20
|
+
export declare function isValidDestination(dest?: string): boolean;
|
|
21
|
+
export declare function resolveTarget(target?: 'Yes' | 'No' | null): LinkTarget | undefined;
|
|
22
|
+
export declare function resolveDisabled(disabled?: boolean | string | null): boolean;
|
|
23
|
+
export declare function resolveIconName(iconName?: string): string | undefined;
|
|
24
|
+
export declare const variantDefaults: {
|
|
25
|
+
readonly primary: {
|
|
26
|
+
readonly bg: "#1f1f1f";
|
|
27
|
+
readonly hover: "#3a3530";
|
|
28
|
+
readonly pressed: "#000000";
|
|
29
|
+
readonly text: "#ffffff";
|
|
30
|
+
readonly disabledBg: "#e6e6e6";
|
|
31
|
+
readonly disabledText: "#9e9e9e";
|
|
32
|
+
readonly focusRing: "#4f84b4";
|
|
33
|
+
};
|
|
34
|
+
readonly secondary: {
|
|
35
|
+
readonly bg: "#ffffff";
|
|
36
|
+
readonly hover: "#f2f2f2";
|
|
37
|
+
readonly pressed: "#e6e6e6";
|
|
38
|
+
readonly text: "#000000";
|
|
39
|
+
readonly border: "#626262";
|
|
40
|
+
readonly disabledBg: "#f2f2f2";
|
|
41
|
+
readonly disabledText: "#b0b0b0";
|
|
42
|
+
readonly focusRing: "#4f84b4";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export declare function getButtonWidth(size: string): string;
|
|
46
|
+
export declare function getIconSize(size: string): ButtonSize;
|
package/dist/button/types.d.ts
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
export type LinkTarget = '_self' | '_blank';
|
|
2
2
|
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
3
|
+
export type ButtonSize = 'small' | 'medium' | 'large';
|
|
4
|
+
export type ButtonAlignment = 'left' | 'center' | 'right';
|
|
3
5
|
export type IconPosition = 'left' | 'right';
|
|
6
|
+
export interface ButtonLabel$ {
|
|
7
|
+
title?: string;
|
|
8
|
+
href: string;
|
|
9
|
+
$?: {
|
|
10
|
+
title?: {
|
|
11
|
+
'data-cslp'?: string;
|
|
12
|
+
};
|
|
13
|
+
href?: {
|
|
14
|
+
'data-cslp'?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface Button$ {
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
label?: ButtonLabel$;
|
|
21
|
+
$?: {
|
|
22
|
+
icon?: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export type ButtonType = 'square' | 'rounded';
|
|
4
26
|
export interface ButtonProps {
|
|
5
|
-
label
|
|
6
|
-
|
|
7
|
-
|
|
27
|
+
label?: ButtonLabel$;
|
|
28
|
+
placeholder_text?: string;
|
|
29
|
+
open_in_new_tab?: 'Yes' | 'No' | null;
|
|
8
30
|
variant?: ButtonVariant;
|
|
9
|
-
|
|
10
|
-
alignment?:
|
|
11
|
-
|
|
12
|
-
icon?:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$?:
|
|
16
|
-
parent$?:
|
|
31
|
+
button_size?: ButtonSize;
|
|
32
|
+
alignment?: ButtonAlignment;
|
|
33
|
+
buttontype?: string;
|
|
34
|
+
icon?: string;
|
|
35
|
+
iconposition?: IconPosition;
|
|
36
|
+
button_state?: boolean | string;
|
|
37
|
+
$?: Button$;
|
|
38
|
+
parent$?: Record<string, unknown>;
|
|
39
|
+
isEditing?: boolean;
|
|
17
40
|
}
|
|
@@ -3,8 +3,17 @@ import HeroBanner from './HeroBanner';
|
|
|
3
3
|
declare const meta: Meta<typeof HeroBanner>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof HeroBanner>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const ProductLaunch: Story;
|
|
7
|
+
export declare const HomepageHero: Story;
|
|
8
|
+
export declare const CampaignHero: Story;
|
|
7
9
|
export declare const VideoHero: Story;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const LeftAligned: Story;
|
|
11
|
+
export declare const CenterAligned: Story;
|
|
12
|
+
export declare const RightAligned: Story;
|
|
13
|
+
export declare const NoGradient: Story;
|
|
14
|
+
export declare const EditingMode: Story;
|
|
15
|
+
export declare const MinimalContent: Story;
|
|
16
|
+
export declare const NoMedia: Story;
|
|
17
|
+
export declare const ResponsiveImage: Story;
|
|
18
|
+
export declare const ButtonWithoutLabel: Story;
|
|
19
|
+
export declare const CustomMediaDimensions: Story;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GradientDepth } from './
|
|
1
|
+
import { GradientDepth } from './helpers';
|
|
2
2
|
export declare const Container: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
theme?: import("@emotion/react").Theme;
|
|
4
4
|
as?: React.ElementType;
|
|
@@ -13,4 +13,24 @@ export declare const GradientOverlay: import("@emotion/styled").StyledComponent<
|
|
|
13
13
|
depth: GradientDepth;
|
|
14
14
|
color: "black" | "white";
|
|
15
15
|
}, 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
|
+
export declare const Overlay: import("@emotion/styled").StyledComponent<{
|
|
25
|
+
theme?: import("@emotion/react").Theme;
|
|
26
|
+
as?: React.ElementType;
|
|
27
|
+
} & {
|
|
28
|
+
justifyContent?: string;
|
|
29
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
30
|
+
export declare const Content: import("@emotion/styled").StyledComponent<{
|
|
31
|
+
theme?: import("@emotion/react").Theme;
|
|
32
|
+
as?: React.ElementType;
|
|
33
|
+
} & {
|
|
34
|
+
textAlign?: string;
|
|
35
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
36
|
export declare const getJustifyContent: (alignment: "left" | "center" | "right") => "center" | "flex-start" | "flex-end";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ParsedMedia } from '../helpers';
|
|
3
|
+
interface MediaProps {
|
|
4
|
+
parsedMedia: ParsedMedia | null;
|
|
5
|
+
mediaWidth: string | number;
|
|
6
|
+
mediaHeight: string | number;
|
|
7
|
+
mediaAttributes?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export declare const Media: React.FC<MediaProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { NsTypography } from '@nuskin/foundation-ui-components';
|
|
3
|
+
interface TypographyProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
placeholder: string;
|
|
6
|
+
isEditing: boolean;
|
|
7
|
+
typographyProps: React.ComponentProps<typeof NsTypography>;
|
|
8
|
+
}
|
|
9
|
+
export declare const Typography: ({ value, placeholder, isEditing, typographyProps }: TypographyProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TypographyFieldsProps {
|
|
3
|
+
brandcaption?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
subtitle?: string;
|
|
6
|
+
body?: string;
|
|
7
|
+
isEditing: boolean;
|
|
8
|
+
editTags?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export declare const TypographyFields: React.FC<TypographyFieldsProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const PLACEHOLDER_BRAND_CAPTION = "Enter Brand Caption";
|
|
2
|
+
export declare const PLACEHOLDER_TITLE = "Enter Title";
|
|
3
|
+
export declare const PLACEHOLDER_SUBTITLE = "Enter Subtitle";
|
|
4
|
+
export declare const PLACEHOLDER_BODY = "Enter Body";
|
|
5
|
+
export declare const ARIA_LABEL_HERO_BANNER = "Hero banner";
|
|
6
|
+
export declare const IMAGE_LOADING_LAZY = "lazy";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type GradientDepth = 'sm' | 'md' | 'lg';
|
|
2
|
+
export type ContentAlignment = 'left' | 'center' | 'right';
|
|
3
|
+
export type TextColor = 'black' | 'white';
|
|
4
|
+
export declare const FULL_SIZE_PERCENT = "100%";
|
|
5
|
+
export declare const MOBILE_BREAKPOINT = "(max-width: 768px)";
|
|
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
|
+
export declare function resolveContentAlignment(contentAlignment?: ContentAlignment): ContentAlignment;
|
|
19
|
+
export declare function resolveGradientDepth(gradientDepth?: GradientDepth): GradientDepth;
|
|
20
|
+
export declare function resolveTextColor(textColor?: string): TextColor;
|
|
21
|
+
export declare function resolveWidth(width?: string | number): string | undefined;
|
|
22
|
+
export declare function resolveHeight(height?: string | number): string | undefined;
|
|
23
|
+
export declare function getGradientColor(textColor: TextColor): 'white' | 'black';
|
|
24
|
+
export type GradientDirection = 'leftToRight' | 'radial' | 'rightToLeft';
|
|
25
|
+
export declare function getGradientDirection(contentAlignment: ContentAlignment): GradientDirection;
|
|
26
|
+
export declare function isFullSize(mediaWidth: string | number, mediaHeight: string | number): boolean;
|
|
27
|
+
export declare function getImageProps(isFullSize: boolean, mediaWidth: string | number, mediaHeight: string | number): {
|
|
28
|
+
variant: 'fill';
|
|
29
|
+
className: 'media-fill';
|
|
30
|
+
} | {
|
|
31
|
+
style: {
|
|
32
|
+
width: string;
|
|
33
|
+
height: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -1,33 +1,39 @@
|
|
|
1
|
-
import { GradientDepth } from "./
|
|
1
|
+
import { GradientDepth } from "./helpers";
|
|
2
|
+
import { ButtonProps } from "../button";
|
|
2
3
|
export type MediaSource = {
|
|
3
4
|
src: string;
|
|
4
5
|
type?: string;
|
|
5
6
|
};
|
|
7
|
+
export type ContentAlignment = 'left' | 'center' | 'right';
|
|
8
|
+
export type HeroBannerMediaType = 'image' | 'gif' | 'video';
|
|
6
9
|
export type Media = {
|
|
7
|
-
type:
|
|
10
|
+
type: HeroBannerMediaType;
|
|
8
11
|
src: string | MediaSource[];
|
|
9
12
|
alt?: string;
|
|
10
13
|
width?: string | number;
|
|
11
14
|
height?: string | number;
|
|
12
15
|
};
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
export interface HeroBanner$ {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
button?: Record<string, unknown>;
|
|
19
|
+
media?: Record<string, unknown>;
|
|
20
|
+
$?: Record<string, unknown>;
|
|
21
|
+
}
|
|
17
22
|
export interface HeroBannerProps {
|
|
18
23
|
title?: string;
|
|
19
24
|
subtitle?: string;
|
|
20
25
|
body?: string;
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
brandcaption?: string;
|
|
27
|
+
button?: ButtonProps;
|
|
23
28
|
media?: Media | string | null;
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
class_name?: string;
|
|
30
|
+
content_alignment?: ContentAlignment;
|
|
26
31
|
width?: string | number;
|
|
27
32
|
height?: string | number;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
$?:
|
|
32
|
-
parent$?: Record<string,
|
|
33
|
+
gradient_enabled?: boolean;
|
|
34
|
+
gradient_depth?: GradientDepth;
|
|
35
|
+
text_color?: string;
|
|
36
|
+
$?: HeroBanner$;
|
|
37
|
+
parent$?: Record<string, unknown>;
|
|
38
|
+
isEditing?: boolean;
|
|
33
39
|
}
|