@transferwise/components 45.3.0 → 45.4.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.
Files changed (52) hide show
  1. package/build/es/no-polyfill/accordion/Accordion.story.js +1 -0
  2. package/build/es/no-polyfill/actionButton/ActionButton.story.js +1 -1
  3. package/build/es/no-polyfill/avatar/Avatar.story.js +1 -1
  4. package/build/es/no-polyfill/button/Button.story.js +1 -0
  5. package/build/es/no-polyfill/checkbox/Checkbox.story.js +1 -0
  6. package/build/es/no-polyfill/common/bottomSheet/BottomSheet.story.js +2 -0
  7. package/build/es/no-polyfill/dateInput/DateInput.story.js +1 -0
  8. package/build/es/no-polyfill/info/Info.story.js +1 -0
  9. package/build/es/no-polyfill/modal/Modal.story.js +2 -1
  10. package/build/es/no-polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
  11. package/build/es/no-polyfill/phoneNumberInput/utils/excludeCountries/excludeCountries.js +8 -0
  12. package/build/es/no-polyfill/phoneNumberInput/utils/excludeCountries/index.js +1 -0
  13. package/build/es/no-polyfill/phoneNumberInput/utils/index.js +1 -1
  14. package/build/es/no-polyfill/select/option/Option.js +1 -1
  15. package/build/es/no-polyfill/tooltip/Tooltip.story.js +1 -1
  16. package/build/es/polyfill/accordion/Accordion.story.js +1 -0
  17. package/build/es/polyfill/actionButton/ActionButton.story.js +1 -1
  18. package/build/es/polyfill/avatar/Avatar.story.js +1 -1
  19. package/build/es/polyfill/button/Button.story.js +1 -0
  20. package/build/es/polyfill/checkbox/Checkbox.story.js +1 -0
  21. package/build/es/polyfill/common/bottomSheet/BottomSheet.story.js +2 -0
  22. package/build/es/polyfill/dateInput/DateInput.story.js +1 -0
  23. package/build/es/polyfill/info/Info.story.js +1 -0
  24. package/build/es/polyfill/modal/Modal.story.js +2 -1
  25. package/build/es/polyfill/phoneNumberInput/PhoneNumberInput.js +1 -1
  26. package/build/es/polyfill/phoneNumberInput/utils/excludeCountries/excludeCountries.js +8 -0
  27. package/build/es/polyfill/phoneNumberInput/utils/excludeCountries/index.js +1 -0
  28. package/build/es/polyfill/phoneNumberInput/utils/index.js +1 -1
  29. package/build/es/polyfill/select/option/Option.js +1 -1
  30. package/build/es/polyfill/tooltip/Tooltip.story.js +1 -1
  31. package/build/main.css +1 -1
  32. package/build/styles/main.css +1 -1
  33. package/build/styles/snackbar/Snackbar.css +1 -1
  34. package/build/types/accordion/Accordion.story.d.ts +46 -0
  35. package/build/types/avatar/Avatar.story.d.ts +3 -1
  36. package/build/types/button/Button.story.d.ts +4586 -0
  37. package/build/types/checkbox/Checkbox.story.d.ts +54 -0
  38. package/build/types/common/bottomSheet/BottomSheet.story.d.ts +29 -0
  39. package/build/types/dateInput/DateInput.story.d.ts +71 -0
  40. package/build/types/info/Info.story.d.ts +39 -0
  41. package/build/types/modal/Modal.story.d.ts +20 -3
  42. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts +4 -0
  43. package/build/types/phoneNumberInput/utils/excludeCountries/excludeCountries.d.ts +1 -0
  44. package/build/types/phoneNumberInput/utils/excludeCountries/index.d.ts +1 -0
  45. package/build/types/phoneNumberInput/utils/index.d.ts +1 -0
  46. package/build/types/test-utils/VariantDecorator.d.ts +18 -0
  47. package/build/types/test-utils/story-config.d.ts +18 -50
  48. package/build/types/tooltip/Tooltip.story.d.ts +17 -9
  49. package/build/umd/no-polyfill/main.js +1 -1
  50. package/build/umd/polyfill/main.js +1 -1
  51. package/package.json +3 -2
  52. package/build/types/test-utils/GlobalsDecorator.d.ts +0 -4
