@transferwise/components 45.10.1 → 45.12.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/build/es/no-polyfill/common/card/Card.js +21 -0
- package/build/es/no-polyfill/common/card/Card.spec.js +6 -0
- package/build/es/no-polyfill/common/card/Card.story.js +1 -0
- package/build/es/no-polyfill/common/card/index.js +1 -0
- package/build/es/no-polyfill/common/closeButton/CloseButton.js +1 -1
- package/build/es/no-polyfill/display/Display.js +1 -1
- package/build/es/no-polyfill/image/Image.js +1 -1
- package/build/es/no-polyfill/index.js +1 -1
- package/build/es/no-polyfill/loader/Loader.js +1 -1
- package/build/es/no-polyfill/modal/Modal.js +1 -1
- package/build/es/no-polyfill/modal/Modal.story.js +1 -1
- package/build/es/no-polyfill/promoCard/PromoCard.js +51 -0
- package/build/es/no-polyfill/promoCard/PromoCard.spec.js +13 -0
- package/build/es/no-polyfill/promoCard/PromoCard.story.js +1 -0
- package/build/es/no-polyfill/promoCard/PromoCardContext.js +19 -0
- package/build/es/no-polyfill/promoCard/PromoCardContext.spec.js +4 -0
- package/build/es/no-polyfill/promoCard/PromoCardGroup.js +20 -0
- package/build/es/no-polyfill/promoCard/PromoCardGroup.spec.js +5 -0
- package/build/es/no-polyfill/promoCard/PromoCardGroup.story.js +1 -0
- package/build/es/no-polyfill/promoCard/PromoCardIndicator.js +16 -0
- package/build/es/no-polyfill/promoCard/index.js +1 -0
- package/build/es/polyfill/common/card/Card.js +21 -0
- package/build/es/polyfill/common/card/Card.spec.js +6 -0
- package/build/es/polyfill/common/card/Card.story.js +1 -0
- package/build/es/polyfill/common/card/index.js +1 -0
- package/build/es/polyfill/common/closeButton/CloseButton.js +1 -1
- package/build/es/polyfill/display/Display.js +1 -1
- package/build/es/polyfill/image/Image.js +1 -1
- package/build/es/polyfill/index.js +1 -1
- package/build/es/polyfill/loader/Loader.js +1 -1
- package/build/es/polyfill/modal/Modal.js +1 -1
- package/build/es/polyfill/modal/Modal.story.js +1 -1
- package/build/es/polyfill/promoCard/PromoCard.js +51 -0
- package/build/es/polyfill/promoCard/PromoCard.spec.js +13 -0
- package/build/es/polyfill/promoCard/PromoCard.story.js +1 -0
- package/build/es/polyfill/promoCard/PromoCardContext.js +19 -0
- package/build/es/polyfill/promoCard/PromoCardContext.spec.js +4 -0
- package/build/es/polyfill/promoCard/PromoCardGroup.js +20 -0
- package/build/es/polyfill/promoCard/PromoCardGroup.spec.js +5 -0
- package/build/es/polyfill/promoCard/PromoCardGroup.story.js +1 -0
- package/build/es/polyfill/promoCard/PromoCardIndicator.js +16 -0
- package/build/es/polyfill/promoCard/index.js +1 -0
- package/build/main.css +1 -1
- package/build/styles/common/card/Card.css +1 -0
- package/build/styles/main.css +1 -1
- package/build/styles/promoCard/PromoCard.css +1 -0
- package/build/types/avatar/index.d.ts +1 -0
- package/build/types/common/card/Card.d.ts +40 -0
- package/build/types/common/card/Card.spec.d.ts +1 -0
- package/build/types/common/card/Card.story.d.ts +6 -0
- package/build/types/common/card/index.d.ts +1 -0
- package/build/types/common/closeButton/CloseButton.d.ts +4 -0
- package/build/types/display/Display.d.ts +1 -1
- package/build/types/image/Image.d.ts +1 -0
- package/build/types/index.d.ts +3 -0
- package/build/types/modal/Modal.d.ts +2 -1
- package/build/types/modal/Modal.story.d.ts +1 -1
- package/build/types/promoCard/PromoCard.d.ts +83 -0
- package/build/types/promoCard/PromoCard.spec.d.ts +1 -0
- package/build/types/promoCard/PromoCard.story.d.ts +11 -0
- package/build/types/promoCard/PromoCardContext.d.ts +45 -0
- package/build/types/promoCard/PromoCardContext.spec.d.ts +1 -0
- package/build/types/promoCard/PromoCardGroup.d.ts +38 -0
- package/build/types/promoCard/PromoCardGroup.spec.d.ts +1 -0
- package/build/types/promoCard/PromoCardGroup.story.d.ts +8 -0
- package/build/types/promoCard/PromoCardIndicator.d.ts +31 -0
- package/build/types/promoCard/index.d.ts +2 -0
- package/build/umd/no-polyfill/main.js +1 -1
- package/build/umd/polyfill/main.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.np-Card{--Card-image-scale:1;--Card-image-translate:0;--Card-indicator-text-background-color:var(--color-background-neutral);--Card-indicator-icon-background-color:var(--color-interactive-accent);--Card-indicator-icon-color:var(--color-interactive-control);--Card-check-background-color:var(--color-interactive-primary);--Card-check-color:var(--color-interactive-control)}.np-Card--promoCard{--Card-max-width:358px}.np-Card--promoCard.is-disabled{filter:grayscale(1);opacity:.45}.np-Card-image{height:auto;left:-24px;left:calc(var(--size-24)*-1);margin:0 auto;position:relative;transform:scale(var(--Card-image-scale)) translateY(var(--Card-image-translate));transition:transform .5s ease-in-out;width:100%;width:calc(100% + 48px);width:calc(100% + var(--size-48))}[dir=rtl] .np-Card-image{left:auto;right:-24px;right:calc(var(--size-24)*-1)}.np-Card-indicator{bottom:8px;bottom:var(--size-8);display:flex;gap:4px;gap:var(--size-4);position:absolute;right:8px;right:var(--size-8)}[dir=rtl] .np-Card-indicator{left:8px;left:var(--size-8);right:auto}.np-Card-indicatorText{background:var(--Card-indicator-text-background-color);border-radius:100px;display:inline-block;padding:16px;padding:var(--size-16);text-align:left;vertical-align:middle}.np-Card-indicatorIcon{align-items:center;background:var(--Card-indicator-icon-background-color);border-radius:50%;border-radius:var(--radius-full);color:var(--Card-indicator-icon-color);display:inline-block;display:flex;height:56px;height:var(--size-56);justify-content:center;width:56px;width:var(--size-56)}[dir=rtl] .np-Card-indicatorIcon{transform:scaleX(-1)}.np-Card--checked,.np-Card--link{box-shadow:none;color:currentColor;cursor:pointer;transform:scale(1);transition:box-shadow .2s ease-in-out,transform .5s ease-in-out}.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--checked,.np-theme-personal:not(.np-theme-personal--dark,.np-theme-personal--bright-green,.np-theme-personal--forest-green) .np-Card--link{--Card-box-shadow:0px 20px var(--size-40) 0px var(--color-background-neutral);--Card-check-color:var(--color-interactive-accent)}.np-Card--checked.is-disabled,.np-Card--link.is-disabled{cursor:not-allowed}@media (prefers-reduced-motion:reduce){.np-Card--checked,.np-Card--link{transition:none}}.np-Card--checked:hover:not(.is-disabled,:disabled,.is-checked,:focus-within),.np-Card--link:hover:not(.is-disabled,:disabled,.is-checked,:focus-within){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow)}.np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral-active);--Card-image-scale:1.1;--Card-image-translate:var(--size-8);box-shadow:var(--Card-box-shadow);transform:scale(98%)}.np-theme-personal--bright-green .np-Card--checked:active:not(.is-disabled,:disabled,.is-checked),.np-theme-personal--bright-green .np-Card--link:active:not(.is-disabled,:disabled,.is-checked){--Card-background-color:var(--color-background-neutral)}.np-Card--checked:focus-visible:not(.is-disabled,:disabled),.np-Card--checked:has(:focus-visible):not(.np-Card--checked),.np-Card--link:focus-visible:not(.is-disabled,:disabled),.np-Card--link:has(:focus-visible):not(.np-Card--checked){--Card-image-scale:1.1;box-shadow:var(--Card-box-shadow);outline:var(--ring-outline-color) solid 4px;outline:var(--ring-outline-color) solid var(--size-4);outline-offset:4px;outline-offset:var(--size-4)}.np-Card--link .np-Card-titleLink{color:#37517e;color:var(--color-content-primary);text-decoration:none}.np-Card--link .np-Card-titleLink:focus-visible{outline:none}.np-Card--link .np-Card-titleLink:after{content:"";display:block;height:100%;left:0;position:absolute;top:0;width:100%;z-index:10}.np-Card--checked.is-checked{box-shadow:0 0 0 4px var(--color-interactive-primary);box-shadow:0 0 0 var(--size-4) var(--color-interactive-primary)}.np-Card--checked.is-checked .np-Card-check{align-items:center;background:var(--Card-check-background-color);border-radius:50%;border-radius:var(--radius-full);color:var(--Card-check-color);display:flex;height:40px;height:var(--size-40);justify-content:center;position:absolute;right:8px;right:var(--size-8);top:8px;top:var(--size-8);width:40px;width:var(--size-40)}[dir=rtl] .np-Card--checked.is-checked .np-Card-check{left:8px;left:var(--size-8);right:auto}.np-Card--checked.is-checked:focus-visible:not(.is-disabled,:disabled){box-shadow:none}.np-CardGroup{display:flex;flex-direction:column;gap:24px;gap:var(--size-24);width:100%}@media (min-width:768px){.np-CardGroup{flex-direction:row}}.np-CardGroup .np-Card.np-Card--promoCard{max-width:100%}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface CardProps {
|
|
3
|
+
/** Content to display inside Card. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Optional prop to specify classNames onto the Card */
|
|
6
|
+
className?: string;
|
|
7
|
+
/** Optional prop to specify the ID on to Card */
|
|
8
|
+
id?: string;
|
|
9
|
+
/** Specify whether the Card is disabled, or not */
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
/** Specify whether the Card is sized small or not */
|
|
12
|
+
isSmall?: boolean;
|
|
13
|
+
/** Optionally specify Card onDismiss function */
|
|
14
|
+
onDismiss?: () => void;
|
|
15
|
+
/** Optional prop to specify the ID used for testing */
|
|
16
|
+
testId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Card component.
|
|
20
|
+
*
|
|
21
|
+
* A card is a container for content that is used to group related information.
|
|
22
|
+
* It can be used to display information in a structured way, and can be
|
|
23
|
+
* customized with various props to suit different use cases.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} props - The component props.
|
|
26
|
+
* @param {ReactNode} children - The content to display inside the card.
|
|
27
|
+
* @param {string} className - Optional class name(s) to add to the card container.
|
|
28
|
+
* @param {string} id - Optional ID to add to the card container.
|
|
29
|
+
* @param {boolean} isDisabled - Whether the card is disabled or not.
|
|
30
|
+
* @param {boolean} isSmall - Whether the card is small or not.
|
|
31
|
+
* @param {(event_: MouseEvent<HTMLButtonElement>) => void} onDismiss - Optional function to call when the card is dismissed.
|
|
32
|
+
* @param {string} testId - Optional ID to add to the card container for testing purposes.
|
|
33
|
+
* @returns {JSX.Element} - The card component.
|
|
34
|
+
* @example
|
|
35
|
+
* <Card>
|
|
36
|
+
* <p>Hello World!</p>
|
|
37
|
+
* </Card>
|
|
38
|
+
*/
|
|
39
|
+
declare const Card: React.FC<CardProps>;
|
|
40
|
+
export default Card;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Card';
|
|
@@ -3,8 +3,12 @@ import { SizeLarge, SizeMedium, SizeSmall } from '../propsValues/size';
|
|
|
3
3
|
export type CloseButtonProps = Pick<React.ComponentPropsWithoutRef<'button'>, 'aria-label' | 'className' | 'onClick'> & {
|
|
4
4
|
size?: SizeSmall | SizeMedium | SizeLarge;
|
|
5
5
|
filled?: boolean;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
testId?: string;
|
|
6
8
|
};
|
|
7
9
|
export declare const CloseButton: import("react").ForwardRefExoticComponent<Pick<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>>, "className" | "aria-label" | "onClick"> & {
|
|
8
10
|
size?: "sm" | "md" | "lg" | undefined;
|
|
9
11
|
filled?: boolean | undefined;
|
|
12
|
+
isDisabled?: boolean | undefined;
|
|
13
|
+
testId?: string | undefined;
|
|
10
14
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -6,5 +6,5 @@ type Props = PropsWithChildren<{
|
|
|
6
6
|
type?: DisplayTypes;
|
|
7
7
|
className?: string;
|
|
8
8
|
}>;
|
|
9
|
-
declare function Display({ as: Heading, type, children, className, }: Props): JSX.Element;
|
|
9
|
+
declare function Display({ as: Heading, type, children, className, id, }: Props): JSX.Element;
|
|
10
10
|
export default Display;
|
package/build/types/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { default as Badge } from './badge';
|
|
|
21
21
|
export { default as BottomSheet } from './common/bottomSheet';
|
|
22
22
|
export { default as Button } from './button';
|
|
23
23
|
export { default as Card } from './card';
|
|
24
|
+
export { default as BaseCard } from './common/card';
|
|
24
25
|
export { default as Checkbox } from './checkbox';
|
|
25
26
|
export { default as CheckboxButton } from './checkboxButton';
|
|
26
27
|
export { default as CheckboxOption } from './checkboxOption';
|
|
@@ -63,6 +64,8 @@ export { default as Popover } from './popover';
|
|
|
63
64
|
export { default as ProcessIndicator } from './processIndicator';
|
|
64
65
|
export { default as ProgressBar } from './progressBar';
|
|
65
66
|
export { default as Progress } from './progress';
|
|
67
|
+
export { default as PromoCard } from './promoCard';
|
|
68
|
+
export { default as PromoCardGroup } from './promoCard';
|
|
66
69
|
export { default as Provider, DirectionProvider, LanguageProvider } from './provider';
|
|
67
70
|
export { default as Radio } from './radio';
|
|
68
71
|
export { default as RadioGroup } from './radioGroup';
|
|
@@ -9,6 +9,7 @@ export type ModalProps = CommonProps & {
|
|
|
9
9
|
open: boolean;
|
|
10
10
|
scroll?: ScrollContent | ScrollViewport;
|
|
11
11
|
position?: PositionTop | PositionCenter;
|
|
12
|
+
disableDimmerClickToClose?: boolean;
|
|
12
13
|
};
|
|
13
|
-
declare const Modal: ({ title, body, footer, onClose, className, open, size, scroll, position, ...otherProps }: ModalProps) => JSX.Element;
|
|
14
|
+
declare const Modal: ({ title, body, footer, onClose, className, open, size, scroll, position, disableDimmerClickToClose, ...otherProps }: ModalProps) => JSX.Element;
|
|
14
15
|
export default Modal;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { StoryObj } from '@storybook/react';
|
|
3
3
|
import { Modal } from '..';
|
|
4
4
|
declare const _default: {
|
|
5
|
-
component: ({ title, body, footer, onClose, className, open, size, scroll, position, ...otherProps }: import("./Modal").ModalProps) => JSX.Element;
|
|
5
|
+
component: ({ title, body, footer, onClose, className, open, size, scroll, position, disableDimmerClickToClose, ...otherProps }: import("./Modal").ModalProps) => JSX.Element;
|
|
6
6
|
title: string;
|
|
7
7
|
args: {
|
|
8
8
|
size: "md";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type ReferenceType = React.Ref<HTMLInputElement>;
|
|
3
|
+
export type LinkTarget = '_blank' | '_parent' | '_self' | '_top';
|
|
4
|
+
export type RelatedTypes = '' | 'alternate' | 'author' | 'bookmark' | 'external' | 'help' | 'license' | 'next' | 'nofollow' | 'noreferrer' | 'noopener' | 'prev' | 'search' | 'tag';
|
|
5
|
+
export interface PromoCardCommonProps {
|
|
6
|
+
/** Optional prop to specify classNames onto the PromoCard */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Optional prop to specify the ID of the PromoCard */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Required prop to specify the descriptive text of the PromoCard */
|
|
11
|
+
description: string;
|
|
12
|
+
/**
|
|
13
|
+
* Optional prop to specify the heading level of the PromoCard
|
|
14
|
+
*
|
|
15
|
+
* @default 'h3'
|
|
16
|
+
*/
|
|
17
|
+
headingLevel?: 'h3' | 'h4' | 'h5' | 'h6';
|
|
18
|
+
/** Optional prop to specify text for the indicator label of the PromoCard */
|
|
19
|
+
indicatorLabel?: string;
|
|
20
|
+
/** Optional prop to specify an image alt text */
|
|
21
|
+
imageAlt?: string;
|
|
22
|
+
/** Optional prop to specify an image class */
|
|
23
|
+
imageClass?: string;
|
|
24
|
+
/** Optional prop to specify an image source url */
|
|
25
|
+
imageSource: string;
|
|
26
|
+
/** Specify whether the PromoCard is disabled, or not */
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
/** Specify an onClick event handler */
|
|
29
|
+
onClick?: () => void;
|
|
30
|
+
/** Optional prop to specify the ID used for testing */
|
|
31
|
+
testId?: string;
|
|
32
|
+
/** Required prop to specify the title text of the PromoCard */
|
|
33
|
+
title: string;
|
|
34
|
+
}
|
|
35
|
+
export interface PromoCardLinkProps extends PromoCardCommonProps {
|
|
36
|
+
/**
|
|
37
|
+
* Optional prop to prompts a user to save the linked URL instead of
|
|
38
|
+
* navigating to it
|
|
39
|
+
*/
|
|
40
|
+
download?: string;
|
|
41
|
+
/** Optionally specify an href for your PromoCard to contain an <a> element */
|
|
42
|
+
href?: string;
|
|
43
|
+
/** Optionally specify the language of the linked URL */
|
|
44
|
+
hrefLang?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Relationship between the PromoCard href URL and the current page. See
|
|
47
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).
|
|
48
|
+
*/
|
|
49
|
+
rel?: RelatedTypes;
|
|
50
|
+
/** Optional prop to to display where the linked URL will show */
|
|
51
|
+
target?: LinkTarget;
|
|
52
|
+
/** Only applies to role="radio" or "checkbox" */
|
|
53
|
+
defaultChecked?: never;
|
|
54
|
+
isChecked?: never;
|
|
55
|
+
tabIndex?: never;
|
|
56
|
+
type?: never;
|
|
57
|
+
reference?: never;
|
|
58
|
+
value?: never;
|
|
59
|
+
}
|
|
60
|
+
export interface PromoCardCheckedProps extends PromoCardCommonProps {
|
|
61
|
+
/** Specify the initial checked attribute of the PromoCard */
|
|
62
|
+
defaultChecked?: boolean;
|
|
63
|
+
/** Specify whether the PromoCard is checked, or not */
|
|
64
|
+
isChecked?: boolean;
|
|
65
|
+
/** Optional prop to specify the tabIndex of the PromoCard */
|
|
66
|
+
tabIndex?: number;
|
|
67
|
+
/** Optional property to provide component Ref */
|
|
68
|
+
reference?: ReferenceType;
|
|
69
|
+
/** Optional prop to specify the input type of the PromoCard */
|
|
70
|
+
type?: 'checkbox' | 'radio';
|
|
71
|
+
/** Specify the value attribute of the PromoCard if Checkbox or Radio */
|
|
72
|
+
value?: string;
|
|
73
|
+
/** Only applies to <a />s */
|
|
74
|
+
download?: never;
|
|
75
|
+
href?: never;
|
|
76
|
+
hrefLang?: never;
|
|
77
|
+
rel?: never;
|
|
78
|
+
target?: never;
|
|
79
|
+
}
|
|
80
|
+
export type PromoCardProps = PromoCardLinkProps | PromoCardCheckedProps;
|
|
81
|
+
export type PolymorphicPromoCard = (props: PromoCardLinkProps | PromoCardCheckedProps) => JSX.Element;
|
|
82
|
+
declare const _default: React.NamedExoticComponent<PromoCardProps>;
|
|
83
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import PromoCard from './PromoCard';
|
|
3
|
+
declare const meta: Meta<typeof PromoCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PromoCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Link: Story;
|
|
8
|
+
export declare const Check: Story;
|
|
9
|
+
export declare const DefaultChecked: Story;
|
|
10
|
+
export declare const Disabled: Story;
|
|
11
|
+
export declare const CustomClass: Story;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The type of the PromoCard context object.
|
|
4
|
+
*
|
|
5
|
+
* The context object contains the current state of the PromoCard group, whether
|
|
6
|
+
* the group is disabled or not, and a function to call when the group value
|
|
7
|
+
* changes. This value is used to provide context to child PromoCard components,
|
|
8
|
+
* allowing them to interact with the group and update its state.
|
|
9
|
+
*/
|
|
10
|
+
interface PromoCardContextType {
|
|
11
|
+
/**
|
|
12
|
+
* The current value of the PromoCard group.
|
|
13
|
+
*
|
|
14
|
+
* @default ''
|
|
15
|
+
*/
|
|
16
|
+
state: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the PromoCard group is disabled or not.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
isDisabled: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* A function to call when the PromoCard group value changes.
|
|
25
|
+
*
|
|
26
|
+
* @param {string} value - The new value of the PromoCard group.
|
|
27
|
+
* @default () => {}
|
|
28
|
+
*/
|
|
29
|
+
onChange: (value: string) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The PromoCard context object.
|
|
33
|
+
*/
|
|
34
|
+
export declare const PromoCardContext: React.Context<PromoCardContextType>;
|
|
35
|
+
/**
|
|
36
|
+
* A custom hook for accessing the PromoCard context object.
|
|
37
|
+
*
|
|
38
|
+
* The `usePromoCardContext` hook is used to access the PromoCard context object
|
|
39
|
+
* from within a child PromoCard component. It throws an error if the context
|
|
40
|
+
* object is not available, which can help with debugging and development.
|
|
41
|
+
*
|
|
42
|
+
* @returns {PromoCardContextType} - The PromoCard context object.
|
|
43
|
+
*/
|
|
44
|
+
export declare const usePromoCardContext: () => PromoCardContextType;
|
|
45
|
+
export default PromoCardContext;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
export type AriaRoleRadioGroup = 'radiogroup';
|
|
3
|
+
export interface PromoCardGroupProps {
|
|
4
|
+
/**
|
|
5
|
+
* Optional class name(s) to add to the group container.
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The PromoCard components to display inside the group.
|
|
10
|
+
*/
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The default checked for the group.
|
|
14
|
+
*/
|
|
15
|
+
defaultChecked?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional ID to add to the group container.
|
|
18
|
+
*/
|
|
19
|
+
id?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the group is disabled or not.
|
|
22
|
+
*/
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Optional label to display above the group.
|
|
26
|
+
*/
|
|
27
|
+
label?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional function to call when the group value changes.
|
|
30
|
+
*/
|
|
31
|
+
onChange?: (value: string) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Optional ID to add to the group container for testing purposes.
|
|
34
|
+
*/
|
|
35
|
+
testId?: string;
|
|
36
|
+
}
|
|
37
|
+
declare const _default: React.NamedExoticComponent<PromoCardGroupProps>;
|
|
38
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import PromoCardGroup from './PromoCardGroup';
|
|
3
|
+
declare const meta: Meta<typeof PromoCardGroup>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PromoCardGroup>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const DefaultChecked: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PromoCardIndicatorProps = {
|
|
3
|
+
/** Optional class name(s) to add to the indicator container. */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** Optional label to display next to the indicator. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Optional icon to display in the indicator. */
|
|
8
|
+
icon?: 'check' | 'arrow' | 'download';
|
|
9
|
+
/** Optional ID to add to the indicator container for testing purposes. */
|
|
10
|
+
testid?: string;
|
|
11
|
+
/** Optional children to display inside the indicator. */
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* PromoCardIndicator component.
|
|
16
|
+
*
|
|
17
|
+
* A PromoCardIndicator is a small component that can be used to display
|
|
18
|
+
* additional information or actions related to a PromoCard. It can be
|
|
19
|
+
* customized with various props to suit different use cases.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} className - Optional class name(s) to add to the indicator container.
|
|
22
|
+
* @param {string} label - Optional label to display next to the indicator.
|
|
23
|
+
* @param {string} icon - Optional icon to display in the indicator.
|
|
24
|
+
* @param {string} testid - Optional ID to add to the indicator container for testing purposes.
|
|
25
|
+
* @param {ReactNode} children - Optional children to display inside the indicator.
|
|
26
|
+
* @returns {JSX.Element} - The PromoCardIndicator component.
|
|
27
|
+
* @example
|
|
28
|
+
* <PromoCardIndicator label="Download" icon="download" />
|
|
29
|
+
*/
|
|
30
|
+
declare const PromoCardIndicator: React.FC<PromoCardIndicatorProps>;
|
|
31
|
+
export default PromoCardIndicator;
|