@transferwise/components 46.65.0 → 46.66.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.
@@ -32,6 +32,7 @@ const Decision = ({
32
32
  const screenSm = useScreenSize.useScreenSize(breakpoint.Breakpoint.SMALL);
33
33
  if (type === exports.DecisionType.NAVIGATION) {
34
34
  const renderedOptions = options.map(({
35
+ 'aria-label': ariaLabel,
35
36
  title,
36
37
  description,
37
38
  disabled,
@@ -44,6 +45,7 @@ const Decision = ({
44
45
  }, key) => /*#__PURE__*/jsxRuntime.jsx(NavigationOption
45
46
  // eslint-disable-next-line react/no-array-index-key
46
47
  , {
48
+ "aria-label": ariaLabel,
47
49
  complex: false,
48
50
  content: description,
49
51
  disabled: disabled,
@@ -66,6 +68,7 @@ const Decision = ({
66
68
  'np-decision--grid': isGrid
67
69
  }, breakpoint ? isGrid && 'flex-wrap' : 'flex-column'),
68
70
  children: breakpoint ? options.map(({
71
+ 'aria-label': ariaLabel,
69
72
  description,
70
73
  disabled,
71
74
  href,
@@ -81,6 +84,7 @@ const Decision = ({
81
84
  className: clsx.clsx(`np-decision__tile${isSmall ? '--small' : ''}`, {
82
85
  'np-decision__tile--fixed-width': isGrid
83
86
  }),
87
+ "aria-label": ariaLabel,
84
88
  description: description,
85
89
  disabled: disabled,
86
90
  href: href,
@@ -1 +1 @@
1
- {"version":3,"file":"Decision.js","sources":["../../src/decision/Decision.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { Size, Breakpoint, SizeSmall, SizeMedium } from '../common';\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport NavigationOption from '../navigationOption';\nimport Tile from '../tile';\n\ninterface DecisionOption {\n description?: React.ReactNode;\n disabled?: boolean;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n media: {\n block: React.ReactNode;\n list: React.ReactNode;\n };\n onClick?: (event?: React.MouseEvent<HTMLElement>) => void;\n title: React.ReactNode;\n}\n\nexport enum DecisionPresentation {\n LIST = 'LIST',\n LIST_BLOCK = 'LIST_BLOCK',\n LIST_BLOCK_GRID = 'LIST_BLOCK_GRID',\n}\n\nexport enum DecisionType {\n NAVIGATION = 'NAVIGATION',\n}\n\nexport interface DecisionProps {\n /** A list of elements to be rendered */\n options: readonly DecisionOption[];\n /** Handles the display mode of the component */\n presentation?: `${DecisionPresentation}`;\n /** Size currently affects only Tile dimension */\n size?: SizeSmall | SizeMedium;\n /** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */\n type?: `${DecisionType}`;\n\n /** Display media in a circle in list presentation */\n showMediaCircleInList?: boolean;\n\n /** Sets navigation options to be aligned with the parent container */\n isContainerAligned?: boolean;\n}\n\nconst Decision = ({\n options,\n presentation = DecisionPresentation.LIST,\n size = Size.MEDIUM,\n type = DecisionType.NAVIGATION,\n showMediaCircleInList = true,\n isContainerAligned = false,\n}: DecisionProps) => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n\n if (type === DecisionType.NAVIGATION) {\n const renderedOptions = options.map(\n ({ title, description, disabled, href, target, media: { list }, onClick }, key) => (\n <NavigationOption\n // eslint-disable-next-line react/no-array-index-key\n key={`nav-${key}`}\n complex={false}\n content={description}\n disabled={disabled}\n href={href}\n target={target}\n media={list}\n showMediaAtAllSizes\n showMediaCircle={showMediaCircleInList}\n isContainerAligned={isContainerAligned}\n title={title}\n onClick={onClick}\n />\n ),\n );\n\n if (\n presentation === DecisionPresentation.LIST_BLOCK ||\n presentation === DecisionPresentation.LIST_BLOCK_GRID\n ) {\n const isSmall = size === Size.SMALL;\n const breakpoint = isSmall ? screenXs : screenSm;\n\n const isGrid = presentation === DecisionPresentation.LIST_BLOCK_GRID;\n\n return (\n <div\n className={clsx(\n 'np-decision d-flex',\n {\n 'np-decision--small': isSmall,\n 'np-decision--grid': isGrid,\n },\n breakpoint ? isGrid && 'flex-wrap' : 'flex-column',\n )}\n >\n {breakpoint\n ? options.map(\n (\n { description, disabled, href, target, media: { block }, onClick, title },\n key,\n ) => (\n <Tile\n // eslint-disable-next-line react/no-array-index-key\n key={`tile-${key}`}\n className={clsx(`np-decision__tile${isSmall ? '--small' : ''}`, {\n 'np-decision__tile--fixed-width': isGrid,\n })}\n description={description}\n disabled={disabled}\n href={href}\n target={target}\n media={block}\n size={isSmall ? Size.SMALL : Size.MEDIUM}\n title={title}\n onClick={onClick}\n />\n ),\n )\n : renderedOptions}\n </div>\n );\n }\n // LIST\n return <>{renderedOptions}</>;\n }\n return null;\n};\n\nexport default Decision;\n"],"names":["DecisionPresentation","DecisionType","Decision","options","presentation","LIST","size","Size","MEDIUM","type","NAVIGATION","showMediaCircleInList","isContainerAligned","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","renderedOptions","map","title","description","disabled","href","target","media","list","onClick","key","_jsx","NavigationOption","complex","content","showMediaAtAllSizes","showMediaCircle","LIST_BLOCK","LIST_BLOCK_GRID","isSmall","breakpoint","isGrid","className","clsx","children","block","Tile","_Fragment"],"mappings":";;;;;;;;;;;;AAoBYA,sCAIX;AAJD,CAAA,UAAYA,oBAAoB,EAAA;AAC9BA,EAAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACbA,EAAAA,oBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,oBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACrC,CAAC,EAJWA,4BAAoB,KAApBA,4BAAoB,GAI/B,EAAA,CAAA,CAAA,CAAA;AAEWC,8BAEX;AAFD,CAAA,UAAYA,YAAY,EAAA;AACtBA,EAAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AAC3B,CAAC,EAFWA,oBAAY,KAAZA,oBAAY,GAEvB,EAAA,CAAA,CAAA,CAAA;AAmBKC,MAAAA,QAAQ,GAAGA,CAAC;EAChBC,OAAO;EACPC,YAAY,GAAGJ,4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QC,KAAAA,EAAAA,GAAG,CAWC,CAAA,CAEpB,CACF,GACDV,eAAAA;AAAe,OAChB,CAAC,CAAA;AAEV,KAAA;AACA;IACA,oBAAOW,cAAA,CAAAgB,mBAAA,EAAA;AAAAH,MAAAA,QAAA,EAAGxB,eAAAA;AAAe,MAAI,CAAA;AAC/B,GAAA;AACA,EAAA,OAAO,IAAI,CAAA;AACb;;;;"}
1
+ {"version":3,"file":"Decision.js","sources":["../../src/decision/Decision.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { Size, Breakpoint, SizeSmall, SizeMedium } from '../common';\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport NavigationOption from '../navigationOption';\nimport Tile from '../tile';\n\ninterface DecisionOption {\n 'aria-label'?: string;\n description?: React.ReactNode;\n disabled?: boolean;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n media: {\n block: React.ReactNode;\n list: React.ReactNode;\n };\n onClick?: (event?: React.MouseEvent<HTMLElement>) => void;\n title: React.ReactNode;\n}\n\nexport enum DecisionPresentation {\n LIST = 'LIST',\n LIST_BLOCK = 'LIST_BLOCK',\n LIST_BLOCK_GRID = 'LIST_BLOCK_GRID',\n}\n\nexport enum DecisionType {\n NAVIGATION = 'NAVIGATION',\n}\n\nexport interface DecisionProps {\n /** A list of elements to be rendered */\n options: readonly DecisionOption[];\n /** Handles the display mode of the component */\n presentation?: `${DecisionPresentation}`;\n /** Size currently affects only Tile dimension */\n size?: SizeSmall | SizeMedium;\n /** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */\n type?: `${DecisionType}`;\n\n /** Display media in a circle in list presentation */\n showMediaCircleInList?: boolean;\n\n /** Sets navigation options to be aligned with the parent container */\n isContainerAligned?: boolean;\n}\n\nconst Decision = ({\n options,\n presentation = DecisionPresentation.LIST,\n size = Size.MEDIUM,\n type = DecisionType.NAVIGATION,\n showMediaCircleInList = true,\n isContainerAligned = false,\n}: DecisionProps) => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n\n if (type === DecisionType.NAVIGATION) {\n const renderedOptions = options.map(\n (\n {\n 'aria-label': ariaLabel,\n title,\n description,\n disabled,\n href,\n target,\n media: { list },\n onClick,\n },\n key,\n ) => (\n <NavigationOption\n // eslint-disable-next-line react/no-array-index-key\n key={`nav-${key}`}\n aria-label={ariaLabel}\n complex={false}\n content={description}\n disabled={disabled}\n href={href}\n target={target}\n media={list}\n showMediaAtAllSizes\n showMediaCircle={showMediaCircleInList}\n isContainerAligned={isContainerAligned}\n title={title}\n onClick={onClick}\n />\n ),\n );\n\n if (\n presentation === DecisionPresentation.LIST_BLOCK ||\n presentation === DecisionPresentation.LIST_BLOCK_GRID\n ) {\n const isSmall = size === Size.SMALL;\n const breakpoint = isSmall ? screenXs : screenSm;\n\n const isGrid = presentation === DecisionPresentation.LIST_BLOCK_GRID;\n\n return (\n <div\n className={clsx(\n 'np-decision d-flex',\n {\n 'np-decision--small': isSmall,\n 'np-decision--grid': isGrid,\n },\n breakpoint ? isGrid && 'flex-wrap' : 'flex-column',\n )}\n >\n {breakpoint\n ? options.map(\n (\n {\n 'aria-label': ariaLabel,\n description,\n disabled,\n href,\n target,\n media: { block },\n onClick,\n title,\n },\n key,\n ) => (\n <Tile\n // eslint-disable-next-line react/no-array-index-key\n key={`tile-${key}`}\n className={clsx(`np-decision__tile${isSmall ? '--small' : ''}`, {\n 'np-decision__tile--fixed-width': isGrid,\n })}\n aria-label={ariaLabel}\n description={description}\n disabled={disabled}\n href={href}\n target={target}\n media={block}\n size={isSmall ? Size.SMALL : Size.MEDIUM}\n title={title}\n onClick={onClick}\n />\n ),\n )\n : renderedOptions}\n </div>\n );\n }\n // LIST\n return <>{renderedOptions}</>;\n }\n return null;\n};\n\nexport default Decision;\n"],"names":["DecisionPresentation","DecisionType","Decision","options","presentation","LIST","size","Size","MEDIUM","type","NAVIGATION","showMediaCircleInList","isContainerAligned","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","renderedOptions","map","ariaLabel","title","description","disabled","href","target","media","list","onClick","key","_jsx","NavigationOption","complex","content","showMediaAtAllSizes","showMediaCircle","LIST_BLOCK","LIST_BLOCK_GRID","isSmall","breakpoint","isGrid","className","clsx","children","block","Tile","_Fragment"],"mappings":";;;;;;;;;;;;AAqBYA,sCAIX;AAJD,CAAA,UAAYA,oBAAoB,EAAA;AAC9BA,EAAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACbA,EAAAA,oBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,oBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACrC,CAAC,EAJWA,4BAAoB,KAApBA,4BAAoB,GAI/B,EAAA,CAAA,CAAA,CAAA;AAEWC,8BAEX;AAFD,CAAA,UAAYA,YAAY,EAAA;AACtBA,EAAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AAC3B,CAAC,EAFWA,oBAAY,KAAZA,oBAAY,GAEvB,EAAA,CAAA,CAAA,CAAA;AAmBKC,MAAAA,QAAQ,GAAGA,CAAC;EAChBC,OAAO;EACPC,YAAY,GAAGJ,4BAAoB,CAACK,IAAI;QACxCC,MAAI,GAAGC,SAAI,CAACC,MAAM;EAClBC,IAAI,GAAGR,oBAAY,CAACS,UAAU;AAC9BC,EAAAA,qBAAqB,GAAG,IAAI;AAC5BC,EAAAA,kBAAkB,GAAG,KAAA;AAAK,CACZ,KAAI;AAClB,EAAA,MAAMC,QAAQ,GAAGC,2BAAa,CAACC,qBAAU,CAACC,WAAW,CAAC,CAAA;AACtD,EAAA,MAAMC,QAAQ,GAAGH,2BAAa,CAACC,qBAAU,CAACG,KAAK,CAAC,CAAA;AAEhD,EAAA,IAAIT,IAAI,KAAKR,oBAAY,CAACS,UAAU,EAAE;AACpC,IAAA,MAAMS,eAAe,GAAGhB,OAAO,CAACiB,GAAG,CACj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deredOptions = options.map(({
31
+ 'aria-label': ariaLabel,
31
32
  title,
32
33
  description,
33
34
  disabled,
@@ -40,6 +41,7 @@ const Decision = ({
40
41
  }, key) => /*#__PURE__*/jsx(NavigationOption
41
42
  // eslint-disable-next-line react/no-array-index-key
42
43
  , {
44
+ "aria-label": ariaLabel,
43
45
  complex: false,
44
46
  content: description,
45
47
  disabled: disabled,
@@ -62,6 +64,7 @@ const Decision = ({
62
64
  'np-decision--grid': isGrid
63
65
  }, breakpoint ? isGrid && 'flex-wrap' : 'flex-column'),
64
66
  children: breakpoint ? options.map(({
67
+ 'aria-label': ariaLabel,
65
68
  description,
66
69
  disabled,
67
70
  href,
@@ -77,6 +80,7 @@ const Decision = ({
77
80
  className: clsx(`np-decision__tile${isSmall ? '--small' : ''}`, {
78
81
  'np-decision__tile--fixed-width': isGrid
79
82
  }),
83
+ "aria-label": ariaLabel,
80
84
  description: description,
81
85
  disabled: disabled,
82
86
  href: href,
@@ -1 +1 @@
1
- {"version":3,"file":"Decision.mjs","sources":["../../src/decision/Decision.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { Size, Breakpoint, SizeSmall, SizeMedium } from '../common';\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport NavigationOption from '../navigationOption';\nimport Tile from '../tile';\n\ninterface DecisionOption {\n description?: React.ReactNode;\n disabled?: boolean;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n media: {\n block: React.ReactNode;\n list: React.ReactNode;\n };\n onClick?: (event?: React.MouseEvent<HTMLElement>) => void;\n title: React.ReactNode;\n}\n\nexport enum DecisionPresentation {\n LIST = 'LIST',\n LIST_BLOCK = 'LIST_BLOCK',\n LIST_BLOCK_GRID = 'LIST_BLOCK_GRID',\n}\n\nexport enum DecisionType {\n NAVIGATION = 'NAVIGATION',\n}\n\nexport interface DecisionProps {\n /** A list of elements to be rendered */\n options: readonly DecisionOption[];\n /** Handles the display mode of the component */\n presentation?: `${DecisionPresentation}`;\n /** Size currently affects only Tile dimension */\n size?: SizeSmall | SizeMedium;\n /** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */\n type?: `${DecisionType}`;\n\n /** Display media in a circle in list presentation */\n showMediaCircleInList?: boolean;\n\n /** Sets navigation options to be aligned with the parent container */\n isContainerAligned?: boolean;\n}\n\nconst Decision = ({\n options,\n presentation = DecisionPresentation.LIST,\n size = Size.MEDIUM,\n type = DecisionType.NAVIGATION,\n showMediaCircleInList = true,\n isContainerAligned = false,\n}: DecisionProps) => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n\n if (type === DecisionType.NAVIGATION) {\n const renderedOptions = options.map(\n ({ title, description, disabled, href, target, media: { list }, onClick }, key) => (\n <NavigationOption\n // eslint-disable-next-line react/no-array-index-key\n key={`nav-${key}`}\n complex={false}\n content={description}\n disabled={disabled}\n href={href}\n target={target}\n media={list}\n showMediaAtAllSizes\n showMediaCircle={showMediaCircleInList}\n isContainerAligned={isContainerAligned}\n title={title}\n onClick={onClick}\n />\n ),\n );\n\n if (\n presentation === DecisionPresentation.LIST_BLOCK ||\n presentation === DecisionPresentation.LIST_BLOCK_GRID\n ) {\n const isSmall = size === Size.SMALL;\n const breakpoint = isSmall ? screenXs : screenSm;\n\n const isGrid = presentation === DecisionPresentation.LIST_BLOCK_GRID;\n\n return (\n <div\n className={clsx(\n 'np-decision d-flex',\n {\n 'np-decision--small': isSmall,\n 'np-decision--grid': isGrid,\n },\n breakpoint ? isGrid && 'flex-wrap' : 'flex-column',\n )}\n >\n {breakpoint\n ? options.map(\n (\n { description, disabled, href, target, media: { block }, onClick, title },\n key,\n ) => (\n <Tile\n // eslint-disable-next-line react/no-array-index-key\n key={`tile-${key}`}\n className={clsx(`np-decision__tile${isSmall ? '--small' : ''}`, {\n 'np-decision__tile--fixed-width': isGrid,\n })}\n description={description}\n disabled={disabled}\n href={href}\n target={target}\n media={block}\n size={isSmall ? Size.SMALL : Size.MEDIUM}\n title={title}\n onClick={onClick}\n />\n ),\n )\n : renderedOptions}\n </div>\n );\n }\n // LIST\n return <>{renderedOptions}</>;\n }\n return null;\n};\n\nexport default Decision;\n"],"names":["DecisionPresentation","DecisionType","Decision","options","presentation","LIST","size","Size","MEDIUM","type","NAVIGATION","showMediaCircleInList","isContainerAligned","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","renderedOptions","map","title","description","disabled","href","target","media","list","onClick","key","_jsx","NavigationOption","complex","content","showMediaAtAllSizes","showMediaCircle","LIST_BLOCK","LIST_BLOCK_GRID","isSmall","breakpoint","isGrid","className","clsx","children","block","Tile","_Fragment"],"mappings":";;;;;;;;IAoBYA,qBAIX;AAJD,CAAA,UAAYA,oBAAoB,EAAA;AAC9BA,EAAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACbA,EAAAA,oBAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AACzBA,EAAAA,oBAAA,CAAA,iBAAA,CAAA,GAAA,iBAAmC,CAAA;AACrC,CAAC,EAJWA,oBAAoB,KAApBA,oBAAoB,GAI/B,EAAA,CAAA,CAAA,CAAA;IAEWC,aAEX;AAFD,CAAA,UAAYA,YAAY,EAAA;AACtBA,EAAAA,YAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AAC3B,CAAC,EAFWA,YAAY,KAAZA,YAAY,GAEvB,EAAA,CAAA,CAAA,CAAA;AAmBKC,MAAAA,QAAQ,GAAGA,CAAC;EAChBC,OAAO;EACPC,YAAY,GAAGJ,oBAAoB,CAACK,IAAI;EACxCC,IAAI,GAAGC,IAAI,CAACC,MAAM;EAClBC,IAAI,GAAGR,YAAY,CAACS,UAAU;AAC9BC,EAAAA,qBAAqB,GAAG,IAAI;AAC5BC,EAAAA,kBAAkB,GAAG,KAAA;AAAK,CACZ,KAAI;AAClB,EAAA,MAAMC,QAAQ,GAAGC,aAAa,CAACC,UAAU,CAACC,WAAW,CAA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,"file":"Decision.mjs","sources":["../../src/decision/Decision.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport { Size, Breakpoint, SizeSmall, SizeMedium } from '../common';\nimport { useScreenSize } from '../common/hooks/useScreenSize';\nimport NavigationOption from '../navigationOption';\nimport Tile from '../tile';\n\ninterface DecisionOption {\n 'aria-label'?: string;\n description?: React.ReactNode;\n disabled?: boolean;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n media: {\n block: React.ReactNode;\n list: React.ReactNode;\n };\n onClick?: (event?: React.MouseEvent<HTMLElement>) => void;\n title: React.ReactNode;\n}\n\nexport enum DecisionPresentation {\n LIST = 'LIST',\n LIST_BLOCK = 'LIST_BLOCK',\n LIST_BLOCK_GRID = 'LIST_BLOCK_GRID',\n}\n\nexport enum DecisionType {\n NAVIGATION = 'NAVIGATION',\n}\n\nexport interface DecisionProps {\n /** A list of elements to be rendered */\n options: readonly DecisionOption[];\n /** Handles the display mode of the component */\n presentation?: `${DecisionPresentation}`;\n /** Size currently affects only Tile dimension */\n size?: SizeSmall | SizeMedium;\n /** Decide which kind of element type needs to be rendered ex: Navigation Options or in the future Radio or Checkbox Options */\n type?: `${DecisionType}`;\n\n /** Display media in a circle in list presentation */\n showMediaCircleInList?: boolean;\n\n /** Sets navigation options to be aligned with the parent container */\n isContainerAligned?: boolean;\n}\n\nconst Decision = ({\n options,\n presentation = DecisionPresentation.LIST,\n size = Size.MEDIUM,\n type = DecisionType.NAVIGATION,\n showMediaCircleInList = true,\n isContainerAligned = false,\n}: DecisionProps) => {\n const screenXs = useScreenSize(Breakpoint.EXTRA_SMALL);\n const screenSm = useScreenSize(Breakpoint.SMALL);\n\n if (type === DecisionType.NAVIGATION) {\n const renderedOptions = options.map(\n (\n {\n 'aria-label': ariaLabel,\n title,\n description,\n disabled,\n href,\n target,\n media: { list },\n onClick,\n },\n key,\n ) => (\n <NavigationOption\n // eslint-disable-next-line react/no-array-index-key\n key={`nav-${key}`}\n aria-label={ariaLabel}\n complex={false}\n content={description}\n disabled={disabled}\n href={href}\n target={target}\n media={list}\n showMediaAtAllSizes\n showMediaCircle={showMediaCircleInList}\n isContainerAligned={isContainerAligned}\n title={title}\n onClick={onClick}\n />\n ),\n );\n\n if (\n presentation === DecisionPresentation.LIST_BLOCK ||\n presentation === DecisionPresentation.LIST_BLOCK_GRID\n ) {\n const isSmall = size === Size.SMALL;\n const breakpoint = isSmall ? screenXs : screenSm;\n\n const isGrid = presentation === DecisionPresentation.LIST_BLOCK_GRID;\n\n return (\n <div\n className={clsx(\n 'np-decision d-flex',\n {\n 'np-decision--small': isSmall,\n 'np-decision--grid': isGrid,\n },\n breakpoint ? isGrid && 'flex-wrap' : 'flex-column',\n )}\n >\n {breakpoint\n ? options.map(\n (\n {\n 'aria-label': ariaLabel,\n description,\n disabled,\n href,\n target,\n media: { block },\n onClick,\n title,\n },\n key,\n ) => (\n <Tile\n // eslint-disable-next-line react/no-array-index-key\n key={`tile-${key}`}\n className={clsx(`np-decision__tile${isSmall ? '--small' : ''}`, {\n 'np-decision__tile--fixed-width': isGrid,\n })}\n aria-label={ariaLabel}\n description={description}\n disabled={disabled}\n href={href}\n target={target}\n media={block}\n size={isSmall ? Size.SMALL : Size.MEDIUM}\n title={title}\n onClick={onClick}\n />\n ),\n )\n : renderedOptions}\n </div>\n );\n }\n // LIST\n return <>{renderedOptions}</>;\n }\n return null;\n};\n\nexport default Decision;\n"],"names":["DecisionPresentation","DecisionType","Decision","options","presentation","LIST","size","Size","MEDIUM","type","NAVIGATION","showMediaCircleInList","isContainerAligned","screenXs","useScreenSize","Breakpoint","EXTRA_SMALL","screenSm","SMALL","renderedOptions","map","ariaLabel","title","description","disabled","href","target","media","list","onClick","key","_jsx","NavigationOption","complex","content","showMediaAtAllSizes","showMediaCircle","LIST_BLOCK","LIST_BLOCK_GRID","isSmall","breakpoint","isGrid","className","clsx","children","block","Tile","_Fragment"],"mappings":";;;;;;;;IAqBYA,qBAIX;AAJD,CAAA,UAAYA,oBAAoB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AACD,SAAA,EACDQ,GAAG,kBAEHC,GAAA,CAACe,IAAAA;AACC;AAAA,UAAA;UAEAJ,SAAS,EAAEC,IAAI,CAAC,CAAoBJ,iBAAAA,EAAAA,OAAO,GAAG,SAAS,GAAG,EAAE,CAAA,CAAE,EAAE;AAC9D,YAAA,gCAAgC,EAAEE,MAAAA;AACnC,WAAA,CAAE;AACH,UAAA,YAAA,EAAYpB,SAAU;AACtBE,UAAAA,WAAW,EAAEA,WAAY;AACzBC,UAAAA,QAAQ,EAAEA,QAAS;AACnBC,UAAAA,IAAI,EAAEA,IAAK;AACXC,UAAAA,MAAM,EAAEA,MAAO;AACfC,UAAAA,KAAK,EAAEkB,KAAM;UACbvC,IAAI,EAAEiC,OAAO,GAAGhC,IAAI,CAACW,KAAK,GAAGX,IAAI,CAACC,MAAO;AACzCc,UAAAA,KAAK,EAAEA,KAAM;AACbO,UAAAA,OAAO,EAAEA,OAAAA;AAAQ,SAAA,EAZZ,CAAQC,KAAAA,EAAAA,GAAG,CAYC,CAAA,CAEpB,CACF,GACDX,eAAAA;AAAe,OAChB,CAAC,CAAA;AAEV,KAAA;AACA;IACA,oBAAOY,GAAA,CAAAgB,QAAA,EAAA;AAAAH,MAAAA,QAAA,EAAGzB,eAAAA;AAAe,MAAI,CAAA;AAC/B,GAAA;AACA,EAAA,OAAO,IAAI,CAAA;AACb;;;;"}
@@ -7,6 +7,7 @@ var jsxRuntime = require('react/jsx-runtime');
7
7
  var typography = require('../common/propsValues/typography.js');
8
8
 
9
9
  function Tile({
10
+ 'aria-label': ariaLabel,
10
11
  className,
11
12
  description,
12
13
  disabled,
@@ -26,6 +27,7 @@ function Tile({
26
27
  }, disabled && 'disabled'),
27
28
  href: href,
28
29
  target: target,
30
+ "aria-label": ariaLabel,
29
31
  onClick: disabled ? undefined : onClick,
30
32
  onKeyDown: disabled ? undefined : ({
31
33
  key
@@ -1 +1 @@
1
- {"version":3,"file":"Tile.js","sources":["../../src/tile/Tile.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport Body from '../body';\nimport { Size, Typography } from '../common';\nimport Title from '../title';\n\nexport interface TileProps {\n /** Classes to apply to the Tile container */\n className?: string;\n description?: React.ReactNode;\n disabled?: boolean;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n /** Accepts only Avatar and images */\n media: React.ReactNode;\n /** Function called onClick or onKeyDown */\n onClick?: (event?: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /** The size applied to Tile */\n size?: `${Size.SMALL | Size.MEDIUM}`;\n title: React.ReactNode;\n}\n\nexport default function Tile({\n className,\n description,\n disabled,\n href,\n target,\n media,\n onClick,\n size = 'md',\n title,\n}: TileProps) {\n const isSmall = size === 'sm';\n const Element = href ? 'a' : 'button';\n\n return (\n <Element\n className={clsx(\n 'decision',\n 'flex-column',\n 'np-tile',\n 'text-no-decoration',\n 'text-xs-center',\n className,\n {\n 'p-a-3': !isSmall,\n 'p-a-2 np-tile--small': isSmall,\n },\n disabled && 'disabled',\n )}\n href={href}\n target={target}\n onClick={disabled ? undefined : onClick}\n onKeyDown={\n disabled\n ? undefined\n : ({ key }) => {\n if (key === 'Enter' || key === ' ') {\n onClick?.();\n }\n }\n }\n >\n <div className=\"np-tile__media d-flex justify-content-center\">{media}</div>\n <Title type={Typography.TITLE_SUBSECTION} className={clsx(isSmall ? 'm-t-1' : 'm-t-2')}>\n {title}\n </Title>\n {description ? (\n <Body as=\"span\" type={Typography.BODY_DEFAULT} className=\"m-t-1\">\n {description}\n </Body>\n ) : null}\n </Element>\n );\n}\n"],"names":["Tile","className","description","disabled","href","target","media","onClick","size","title","isSmall","Element","_jsxs","clsx","undefined","onKeyDown","key","children","_jsx","Title","type","Typography","TITLE_SUBSECTION","Body","as","BODY_DEFAULT"],"mappings":";;;;;;;;AAsBc,SAAUA,IAAIA,CAAC;EAC3BC,SAAS;EACTC,WAAW;EACXC,QAAQ;EACRC,IAAI;EACJC,MAAM;EACNC,KAAK;EACLC,OAAO;AACPC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ACI,YAAa;AAACxB,MAAAA,SAAS,EAAC,OAAO;AAAAgB,MAAAA,QAAA,EAC7Df,WAAAA;KACG,CAAC,GACL,IAAI,CAAA;AAAA,GACD,CAAC,CAAA;AAEd;;;;"}
1
+ {"version":3,"file":"Tile.js","sources":["../../src/tile/Tile.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport Body from '../body';\nimport { Size, Typography } from '../common';\nimport Title from '../title';\n\nexport interface TileProps {\n /** Classes to apply to the Tile container */\n /** A label for the accordion item, used for accessibility purposes. */\n 'aria-label'?: string;\n className?: string;\n description?: React.ReactNode;\n disabled?: boolean;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n /** Accepts only Avatar and images */\n media: React.ReactNode;\n /** Function called onClick or onKeyDown */\n onClick?: (event?: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /** The size applied to Tile */\n size?: `${Size.SMALL | Size.MEDIUM}`;\n title: React.ReactNode;\n}\n\nexport default function Tile({\n 'aria-label': ariaLabel,\n className,\n description,\n disabled,\n href,\n target,\n media,\n onClick,\n size = 'md',\n title,\n}: TileProps) {\n const isSmall = size === 'sm';\n const Element = href ? 'a' : 'button';\n\n return (\n <Element\n className={clsx(\n 'decision',\n 'flex-column',\n 'np-tile',\n 'text-no-decoration',\n 'text-xs-center',\n className,\n {\n 'p-a-3': !isSmall,\n 'p-a-2 np-tile--small': isSmall,\n },\n disabled && 'disabled',\n )}\n href={href}\n target={target}\n aria-label={ariaLabel}\n onClick={disabled ? undefined : onClick}\n onKeyDown={\n disabled\n ? undefined\n : ({ key }) => {\n if (key === 'Enter' || key === ' ') {\n onClick?.();\n }\n }\n }\n >\n <div className=\"np-tile__media d-flex justify-content-center\">{media}</div>\n <Title type={Typography.TITLE_SUBSECTION} className={clsx(isSmall ? 'm-t-1' : 'm-t-2')}>\n {title}\n </Title>\n {description ? (\n <Body as=\"span\" type={Typography.BODY_DEFAULT} className=\"m-t-1\">\n {description}\n </Body>\n ) : null}\n </Element>\n );\n}\n"],"names":["Tile","ariaLabel","className","description","disabled","href","target","media","onClick","size","title","isSmall","Element","_jsxs","clsx","undefined","onKeyDown","key","children","_jsx","Title","type","Typography","TITLE_SUBSECTION","Body","as","BODY_DEFAULT"],"mappings":";;;;;;;;AAwBwB,SAAAA,IAAIA,CAAC;AAC3B,EAAA,YAAY,EAAEC,SAAS;EACvBC,SAAS;EACTC,WAAW;EACXC,QAAQ;EACRC,IAAI;EACJC,MAAM;EACNC,KAAK;EACLC,OAAO;AACPC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,KAAAA;AACU,CAAA,EAAA;AACV,EAAA,MAAMC,OAAO,GAAGF,IAAI,KAAK,IAAI,CAAA;AAC7B,EAAA,MAAMG,OAAO,GAAGP,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAA;EAErC,oBACEQ,eAAA,CAACD,OAAO,EAAA;AACNV,IAAAA,SAAS,EAAEY,SAAI,CACb,UAAU,EACV,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,gBAAgB,EAChBZ,SAAS,EACT;MACE,OAAO,EAAE,CAACS,OAAO;AACjB,MAAA,sBAAsB,EAAEA,OAAAA;AACzB,KAAA,EACDP,QAAQ,IAAI,UAAU,CACtB;AACFC,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,MAAM,EAAEA,MAAO;AACf,IAAA,YAAA,EAAYL,SAAU;AACtBO,IAAAA,OAAO,EAAEJ,QAAQ,GAAGW,SAAS,GAAGP,OAAQ;AACxCQ,IAAAA,SAAS,EACPZ,QAAQ,GACJW,SAAS,GACT,CAAC;AAAEE,MAAAA,GAAAA;AAAG,KAAE,KAAI;AACV,MAAA,IAAIA,GAAG,KAAK,OAAO,IAAIA,GAAG,KAAK,GAAG,EAAE;AAClCT,QAAAA,OAAO,IAAI,CAAA;AACb,OAAA;KAEP;AAAAU,IAAAA,QAAA,gBAEDC,cAAA,CAAA,KAAA,EAAA;AAAKjB,MAAAA,SAAS,EAAC,8CAA8C;AAAAgB,MAAAA,QAAA,EAAEX,KAAAA;AAAK,KAAM,CAC1E,eAAAY,cAAA,CAACC,KAAK,EAAA;MAACC,IAAI,EAAEC,qBAAU,CAACC,gBAAiB;MAACrB,SAAS,EAAEY,SAAI,CAACH,OAAO,GAAG,OAAO,GAAG,OAAO,CAAE;AAAAO,MAAAA,QAAA,EACpFR,KAAAA;AAAK,KACD,CACP,EAACP,WAAW,gBACVgB,cAAA,CAACK,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;MAACJ,IAAI,EAAEC,qBAAU,CAACI,YAAa;AAACxB,MAAAA,SAAS,EAAC,OAAO;AAAAgB,MAAAA,QAAA,EAC7Df,WAAAA;KACG,CAAC,GACL,IAAI,CAAA;AAAA,GACD,CAAC,CAAA;AAEd;;;;"}
@@ -5,6 +5,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
5
5
  import { Typography } from '../common/propsValues/typography.mjs';
6
6
 
7
7
  function Tile({
8
+ 'aria-label': ariaLabel,
8
9
  className,
9
10
  description,
10
11
  disabled,
@@ -24,6 +25,7 @@ function Tile({
24
25
  }, disabled && 'disabled'),
25
26
  href: href,
26
27
  target: target,
28
+ "aria-label": ariaLabel,
27
29
  onClick: disabled ? undefined : onClick,
28
30
  onKeyDown: disabled ? undefined : ({
29
31
  key
@@ -1 +1 @@
1
- {"version":3,"file":"Tile.mjs","sources":["../../src/tile/Tile.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport Body from '../body';\nimport { Size, Typography } from '../common';\nimport Title from '../title';\n\nexport interface TileProps {\n /** Classes to apply to the Tile container */\n className?: string;\n description?: React.ReactNode;\n disabled?: boolean;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n /** Accepts only Avatar and images */\n media: React.ReactNode;\n /** Function called onClick or onKeyDown */\n onClick?: (event?: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /** The size applied to Tile */\n size?: `${Size.SMALL | Size.MEDIUM}`;\n title: React.ReactNode;\n}\n\nexport default function Tile({\n className,\n description,\n disabled,\n href,\n target,\n media,\n onClick,\n size = 'md',\n title,\n}: TileProps) {\n const isSmall = size === 'sm';\n const Element = href ? 'a' : 'button';\n\n return (\n <Element\n className={clsx(\n 'decision',\n 'flex-column',\n 'np-tile',\n 'text-no-decoration',\n 'text-xs-center',\n className,\n {\n 'p-a-3': !isSmall,\n 'p-a-2 np-tile--small': isSmall,\n },\n disabled && 'disabled',\n )}\n href={href}\n target={target}\n onClick={disabled ? undefined : onClick}\n onKeyDown={\n disabled\n ? undefined\n : ({ key }) => {\n if (key === 'Enter' || key === ' ') {\n onClick?.();\n }\n }\n }\n >\n <div className=\"np-tile__media d-flex justify-content-center\">{media}</div>\n <Title type={Typography.TITLE_SUBSECTION} className={clsx(isSmall ? 'm-t-1' : 'm-t-2')}>\n {title}\n </Title>\n {description ? (\n <Body as=\"span\" type={Typography.BODY_DEFAULT} className=\"m-t-1\">\n {description}\n </Body>\n ) : null}\n </Element>\n );\n}\n"],"names":["Tile","className","description","disabled","href","target","media","onClick","size","title","isSmall","Element","_jsxs","clsx","undefined","onKeyDown","key","children","_jsx","Title","type","Typography","TITLE_SUBSECTION","Body","as","BODY_DEFAULT"],"mappings":";;;;;;AAsBc,SAAUA,IAAIA,CAAC;EAC3BC,SAAS;EACTC,WAAW;EACXC,QAAQ;EACRC,IAAI;EACJC,MAAM;EACNC,KAAK;EACLC,OAAO;AACPC,EAAAA,IAAI,GAAG,IAAI;AACXC,EAAAA,KAAAA;AACU,CAAA,EAAA;AACV,EAAA,MAAMC,OAAO,GAAGF,IAAI,KAAK,IAAI,CAAA;AAC7B,EAAA,MAAMG,OAAO,GAAGP,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAA;EAErC,oBACEQ,IAAA,CAACD,OAAO,EAAA;AACNV,IAAAA,SAAS,EAAEY,IAAI,CACb,UAAU,EACV,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,gBAAgB,EAChBZ,SAAS,EACT;MACE,OAAO,EAAE,CAACS,OAAO;AACjB,MAAA,sBAAsB,EAAEA,OAAAA;AACzB,KAAA,EACDP,QAAQ,IAAI,UAAU,CACtB;AACFC,IAAAA,IAAI,EAAEA,IAAK;AACXC,IAAAA,MAAM,EAAEA,MAAO;AACfE,IAAAA,OAAO,EAAEJ,QAAQ,GAAGW,SAAS,GAAGP,OAAQ;AACxCQ,IAAAA,SAAS,EACPZ,QAAQ,GACJW,SAAS,GACT,CAAC;AAAEE,MAAAA,GAAAA;AAAG,KAAE,KAAI;AACV,MAAA,IAAIA,GAAG,KAAK,OAAO,IAAIA,GAAG,KAAK,GAAG,EAAE;AAClCT,QAAAA,OAAO,IAAI,CAAA;AACb,OAAA;KAEP;AAAAU,IAAAA,QAAA,gBAEDC,GAAA,CAAA,KAAA,EAAA;AAAKjB,MAAAA,SAAS,EAAC,8CAA8C;AAAAgB,MAAAA,QAAA,EAAEX,KAAAA;AAAK,KAAM,CAC1E,eAAAY,GAAA,CAACC,KAAK,EAAA;MAACC,IAAI,EAAEC,UAAU,CAACC,gBAAiB;MAACrB,SAAS,EAAEY,IAAI,CAACH,OAAO,GAAG,OAAO,GAAG,OAAO,CAAE;AAAAO,MAAAA,QAAA,EACpFR,KAAAA;AAAK,KACD,CACP,EAACP,WAAW,gBACVgB,GAAA,CAACK,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;MAACJ,IAAI,EAAEC,UAAU,CAACI,YAAa;AAACxB,MAAAA,SAAS,EAAC,OAAO;AAAAgB,MAAAA,QAAA,EAC7Df,WAAAA;KACG,CAAC,GACL,IAAI,CAAA;AAAA,GACD,CAAC,CAAA;AAEd;;;;"}
1
+ {"version":3,"file":"Tile.mjs","sources":["../../src/tile/Tile.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nimport Body from '../body';\nimport { Size, Typography } from '../common';\nimport Title from '../title';\n\nexport interface TileProps {\n /** Classes to apply to the Tile container */\n /** A label for the accordion item, used for accessibility purposes. */\n 'aria-label'?: string;\n className?: string;\n description?: React.ReactNode;\n disabled?: boolean;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n /** Accepts only Avatar and images */\n media: React.ReactNode;\n /** Function called onClick or onKeyDown */\n onClick?: (event?: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;\n /** The size applied to Tile */\n size?: `${Size.SMALL | Size.MEDIUM}`;\n title: React.ReactNode;\n}\n\nexport default function Tile({\n 'aria-label': ariaLabel,\n className,\n description,\n disabled,\n href,\n target,\n media,\n onClick,\n size = 'md',\n title,\n}: TileProps) {\n const isSmall = size === 'sm';\n const Element = href ? 'a' : 'button';\n\n return (\n <Element\n className={clsx(\n 'decision',\n 'flex-column',\n 'np-tile',\n 'text-no-decoration',\n 'text-xs-center',\n className,\n {\n 'p-a-3': !isSmall,\n 'p-a-2 np-tile--small': isSmall,\n },\n disabled && 'disabled',\n )}\n href={href}\n target={target}\n aria-label={ariaLabel}\n onClick={disabled ? undefined : onClick}\n onKeyDown={\n disabled\n ? undefined\n : ({ key }) => {\n if (key === 'Enter' || key === ' ') {\n onClick?.();\n }\n }\n }\n >\n <div className=\"np-tile__media d-flex justify-content-center\">{media}</div>\n <Title type={Typography.TITLE_SUBSECTION} className={clsx(isSmall ? 'm-t-1' : 'm-t-2')}>\n {title}\n </Title>\n {description ? (\n <Body as=\"span\" type={Typography.BODY_DEFAULT} className=\"m-t-1\">\n {description}\n </Body>\n ) : null}\n </Element>\n );\n}\n"],"names":["Tile","ariaLabel","className","description","disabled","href","target","media","onClick","size","title","isSmall","Element","_jsxs","clsx","undefined","onKeyDown","key","children","_jsx","Title","type","Typography","TITLE_SUBSECTION","Body","as","BODY_DEFAULT"],"mappings":";;;;;;AAwBwB,SAAAA,IAAIA,CAAC;AAC3B,EAAA,YAAY,EAAEC,SAAS;EACvBC,SAAS;EACTC,WAAW;EACXC,QAAQ;EACRC,IAAI;EACJC,MAAM;EACNC,KAAK;EACLC,OAAO;AACPC,EAAAA,IAAI,GAAG,IAAI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,CAACI,YAAa;AAACxB,MAAAA,SAAS,EAAC,OAAO;AAAAgB,MAAAA,QAAA,EAC7Df,WAAAA;KACG,CAAC,GACL,IAAI,CAAA;AAAA,GACD,CAAC,CAAA;AAEd;;;;"}
@@ -1,5 +1,6 @@
1
1
  import { SizeSmall, SizeMedium } from '../common';
2
2
  interface DecisionOption {
3
+ 'aria-label'?: string;
3
4
  description?: React.ReactNode;
4
5
  disabled?: boolean;
5
6
  href?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Decision.d.ts","sourceRoot":"","sources":["../../../src/decision/Decision.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAKpE,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC,yBAAyB,CAAC;IACzC,KAAK,EAAE;QACL,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;KACvB,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAC1D,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,eAAe,oBAAoB;CACpC;AAED,oBAAY,YAAY;IACtB,UAAU,eAAe;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAC;IACnC,iDAAiD;IACjD,YAAY,CAAC,EAAE,GAAG,oBAAoB,EAAE,CAAC;IACzC,iDAAiD;IACjD,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC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A+H;IAC/H,IAAI,CAAC,EAAE,GAAG,YAAY,EAAE,CAAC;IAEzB,qDAAqD;IACrD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC,sEAAsE;IACtE,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,QAAA,MAAM,QAAQ,sFAOX,aAAa,uCAmGf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,6 +1,8 @@
1
1
  import { Size } from '../common';
2
2
  export interface TileProps {
3
3
  /** Classes to apply to the Tile container */
4
+ /** A label for the accordion item, used for accessibility purposes. */
5
+ 'aria-label'?: string;
4
6
  className?: string;
5
7
  description?: React.ReactNode;
6
8
  disabled?: boolean;
@@ -14,5 +16,5 @@ export interface TileProps {
14
16
  size?: `${Size.SMALL | Size.MEDIUM}`;
15
17
  title: React.ReactNode;
16
18
  }
17
- export default function Tile({ className, description, disabled, href, target, media, onClick, size, title, }: TileProps): import("react").JSX.Element;
19
+ export default function Tile({ 'aria-label': ariaLabel, className, description, disabled, href, target, media, onClick, size, title, }: TileProps): import("react").JSX.Element;
18
20
  //# sourceMappingURL=Tile.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["../../../src/tile/Tile.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAc,MAAM,WAAW,CAAC;AAG7C,MAAM,WAAW,SAAS;IACxB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC,yBAAyB,CAAC;IACzC,qCAAqC;IACrC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CA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,EACR,IAAI,EACJ,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAW,EACX,KAAK,GACN,EAAE,SAAS,+BA4CX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transferwise/components",
3
- "version": "46.65.0",
3
+ "version": "46.66.0",
4
4
  "description": "Neptune React components",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -93,8 +93,8 @@
93
93
  "rollup-preserve-directives": "^1.1.1",
94
94
  "storybook": "^8.2.2",
95
95
  "@transferwise/less-config": "3.1.0",
96
- "@wise/components-theming": "1.6.0",
97
- "@transferwise/neptune-css": "14.15.0"
96
+ "@transferwise/neptune-css": "14.15.0",
97
+ "@wise/components-theming": "1.6.0"
98
98
  },
99
99
  "peerDependencies": {
100
100
  "@transferwise/icons": "^3.7.0",
@@ -0,0 +1,166 @@
1
+ import Avatar from '../avatar';
2
+ import { Breakpoint, Size } from '../common';
3
+ import { mockMatchMedia } from '../mocks';
4
+ import { render, screen } from '../test-utils';
5
+
6
+ import Decision, { DecisionPresentation, DecisionType } from '.';
7
+ import { DecisionProps } from './Decision';
8
+
9
+ mockMatchMedia(jest);
10
+
11
+ describe('Decision', () => {
12
+ const commonProps: DecisionProps = {
13
+ options: [
14
+ {
15
+ media: {
16
+ list: <Avatar type="initials">HM</Avatar>,
17
+ block: <img src="img.jpg" alt="alt" />,
18
+ },
19
+ href: '#href',
20
+ title: 'title',
21
+ description: 'description',
22
+ 'aria-label': 'A label',
23
+ onClick: jest.fn(),
24
+ },
25
+ ],
26
+ presentation: DecisionPresentation.LIST_BLOCK,
27
+ type: DecisionType.NAVIGATION,
28
+ };
29
+
30
+ const initialInnerWidth = window.innerWidth;
31
+ const resetClientWidth = (width: number) => {
32
+ window.innerWidth = width;
33
+ };
34
+
35
+ afterAll(() => {
36
+ window.innerWidth = initialInnerWidth;
37
+ });
38
+
39
+ beforeEach(() => {
40
+ resetClientWidth(Breakpoint.EXTRA_SMALL - 1);
41
+ });
42
+
43
+ describe(`when presentation is ${DecisionPresentation.LIST_BLOCK}`, () => {
44
+ const props = { ...commonProps };
45
+
46
+ it('renders only Navigation Option before first breakpoint', () => {
47
+ render(<Decision {...props} />);
48
+ const element = screen.getByLabelText('A label');
49
+ expect(element).toBeInTheDocument();
50
+
51
+ expectElementToBeNavigationOption(element);
52
+ expectElementNotToBeTile(element);
53
+ });
54
+
55
+ it('renders only Tile after first breakpoint', () => {
56
+ resetClientWidth(Breakpoint.SMALL);
57
+
58
+ render(<Decision {...props} />);
59
+ const element = screen.getByLabelText('A label');
60
+ expect(element).toBeInTheDocument();
61
+
62
+ expectElementNotToBeNavigationOption(element);
63
+ expectElementToBeTile(element);
64
+ expectElementNotToBeSmallTile(element);
65
+ });
66
+ });
67
+
68
+ describe(`when presentation is ${DecisionPresentation.LIST_BLOCK_GRID}`, () => {
69
+ const props = { ...commonProps, presentation: DecisionPresentation.LIST_BLOCK_GRID };
70
+
71
+ it('renders only Navigation Option before first breakpoint', () => {
72
+ render(<Decision {...props} />);
73
+ const element = screen.getByLabelText('A label');
74
+ expect(element).toBeInTheDocument();
75
+
76
+ expectElementToBeNavigationOption(element);
77
+ expectElementNotToBeTile(element);
78
+ });
79
+
80
+ it('renders only Tile after first breakpoint', () => {
81
+ resetClientWidth(Breakpoint.SMALL);
82
+
83
+ render(<Decision {...props} />);
84
+ const element = screen.getByLabelText('A label');
85
+ expect(element).toBeInTheDocument();
86
+
87
+ expectElementNotToBeNavigationOption(element);
88
+ expectElementToBeTile(element);
89
+ expectElementNotToBeSmallTile(element);
90
+ });
91
+
92
+ it('renders container as a grid', () => {
93
+ resetClientWidth(Breakpoint.SMALL);
94
+
95
+ render(<Decision {...props} />);
96
+ const element = screen.getByLabelText('A label').parentElement;
97
+
98
+ expect(element).toHaveClass('np-decision');
99
+ expect(element).toHaveClass('np-decision--grid');
100
+ expect(element).toHaveClass('flex-wrap');
101
+ });
102
+ });
103
+
104
+ describe(`when presentation is ${DecisionPresentation.LIST_BLOCK} and size is Small`, () => {
105
+ const props: DecisionProps = {
106
+ ...commonProps,
107
+ presentation: DecisionPresentation.LIST_BLOCK,
108
+ size: Size.SMALL,
109
+ };
110
+
111
+ it('renders only Navigation Option before breakpoint', () => {
112
+ render(<Decision {...props} />);
113
+ const element = screen.getByLabelText('A label');
114
+ expect(element).toBeInTheDocument();
115
+
116
+ expectElementToBeNavigationOption(element);
117
+ expectElementNotToBeTile(element);
118
+ });
119
+
120
+ it('renders Small Tile after breakpoint', () => {
121
+ resetClientWidth(Breakpoint.EXTRA_SMALL);
122
+
123
+ render(<Decision {...props} />);
124
+ const element = screen.getByLabelText('A label');
125
+ expect(element).toBeInTheDocument();
126
+
127
+ expectElementNotToBeNavigationOption(element);
128
+ expectElementToBeTile(element);
129
+ expectElementToBeSmallTile(element);
130
+ });
131
+ });
132
+
133
+ describe(`when presentation is ${DecisionPresentation.LIST}`, () => {
134
+ const props = { ...commonProps, presentation: DecisionPresentation.LIST };
135
+
136
+ it('renders Navigation Option before breakpoint', () => {
137
+ render(<Decision {...props} />);
138
+ const element = screen.getByLabelText('A label');
139
+ expect(element).toBeInTheDocument();
140
+
141
+ expectElementToBeNavigationOption(element);
142
+ expectElementNotToBeTile(element);
143
+ });
144
+ });
145
+
146
+ const expectElementToBeNavigationOption = (element: HTMLElement) => {
147
+ expect(element).toHaveClass('np-navigation-option');
148
+ };
149
+ const expectElementNotToBeNavigationOption = (element: HTMLElement) => {
150
+ expect(element).not.toHaveClass('np-navigation-option');
151
+ };
152
+
153
+ const expectElementToBeTile = (element: HTMLElement) => {
154
+ expect(element).toHaveClass('np-tile');
155
+ };
156
+ const expectElementNotToBeTile = (element: HTMLElement) => {
157
+ expect(element).not.toHaveClass('np-tile');
158
+ };
159
+
160
+ const expectElementToBeSmallTile = (element: HTMLElement) => {
161
+ expect(element).toHaveClass('np-tile--small');
162
+ };
163
+ const expectElementNotToBeSmallTile = (element: HTMLElement) => {
164
+ expect(element).not.toHaveClass('np-tile--small');
165
+ };
166
+ });
@@ -24,63 +24,64 @@ export const Basic = () => {
24
24
  const size = select('size', [Size.MEDIUM, Size.SMALL], Size.MEDIUM);
25
25
 
26
26
  return (
27
- <>
28
- <Decision
29
- options={[
30
- {
31
- description: 'Short text test.',
32
- onClick: action('clicked'),
33
- href: '#href1',
34
- disabled,
35
- media: {
36
- block: <Illustration name="globe" alt="" disablePadding />,
37
- list: (
38
- <Avatar size="md" type="initials">
39
- HM
40
- </Avatar>
41
- ),
42
- },
43
- title: 'Hank Miller',
27
+ <Decision
28
+ options={[
29
+ {
30
+ description: 'Short text test.',
31
+ onClick: action('clicked'),
32
+ href: '#href1',
33
+ disabled,
34
+ media: {
35
+ block: <Illustration name="globe" alt="" disablePadding />,
36
+ list: (
37
+ <Avatar size="md" type="initials">
38
+ HM
39
+ </Avatar>
40
+ ),
44
41
  },
45
- {
46
- description:
47
- "Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
48
- onClick: action('clicked'),
49
- disabled,
50
- href: '#href2',
51
- media: {
52
- block: <Illustration name="confetti" alt="" disablePadding />,
53
- list: (
54
- <Avatar size="md" type="initials">
55
- HM
56
- </Avatar>
57
- ),
58
- },
59
- title: 'Hank Miller',
42
+ 'aria-label': 'Click to see something',
43
+ title: 'Hank Miller',
44
+ },
45
+ {
46
+ description:
47
+ "Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
48
+ onClick: action('clicked'),
49
+ disabled,
50
+ href: '#href2',
51
+ media: {
52
+ block: <Illustration name="confetti" alt="" disablePadding />,
53
+ list: (
54
+ <Avatar size="md" type="initials">
55
+ HM
56
+ </Avatar>
57
+ ),
60
58
  },
61
- {
62
- description: "I'm disabled and don't require an onClick or href.",
63
- media: {
64
- block: <Illustration name="briefcase" alt="" disablePadding />,
65
- list: (
66
- <img
67
- src="https://wise.com/public-resources/assets/illustrations/business_account_web_small.svg"
68
- alt=""
69
- width="100"
70
- />
71
- ),
72
- },
73
- disabled: true,
74
- title: 'Hank Miller',
59
+ 'aria-label': 'Click here to send money to Hank Miller.',
60
+ title: 'Hank Miller',
61
+ },
62
+ {
63
+ description: "I'm disabled and don't require an onClick or href.",
64
+ media: {
65
+ block: <Illustration name="briefcase" alt="" disablePadding />,
66
+ list: (
67
+ <img
68
+ src="https://wise.com/public-resources/assets/illustrations/business_account_web_small.svg"
69
+ alt=""
70
+ width="100"
71
+ />
72
+ ),
75
73
  },
76
- ]}
77
- presentation={presentation}
78
- type={DecisionType.NAVIGATION}
79
- showMediaCircleInList={showMediaCircleInList}
80
- isContainerAligned={isContainerAligned}
81
- size={size}
82
- />
83
- </>
74
+ 'aria-label': 'This option is disabled.',
75
+ disabled: true,
76
+ title: 'Hank Miller',
77
+ },
78
+ ]}
79
+ presentation={presentation}
80
+ type={DecisionType.NAVIGATION}
81
+ showMediaCircleInList={showMediaCircleInList}
82
+ isContainerAligned={isContainerAligned}
83
+ size={size}
84
+ />
84
85
  );
85
86
  };
86
87
 
@@ -94,160 +95,165 @@ export const grid = () => {
94
95
  const size = select('size', [Size.MEDIUM, Size.SMALL], Size.MEDIUM);
95
96
 
96
97
  return (
97
- <>
98
- <Decision
99
- options={[
100
- {
101
- description: 'Short text test.',
102
- onClick: action('clicked'),
103
- href: '#href1',
104
- disabled,
105
- media: {
106
- block: (
107
- <img
108
- src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
109
- alt=""
110
- />
111
- ),
112
- list: (
113
- <Avatar size="md" type="initials">
114
- HM
115
- </Avatar>
116
- ),
117
- },
118
- title: 'Hank Miller',
98
+ <Decision
99
+ options={[
100
+ {
101
+ description: 'Short text test.',
102
+ onClick: action('clicked'),
103
+ href: '#href1',
104
+ disabled,
105
+ media: {
106
+ block: (
107
+ <img
108
+ src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
109
+ alt=""
110
+ />
111
+ ),
112
+ list: (
113
+ <Avatar size="md" type="initials">
114
+ HM
115
+ </Avatar>
116
+ ),
119
117
  },
120
- {
121
- description:
122
- "Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
123
- onClick: action('clicked'),
124
- disabled,
125
- href: '#href2',
126
- media: {
127
- block: (
128
- <img
129
- src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
130
- alt=""
131
- />
132
- ),
133
- list: (
134
- <Avatar size="md" type="initials">
135
- HM
136
- </Avatar>
137
- ),
138
- },
139
- title: 'Hank Miller',
118
+ 'aria-label': 'Click to see something',
119
+ title: 'Hank Miller',
120
+ },
121
+ {
122
+ description:
123
+ "Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
124
+ onClick: action('clicked'),
125
+ disabled,
126
+ href: '#href2',
127
+ media: {
128
+ block: (
129
+ <img
130
+ src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
131
+ alt=""
132
+ />
133
+ ),
134
+ list: (
135
+ <Avatar size="md" type="initials">
136
+ HM
137
+ </Avatar>
138
+ ),
140
139
  },
141
- {
142
- description:
143
- "Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
144
- onClick: action('clicked'),
145
- href: '#href3',
146
- media: {
147
- block: (
148
- <img
149
- src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
150
- alt=""
151
- />
152
- ),
153
- list: (
154
- <Avatar size="md" type="initials">
155
- HM
156
- </Avatar>
157
- ),
158
- },
159
- disabled,
160
- title: 'Hank Miller',
140
+ 'aria-label': 'Click here to send money to Hank Miller.',
141
+ title: 'Hank Miller',
142
+ },
143
+ {
144
+ description:
145
+ "Click here to send money to Hank Miller. Money will be sent directly to Han Miller's multi-currency account.",
146
+ onClick: action('clicked'),
147
+ href: '#href3',
148
+ media: {
149
+ block: (
150
+ <img
151
+ src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
152
+ alt=""
153
+ />
154
+ ),
155
+ list: (
156
+ <Avatar size="md" type="initials">
157
+ HM
158
+ </Avatar>
159
+ ),
161
160
  },
162
- {
163
- description:
164
- "Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
165
- onClick: action('clicked'),
166
- href: '#href1',
167
- disabled,
168
- media: {
169
- block: (
170
- <img
171
- src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
172
- alt=""
173
- />
174
- ),
175
- list: (
176
- <Avatar size="md" type="initials">
177
- HM
178
- </Avatar>
179
- ),
180
- },
181
- title: 'Hank Miller',
161
+ 'aria-label': 'Click here to send money to Hank Miller.',
162
+ disabled,
163
+ title: 'Hank Miller',
164
+ },
165
+ {
166
+ description:
167
+ "Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
168
+ onClick: action('clicked'),
169
+ href: '#href1',
170
+ disabled,
171
+ media: {
172
+ block: (
173
+ <img
174
+ src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
175
+ alt=""
176
+ />
177
+ ),
178
+ list: (
179
+ <Avatar size="md" type="initials">
180
+ HM
181
+ </Avatar>
182
+ ),
182
183
  },
183
- {
184
- description:
185
- "Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
186
- onClick: action('clicked'),
187
- href: '#href1',
188
- disabled,
189
- media: {
190
- block: (
191
- <img
192
- src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
193
- alt=""
194
- />
195
- ),
196
- list: (
197
- <Avatar size="md" type="initials">
198
- HM
199
- </Avatar>
200
- ),
201
- },
202
- title: 'Hank Miller',
184
+ 'aria-label': 'Click here to send money to Hank Miller.',
185
+ title: 'Hank Miller',
186
+ },
187
+ {
188
+ description:
189
+ "Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
190
+ onClick: action('clicked'),
191
+ href: '#href1',
192
+ disabled,
193
+ media: {
194
+ block: (
195
+ <img
196
+ src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
197
+ alt=""
198
+ />
199
+ ),
200
+ list: (
201
+ <Avatar size="md" type="initials">
202
+ HM
203
+ </Avatar>
204
+ ),
203
205
  },
204
- {
205
- description:
206
- "Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
207
- onClick: action('clicked'),
208
- href: '#href1',
209
- disabled,
210
- media: {
211
- block: (
212
- <img
213
- src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
214
- alt=""
215
- />
216
- ),
217
- list: (
218
- <Avatar size="md" type="initials">
219
- HM
220
- </Avatar>
221
- ),
222
- },
223
- title: 'Hank Miller',
206
+ 'aria-label': 'Click here to send money to Hank Miller.',
207
+ title: 'Hank Miller',
208
+ },
209
+ {
210
+ description:
211
+ "Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
212
+ onClick: action('clicked'),
213
+ href: '#href1',
214
+ disabled,
215
+ media: {
216
+ block: (
217
+ <img
218
+ src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
219
+ alt=""
220
+ />
221
+ ),
222
+ list: (
223
+ <Avatar size="md" type="initials">
224
+ HM
225
+ </Avatar>
226
+ ),
224
227
  },
225
- {
226
- description:
227
- "Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
228
- onClick: action('clicked'),
229
- href: '#href1',
230
- disabled,
231
- media: {
232
- block: (
233
- <img
234
- src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
235
- alt=""
236
- />
237
- ),
238
- list: (
239
- <Avatar size="md" type="initials">
240
- HM
241
- </Avatar>
242
- ),
243
- },
244
- title: 'Hank Miller',
228
+ 'aria-label': 'Click here to send money to Hank Miller.',
229
+ title: 'Hank Miller',
230
+ },
231
+ {
232
+ description:
233
+ "Click here to send money to Hank Miller. Money will be sent directly to Hank Miller's multi-currency account.",
234
+ onClick: action('clicked'),
235
+ href: '#href1',
236
+ disabled,
237
+ media: {
238
+ block: (
239
+ <img
240
+ src="https://wise.com/public-resources/assets/bank-details/bank-details-flow/finish.svg"
241
+ alt=""
242
+ />
243
+ ),
244
+ list: (
245
+ <Avatar size="md" type="initials">
246
+ HM
247
+ </Avatar>
248
+ ),
245
249
  },
246
- ]}
247
- presentation={presentation}
248
- type={DecisionType.NAVIGATION}
249
- size={size}
250
- />
251
- </>
250
+ 'aria-label': 'Click here to send money to Hank Miller.',
251
+ title: 'Hank Miller',
252
+ },
253
+ ]}
254
+ presentation={presentation}
255
+ type={DecisionType.NAVIGATION}
256
+ size={size}
257
+ />
252
258
  );
253
259
  };
@@ -6,6 +6,7 @@ import NavigationOption from '../navigationOption';
6
6
  import Tile from '../tile';
7
7
 
8
8
  interface DecisionOption {
9
+ 'aria-label'?: string;
9
10
  description?: React.ReactNode;
10
11
  disabled?: boolean;
11
12
  href?: string;
@@ -58,10 +59,23 @@ const Decision = ({
58
59
 
59
60
  if (type === DecisionType.NAVIGATION) {
60
61
  const renderedOptions = options.map(
61
- ({ title, description, disabled, href, target, media: { list }, onClick }, key) => (
62
+ (
63
+ {
64
+ 'aria-label': ariaLabel,
65
+ title,
66
+ description,
67
+ disabled,
68
+ href,
69
+ target,
70
+ media: { list },
71
+ onClick,
72
+ },
73
+ key,
74
+ ) => (
62
75
  <NavigationOption
63
76
  // eslint-disable-next-line react/no-array-index-key
64
77
  key={`nav-${key}`}
78
+ aria-label={ariaLabel}
65
79
  complex={false}
66
80
  content={description}
67
81
  disabled={disabled}
@@ -100,7 +114,16 @@ const Decision = ({
100
114
  {breakpoint
101
115
  ? options.map(
102
116
  (
103
- { description, disabled, href, target, media: { block }, onClick, title },
117
+ {
118
+ 'aria-label': ariaLabel,
119
+ description,
120
+ disabled,
121
+ href,
122
+ target,
123
+ media: { block },
124
+ onClick,
125
+ title,
126
+ },
104
127
  key,
105
128
  ) => (
106
129
  <Tile
@@ -109,6 +132,7 @@ const Decision = ({
109
132
  className={clsx(`np-decision__tile${isSmall ? '--small' : ''}`, {
110
133
  'np-decision__tile--fixed-width': isGrid,
111
134
  })}
135
+ aria-label={ariaLabel}
112
136
  description={description}
113
137
  disabled={disabled}
114
138
  href={href}
package/src/tile/Tile.tsx CHANGED
@@ -6,6 +6,8 @@ import Title from '../title';
6
6
 
7
7
  export interface TileProps {
8
8
  /** Classes to apply to the Tile container */
9
+ /** A label for the accordion item, used for accessibility purposes. */
10
+ 'aria-label'?: string;
9
11
  className?: string;
10
12
  description?: React.ReactNode;
11
13
  disabled?: boolean;
@@ -21,6 +23,7 @@ export interface TileProps {
21
23
  }
22
24
 
23
25
  export default function Tile({
26
+ 'aria-label': ariaLabel,
24
27
  className,
25
28
  description,
26
29
  disabled,
@@ -51,6 +54,7 @@ export default function Tile({
51
54
  )}
52
55
  href={href}
53
56
  target={target}
57
+ aria-label={ariaLabel}
54
58
  onClick={disabled ? undefined : onClick}
55
59
  onKeyDown={
56
60
  disabled
@@ -1,127 +0,0 @@
1
- import Avatar from '../avatar';
2
- import { Breakpoint, Size } from '../common';
3
- import { mockMatchMedia } from '../mocks';
4
- import { render, fireEvent, screen } from '../test-utils';
5
-
6
- import Decision, { DecisionPresentation, DecisionType } from '.';
7
-
8
- mockMatchMedia(jest);
9
-
10
- describe('Decision', () => {
11
- const commonProps = {
12
- options: [
13
- {
14
- media: {
15
- list: <Avatar type="initials">HM</Avatar>,
16
- block: <img src="img.jpg" alt="alt" />,
17
- },
18
- href: '#href',
19
- title: 'title',
20
- description: 'description',
21
- onClick: jest.fn(),
22
- },
23
- ],
24
- presentation: DecisionPresentation.LIST_BLOCK,
25
- type: DecisionType.NAVIGATION,
26
- };
27
-
28
- const initialInnerWidth = window.innerWidth;
29
- const resetClientWidth = (width) => {
30
- window.innerWidth = width;
31
- };
32
-
33
- afterAll(() => {
34
- window.innerWidth = initialInnerWidth;
35
- });
36
-
37
- beforeEach(() => {
38
- resetClientWidth(Breakpoint.EXTRA_SMALL - 1);
39
- });
40
-
41
- describe(`when presentation is ${DecisionPresentation.LIST_BLOCK}`, () => {
42
- const props = { ...commonProps };
43
-
44
- it('renders only Navigation Option before first breakpoint', () => {
45
- const { container } = render(<Decision {...props} />);
46
-
47
- expect(getNavigationOption(container)).toBeInTheDocument();
48
- expect(getTile(container)).not.toBeInTheDocument();
49
- });
50
-
51
- it('renders only Tile after first breakpoint', () => {
52
- resetClientWidth(Breakpoint.SMALL);
53
- const { container } = render(<Decision {...props} />);
54
-
55
- expect(getNavigationOption(container)).not.toBeInTheDocument();
56
- expect(getTile(container)).toBeInTheDocument();
57
- expect(getTile(container)).not.toHaveClass('np-tile--small');
58
- });
59
- });
60
-
61
- describe(`when presentation is ${DecisionPresentation.LIST_BLOCK_GRID}`, () => {
62
- const props = { ...commonProps, presentation: DecisionPresentation.LIST_BLOCK_GRID };
63
-
64
- it('renders only Navigation Option before first breakpoint', () => {
65
- const { container } = render(<Decision {...props} />);
66
-
67
- expect(getNavigationOption(container)).toBeInTheDocument();
68
- expect(getTile(container)).not.toBeInTheDocument();
69
- });
70
-
71
- it('renders only Tile after first breakpoint', () => {
72
- resetClientWidth(Breakpoint.SMALL);
73
- const { container } = render(<Decision {...props} />);
74
-
75
- expect(getNavigationOption(container)).not.toBeInTheDocument();
76
- expect(getTile(container)).toBeInTheDocument();
77
- expect(getTile(container)).not.toHaveClass('np-tile--small');
78
- });
79
-
80
- it('renders container as a grid', () => {
81
- resetClientWidth(Breakpoint.SMALL);
82
- const { container } = render(<Decision {...props} />);
83
-
84
- const decisionElement = container.querySelector('.np-decision');
85
- expect(decisionElement).toHaveClass('np-decision--grid');
86
- expect(decisionElement).toHaveClass('flex-wrap');
87
- });
88
- });
89
-
90
- describe(`when presentation is ${DecisionPresentation.LIST_BLOCK} and size is Small`, () => {
91
- const props = {
92
- ...commonProps,
93
- presentation: DecisionPresentation.LIST_BLOCK,
94
- size: Size.SMALL,
95
- };
96
-
97
- it('renders only Navigation Option before breakpoint', () => {
98
- const { container } = render(<Decision {...props} />);
99
-
100
- expect(getNavigationOption(container)).toBeInTheDocument();
101
- expect(getTile(container)).not.toBeInTheDocument();
102
- });
103
-
104
- it('renders Small Tile after breakpoint', () => {
105
- resetClientWidth(Breakpoint.EXTRA_SMALL);
106
- const { container } = render(<Decision {...props} />);
107
-
108
- expect(getNavigationOption(container)).not.toBeInTheDocument();
109
- expect(getTile(container)).toBeInTheDocument();
110
- expect(getTile(container)).toHaveClass('np-tile--small');
111
- });
112
- });
113
-
114
- describe(`when presentation is ${DecisionPresentation.LIST}`, () => {
115
- const props = { ...commonProps, presentation: DecisionPresentation.LIST };
116
-
117
- it('renders Navigation Option before breakpoint', () => {
118
- const { container } = render(<Decision {...props} />);
119
-
120
- expect(getNavigationOption(container)).toBeInTheDocument();
121
- expect(getTile(container)).not.toBeInTheDocument();
122
- });
123
- });
124
-
125
- const getNavigationOption = (container) => container.querySelector('.np-navigation-option');
126
- const getTile = (container) => container.querySelector('.np-tile');
127
- });