@@ -0,0 +1,54 @@
1
+ /// <reference types="react" />
2
+ import { StoryObj } from '@storybook/react';
3
+ import Checkbox from './Checkbox';
4
+ declare const _default: {
5
+ component: {
6
+ ({ id, checked, required, disabled, readOnly, label, className, secondary, onChange, onFocus, onBlur, }: {
7
+ id: any;
8
+ checked: any;
9
+ required: any;
10
+ disabled: any;
11
+ readOnly: any;
12
+ label: any;
13
+ className: any;
14
+ secondary: any;
15
+ onChange: any;
16
+ onFocus: any;
17
+ onBlur: any;
18
+ }): JSX.Element;
19
+ propTypes: {
20
+ id: any;
21
+ checked: any;
22
+ required: any;
23
+ disabled: any;
24
+ readOnly: any;
25
+ label: any;
26
+ secondary: any;
27
+ onFocus: any;
28
+ onChange: any;
29
+ onBlur: any;
30
+ className: any;
31
+ };
32
+ defaultProps: {
33
+ id: null;
34
+ checked: boolean;
35
+ required: boolean;
36
+ disabled: boolean;
37
+ readOnly: boolean;
38
+ secondary: null;
39
+ onFocus: null;
40
+ onBlur: null;
41
+ className: undefined;
42
+ };
43
+ };
44
+ title: string;
45
+ args: {
46
+ label: string;
47
+ };
48
+ tags: string[];
49
+ };
50
+ export default _default;
51
+ type Story = StoryObj<typeof Checkbox>;
52
+ export declare const Basic: Story;
53
+ export declare const Multiple: Story;
54
+ export declare const MultipleMobile: Story;
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import { StoryObj } from '@storybook/react';
3
+ import BottomSheet from './BottomSheet';
4
+ declare const _default: {
5
+ component: (props: {
6
+ onClose?: ((event: Event | import("react").SyntheticEvent<Element, Event>) => void) | undefined;
7
+ open: boolean;
8
+ } & import("..").CommonProps & {
9
+ children?: import("react").ReactNode;
10
+ }) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
11
+ title: string;
12
+ args: {
13
+ open: true;
14
+ };
15
+ render: (args: {
16
+ onClose?: ((event: Event | import("react").SyntheticEvent<Element, Event>) => void) | undefined;
17
+ open: boolean;
18
+ } & import("..").CommonProps & {
19
+ children?: import("react").ReactNode;
20
+ }) => JSX.Element;
21
+ };
22
+ export default _default;
23
+ type Story = StoryObj<typeof BottomSheet>;
24
+ export declare const Basic: Story;
25
+ export declare const BasicMobile: Story;
26
+ export declare const WithOverflowContent: Story;
27
+ export declare const WithOverflowContentMobile: Story;
28
+ export declare const WithOverflowContentDark: Story;
29
+ export declare const WithOverflowContentDarkMobile: Story;
@@ -0,0 +1,71 @@
1
+ /// <reference types="react" />
2
+ import { StoryObj } from '@storybook/react';
3
+ import { DateInput } from '..';
4
+ declare const _default: {
5
+ component: {
6
+ ({ disabled, size, value, dayLabel, monthLabel, yearLabel, monthFormat, mode, onChange, onFocus, onBlur, placeholders, id, selectProps, }: {
7
+ disabled: any;
8
+ size: any;
9
+ value: any;
10
+ dayLabel: any;
11
+ monthLabel: any;
12
+ yearLabel: any;
13
+ monthFormat: any;
14
+ mode: any;
15
+ onChange: any;
16
+ onFocus: any;
17
+ onBlur: any;
18
+ placeholders: any;
19
+ id: any;
20
+ selectProps: any;
21
+ }): JSX.Element;
22
+ propTypes: {
23
+ disabled: any;
24
+ size: any;
25
+ value: any;
26
+ onChange: any;
27
+ onFocus: any;
28
+ onBlur: any;
29
+ dayLabel: any;
30
+ monthLabel: any;
31
+ yearLabel: any;
32
+ monthFormat: any;
33
+ mode: any;
34
+ placeholders: any;
35
+ id: any;
36
+ selectProps: any;
37
+ };
38
+ defaultProps: {
39
+ disabled: boolean;
40
+ size: import("..").Size;
41
+ value: null;
42
+ onFocus: null;
43
+ onBlur: null;
44
+ monthFormat: import("..").MonthFormat;
45
+ mode: import("..").DateMode;
46
+ id: string;
47
+ selectProps: {};
48
+ };
49
+ };
50
+ title: string;
51
+ args: {
52
+ dayLabel: string;
53
+ monthLabel: string;
54
+ yearLabel: string;
55
+ selectProps: {
56
+ buttonProps: {
57
+ 'aria-label': string;
58
+ };
59
+ dropdownProps: {
60
+ 'aria-label': string;
61
+ };
62
+ };
63
+ };
64
+ tags: string[];
65
+ };
66
+ export default _default;
67
+ type Story = StoryObj<typeof DateInput>;
68
+ export declare const Basic: Story;
69
+ export declare const BasicMobile: Story;
70
+ export declare const InputError: Story;
71
+ export declare const InputErrorMobile: Story;
@@ -0,0 +1,39 @@
1
+ /// <reference types="react" />
2
+ import { StoryObj } from '@storybook/react';
3
+ import Info, { InfoPresentation } from '.';
4
+ declare const _default: {
5
+ component: {
6
+ (props: any): JSX.Element;
7
+ propTypes: {
8
+ 'aria-label': any;
9
+ className: any;
10
+ content: any;
11
+ onClick: any;
12
+ presentation: any;
13
+ size: any;
14
+ title: any;
15
+ };
16
+ defaultProps: {
17
+ className: undefined;
18
+ content: undefined;
19
+ onClick: undefined;
20
+ presentation: InfoPresentation;
21
+ size: import("..").Size;
22
+ title: undefined;
23
+ };
24
+ };
25
+ title: string;
26
+ args: {
27
+ 'aria-label': string;
28
+ title: string;
29
+ content: string;
30
+ };
31
+ render: (args: any) => JSX.Element;
32
+ };
33
+ export default _default;
34
+ type Story = StoryObj<typeof Info>;
35
+ export declare const Basic: Story;
36
+ export declare const OpenedPopover: Story;
37
+ export declare const OpenedPopoverMobile: Story;
38
+ export declare const OpenedModal: Story;
39
+ export declare const OpenedModalMobile: Story;
@@ -1,10 +1,27 @@
1
1
  /// <reference types="react" />
