@transferwise/components 46.169.1 → 46.170.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/ListItem/IconButton/ListItemIconButton.js +2 -1
- package/build/ListItem/IconButton/ListItemIconButton.js.map +1 -1
- package/build/ListItem/IconButton/ListItemIconButton.mjs +2 -1
- package/build/ListItem/IconButton/ListItemIconButton.mjs.map +1 -1
- package/build/types/ListItem/IconButton/ListItemIconButton.d.ts +3 -1
- package/build/types/ListItem/IconButton/ListItemIconButton.d.ts.map +1 -1
- package/build/types/ListItem/ListItem.d.ts +1 -1
- package/package.json +2 -1
- package/src/ListItem/IconButton/ListItemIconButton.test.tsx +38 -0
- package/src/ListItem/IconButton/ListItemIconButton.tsx +4 -1
- package/src/ListItem/IconButton/_stories/ListItemIconButton.story.tsx +35 -0
- package/src/Prompt/CriticalBanner/_stories/CriticalBanner.docs.mdx +7 -3
|
@@ -9,6 +9,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
9
9
|
|
|
10
10
|
const IconButton = function ({
|
|
11
11
|
priority = 'minimal',
|
|
12
|
+
size = 40,
|
|
12
13
|
'aria-label': ariaLabel,
|
|
13
14
|
...props
|
|
14
15
|
}) {
|
|
@@ -45,7 +46,7 @@ const IconButton = function ({
|
|
|
45
46
|
...getAriaProps(),
|
|
46
47
|
className: clsx.clsx('wds-list-item-control', !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element'),
|
|
47
48
|
id: ids.control,
|
|
48
|
-
size:
|
|
49
|
+
size: size,
|
|
49
50
|
priority: priority,
|
|
50
51
|
disabled: baseItemProps.disabled
|
|
51
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemIconButton.js","sources":["../../../src/ListItem/IconButton/ListItemIconButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useContext, type ReactNode } from 'react';\nimport IconButtonComp, { type IconButtonProps } from '../../IconButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemIconButtonProps = Pick<\n IconButtonProps,\n 'type' | 'onClick' | 'href' | 'target' | 'aria-label'\n> & {\n children: ReactNode;\n partiallyInteractive?: boolean;\n /** @default 'minimal' */\n priority?: IconButtonProps['priority'];\n};\n\n/**\n * This component allows for rendering a IconButton control. It's a thin wrapper around the\n * [IconButton component](https://storybook.wise.design/?path=/docs/actions-iconbutton--docs), but offers only\n * a subset of its features in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://docs.wise.design/components/list-item---icon-button) for details.\n */\nexport const IconButton = function ({\n priority = 'minimal',\n 'aria-label': ariaLabel,\n ...props\n}: ListItemIconButtonProps) {\n const { partiallyInteractive, ...restProps } = props;\n\n const { ids, props: itemProps } = useContext(ListItemContext);\n const { baseItemProps } = useListItemControl('icon-button', {\n partiallyInteractive,\n ...restProps,\n });\n\n const getAriaProps = () => {\n const labelIds = [\n itemProps.inverted ? ids.subtitle : ids.title,\n itemProps.inverted ? ids.title : ids.subtitle,\n itemProps.inverted ? ids.valueSubtitle : ids.valueTitle,\n itemProps.inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');\n\n if (ariaLabel) {\n return {\n 'aria-label': ariaLabel,\n 'aria-describedby': labelIds.concat(descriptorIds),\n };\n }\n\n return {\n 'aria-labelledby': labelIds,\n 'aria-describedby': descriptorIds,\n };\n };\n\n return (\n <IconButtonComp\n {...restProps}\n {...getAriaProps()}\n className={clsx(\n 'wds-list-item-control',\n !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n )}\n id={ids.control}\n size={
|
|
1
|
+
{"version":3,"file":"ListItemIconButton.js","sources":["../../../src/ListItem/IconButton/ListItemIconButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useContext, type ReactNode } from 'react';\nimport IconButtonComp, { type IconButtonProps } from '../../IconButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemIconButtonProps = Pick<\n IconButtonProps,\n 'type' | 'onClick' | 'href' | 'target' | 'aria-label'\n> & {\n /** @default 40 */\n size?: 24 | 40;\n children: ReactNode;\n partiallyInteractive?: boolean;\n /** @default 'minimal' */\n priority?: IconButtonProps['priority'];\n};\n\n/**\n * This component allows for rendering a IconButton control. It's a thin wrapper around the\n * [IconButton component](https://storybook.wise.design/?path=/docs/actions-iconbutton--docs), but offers only\n * a subset of its features in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://docs.wise.design/components/list-item---icon-button) for details.\n */\nexport const IconButton = function ({\n priority = 'minimal',\n size = 40,\n 'aria-label': ariaLabel,\n ...props\n}: ListItemIconButtonProps) {\n const { partiallyInteractive, ...restProps } = props;\n\n const { ids, props: itemProps } = useContext(ListItemContext);\n const { baseItemProps } = useListItemControl('icon-button', {\n partiallyInteractive,\n ...restProps,\n });\n\n const getAriaProps = () => {\n const labelIds = [\n itemProps.inverted ? ids.subtitle : ids.title,\n itemProps.inverted ? ids.title : ids.subtitle,\n itemProps.inverted ? ids.valueSubtitle : ids.valueTitle,\n itemProps.inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');\n\n if (ariaLabel) {\n return {\n 'aria-label': ariaLabel,\n 'aria-describedby': labelIds.concat(descriptorIds),\n };\n }\n\n return {\n 'aria-labelledby': labelIds,\n 'aria-describedby': descriptorIds,\n };\n };\n\n return (\n <IconButtonComp\n {...restProps}\n {...getAriaProps()}\n className={clsx(\n 'wds-list-item-control',\n !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n )}\n id={ids.control}\n size={size}\n priority={priority}\n disabled={baseItemProps.disabled}\n />\n );\n};\n\nIconButton.displayName = 'ListItem.IconButton';\n"],"names":["IconButton","priority","size","ariaLabel","props","partiallyInteractive","restProps","ids","itemProps","useContext","ListItemContext","baseItemProps","useListItemControl","getAriaProps","labelIds","inverted","subtitle","title","valueSubtitle","valueTitle","join","descriptorIds","additionalInfo","prompt","concat","_jsx","IconButtonComp","className","clsx","href","id","control","disabled","displayName"],"mappings":";;;;;;;;;AAyBO,MAAMA,UAAU,GAAG,UAAU;AAClCC,EAAAA,QAAQ,GAAG,SAAS;AACpBC,EAAAA,IAAI,GAAG,EAAE;AACT,EAAA,YAAY,EAAEC,SAAS;EACvB,GAAGC;AAAK,CACgB,EAAA;EACxB,MAAM;IAAEC,oBAAoB;IAAE,GAAGC;AAAS,GAAE,GAAGF,KAAK;EAEpD,MAAM;IAAEG,GAAG;AAAEH,IAAAA,KAAK,EAAEI;AAAS,GAAE,GAAGC,gBAAU,CAACC,+BAAe,CAAC;EAC7D,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,qCAAkB,CAAC,aAAa,EAAE;IAC1DP,oBAAoB;IACpB,GAAGC;AACJ,GAAA,CAAC;EAEF,MAAMO,YAAY,GAAGA,MAAK;IACxB,MAAMC,QAAQ,GAAG,CACfN,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACS,QAAQ,GAAGT,GAAG,CAACU,KAAK,EAC7CT,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACU,KAAK,GAAGV,GAAG,CAACS,QAAQ,EAC7CR,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACW,aAAa,GAAGX,GAAG,CAACY,UAAU,EACvDX,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACY,UAAU,GAAGZ,GAAG,CAACW,aAAa,CACxD,CAACE,IAAI,CAAC,GAAG,CAAC;AACX,IAAA,MAAMC,aAAa,GAAG,CAACd,GAAG,CAACe,cAAc,EAAEf,GAAG,CAACgB,MAAM,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC;AAEhE,IAAA,IAAIjB,SAAS,EAAE;MACb,OAAO;AACL,QAAA,YAAY,EAAEA,SAAS;AACvB,QAAA,kBAAkB,EAAEW,QAAQ,CAACU,MAAM,CAACH,aAAa;OAClD;AACH,IAAA;IAEA,OAAO;AACL,MAAA,iBAAiB,EAAEP,QAAQ;AAC3B,MAAA,kBAAkB,EAAEO;KACrB;EACH,CAAC;EAED,oBACEI,cAAA,CAACC,oBAAc,EAAA;AAAA,IAAA,GACTpB,SAAS;IAAA,GACTO,YAAY,EAAE;AAClBc,IAAAA,SAAS,EAAEC,SAAI,CACb,uBAAuB,EACvB,CAACvB,oBAAoB,IAAID,KAAK,CAACyB,IAAI,IAAI,sCAAsC,CAC7E;IACFC,EAAE,EAAEvB,GAAG,CAACwB,OAAQ;AAChB7B,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,QAAQ,EAAEA,QAAS;IACnB+B,QAAQ,EAAErB,aAAa,CAACqB;AAAS,GAAA,CACjC;AAEN;AAEAhC,UAAU,CAACiC,WAAW,GAAG,qBAAqB;;"}
|
|
@@ -7,6 +7,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
7
7
|
|
|
8
8
|
const IconButton = function ({
|
|
9
9
|
priority = 'minimal',
|
|
10
|
+
size = 40,
|
|
10
11
|
'aria-label': ariaLabel,
|
|
11
12
|
...props
|
|
12
13
|
}) {
|
|
@@ -43,7 +44,7 @@ const IconButton = function ({
|
|
|
43
44
|
...getAriaProps(),
|
|
44
45
|
className: clsx('wds-list-item-control', !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element'),
|
|
45
46
|
id: ids.control,
|
|
46
|
-
size:
|
|
47
|
+
size: size,
|
|
47
48
|
priority: priority,
|
|
48
49
|
disabled: baseItemProps.disabled
|
|
49
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemIconButton.mjs","sources":["../../../src/ListItem/IconButton/ListItemIconButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useContext, type ReactNode } from 'react';\nimport IconButtonComp, { type IconButtonProps } from '../../IconButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemIconButtonProps = Pick<\n IconButtonProps,\n 'type' | 'onClick' | 'href' | 'target' | 'aria-label'\n> & {\n children: ReactNode;\n partiallyInteractive?: boolean;\n /** @default 'minimal' */\n priority?: IconButtonProps['priority'];\n};\n\n/**\n * This component allows for rendering a IconButton control. It's a thin wrapper around the\n * [IconButton component](https://storybook.wise.design/?path=/docs/actions-iconbutton--docs), but offers only\n * a subset of its features in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://docs.wise.design/components/list-item---icon-button) for details.\n */\nexport const IconButton = function ({\n priority = 'minimal',\n 'aria-label': ariaLabel,\n ...props\n}: ListItemIconButtonProps) {\n const { partiallyInteractive, ...restProps } = props;\n\n const { ids, props: itemProps } = useContext(ListItemContext);\n const { baseItemProps } = useListItemControl('icon-button', {\n partiallyInteractive,\n ...restProps,\n });\n\n const getAriaProps = () => {\n const labelIds = [\n itemProps.inverted ? ids.subtitle : ids.title,\n itemProps.inverted ? ids.title : ids.subtitle,\n itemProps.inverted ? ids.valueSubtitle : ids.valueTitle,\n itemProps.inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');\n\n if (ariaLabel) {\n return {\n 'aria-label': ariaLabel,\n 'aria-describedby': labelIds.concat(descriptorIds),\n };\n }\n\n return {\n 'aria-labelledby': labelIds,\n 'aria-describedby': descriptorIds,\n };\n };\n\n return (\n <IconButtonComp\n {...restProps}\n {...getAriaProps()}\n className={clsx(\n 'wds-list-item-control',\n !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n )}\n id={ids.control}\n size={
|
|
1
|
+
{"version":3,"file":"ListItemIconButton.mjs","sources":["../../../src/ListItem/IconButton/ListItemIconButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useContext, type ReactNode } from 'react';\nimport IconButtonComp, { type IconButtonProps } from '../../IconButton';\nimport { useListItemControl } from '../useListItemControl';\nimport { ListItemContext } from '../ListItemContext';\n\nexport type ListItemIconButtonProps = Pick<\n IconButtonProps,\n 'type' | 'onClick' | 'href' | 'target' | 'aria-label'\n> & {\n /** @default 40 */\n size?: 24 | 40;\n children: ReactNode;\n partiallyInteractive?: boolean;\n /** @default 'minimal' */\n priority?: IconButtonProps['priority'];\n};\n\n/**\n * This component allows for rendering a IconButton control. It's a thin wrapper around the\n * [IconButton component](https://storybook.wise.design/?path=/docs/actions-iconbutton--docs), but offers only\n * a subset of its features in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://docs.wise.design/components/list-item---icon-button) for details.\n */\nexport const IconButton = function ({\n priority = 'minimal',\n size = 40,\n 'aria-label': ariaLabel,\n ...props\n}: ListItemIconButtonProps) {\n const { partiallyInteractive, ...restProps } = props;\n\n const { ids, props: itemProps } = useContext(ListItemContext);\n const { baseItemProps } = useListItemControl('icon-button', {\n partiallyInteractive,\n ...restProps,\n });\n\n const getAriaProps = () => {\n const labelIds = [\n itemProps.inverted ? ids.subtitle : ids.title,\n itemProps.inverted ? ids.title : ids.subtitle,\n itemProps.inverted ? ids.valueSubtitle : ids.valueTitle,\n itemProps.inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const descriptorIds = [ids.additionalInfo, ids.prompt].join(' ');\n\n if (ariaLabel) {\n return {\n 'aria-label': ariaLabel,\n 'aria-describedby': labelIds.concat(descriptorIds),\n };\n }\n\n return {\n 'aria-labelledby': labelIds,\n 'aria-describedby': descriptorIds,\n };\n };\n\n return (\n <IconButtonComp\n {...restProps}\n {...getAriaProps()}\n className={clsx(\n 'wds-list-item-control',\n !partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',\n )}\n id={ids.control}\n size={size}\n priority={priority}\n disabled={baseItemProps.disabled}\n />\n );\n};\n\nIconButton.displayName = 'ListItem.IconButton';\n"],"names":["IconButton","priority","size","ariaLabel","props","partiallyInteractive","restProps","ids","itemProps","useContext","ListItemContext","baseItemProps","useListItemControl","getAriaProps","labelIds","inverted","subtitle","title","valueSubtitle","valueTitle","join","descriptorIds","additionalInfo","prompt","concat","_jsx","IconButtonComp","className","clsx","href","id","control","disabled","displayName"],"mappings":";;;;;;;AAyBO,MAAMA,UAAU,GAAG,UAAU;AAClCC,EAAAA,QAAQ,GAAG,SAAS;AACpBC,EAAAA,IAAI,GAAG,EAAE;AACT,EAAA,YAAY,EAAEC,SAAS;EACvB,GAAGC;AAAK,CACgB,EAAA;EACxB,MAAM;IAAEC,oBAAoB;IAAE,GAAGC;AAAS,GAAE,GAAGF,KAAK;EAEpD,MAAM;IAAEG,GAAG;AAAEH,IAAAA,KAAK,EAAEI;AAAS,GAAE,GAAGC,UAAU,CAACC,eAAe,CAAC;EAC7D,MAAM;AAAEC,IAAAA;AAAa,GAAE,GAAGC,kBAAkB,CAAC,aAAa,EAAE;IAC1DP,oBAAoB;IACpB,GAAGC;AACJ,GAAA,CAAC;EAEF,MAAMO,YAAY,GAAGA,MAAK;IACxB,MAAMC,QAAQ,GAAG,CACfN,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACS,QAAQ,GAAGT,GAAG,CAACU,KAAK,EAC7CT,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACU,KAAK,GAAGV,GAAG,CAACS,QAAQ,EAC7CR,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACW,aAAa,GAAGX,GAAG,CAACY,UAAU,EACvDX,SAAS,CAACO,QAAQ,GAAGR,GAAG,CAACY,UAAU,GAAGZ,GAAG,CAACW,aAAa,CACxD,CAACE,IAAI,CAAC,GAAG,CAAC;AACX,IAAA,MAAMC,aAAa,GAAG,CAACd,GAAG,CAACe,cAAc,EAAEf,GAAG,CAACgB,MAAM,CAAC,CAACH,IAAI,CAAC,GAAG,CAAC;AAEhE,IAAA,IAAIjB,SAAS,EAAE;MACb,OAAO;AACL,QAAA,YAAY,EAAEA,SAAS;AACvB,QAAA,kBAAkB,EAAEW,QAAQ,CAACU,MAAM,CAACH,aAAa;OAClD;AACH,IAAA;IAEA,OAAO;AACL,MAAA,iBAAiB,EAAEP,QAAQ;AAC3B,MAAA,kBAAkB,EAAEO;KACrB;EACH,CAAC;EAED,oBACEI,GAAA,CAACC,YAAc,EAAA;AAAA,IAAA,GACTpB,SAAS;IAAA,GACTO,YAAY,EAAE;AAClBc,IAAAA,SAAS,EAAEC,IAAI,CACb,uBAAuB,EACvB,CAACvB,oBAAoB,IAAID,KAAK,CAACyB,IAAI,IAAI,sCAAsC,CAC7E;IACFC,EAAE,EAAEvB,GAAG,CAACwB,OAAQ;AAChB7B,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,QAAQ,EAAEA,QAAS;IACnB+B,QAAQ,EAAErB,aAAa,CAACqB;AAAS,GAAA,CACjC;AAEN;AAEAhC,UAAU,CAACiC,WAAW,GAAG,qBAAqB;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type IconButtonProps } from '../../IconButton';
|
|
3
3
|
export type ListItemIconButtonProps = Pick<IconButtonProps, 'type' | 'onClick' | 'href' | 'target' | 'aria-label'> & {
|
|
4
|
+
/** @default 40 */
|
|
5
|
+
size?: 24 | 40;
|
|
4
6
|
children: ReactNode;
|
|
5
7
|
partiallyInteractive?: boolean;
|
|
6
8
|
/** @default 'minimal' */
|
|
@@ -14,7 +16,7 @@ export type ListItemIconButtonProps = Pick<IconButtonProps, 'type' | 'onClick' |
|
|
|
14
16
|
* Please refer to the [Design documentation](https://docs.wise.design/components/list-item---icon-button) for details.
|
|
15
17
|
*/
|
|
16
18
|
export declare const IconButton: {
|
|
17
|
-
({ priority, "aria-label": ariaLabel, ...props }: ListItemIconButtonProps): import("react").JSX.Element;
|
|
19
|
+
({ priority, size, "aria-label": ariaLabel, ...props }: ListItemIconButtonProps): import("react").JSX.Element;
|
|
18
20
|
displayName: string;
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=ListItemIconButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemIconButton.d.ts","sourceRoot":"","sources":["../../../../src/ListItem/IconButton/ListItemIconButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIxE,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,eAAe,EACf,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,YAAY,CACtD,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,yBAAyB;IACzB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;
|
|
1
|
+
{"version":3,"file":"ListItemIconButton.d.ts","sourceRoot":"","sources":["../../../../src/ListItem/IconButton/ListItemIconButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIxE,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,eAAe,EACf,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,YAAY,CACtD,GAAG;IACF,kBAAkB;IAClB,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,yBAAyB;IACzB,QAAQ,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;4DAKpB,uBAAuB;;CA6CzB,CAAC"}
|
|
@@ -105,7 +105,7 @@ export declare const ListItem: {
|
|
|
105
105
|
displayName: string;
|
|
106
106
|
};
|
|
107
107
|
IconButton: {
|
|
108
|
-
({ priority, "aria-label": ariaLabel, ...props }: ListItemIconButtonProps): import("react").JSX.Element;
|
|
108
|
+
({ priority, size, "aria-label": ariaLabel, ...props }: ListItemIconButtonProps): import("react").JSX.Element;
|
|
109
109
|
displayName: string;
|
|
110
110
|
};
|
|
111
111
|
Navigation: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.170.0",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"@types/react-dom": "^18.3.7",
|
|
73
73
|
"@types/react-transition-group": "4.4.12",
|
|
74
74
|
"@monaco-editor/react": "^4.7.0",
|
|
75
|
+
"modern-normalize": "^3.0.1",
|
|
75
76
|
"monaco-editor": "^0.57.0",
|
|
76
77
|
"monaco-editor-webpack-plugin": "^7.1.1",
|
|
77
78
|
"@wise/art": "^2.33.0",
|
|
@@ -117,6 +117,44 @@ describe('ListItem.IconButton', () => {
|
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
119
|
|
|
120
|
+
describe('size', () => {
|
|
121
|
+
it('renders at size 40 by default', () => {
|
|
122
|
+
renderWith({
|
|
123
|
+
control: (
|
|
124
|
+
<ListItem.IconButton>
|
|
125
|
+
<Edit />
|
|
126
|
+
</ListItem.IconButton>
|
|
127
|
+
),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
expect(screen.getByRole('button')).toHaveStyle({ '--circle-size': '40px' });
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it.each([24, 40] as const)('renders at size %i when specified', (size) => {
|
|
134
|
+
renderWith({
|
|
135
|
+
control: (
|
|
136
|
+
<ListItem.IconButton size={size}>
|
|
137
|
+
<Edit />
|
|
138
|
+
</ListItem.IconButton>
|
|
139
|
+
),
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
expect(screen.getByRole('button')).toHaveStyle({ '--circle-size': `${size}px` });
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('applies size when rendered as link', () => {
|
|
146
|
+
renderWith({
|
|
147
|
+
control: (
|
|
148
|
+
<ListItem.IconButton href="/test" size={24}>
|
|
149
|
+
<Edit />
|
|
150
|
+
</ListItem.IconButton>
|
|
151
|
+
),
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
expect(screen.getByRole('link')).toHaveStyle({ '--circle-size': '24px' });
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
120
158
|
it('renders children content', () => {
|
|
121
159
|
renderWith({
|
|
122
160
|
control: (
|
|
@@ -8,6 +8,8 @@ export type ListItemIconButtonProps = Pick<
|
|
|
8
8
|
IconButtonProps,
|
|
9
9
|
'type' | 'onClick' | 'href' | 'target' | 'aria-label'
|
|
10
10
|
> & {
|
|
11
|
+
/** @default 40 */
|
|
12
|
+
size?: 24 | 40;
|
|
11
13
|
children: ReactNode;
|
|
12
14
|
partiallyInteractive?: boolean;
|
|
13
15
|
/** @default 'minimal' */
|
|
@@ -23,6 +25,7 @@ export type ListItemIconButtonProps = Pick<
|
|
|
23
25
|
*/
|
|
24
26
|
export const IconButton = function ({
|
|
25
27
|
priority = 'minimal',
|
|
28
|
+
size = 40,
|
|
26
29
|
'aria-label': ariaLabel,
|
|
27
30
|
...props
|
|
28
31
|
}: ListItemIconButtonProps) {
|
|
@@ -65,7 +68,7 @@ export const IconButton = function ({
|
|
|
65
68
|
!partiallyInteractive && props.href && 'wds-list-item-control_pseudo-element',
|
|
66
69
|
)}
|
|
67
70
|
id={ids.control}
|
|
68
|
-
size={
|
|
71
|
+
size={size}
|
|
69
72
|
priority={priority}
|
|
70
73
|
disabled={baseItemProps.disabled}
|
|
71
74
|
/>
|
|
@@ -31,6 +31,7 @@ const meta: Meta<ListItemIconButtonProps> = {
|
|
|
31
31
|
args: {
|
|
32
32
|
partiallyInteractive: false,
|
|
33
33
|
priority: undefined,
|
|
34
|
+
size: undefined,
|
|
34
35
|
type: undefined,
|
|
35
36
|
'aria-label': 'Edit details',
|
|
36
37
|
children: <Edit />,
|
|
@@ -54,6 +55,14 @@ const meta: Meta<ListItemIconButtonProps> = {
|
|
|
54
55
|
},
|
|
55
56
|
description: 'IconButton priority/style variant',
|
|
56
57
|
},
|
|
58
|
+
size: {
|
|
59
|
+
control: 'radio',
|
|
60
|
+
options: ['unset (undefined)', 24, 40],
|
|
61
|
+
mapping: {
|
|
62
|
+
'unset (undefined)': undefined,
|
|
63
|
+
},
|
|
64
|
+
description: 'IconButton size',
|
|
65
|
+
},
|
|
57
66
|
type: {
|
|
58
67
|
control: 'radio',
|
|
59
68
|
options: ['unset (undefined)', 'default', 'negative'],
|
|
@@ -253,6 +262,32 @@ export const Priority: Story = {
|
|
|
253
262
|
},
|
|
254
263
|
};
|
|
255
264
|
|
|
265
|
+
/**
|
|
266
|
+
* The icon button is available in two sizes: `24` and `40` (default). <br />
|
|
267
|
+
* [Design documentation](https://docs.wise.design/components/icon-button#sizes)
|
|
268
|
+
*/
|
|
269
|
+
export const Size: Story = {
|
|
270
|
+
argTypes: hideControls(['size']),
|
|
271
|
+
render: (args) => {
|
|
272
|
+
return (
|
|
273
|
+
<List>
|
|
274
|
+
<ListItem
|
|
275
|
+
title="Size 24"
|
|
276
|
+
subtitle="Small icon button"
|
|
277
|
+
media={MEDIA.avatarSingle}
|
|
278
|
+
control={<ListItem.IconButton {...args} size={24} />}
|
|
279
|
+
/>
|
|
280
|
+
<ListItem
|
|
281
|
+
title="Size 40"
|
|
282
|
+
subtitle="Large icon button (default)"
|
|
283
|
+
media={MEDIA.avatarSingle}
|
|
284
|
+
control={<ListItem.IconButton {...args} size={40} />}
|
|
285
|
+
/>
|
|
286
|
+
</List>
|
|
287
|
+
);
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
|
|
256
291
|
/**
|
|
257
292
|
* If `href` prop is set, the component will be automatically rendered as an HTML anchor element.
|
|
258
293
|
*/
|
|
@@ -10,9 +10,11 @@ Typically `CriticalBanner` should be used in one of three ways. Pick the one tha
|
|
|
10
10
|
|
|
11
11
|
- `Layout` via `@transferwise/navigation-ui` - Fetched automatically from navigation-service (for non-flow layouts)
|
|
12
12
|
- `Flow` / `HashRouterFlow` via `@transferwise/flow` - Fetched automatically from navigation-service (for flows)
|
|
13
|
-
- `
|
|
13
|
+
- `FlowNavigationWrapper` via `@transferwise/navigation-ui` - Fetches, caches and renders the critical banner automatically for custom solutions
|
|
14
14
|
|
|
15
|
-
If your page uses `Layout`, `Flow` or `HashRouterFlow`, you don't need to render `CriticalBanner` yourself. These components fetch the banner,
|
|
15
|
+
If your page uses `Layout`, `FlowNavigationWrapper`, `Flow` or `HashRouterFlow`, you don't need to render `CriticalBanner` yourself. These components fetch and render the banner for you automatically, whilst caching it between page loads/navigation to avoid rerendering it unnecessarily.
|
|
16
|
+
|
|
17
|
+
Additionally, you can use `FlowNavigation` directly if you need a completely custom solution, however you will need to manage fetching the critical banner yourself.
|
|
16
18
|
|
|
17
19
|
## Layout from @transferwise/navigation-ui
|
|
18
20
|
|
|
@@ -90,7 +92,9 @@ const SendFlow = ({ navigationData }: { navigationData?: NavigationData }) => (
|
|
|
90
92
|
|
|
91
93
|
## FlowNavigation from @transferwise/components
|
|
92
94
|
|
|
93
|
-
`
|
|
95
|
+
We recommend using the `FlowNavigationWrapper` from `@transferwise/navigation-ui` for handling the critical banner automatically with `FlowNavigation`. [See the source code in navigation-web for further details](https://github.com/transferwise/navigation-web/blob/main/packages/ui/src/flow-wrapper/FlowNavigationWrapper.tsx#L22)
|
|
96
|
+
|
|
97
|
+
If you still want to use `FlowNavigation` from `@transferwise/components` directly, it renders a critical banner above the navigation when you pass a `banner` prop. Use this if you build your flow with `FlowNavigation` directly. You're responsible for getting the banner data.
|
|
94
98
|
|
|
95
99
|
`banner` accepts either:
|
|
96
100
|
|