@transferwise/components 46.71.1 → 46.71.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n React.ComponentPropsWithRef<'a'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n logDeprecationNotices({ size, type });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newType = establishNewType(type);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,gBAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;QAC3BC,MAAI,GAAGC,SAAI,CAACC,MAAM;EAClBC,IAAI,GAAGC,mBAAW,CAACC,MAAM;EACzBC,OAAO;EACP,GAAGC,IAAAA;AACG,CAAA,EACRC,SAAS,KACP;AACF,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;AAEtB;AACAC,EAAAA,iCAAqB,CAAC;UAAEX,MAAI;AAAEG,IAAAA,IAAAA;AAAI,GAAE,CAAC,CAAA;AAErC;AACA,EAAA,MAAMS,OAAO,GAAGC,4BAAgB,CAACV,IAAI,CAAC,CAAA;AACtC;AACA,EAAA,MAAMW,WAAW,GAAGC,gCAAoB,CAAClB,QAAQ,EAAEM,IAAI,CAAC,CAAA;EAExD,MAAMa,OAAO,GAAGC,SAAI,CAClB,CAAA,QAAA,EAAWjB,MAAI,CAAA,CAAE,EACjB,CAAA,cAAA,EAAiBA,MAAI,CAAA,CAAE,EACvB;AACE,IAAA,aAAa,EAAEJ,OAAO;AACtB,IAAA,wBAAwB,EAAEJ,KAAK;AAC/BG,IAAAA,QAAAA;GACD;AACD;AACA;EACA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W3B,OAAO,GAAG,QAAQ,GAAG,KAAM;AACtC,IAAA,WAAA,EAAWA,OAAQ;AACnB,IAAA,YAAA,EAAYA,OAAO,GAAGa,IAAI,CAACuB,aAAa,CAACC,eAAQ,CAACC,gBAAgB,CAAC,GAAG3B,IAAI,CAAC,YAAY,CAAE;AAAAd,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBACNuC,cAAA,CAACC,gBAAgB,EAAA;MACfpC,IAAI,EAAEoB,oBAAoB,EAAG;AAC7B1B,MAAAA,SAAS,EAAC,YAAY;MACtB,aAAY,EAAA,yBAAA;AAAyB,KACrC,CACH,CAAA;AAAA,GACM,CAAC,CAAA;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"Button.js","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n logDeprecationNotices({ size, type });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newType = establishNewType(type);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,gBAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;QAC3BC,MAAI,GAAGC,SAAI,CAACC,MAAM;EAClBC,IAAI,GAAGC,mBAAW,CAACC,MAAM;EACzBC,OAAO;EACP,GAAGC,IAAAA;AACG,CAAA,EACRC,SAAS,KACP;AACF,EAAA,MAAMC,IAAI,GAAGC,iBAAO,EAAE,CAAA;AAEtB;AACAC,EAAAA,iCAAqB,CAAC;UAAEX,MAAI;AAAEG,IAAAA,IAAAA;AAAI,GAAE,CAAC,CAAA;AAErC;AACA,EAAA,MAAMS,OAAO,GAAGC,4BAAgB,CAACV,IAAI,CAAC,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A;AACxB,KAAC,MAAM,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACxCA,OAAO,CAACC,KAAK,CAAC,CAAA;AAChB,KAAA;GACD,CAAA;EAEH,oBACEE,eAAA,CAACR,OAAO,EAAA;AACNS,IAAAA,GAAG,EAAEvB,SAAU;AACfd,IAAAA,SAAS,EAAEsB,OAAQ;AACnBV,IAAAA,OAAO,EAAEoB,WAAW,CAACpB,OAAO,CAAE;AAAA,IAAA,GAC1BiB,KAAK;AACT,IAAA,WAAA,EAAW3B,OAAO,GAAG,QAAQ,GAAG,KAAM;AACtC,IAAA,WAAA,EAAWA,OAAQ;AACnB,IAAA,YAAA,EAAYA,OAAO,GAAGa,IAAI,CAACuB,aAAa,CAACC,eAAQ,CAACC,gBAAgB,CAAC,GAAG3B,IAAI,CAAC,YAAY,CAAE;AAAAd,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBACNuC,cAAA,CAACC,gBAAgB,EAAA;MACfpC,IAAI,EAAEoB,oBAAoB,EAAG;AAC7B1B,MAAAA,SAAS,EAAC,YAAY;MACtB,aAAY,EAAA,yBAAA;AAAyB,KACrC,CACH,CAAA;AAAA,GACM,CAAC,CAAA;AAEd,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n React.ComponentPropsWithRef<'a'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n logDeprecationNotices({ size, type });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newType = establishNewType(type);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","preventDefault","_jsxs","ref","formatMessage","messages","loadingAriaLabel","_jsx","ProcessIndicator"],"mappings":";;;;;;;;;;;AAuDA,MAAMA,MAAM,gBAAGC,UAAU,CACvB,CACE;AACEC,EAAAA,EAAE,EAAEC,SAAS;AACbC,EAAAA,KAAK,GAAG,KAAK;EACbC,QAAQ;EACRC,SAAS;EACTC,QAAQ;AACRC,EAAAA,OAAO,GAAG,KAAK;EACfC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,I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O;AACxBO,MAAAA,IAAI,EAAEqB,QAAAA;KACP,CAAA;AACH,GAAC,MAAM;AACLD,IAAAA,KAAK,GAAG;AACN,MAAA,GAAGhB,IAAI;AACP,MAAA,eAAe,EAAEX,OAAAA;KACH,CAAA;AAClB,GAAA;AAEA;;;AAGG;AACH,EAAA,MAAM8B,WAAW,GACdC,OAAyB,IACzBC,KAAoE,IAAI;IACvE,IAAIjC,QAAQ,IAAIC,OAAO,EAAE;MACvBgC,KAAK,CAACC,cAAc,EAAE,CAAA;AACxB,KAAC,MAAM,IAAI,OAAOF,OAAO,KAAK,UAAU,EAAE;MACxCA,OAAO,CAACC,KAAK,CAAC,CAAA;AAChB,KAAA;GACD,CAAA;EAEH,oBACEE,IAAA,CAACR,OAAO,EAAA;AACNS,IAAAA,GAAG,EAAEvB,SAAU;AACfd,IAAAA,SAAS,EAAEsB,OAAQ;AACnBV,IAAAA,OAAO,EAAEoB,WAAW,CAACpB,OAAO,CAAE;AAAA,IAAA,GAC1BiB,KAAK;AACT,IAAA,WAAA,EAAW3B,OAAO,GAAG,QAAQ,GAAG,KAAM;AACtC,IAAA,WAAA,EAAWA,OAAQ;AACnB,IAAA,YAAA,EAAYA,OAAO,GAAGa,IAAI,CAACuB,aAAa,CAACC,QAAQ,CAACC,gBAAgB,CAAC,GAAG3B,IAAI,CAAC,YAAY,CAAE;AAAAd,IAAAA,QAAA,GAExFA,QAAQ,EACRG,OAAO,iBACNuC,GAAA,CAACC,gBAAgB,EAAA;MACfpC,IAAI,EAAEoB,oBAAoB,EAAG;AAC7B1B,MAAAA,SAAS,EAAC,YAAY;MACtB,aAAY,EAAA,yBAAA;AAAyB,KACrC,CACH,CAAA;AAAA,GACM,CAAC,CAAA;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"Button.mjs","sources":["../../src/button/Button.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { ElementType, forwardRef, MouseEvent } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport {\n Size,\n ControlType,\n Priority,\n ControlTypeAccent,\n ControlTypeNegative,\n ControlTypePositive,\n PriorityPrimary,\n PrioritySecondary,\n PriorityTertiary,\n SizeExtraSmall,\n SizeSmall,\n SizeMedium,\n SizeLarge,\n} from '../common';\nimport ProcessIndicator from '../processIndicator';\n\nimport messages from './Button.messages';\nimport { typeClassMap, priorityClassMap } from './classMap';\nimport { establishNewPriority, establishNewType, logDeprecationNotices } from './legacyUtils';\n\n/** @deprecated */\ntype DeprecatedTypes = 'primary' | 'pay' | 'secondary' | 'danger' | 'link';\n\n/** @deprecated */\ntype DeprecatedSizes = SizeExtraSmall;\n\ntype CommonProps = {\n block?: boolean;\n disabled?: boolean;\n loading?: boolean;\n type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;\n priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;\n size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;\n};\n\ntype ButtonProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'button'>, 'type'> & {\n as?: 'button';\n htmlType?: 'submit' | 'reset' | 'button';\n };\n\ntype AnchorProps = CommonProps &\n Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {\n as?: 'a';\n };\n\nexport type Props = ButtonProps | AnchorProps;\n\ntype ButtonReferenceType = HTMLButtonElement | HTMLAnchorElement;\n\nconst Button = forwardRef<ButtonReferenceType, Props>(\n (\n {\n as: component,\n block = false,\n children,\n className,\n disabled,\n loading = false,\n priority = Priority.PRIMARY,\n size = Size.MEDIUM,\n type = ControlType.ACCENT,\n onClick,\n ...rest\n }: Props,\n reference,\n ) => {\n const intl = useIntl();\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n logDeprecationNotices({ size, type });\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newType = establishNewType(type);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const newPriority = establishNewPriority(priority, type);\n\n const classes = clsx(\n `btn btn-${size}`,\n `np-btn np-btn-${size}`,\n {\n 'btn-loading': loading,\n 'btn-block np-btn-block': block,\n disabled,\n },\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n typeClassMap[newType],\n // @ts-expect-error fix when refactor `typeClassMap` to TypeScript\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n priorityClassMap[newPriority],\n className,\n );\n\n function processIndicatorSize() {\n return ['sm', 'xs'].includes(size) ? 'xxs' : 'xs';\n }\n\n const Element = (component as ElementType) ?? 'button';\n let props;\n\n if (Element === 'button') {\n const { htmlType = 'button', ...restProps } = rest as ButtonProps;\n props = {\n ...restProps,\n disabled,\n 'aria-disabled': loading,\n type: htmlType,\n };\n } else {\n props = {\n ...rest,\n 'aria-disabled': loading,\n } as AnchorProps;\n }\n\n /**\n * Ensures that the button cannot be activated in loading or disabled mode,\n * when `aria-disabled` might be used over the `disabled` HTML attribute\n */\n const handleClick =\n (handler: Props['onClick']) =>\n (event: MouseEvent<HTMLButtonElement> & MouseEvent<HTMLAnchorElement>) => {\n if (disabled || loading) {\n event.preventDefault();\n } else if (typeof handler === 'function') {\n handler(event);\n }\n };\n\n return (\n <Element\n ref={reference}\n className={classes}\n onClick={handleClick(onClick)}\n {...props}\n aria-live={loading ? 'polite' : 'off'}\n aria-busy={loading}\n aria-label={loading ? intl.formatMessage(messages.loadingAriaLabel) : rest['aria-label']}\n >\n {children}\n {loading && (\n <ProcessIndicator\n size={processIndicatorSize()}\n className=\"btn-loader\"\n data-testid=\"ButtonProgressIndicator\"\n />\n )}\n </Element>\n );\n },\n);\n\nexport default Button;\n"],"names":["Button","forwardRef","as","component","block","children","className","disabled","loading","priority","Priority","PRIMARY","size","Size","MEDIUM","type","ControlType","ACCENT","onClick","rest","reference","intl","useIntl","logDeprecationNotices","newType","establishNewType","newPriority","establishNewPriority","classes","clsx","typeClassMap","priorityClassMap","processIndicatorSize","includes","Element","props","htmlType","restProps","handleClick","handler","event","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gB,EAAA;MACfpC,IAAI,EAAEoB,oBAAoB,EAAG;AAC7B1B,MAAAA,SAAS,EAAC,YAAY;MACtB,aAAY,EAAA,yBAAA;AAAyB,KACrC,CACH,CAAA;AAAA,GACM,CAAC,CAAA;AAEd,CAAC;;;;"}
@@ -43,13 +43,14 @@ function Instruction({
43
43
  const isInstructionNode = typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
44
44
  return /*#__PURE__*/jsxRuntime.jsxs("li", {
45
45
  className: "instruction",
46
- "aria-label": isInstructionNode ? item['aria-label'] : undefined,
47
46
  children: [type === 'do' ? /*#__PURE__*/jsxRuntime.jsx(icons.CheckCircleFill, {
48
47
  size: 24,
49
- className: type
48
+ className: type,
49
+ title: isInstructionNode ? item['aria-label'] : undefined
50
50
  }) : /*#__PURE__*/jsxRuntime.jsx(icons.CrossCircleFill, {
51
51
  size: 24,
52
- className: type
52
+ className: type,
53
+ title: isInstructionNode ? item['aria-label'] : undefined
53
54
  }), /*#__PURE__*/jsxRuntime.jsx(Body, {
54
55
  className: "text-primary",
55
56
  type: typography.Typography.BODY_LARGE,
@@ -1 +1 @@
1
- {"version":3,"file":"InstructionsList.js","sources":["../../src/instructionsList/InstructionsList.tsx"],"sourcesContent":["import { CrossCircleFill as DontIcon, CheckCircleFill as DoIcon } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport Body from '../body/Body';\nimport { Typography, CommonProps } from '../common';\n\ntype InstructionNode = {\n content: ReactNode;\n ['aria-label']: string;\n};\n\nexport type InstructionsListProps = CommonProps &\n (\n | {\n dos?: readonly ReactNode[];\n donts?: readonly ReactNode[];\n sort?: 'dosFirst' | 'dontsFirst';\n }\n | {\n dos?: readonly InstructionNode[];\n donts?: readonly InstructionNode[];\n sort?: 'dosFirst' | 'dontsFirst';\n }\n );\n\nconst InstructionsList = ({ className, dos, donts, sort = 'dosFirst' }: InstructionsListProps) => {\n const dosInstructions =\n dos?.map((doThis, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Instruction key={index} item={doThis} type=\"do\" />\n )) ?? null;\n\n const dontsInstructions =\n donts?.map((dont, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Instruction key={index} item={dont} type=\"dont\" />\n )) ?? null;\n\n const orderedInstructions =\n sort === 'dosFirst' ? (\n <>\n {dosInstructions}\n {dontsInstructions}\n </>\n ) : (\n <>\n {dontsInstructions}\n {dosInstructions}\n </>\n );\n\n return <ul className={clsx('tw-instructions', className)}>{orderedInstructions}</ul>;\n};\n\nfunction Instruction({ item, type }: { item: ReactNode | InstructionNode; type: 'do' | 'dont' }) {\n const isInstructionNode =\n typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;\n return (\n <li className=\"instruction\" aria-label={isInstructionNode ? item['aria-label'] : undefined}>\n {type === 'do' ? (\n <DoIcon size={24} className={type} />\n ) : (\n <DontIcon size={24} className={type} />\n )}\n <Body className=\"text-primary\" type={Typography.BODY_LARGE}>\n {isInstructionNode ? item.content : item}\n </Body>\n </li>\n );\n}\n\nexport default InstructionsList;\n"],"names":["InstructionsList","className","dos","donts","sort","dosInstructions","map","doThis","index","_jsx","Instruction","item","type","dontsInstructions","dont","orderedInstructions","_jsxs","_Fragment","children","clsx","isInstructionNode","undefined","DoIcon","size","DontIcon","Body","Typography","BODY_LARGE","content"],"mappings":";;;;;;;;AA0BMA,MAAAA,gBAAgB,GAAGA,CAAC;EAAEC,SAAS;EAAEC,GAAG;EAAEC,KAAK;AAAEC,EAAAA,IAAI,GAAG,UAAA;AAAU,CAAyB,KAAI;EAC/F,MAAMC,eAAe,GACnBH,GAAG,EAAEI,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK;AAAA;AACrB;AACAC,EAAAA,cAAA,CAACC,WAAW,EAAA;AAAaC,IAAAA,IAAI,EAAEJ,MAAO;AAACK,IAAAA,IAAI,EAAC,IAAA;AAAI,GAAA,EAA9BJ,MACnB,CAAC,IAAI,IAAI,CAAA;EAEZ,MAAMK,iBAA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ACe,qBAAQ,EAAA;AAACD,MAAAA,IAAI,EAAE,EAAG;AAACtB,MAAAA,SAAS,EAAEW,IAAAA;AAAK,KAAA,CACrC,eACDH,cAAA,CAACgB,IAAI,EAAA;AAACxB,MAAAA,SAAS,EAAC,cAAc;MAACW,IAAI,EAAEc,qBAAU,CAACC,UAAW;AAAAT,MAAAA,QAAA,EACxDE,iBAAiB,GAAGT,IAAI,CAACiB,OAAO,GAAGjB,IAAAA;AAAI,KACpC,CACR,CAAA;AAAA,GAAI,CAAC,CAAA;AAET;;;;"}
1
+ {"version":3,"file":"InstructionsList.js","sources":["../../src/instructionsList/InstructionsList.tsx"],"sourcesContent":["import { CrossCircleFill as DontIcon, CheckCircleFill as DoIcon } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport Body from '../body/Body';\nimport { Typography, CommonProps } from '../common';\n\ntype InstructionNode = {\n content: ReactNode;\n ['aria-label']: string;\n};\n\nexport type InstructionsListProps = CommonProps &\n (\n | {\n dos?: readonly ReactNode[];\n donts?: readonly ReactNode[];\n sort?: 'dosFirst' | 'dontsFirst';\n }\n | {\n dos?: readonly InstructionNode[];\n donts?: readonly InstructionNode[];\n sort?: 'dosFirst' | 'dontsFirst';\n }\n );\n\nconst InstructionsList = ({ className, dos, donts, sort = 'dosFirst' }: InstructionsListProps) => {\n const dosInstructions =\n dos?.map((doThis, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Instruction key={index} item={doThis} type=\"do\" />\n )) ?? null;\n\n const dontsInstructions =\n donts?.map((dont, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Instruction key={index} item={dont} type=\"dont\" />\n )) ?? null;\n\n const orderedInstructions =\n sort === 'dosFirst' ? (\n <>\n {dosInstructions}\n {dontsInstructions}\n </>\n ) : (\n <>\n {dontsInstructions}\n {dosInstructions}\n </>\n );\n\n return <ul className={clsx('tw-instructions', className)}>{orderedInstructions}</ul>;\n};\n\nfunction Instruction({ item, type }: { item: ReactNode | InstructionNode; type: 'do' | 'dont' }) {\n const isInstructionNode =\n typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;\n return (\n <li className=\"instruction\">\n {type === 'do' ? (\n <DoIcon\n size={24}\n className={type}\n title={isInstructionNode ? item['aria-label'] : undefined}\n />\n ) : (\n <DontIcon\n size={24}\n className={type}\n title={isInstructionNode ? item['aria-label'] : undefined}\n />\n )}\n <Body className=\"text-primary\" type={Typography.BODY_LARGE}>\n {isInstructionNode ? item.content : item}\n </Body>\n </li>\n );\n}\n\nexport default InstructionsList;\n"],"names":["InstructionsList","className","dos","donts","sort","dosInstructions","map","doThis","index","_jsx","Instruction","item","type","dontsInstructions","dont","orderedInstructions","_jsxs","_Fragment","children","clsx","isInstructionNode","DoIcon","size","title","undefined","DontIcon","Body","Typography","BODY_LARGE","content"],"mappings":";;;;;;;;AA0BMA,MAAAA,gBAAgB,GAAGA,CAAC;EAAEC,SAAS;EAAEC,GAAG;EAAEC,KAAK;AAAEC,EAAAA,IAAI,GAAG,UAAA;AAAU,CAAyB,KAAI;EAC/F,MAAMC,eAAe,GACnBH,GAAG,EAAEI,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK;AAAA;AACrB;AACAC,EAAAA,cAAA,CAACC,WAAW,EAAA;AAAaC,IAAAA,IAAI,EAAEJ,MAAO;AAACK,IAAAA,IAAI,EAAC,IAAA;AAAI,GAAA,EAA9BJ,MACnB,CAAC,IAAI,IAAI,CAAA;EAEZ,MAAMK,iBAAiB,GACrBV,KAAK,EAAEG,GAAG,CAAC,CAACQ,IAAI,EAAEN,KAAK;AAAA;AACrB;AACAC,EAAAA,cAAA,CAACC,WAAW,EAAA;AAAaC,IAAAA,IAAI,EAAEG,IAAK;AAACF,IAAAA,IAAI,EAAC,MAAA;AAAM,GAAA,EAA9BJ,MACnB,CAAC,IAAI,IAAI,CAAA;EAEZ,MAAMO,mBAAmB,GACvBX,IAAI,KAAK,UAAU,gBACjBY,eAAA,CAAAC,mBAAA,EAAA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,QAAA,EACxDE,iBAAiB,GAAGT,IAAI,CAACkB,OAAO,GAAGlB,IAAAA;AAAI,KACpC,CACR,CAAA;AAAA,GAAI,CAAC,CAAA;AAET;;;;"}
@@ -41,13 +41,14 @@ function Instruction({
41
41
  const isInstructionNode = typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
42
42
  return /*#__PURE__*/jsxs("li", {
43
43
  className: "instruction",
44
- "aria-label": isInstructionNode ? item['aria-label'] : undefined,
45
44
  children: [type === 'do' ? /*#__PURE__*/jsx(CheckCircleFill, {
46
45
  size: 24,
47
- className: type
46
+ className: type,
47
+ title: isInstructionNode ? item['aria-label'] : undefined
48
48
  }) : /*#__PURE__*/jsx(CrossCircleFill, {
49
49
  size: 24,
50
- className: type
50
+ className: type,
51
+ title: isInstructionNode ? item['aria-label'] : undefined
51
52
  }), /*#__PURE__*/jsx(Body, {
52
53
  className: "text-primary",
53
54
  type: Typography.BODY_LARGE,
@@ -1 +1 @@
1
- {"version":3,"file":"InstructionsList.mjs","sources":["../../src/instructionsList/InstructionsList.tsx"],"sourcesContent":["import { CrossCircleFill as DontIcon, CheckCircleFill as DoIcon } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport Body from '../body/Body';\nimport { Typography, CommonProps } from '../common';\n\ntype InstructionNode = {\n content: ReactNode;\n ['aria-label']: string;\n};\n\nexport type InstructionsListProps = CommonProps &\n (\n | {\n dos?: readonly ReactNode[];\n donts?: readonly ReactNode[];\n sort?: 'dosFirst' | 'dontsFirst';\n }\n | {\n dos?: readonly InstructionNode[];\n donts?: readonly InstructionNode[];\n sort?: 'dosFirst' | 'dontsFirst';\n }\n );\n\nconst InstructionsList = ({ className, dos, donts, sort = 'dosFirst' }: InstructionsListProps) => {\n const dosInstructions =\n dos?.map((doThis, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Instruction key={index} item={doThis} type=\"do\" />\n )) ?? null;\n\n const dontsInstructions =\n donts?.map((dont, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Instruction key={index} item={dont} type=\"dont\" />\n )) ?? null;\n\n const orderedInstructions =\n sort === 'dosFirst' ? (\n <>\n {dosInstructions}\n {dontsInstructions}\n </>\n ) : (\n <>\n {dontsInstructions}\n {dosInstructions}\n </>\n );\n\n return <ul className={clsx('tw-instructions', className)}>{orderedInstructions}</ul>;\n};\n\nfunction Instruction({ item, type }: { item: ReactNode | InstructionNode; type: 'do' | 'dont' }) {\n const isInstructionNode =\n typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;\n return (\n <li className=\"instruction\" aria-label={isInstructionNode ? item['aria-label'] : undefined}>\n {type === 'do' ? (\n <DoIcon size={24} className={type} />\n ) : (\n <DontIcon size={24} className={type} />\n )}\n <Body className=\"text-primary\" type={Typography.BODY_LARGE}>\n {isInstructionNode ? item.content : item}\n </Body>\n </li>\n );\n}\n\nexport default InstructionsList;\n"],"names":["InstructionsList","className","dos","donts","sort","dosInstructions","map","doThis","index","_jsx","Instruction","item","type","dontsInstructions","dont","orderedInstructions","_jsxs","_Fragment","children","clsx","isInstructionNode","undefined","DoIcon","size","DontIcon","Body","Typography","BODY_LARGE","content"],"mappings":";;;;;;AA0BMA,MAAAA,gBAAgB,GAAGA,CAAC;EAAEC,SAAS;EAAEC,GAAG;EAAEC,KAAK;AAAEC,EAAAA,IAAI,GAAG,UAAA;AAAU,CAAyB,KAAI;EAC/F,MAAMC,eAAe,GACnBH,GAAG,EAAEI,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK;AAAA;AACrB;AACAC,EAAAA,GAAA,CAACC,WAAW,EAAA;AAAaC,IAAAA,IAAI,EAAEJ,MAAO;AAACK,IAAAA,IAAI,EAAC,IAAA;AAAI,GAAA,EAA9BJ,MACnB,CAAC,IAAI,IAAI,CAAA;EAEZ,MAAMK,iBAAiB,GACrBV,KAAK,EAAEG,GAAG,CAAC,CAACQ,IAAI,EAAEN,KAAK;AAAA;AACrB;AACAC,EAAAA,GAAA,CAAC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eACDH,GAAA,CAACgB,IAAI,EAAA;AAACxB,MAAAA,SAAS,EAAC,cAAc;MAACW,IAAI,EAAEc,UAAU,CAACC,UAAW;AAAAT,MAAAA,QAAA,EACxDE,iBAAiB,GAAGT,IAAI,CAACiB,OAAO,GAAGjB,IAAAA;AAAI,KACpC,CACR,CAAA;AAAA,GAAI,CAAC,CAAA;AAET;;;;"}
1
+ {"version":3,"file":"InstructionsList.mjs","sources":["../../src/instructionsList/InstructionsList.tsx"],"sourcesContent":["import { CrossCircleFill as DontIcon, CheckCircleFill as DoIcon } from '@transferwise/icons';\nimport { clsx } from 'clsx';\nimport { ReactNode } from 'react';\n\nimport Body from '../body/Body';\nimport { Typography, CommonProps } from '../common';\n\ntype InstructionNode = {\n content: ReactNode;\n ['aria-label']: string;\n};\n\nexport type InstructionsListProps = CommonProps &\n (\n | {\n dos?: readonly ReactNode[];\n donts?: readonly ReactNode[];\n sort?: 'dosFirst' | 'dontsFirst';\n }\n | {\n dos?: readonly InstructionNode[];\n donts?: readonly InstructionNode[];\n sort?: 'dosFirst' | 'dontsFirst';\n }\n );\n\nconst InstructionsList = ({ className, dos, donts, sort = 'dosFirst' }: InstructionsListProps) => {\n const dosInstructions =\n dos?.map((doThis, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Instruction key={index} item={doThis} type=\"do\" />\n )) ?? null;\n\n const dontsInstructions =\n donts?.map((dont, index) => (\n // eslint-disable-next-line react/no-array-index-key\n <Instruction key={index} item={dont} type=\"dont\" />\n )) ?? null;\n\n const orderedInstructions =\n sort === 'dosFirst' ? (\n <>\n {dosInstructions}\n {dontsInstructions}\n </>\n ) : (\n <>\n {dontsInstructions}\n {dosInstructions}\n </>\n );\n\n return <ul className={clsx('tw-instructions', className)}>{orderedInstructions}</ul>;\n};\n\nfunction Instruction({ item, type }: { item: ReactNode | InstructionNode; type: 'do' | 'dont' }) {\n const isInstructionNode =\n typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;\n return (\n <li className=\"instruction\">\n {type === 'do' ? (\n <DoIcon\n size={24}\n className={type}\n title={isInstructionNode ? item['aria-label'] : undefined}\n />\n ) : (\n <DontIcon\n size={24}\n className={type}\n title={isInstructionNode ? item['aria-label'] : undefined}\n />\n )}\n <Body className=\"text-primary\" type={Typography.BODY_LARGE}>\n {isInstructionNode ? item.content : item}\n </Body>\n </li>\n );\n}\n\nexport default InstructionsList;\n"],"names":["InstructionsList","className","dos","donts","sort","dosInstructions","map","doThis","index","_jsx","Instruction","item","type","dontsInstructions","dont","orderedInstructions","_jsxs","_Fragment","children","clsx","isInstructionNode","DoIcon","size","title","undefined","DontIcon","Body","Typography","BODY_LARGE","content"],"mappings":";;;;;;AA0BMA,MAAAA,gBAAgB,GAAGA,CAAC;EAAEC,SAAS;EAAEC,GAAG;EAAEC,KAAK;AAAEC,EAAAA,IAAI,GAAG,UAAA;AAAU,CAAyB,KAAI;EAC/F,MAAMC,eAAe,GACnBH,GAAG,EAAEI,GAAG,CAAC,CAACC,MAAM,EAAEC,KAAK;AAAA;AACrB;AACAC,EAAAA,GAAA,CAACC,WAAW,EAAA;AAAaC,IAAAA,IAAI,EAAEJ,MAAO;AAACK,IAAAA,IAAI,EAAC,IAAA;AAAI,GAAA,EAA9BJ,MACnB,CAAC,IAAI,IAAI,CAAA;EAEZ,MAAMK,iBAAiB,GACrBV,KAAK,EAAEG,GAAG,CAAC,CAACQ,IAAI,EAAEN,KAAK;AAAA;AACrB;AACAC,EAAAA,GAAA,CAACC,WAAW,EAAA;AAAaC,IAAAA,IAAI,EAAEG,IAAK;AAACF,IAAAA,IAAI,EAAC,MAAA;AAAM,GAAA,EAA9BJ,MACnB,CAAC,IAAI,IAAI,CAAA;EAEZ,MAAMO,mBAAmB,GACvBX,IAAI,KAAK,UAAU,gBACjBY,IAAA,CAAAC,QAAA,EAAA;IAAAC,QAAA,EAAA,CACGb,eAAe,EACfQ,iBAAiB,CAAA;AAAA,GACpB,CAAG,gBAEHG,IAAA,CAAAC,QAAA,EAAA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A;AAET;;;;"}
@@ -15,7 +15,7 @@ type ButtonProps = CommonProps & Omit<React.ComponentPropsWithRef<'button'>, 'ty
15
15
  as?: 'button';
16
16
  htmlType?: 'submit' | 'reset' | 'button';
17
17
  };
18
- type AnchorProps = CommonProps & React.ComponentPropsWithRef<'a'> & {
18
+ type AnchorProps = CommonProps & Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {
19
19
  as?: 'a';
20
20
  };
21
21
  export type Props = ButtonProps | AnchorProps;
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/button/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAIL,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,UAAU,EACV,SAAS,EACV,MAAM,WAAW,CAAC;AAOnB,kBAAkB;AAClB,KAAK,eAAe,GAAG,SAAS,GAAG,KAAK,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3E,kBAAkB;AAClB,KAAK,eAAe,GAAG,cAAc,CAAC;AAEtC,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,iBAAiB,GAAG,mBAAmB,GAAG,mBAAmB,GAAG,eAAe,GAAG,IAAI,CAAC;IAC9F,QAAQ,CAAC,EAAE,eAAe,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,IAAI,CAAC;IACzE,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,eAAe,CAAC;CAC7D,CAAC;AAEF,KAAK,WAAW,GAAG,WAAW,GAC5B,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,GAAG;IACpD,EAAE,CAAC,EAAE,Q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A2B5F,CAAC;AAmBF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"InstructionsList.d.ts","sourceRoot":"","sources":["../../../src/instructionsList/InstructionsList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EAAc,WAAW,EAAE,MAAM,WAAW,CAAC;AAEpD,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,SAAS,CAAC;IACnB,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,WAAW,GAC7C,CACI;IACE,GAAG,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B,IAAI,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;CAClC,GACD;IACE,GAAG,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACjC,KAAK,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACnC,IAAI,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;CAClC,CACJ,CAAC;AAEJ,QAAA,MAAM,gBAAgB,oCAAkD,qBAAqB,gCA2B5F,CAAC;AA2BF,eAAe,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.71.1",
3
+ "version": "46.71.2",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -68,7 +68,7 @@
68
68
  "@testing-library/jest-dom": "^6.4.6",
69
69
  "@testing-library/react": "^16.0.0",
70
70
  "@testing-library/user-event": "^14.5.2",
71
- "@transferwise/icons": "^3.7.0",
71
+ "@transferwise/icons": "^3.13.1",
72
72
  "@tsconfig/recommended": "^1.0.7",
73
73
  "@types/babel__core": "^7.20.5",
74
74
  "@types/commonmark": "^0.27.9",
@@ -96,7 +96,7 @@
96
96
  "@wise/components-theming": "1.6.0"
97
97
  },
98
98
  "peerDependencies": {
99
- "@transferwise/icons": "^3.7.0",
99
+ "@transferwise/icons": "^3.13.1",
100
100
  "@transferwise/neptune-css": "^14.9.6",
101
101
  "@wise/art": "^2.7.0",
102
102
  "@wise/components-theming": "^1.0.0",
@@ -28,15 +28,15 @@ exports[`AccordionItem open / close renders an item closed 1`] = `
28
28
  class="media-right"
29
29
  >
30
30
  <span
31
- aria-hidden="true"
32
31
  class="tw-icon tw-icon-chevron-up tw-chevron chevron-color bottom"
33
32
  data-testid="chevron-up-icon"
34
- role="presentation"
35
33
  >
36
34
  <svg
35
+ aria-hidden="true"
37
36
  fill="currentColor"
38
37
  focusable="false"
39
38
  height="24"
39
+ role="none"
40
40
  viewBox="0 0 24 24"
41
41
  width="24"
42
42
  >
@@ -80,15 +80,15 @@ exports[`AccordionItem open / close renders an item open 1`] = `
80
80
  class="media-right"
81
81
  >
82
82
  <span
83
- aria-hidden="true"
84
83
  class="tw-icon tw-icon-chevron-up tw-chevron chevron-color top"
85
84
  data-testid="chevron-up-icon"
86
- role="presentation"
87
85
  >
88
86
  <svg
87
+ aria-hidden="true"
89
88
  fill="currentColor"
90
89
  focusable="false"
91
90
  height="24"
91
+ role="none"
92
92
  viewBox="0 0 24 24"
93
93
  width="24"
94
94
  >
@@ -23,15 +23,15 @@ exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar w
23
23
  class="tw-avatar__content"
24
24
  >
25
25
  <span
26
- aria-hidden="true"
27
26
  class="tw-icon tw-icon-briefcase "
28
27
  data-testid="briefcase-icon"
29
- role="presentation"
30
28
  >
31
29
  <svg
30
+ aria-hidden="true"
32
31
  fill="currentColor"
33
32
  focusable="false"
34
33
  height="24"
34
+ role="none"
35
35
  viewBox="0 0 24 24"
36
36
  width="24"
37
37
  >
@@ -52,15 +52,15 @@ exports[`FlowNavigationAvatar with a name AND profileType FlowNavigationAvatar w
52
52
  class="tw-avatar__content"
53
53
  >
54
54
  <span
55
- aria-hidden="true"
56
55
  class="tw-icon tw-icon-person "
57
56
  data-testid="person-icon"
58
- role="presentation"
59
57
  >
60
58
  <svg
59
+ aria-hidden="true"
61
60
  fill="currentColor"
62
61
  focusable="false"
63
62
  height="24"
63
+ role="none"
64
64
  viewBox="0 0 24 24"
65
65
  width="24"
66
66
  >
@@ -87,15 +87,15 @@ exports[`FlowNavigationAvatar with a name AND profileType with a badge url passe
87
87
  class="tw-avatar__content"
88
88
  >
89
89
  <span
90
- aria-hidden="true"
91
90
  class="tw-icon tw-icon-person "
92
91
  data-testid="person-icon"
93
- role="presentation"
94
92
  >
95
93
  <svg
94
+ aria-hidden="true"
96
95
  fill="currentColor"
97
96
  focusable="false"
98
97
  height="24"
98
+ role="none"
99
99
  viewBox="0 0 24 24"
100
100
  width="24"
101
101
  >
@@ -126,15 +126,15 @@ exports[`FlowNavigationAvatar with a name AND profileType with nothing passed re
126
126
  class="tw-avatar__content"
127
127
  >
128
128
  <span
129
- aria-hidden="true"
130
129
  class="tw-icon tw-icon-person "
131
130
  data-testid="person-icon"
132
- role="presentation"
133
131
  >
134
132
  <svg
133
+ aria-hidden="true"
135
134
  fill="currentColor"
136
135
  focusable="false"
137
136
  height="24"
137
+ role="none"
138
138
  viewBox="0 0 24 24"
139
139
  width="24"
140
140
  >
@@ -45,7 +45,7 @@ type ButtonProps = CommonProps &
45
45
  };
46
46
 
47
47
  type AnchorProps = CommonProps &
48
- React.ComponentPropsWithRef<'a'> & {
48
+ Omit<React.ComponentPropsWithRef<'a'>, 'type'> & {
49
49
  as?: 'a';
50
50
  };
51
51
 
@@ -127,15 +127,15 @@ exports[`Chips Filter Chips renders as expected 1`] = `
127
127
  type="button"
128
128
  >
129
129
  <span
130
- aria-hidden="true"
131
130
  class="tw-icon tw-icon-cross "
132
131
  data-testid="cross-icon"
133
- role="presentation"
134
132
  >
135
133
  <svg
134
+ aria-hidden="true"
136
135
  fill="currentColor"
137
136
  focusable="false"
138
137
  height="16"
138
+ role="none"
139
139
  viewBox="0 0 24 24"
140
140
  width="16"
141
141
  >
@@ -11,15 +11,15 @@ exports[`CircularButton defaults renders a button of type accent and priority pr
11
11
  type="button"
12
12
  />
13
13
  <span
14
- aria-hidden="true"
15
14
  class="tw-icon tw-icon-plus "
16
15
  data-testid="plus-icon"
17
- role="presentation"
18
16
  >
19
17
  <svg
18
+ aria-hidden="true"
20
19
  fill="currentColor"
21
20
  focusable="false"
22
21
  height="24"
22
+ role="none"
23
23
  viewBox="0 0 24 24"
24
24
  width="24"
25
25
  >
@@ -48,15 +48,15 @@ exports[`CircularButton priorities renders primary buttons 1`] = `
48
48
  type="button"
49
49
  />
50
50
  <span
51
- aria-hidden="true"
52
51
  class="tw-icon tw-icon-plus "
53
52
  data-testid="plus-icon"
54
- role="presentation"
55
53
  >
56
54
  <svg
55
+ aria-hidden="true"
57
56
  fill="currentColor"
58
57
  focusable="false"
59
58
  height="24"
59
+ role="none"
60
60
  viewBox="0 0 24 24"
61
61
  width="24"
62
62
  >
@@ -85,15 +85,15 @@ exports[`CircularButton priorities renders primary buttons 2`] = `
85
85
  type="button"
86
86
  />
87
87
  <span
88
- aria-hidden="true"
89
88
  class="tw-icon tw-icon-plus "
90
89
  data-testid="plus-icon"
91
- role="presentation"
92
90
  >
93
91
  <svg
92
+ aria-hidden="true"
94
93
  fill="currentColor"
95
94
  focusable="false"
96
95
  height="24"
96
+ role="none"
97
97
  viewBox="0 0 24 24"
98
98
  width="24"
99
99
  >
@@ -122,15 +122,15 @@ exports[`CircularButton priorities renders primary buttons 3`] = `
122
122
  type="button"
123
123
  />
124
124
  <span
125
- aria-hidden="true"
126
125
  class="tw-icon tw-icon-plus "
127
126
  data-testid="plus-icon"
128
- role="presentation"
129
127
  >
130
128
  <svg
129
+ aria-hidden="true"
131
130
  fill="currentColor"
132
131
  focusable="false"
133
132
  height="24"
133
+ role="none"
134
134
  viewBox="0 0 24 24"
135
135
  width="24"
136
136
  >
@@ -159,15 +159,15 @@ exports[`CircularButton priorities renders secondary buttons 1`] = `
159
159
  type="button"
160
160
  />
161
161
  <span
162
- aria-hidden="true"
163
162
  class="tw-icon tw-icon-plus "
164
163
  data-testid="plus-icon"
165
- role="presentation"
166
164
  >
167
165
  <svg
166
+ aria-hidden="true"
168
167
  fill="currentColor"
169
168
  focusable="false"
170
169
  height="24"
170
+ role="none"
171
171
  viewBox="0 0 24 24"
172
172
  width="24"
173
173
  >
@@ -196,15 +196,15 @@ exports[`CircularButton priorities renders secondary buttons 2`] = `
196
196
  type="button"
197
197
  />
198
198
  <span
199
- aria-hidden="true"
200
199
  class="tw-icon tw-icon-plus "
201
200
  data-testid="plus-icon"
202
- role="presentation"
203
201
  >
204
202
  <svg
203
+ aria-hidden="true"
205
204
  fill="currentColor"
206
205
  focusable="false"
207
206
  height="24"
207
+ role="none"
208
208
  viewBox="0 0 24 24"
209
209
  width="24"
210
210
  >
@@ -233,15 +233,15 @@ exports[`CircularButton priorities renders secondary buttons 3`] = `
233
233
  type="button"
234
234
  />
235
235
  <span
236
- aria-hidden="true"
237
236
  class="tw-icon tw-icon-plus "
238
237
  data-testid="plus-icon"
239
- role="presentation"
240
238
  >
241
239
  <svg
240
+ aria-hidden="true"
242
241
  fill="currentColor"
243
242
  focusable="false"
244
243
  height="24"
244
+ role="none"
245
245
  viewBox="0 0 24 24"
246
246
  width="24"
247
247
  >
@@ -270,15 +270,15 @@ exports[`CircularButton types renders accent buttons 1`] = `
270
270
  type="button"
271
271
  />
272
272
  <span
273
- aria-hidden="true"
274
273
  class="tw-icon tw-icon-plus "
275
274
  data-testid="plus-icon"
276
- role="presentation"
277
275
  >
278
276
  <svg
277
+ aria-hidden="true"
279
278
  fill="currentColor"
280
279
  focusable="false"
281
280
  height="24"
281
+ role="none"
282
282
  viewBox="0 0 24 24"
283
283
  width="24"
284
284
  >
@@ -307,15 +307,15 @@ exports[`CircularButton types renders negative buttons 1`] = `
307
307
  type="button"
308
308
  />
309
309
  <span
310
- aria-hidden="true"
311
310
  class="tw-icon tw-icon-plus "
312
311
  data-testid="plus-icon"
313
- role="presentation"
314
312
  >
315
313
  <svg
314
+ aria-hidden="true"
316
315
  fill="currentColor"
317
316
  focusable="false"
318
317
  height="24"
318
+ role="none"
319
319
  viewBox="0 0 24 24"
320
320
  width="24"
321
321
  >
@@ -344,15 +344,15 @@ exports[`CircularButton types renders positive buttons 1`] = `
344
344
  type="button"
345
345
  />
346
346
  <span
347
- aria-hidden="true"
348
347
  class="tw-icon tw-icon-plus "
349
348
  data-testid="plus-icon"
350
- role="presentation"
351
349
  >
352
350
  <svg
351
+ aria-hidden="true"
353
352
  fill="currentColor"
354
353
  focusable="false"
355
354
  height="24"
355
+ role="none"
356
356
  viewBox="0 0 24 24"
357
357
  width="24"
358
358
  >
@@ -39,15 +39,15 @@ exports[`BottomSheet renders content when open 1`] = `
39
39
  type="button"
40
40
  >
41
41
  <span
42
- aria-hidden="true"
43
42
  class="tw-icon tw-icon-cross "
44
43
  data-testid="cross-icon"
45
- role="presentation"
46
44
  >
47
45
  <svg
46
+ aria-hidden="true"
48
47
  fill="currentColor"
49
48
  focusable="false"
50
49
  height="16"
50
+ role="none"
51
51
  viewBox="0 0 24 24"
52
52
  width="16"
53
53
  >
@@ -8,15 +8,15 @@ exports[`CloseButton renders as expected 1`] = `
8
8
  type="button"
9
9
  >
10
10
  <span
11
- aria-hidden="true"
12
11
  class="tw-icon tw-icon-cross "
13
12
  data-testid="cross-icon"
14
- role="presentation"
15
13
  >
16
14
  <svg
15
+ aria-hidden="true"
17
16
  fill="currentColor"
18
17
  focusable="false"
19
18
  height="24"
19
+ role="none"
20
20
  viewBox="0 0 24 24"
21
21
  width="24"
22
22
  >
@@ -24,15 +24,15 @@ exports[`Drawer renders content when open 1`] = `
24
24
  type="button"
25
25
  >
26
26
  <span
27
- aria-hidden="true"
28
27
  class="tw-icon tw-icon-cross "
29
28
  data-testid="cross-icon"
30
- role="presentation"
31
29
  >
32
30
  <svg
31
+ aria-hidden="true"
33
32
  fill="currentColor"
34
33
  focusable="false"
35
34
  height="24"
35
+ role="none"
36
36
  viewBox="0 0 24 24"
37
37
  width="24"
38
38
  >
@@ -38,15 +38,15 @@ exports[`FlowNavigation on mobile renders as expected 1`] = `
38
38
  type="button"
39
39
  >
40
40
  <span
41
- aria-hidden="true"
42
41
  class="tw-icon tw-icon-cross "
43
42
  data-testid="cross-icon"
44
- role="presentation"
45
43
  >
46
44
  <svg
45
+ aria-hidden="true"
47
46
  fill="currentColor"
48
47
  focusable="false"
49
48
  height="24"
49
+ role="none"
50
50
  viewBox="0 0 24 24"
51
51
  width="24"
52
52
  >
@@ -153,15 +153,15 @@ exports[`FlowNavigation renders as expected 1`] = `
153
153
  type="button"
154
154
  >
155
155
  <span
156
- aria-hidden="true"
157
156
  class="tw-icon tw-icon-cross "
158
157
  data-testid="cross-icon"
159
- role="presentation"
160
158
  >
161
159
  <svg
160
+ aria-hidden="true"
162
161
  fill="currentColor"
163
162
  focusable="false"
164
163
  height="24"
164
+ role="none"
165
165
  viewBox="0 0 24 24"
166
166
  width="24"
167
167
  >
@@ -1,4 +1,4 @@
1
- import { render, screen } from '../test-utils';
1
+ import { render, screen, within } from '../test-utils';
2
2
 
3
3
  import InstructionsList from '.';
4
4
 
@@ -34,8 +34,16 @@ describe('InstructionsList', () => {
34
34
 
35
35
  const instructions = container.querySelectorAll('.instruction');
36
36
  expect(instructions).toHaveLength(2);
37
- expect(instructions[0]).toHaveAttribute('aria-label', dos[0]['aria-label']);
38
- expect(instructions[1]).toHaveAttribute('aria-label', donts[0]['aria-label']);
37
+ expect(
38
+ within(instructions[0] as HTMLElement).getByRole('graphics-symbol', {
39
+ name: dos[0]['aria-label'],
40
+ }),
41
+ ).toBeInTheDocument();
42
+ expect(
43
+ within(instructions[1] as HTMLElement).getByRole('graphics-symbol', {
44
+ name: donts[0]['aria-label'],
45
+ }),
46
+ ).toBeInTheDocument();
39
47
  });
40
48
 
41
49
  it('should render donts first when sort is set to `dontsFirst`', () => {
@@ -48,7 +56,15 @@ describe('InstructionsList', () => {
48
56
 
49
57
  const instructions = container.querySelectorAll('.instruction');
50
58
  expect(instructions).toHaveLength(2);
51
- expect(instructions[0]).toHaveAttribute('aria-label', donts[0]['aria-label']);
52
- expect(instructions[1]).toHaveAttribute('aria-label', dos[0]['aria-label']);
59
+ expect(
60
+ within(instructions[0] as HTMLElement).getByRole('graphics-symbol', {
61
+ name: donts[0]['aria-label'],
62
+ }),
63
+ ).toBeInTheDocument();
64
+ expect(
65
+ within(instructions[1] as HTMLElement).getByRole('graphics-symbol', {
66
+ name: dos[0]['aria-label'],
67
+ }),
68
+ ).toBeInTheDocument();
53
69
  });
54
70
  });
@@ -57,11 +57,19 @@ function Instruction({ item, type }: { item: ReactNode | InstructionNode; type:
57
57
  const isInstructionNode =
58
58
  typeof item === 'object' && item !== null && 'content' in item && 'aria-label' in item;
59
59
  return (
60
- <li className="instruction" aria-label={isInstructionNode ? item['aria-label'] : undefined}>
60
+ <li className="instruction">
61
61
  {type === 'do' ? (
62
- <DoIcon size={24} className={type} />
62
+ <DoIcon
63
+ size={24}
64
+ className={type}
65
+ title={isInstructionNode ? item['aria-label'] : undefined}
66
+ />
63
67
  ) : (
64
- <DontIcon size={24} className={type} />
68
+ <DontIcon
69
+ size={24}
70
+ className={type}
71
+ title={isInstructionNode ? item['aria-label'] : undefined}
72
+ />
65
73
  )}
66
74
  <Body className="text-primary" type={Typography.BODY_LARGE}>
67
75
  {isInstructionNode ? item.content : item}
@@ -35,15 +35,15 @@ exports[`OverlayHeader renders as expected 1`] = `
35
35
  type="button"
36
36
  >
37
37
  <span
38
- aria-hidden="true"
39
38
  class="tw-icon tw-icon-cross "
40
39
  data-testid="cross-icon"
41
- role="presentation"
42
40
  >
43
41
  <svg
42
+ aria-hidden="true"
44
43
  fill="currentColor"
45
44
  focusable="false"
46
45
  height="24"
46
+ role="none"
47
47
  viewBox="0 0 24 24"
48
48
  width="24"
49
49
  >