2
- import { Story } from '@storybook/react';
2
+ import { StoryObj } from '@storybook/react';
3
+ import { Modal } from '..';
3
4
  declare const _default: {
4
5
  component: ({ title, body, footer, onClose, className, open, size, scroll, position, ...otherProps }: import("./Modal").ModalProps) => JSX.Element;
5
6
  title: string;
7
+ args: {
8
+ size: "md";
9
+ position: "center";
10
+ open: true;
11
+ };
12
+ parameters: {
13
+ chromatic: {
14
+ delay: number;
15
+ };
16
+ };
6
17
  };
7
18
  export default _default;
19
+ type Story = StoryObj<typeof Modal>;
8
20
  export declare const Basic: Story;
9
- export declare const WithLongText: () => JSX.Element;
10
- export declare const WithLongTextMobileView: Story;
21
+ export declare const BasicMobile: Story;
22
+ export declare const ContentScroll: Story;
23
+ export declare const ContentScrollMobile: Story;
24
+ export declare const ViewportScroll: Story;
25
+ export declare const ViewportScrollMobile: Story;
26
+ export declare const WithoutTitle: Story;
27
+ export declare const WithoutTitleMobile: Story;
@@ -15,6 +15,10 @@ export interface PhoneNumberInputProps {
15
15
  size?: PhoneNumberInputSize;
16
16
  placeholder?: string;
17
17
  selectProps?: Object;
18
+ /**
19
+ * List of iso3 codes of countries to remove from the list
20
+ */
21
+ disabledCountries?: string[];
18
22
  }
19
23
 
20
24
  declare const PhoneNumberInput: React.FC<PhoneNumberInputProps>;
@@ -0,0 +1 @@
1
+ export function excludeCountries(countries: any[], disabledCountries: any[]): any;
@@ -0,0 +1 @@
1
+ export { excludeCountries } from "./excludeCountries";
@@ -10,3 +10,4 @@ export { cleanNumber } from "./cleanNumber";
10
10
  export { isStringNumeric } from "./isStringNumeric";
11
11
  export { sortArrayByProperty } from "./sortArrayByProperty";
12
12
  export { groupCountriesByPrefix } from "./groupCountriesByPrefix";
13
+ export { excludeCountries } from "./excludeCountries";
@@ -0,0 +1,18 @@
1
+ import { Decorator } from '@storybook/react';
2
+ import { ChromaticParameters } from './ChromaticParameters';
3
+ declare module '@storybook/types' {
4
+ interface Parameters {
5
+ /** Prefer using `storyConfig` for configuring variants */
6
+ variants?: ('default' | 'light' | 'dark' | 'rtl' | (string & Record<string, unknown>))[];
7
+ /** Used by Chromatic */
8
+ chromatic?: ChromaticParameters;
9
+ viewport?: {
10
+ viewports?: unknown[];
11
+ defaultViewport?: string;
12
+ };
13
+ }
14
+ }
15
+ /**
16
+ * Creates multiple variants of a component in a single story.
17
+ */
18
+ export declare const VariantDecorator: Decorator;
@@ -1,54 +1,22 @@
1
- import { Story } from '@storybook/react';
2
- export declare const defaultMobileViewPortWidth = 390;
3
- export declare const defaultVisualTestDelay = 1000;
4
- export declare const defaultMobileViewDevice: {
5
- type: string;
6
- name: string;
7
- styles: import("@storybook/addon-viewport/dist/Viewport-f0912abf").S;
8
- };
9
- export type StoryConfig = {
10
- darkMode?: boolean;
11
- rtlMode?: boolean;
12
- allGlobals?: boolean;
13
- mobileView?: boolean;
14
- visualTest?: ChromaticParameters;
15
- };
16
- export declare function storyConfig(story: Story, config: StoryConfig): Story;
17
- /**
18
- * Chromatic Config params
19
- *
20
- * {@see https://github.com/chromaui/chromatic-cli/blob/main/storybook-addon.d.ts}
21
- * (this typs wasn't exported from any Chromatic package)
22
- */
23
- export type ChromaticParameters = {
24
- /**
25
- * To set a viewport, specify one or more screen widths to the `chromatic.viewports` parameter.
26
- */
27
- viewports?: number[];
1
+ import { StoryObj } from '@storybook/react';
2
+ interface StoryConfig {
28
3
  /**
29
- * You can omit stories entirely from Chromatic testing using the disable story parameter.
30
- */
31
- disable?: boolean;
32
- /**
33
- * Chromatic will pause CSS animations and reset them to their beginning state.
4
+ * Creates variations of the component for the current story. Some
5
+ * padding is applied to the variants for spacing.
34
6
  *
35
- * Some animations are used to "animate in" visible elements. To specify that Chromatic should pause the
36
- * animation at the end, use the `pauseAnimationAtEnd` story parameter.
37
- */
38
- pauseAnimationAtEnd?: boolean;
39
- /**
40
- * Use story-level delay to ensure a minimum amount of time (in milliseconds) has passed before Chromatic takes a
41
- * screenshot.
42
- */
43
- delay?: number;
44
- /**
45
- * The diffThreshold parameter allows you to fine tune the threshold for visual change between snapshots before
46
- * they’re flagged by Chromatic. Sometimes you need assurance to the sub-pixel and other times you want to skip
47
- * visual noise generated by non-deterministic rendering such as anti-aliasing.
7
+ * - `default` adds just the story itself with some padding.
8
+ * - `light` adds a light theme variant.
9
+ * - `dark` adds a dark theme variant.
10
+ * - `rtl` adds a right-to-left writing mode variant.
11
+ * - `mobile` sets the default viewport for the Story with mobile
12
+ * dimensions and uses those dimensions for snapshots.
48
13
  *
49
- * 0 is the most accurate. 1 is the least accurate.
50
- *
51
- * @default 0.063
14
+ * @default undefined
52
15
  */
53
- diffThreshold?: number;
54
- };
16
+ variants?: ('default' | 'light' | 'dark' | 'rtl' | 'mobile')[];
17
+ }
18
+ /**
19
+ * Utility function for creating variants of a CSFv3 story.
20
+ */
21
+ export declare const storyConfig: <Args>(storyObject: StoryObj<Args>, { variants }: StoryConfig) => StoryObj<Args>;
22
+ export {};
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { Story } from '@storybook/react';
2
+ import { StoryObj } from '@storybook/react';
3
+ import Tooltip from './Tooltip';
3
4
  declare const _default: {
4
5
  component: ({ position, children, label, className, }: {
5
6
  position?: "top" | "bottom" | "left" | "right" | undefined;
@@ -8,13 +9,20 @@ declare const _default: {
8
9
  children?: import("react").ReactNode;
9
10
  } & import("../common").CommonProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
10
11
  title: string;
12
+ args: {
13
+ label: string;
14
+ position: "bottom";
15
+ };
16
+ render: (args: {
17
+ position?: "top" | "bottom" | "left" | "right" | undefined;
18
+ label: import("react").ReactNode;
19
+ } & {
20
+ children?: import("react").ReactNode;
21
+ } & import("../common").CommonProps) => JSX.Element;
22
+ tags: string[];
11
23
  };
12
24
  export default _default;
13
- export declare const Basic: {
14
- (): JSX.Element;
15
- play: typeof hoverOverButton;
16
- };
17
- export declare const BasicDarkMode: Story;
18
- declare function hoverOverButton({ canvasElement }: {
19
- canvasElement: HTMLElement;
20
- }): void;
25
+ type Story = StoryObj<typeof Tooltip>;
26
+ export declare const Basic: Story;
27
+ export declare const OpenedTooltip: Story;
28
+ export declare const OpenedTooltipDark: Story;