@transferwise/components 0.0.0-experimental-15914a5 → 0.0.0-experimental-a12c97e
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/AvatarLayout/ListItemAvatarLayout.js +0 -2
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.js.map +1 -1
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs +0 -2
- package/build/listItem/AvatarLayout/ListItemAvatarLayout.mjs.map +1 -1
- package/build/listItem/AvatarView/ListItemAvatarView.js +0 -2
- package/build/listItem/AvatarView/ListItemAvatarView.js.map +1 -1
- package/build/listItem/AvatarView/ListItemAvatarView.mjs +0 -2
- package/build/listItem/AvatarView/ListItemAvatarView.mjs.map +1 -1
- package/build/listItem/Image/ListItemImage.js +1 -3
- package/build/listItem/Image/ListItemImage.js.map +1 -1
- package/build/listItem/Image/ListItemImage.mjs +1 -3
- package/build/listItem/Image/ListItemImage.mjs.map +1 -1
- package/build/listItem/ListItem.js +14 -16
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +14 -16
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/listItem/ListItemContext.js.map +1 -1
- package/build/listItem/ListItemContext.mjs.map +1 -1
- package/build/listItem/Navigation/ListItemNavigation.js +1 -1
- package/build/listItem/Navigation/ListItemNavigation.js.map +1 -1
- package/build/listItem/Navigation/ListItemNavigation.mjs +1 -1
- package/build/listItem/Navigation/ListItemNavigation.mjs.map +1 -1
- package/build/main.css +99 -51
- package/build/styles/avatarView/AvatarView.css +3 -1
- package/build/styles/listItem/ListItem.css +96 -50
- package/build/styles/listItem/ListItem.grid.css +9 -15
- package/build/styles/main.css +99 -51
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs.map +1 -1
- package/build/types/listItem/AvatarLayout/ListItemAvatarLayout.d.ts.map +1 -1
- package/build/types/listItem/AvatarView/ListItemAvatarView.d.ts.map +1 -1
- package/build/types/listItem/Image/ListItemImage.d.ts.map +1 -1
- package/build/types/listItem/ListItem.d.ts.map +1 -1
- package/build/types/listItem/ListItemContext.d.ts +0 -4
- package/build/types/listItem/ListItemContext.d.ts.map +1 -1
- package/build/types/listItem/_stories/helpers.d.ts +27 -0
- package/build/types/listItem/_stories/helpers.d.ts.map +1 -0
- package/build/types/switch/Switch.d.ts +1 -1
- package/build/types/switch/Switch.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/avatarView/AvatarView.css +3 -1
- package/src/avatarView/AvatarView.less +2 -1
- package/src/listItem/AdditionalInfo/ListItemAdditionalInfo.story.tsx +58 -8
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.story.tsx +3 -0
- package/src/listItem/AvatarLayout/ListItemAvatarLayout.tsx +0 -3
- package/src/listItem/AvatarView/ListItemAvatarView.story.tsx +21 -3
- package/src/listItem/AvatarView/ListItemAvatarView.tsx +0 -3
- package/src/listItem/Button/ListItemButton.spec.tsx +35 -10
- package/src/listItem/Button/ListItemButton.story.tsx +95 -37
- package/src/listItem/Checkbox/ListItemCheckbox.story.tsx +18 -0
- package/src/listItem/IconButton/ListItemIconButton.story.tsx +15 -2
- package/src/listItem/Image/ListItemImage.spec.tsx +5 -8
- package/src/listItem/Image/ListItemImage.story.tsx +6 -23
- package/src/listItem/Image/ListItemImage.tsx +1 -4
- package/src/listItem/ListItem.css +96 -50
- package/src/listItem/ListItem.grid.css +9 -15
- package/src/listItem/ListItem.grid.less +14 -22
- package/src/listItem/ListItem.less +111 -46
- package/src/listItem/ListItem.tsx +18 -24
- package/src/listItem/ListItemContext.tsx +0 -5
- package/src/listItem/Navigation/ListItemNavigation.story.tsx +5 -2
- package/src/listItem/Navigation/ListItemNavigation.tsx +1 -1
- package/src/listItem/Radio/ListItemRadio.story.tsx +10 -0
- package/src/listItem/Switch/ListItemSwitch.story.tsx +8 -0
- package/src/listItem/_stories/ListItem.scenarios.story.tsx +209 -0
- package/src/listItem/_stories/ListItem.story.tsx +243 -141
- package/src/listItem/_stories/ListItem.variants.test.story.tsx +2 -7
- package/src/listItem/_stories/helpers.tsx +53 -0
- package/src/main.css +99 -51
- package/src/switch/Switch.tsx +1 -1
- package/build/listItem/useListItemMedia.js +0 -21
- package/build/listItem/useListItemMedia.js.map +0 -1
- package/build/listItem/useListItemMedia.mjs +0 -19
- package/build/listItem/useListItemMedia.mjs.map +0 -1
- package/build/types/listItem/test-utils.d.ts +0 -7
- package/build/types/listItem/test-utils.d.ts.map +0 -1
- package/build/types/listItem/useListItemMedia.d.ts +0 -6
- package/build/types/listItem/useListItemMedia.d.ts.map +0 -1
- package/src/listItem/test-utils.tsx +0 -33
- package/src/listItem/useListItemMedia.tsx +0 -13
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var AvatarLayout$1 = require('../../avatarLayout/AvatarLayout.js');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
|
-
var useListItemMedia = require('../useListItemMedia.js');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
|
|
8
7
|
const AvatarLayout = ({
|
|
@@ -10,7 +9,6 @@ const AvatarLayout = ({
|
|
|
10
9
|
size = 48,
|
|
11
10
|
...props
|
|
12
11
|
}) => {
|
|
13
|
-
useListItemMedia.useListItemMedia(size);
|
|
14
12
|
return /*#__PURE__*/jsxRuntime.jsx(AvatarLayout$1.default, {
|
|
15
13
|
...props,
|
|
16
14
|
size: size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemAvatarLayout.js","sources":["../../../src/listItem/AvatarLayout/ListItemAvatarLayout.tsx"],"sourcesContent":["import AvatarLayoutComp, { type AvatarLayoutProps } from '../../avatarLayout';\nimport { clsx } from 'clsx';\
|
|
1
|
+
{"version":3,"file":"ListItemAvatarLayout.js","sources":["../../../src/listItem/AvatarLayout/ListItemAvatarLayout.tsx"],"sourcesContent":["import AvatarLayoutComp, { type AvatarLayoutProps } from '../../avatarLayout';\nimport { clsx } from 'clsx';\n\ntype SizeProp = { size?: 32 | 40 | 48 | 56 | 72 };\n\nexport type ListItemAvatarLayoutProps = Omit<AvatarLayoutProps, 'size' | 'interactive'> & SizeProp;\n\n/**\n * This component allows for rendering 2 avatars. It's a thin wrapper around the\n * [AvatarLayout component](https://storybook.wise.design/?path=/docs/content-avatarlayout--docs), but offers only\n * a subset of its sizes, and disallows interactive mode, in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://wise.design/components/list-item#avatar) for details.\n */\nexport const AvatarLayout = ({ className, size = 48, ...props }: ListItemAvatarLayoutProps) => {\n return (\n <AvatarLayoutComp\n {...props}\n size={size}\n className={clsx('wds-list-item-media-avatar-layout', className)}\n />\n );\n};\nAvatarLayout.displayName = 'ListItem.AvatarLayout';\n"],"names":["AvatarLayout","className","size","props","_jsx","AvatarLayoutComp","clsx","displayName"],"mappings":";;;;;;AAcO,MAAMA,YAAY,GAAGA,CAAC;EAAEC,SAAS;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAE,GAAGC;AAAK,CAA6B,KAAI;EAC5F,oBACEC,cAAA,CAACC,sBAAgB,EAAA;AAAA,IAAA,GACXF,KAAK;AACTD,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,SAAS,EAAEK,SAAI,CAAC,mCAAmC,EAAEL,SAAS;AAAE,GAAA,CAChE;AAEN;AACAD,YAAY,CAACO,WAAW,GAAG,uBAAuB;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import AvatarLayout$1 from '../../avatarLayout/AvatarLayout.mjs';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { useListItemMedia } from '../useListItemMedia.mjs';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
5
|
const AvatarLayout = ({
|
|
@@ -8,7 +7,6 @@ const AvatarLayout = ({
|
|
|
8
7
|
size = 48,
|
|
9
8
|
...props
|
|
10
9
|
}) => {
|
|
11
|
-
useListItemMedia(size);
|
|
12
10
|
return /*#__PURE__*/jsx(AvatarLayout$1, {
|
|
13
11
|
...props,
|
|
14
12
|
size: size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemAvatarLayout.mjs","sources":["../../../src/listItem/AvatarLayout/ListItemAvatarLayout.tsx"],"sourcesContent":["import AvatarLayoutComp, { type AvatarLayoutProps } from '../../avatarLayout';\nimport { clsx } from 'clsx';\
|
|
1
|
+
{"version":3,"file":"ListItemAvatarLayout.mjs","sources":["../../../src/listItem/AvatarLayout/ListItemAvatarLayout.tsx"],"sourcesContent":["import AvatarLayoutComp, { type AvatarLayoutProps } from '../../avatarLayout';\nimport { clsx } from 'clsx';\n\ntype SizeProp = { size?: 32 | 40 | 48 | 56 | 72 };\n\nexport type ListItemAvatarLayoutProps = Omit<AvatarLayoutProps, 'size' | 'interactive'> & SizeProp;\n\n/**\n * This component allows for rendering 2 avatars. It's a thin wrapper around the\n * [AvatarLayout component](https://storybook.wise.design/?path=/docs/content-avatarlayout--docs), but offers only\n * a subset of its sizes, and disallows interactive mode, in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://wise.design/components/list-item#avatar) for details.\n */\nexport const AvatarLayout = ({ className, size = 48, ...props }: ListItemAvatarLayoutProps) => {\n return (\n <AvatarLayoutComp\n {...props}\n size={size}\n className={clsx('wds-list-item-media-avatar-layout', className)}\n />\n );\n};\nAvatarLayout.displayName = 'ListItem.AvatarLayout';\n"],"names":["AvatarLayout","className","size","props","_jsx","AvatarLayoutComp","clsx","displayName"],"mappings":";;;;AAcO,MAAMA,YAAY,GAAGA,CAAC;EAAEC,SAAS;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAE,GAAGC;AAAK,CAA6B,KAAI;EAC5F,oBACEC,GAAA,CAACC,cAAgB,EAAA;AAAA,IAAA,GACXF,KAAK;AACTD,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,SAAS,EAAEK,IAAI,CAAC,mCAAmC,EAAEL,SAAS;AAAE,GAAA,CAChE;AAEN;AACAD,YAAY,CAACO,WAAW,GAAG,uBAAuB;;;;"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var clsx = require('clsx');
|
|
4
4
|
var AvatarView$1 = require('../../avatarView/AvatarView.js');
|
|
5
|
-
var useListItemMedia = require('../useListItemMedia.js');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
|
|
8
7
|
const AvatarView = ({
|
|
@@ -10,7 +9,6 @@ const AvatarView = ({
|
|
|
10
9
|
size = 48,
|
|
11
10
|
...props
|
|
12
11
|
}) => {
|
|
13
|
-
useListItemMedia.useListItemMedia(size);
|
|
14
12
|
return /*#__PURE__*/jsxRuntime.jsx(AvatarView$1.default, {
|
|
15
13
|
...props,
|
|
16
14
|
size: size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemAvatarView.js","sources":["../../../src/listItem/AvatarView/ListItemAvatarView.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport AvatarViewComp, { AvatarViewProps } from '../../avatarView';\
|
|
1
|
+
{"version":3,"file":"ListItemAvatarView.js","sources":["../../../src/listItem/AvatarView/ListItemAvatarView.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport AvatarViewComp, { AvatarViewProps } from '../../avatarView';\n\nexport type ListItemAvatarViewProps = Omit<AvatarViewProps, 'size' | 'interactive'> & {\n size?: 32 | 40 | 48 | 56 | 72;\n};\n\n/**\n * This component renders a single avatar. It's a thin wrapper around the\n * [AvatarView component](https://storybook.wise.design/?path=/docs/content-avatarview--docs), but offers only\n * a subset of its sizes, in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://wise.design/components/list-item#avatar) for details.\n */\nexport const AvatarView = ({ className, size = 48, ...props }: ListItemAvatarViewProps) => {\n return (\n <AvatarViewComp\n {...props}\n size={size}\n className={clsx('wds-list-item-media-avatar-view', className)}\n />\n );\n};\nAvatarView.displayName = 'ListItem.AvatarView';\n"],"names":["AvatarView","className","size","props","_jsx","AvatarViewComp","clsx","displayName"],"mappings":";;;;;;AAcO,MAAMA,UAAU,GAAGA,CAAC;EAAEC,SAAS;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAE,GAAGC;AAAK,CAA2B,KAAI;EACxF,oBACEC,cAAA,CAACC,oBAAc,EAAA;AAAA,IAAA,GACTF,KAAK;AACTD,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,SAAS,EAAEK,SAAI,CAAC,iCAAiC,EAAEL,SAAS;AAAE,GAAA,CAC9D;AAEN;AACAD,UAAU,CAACO,WAAW,GAAG,qBAAqB;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import AvatarView$1 from '../../avatarView/AvatarView.mjs';
|
|
3
|
-
import { useListItemMedia } from '../useListItemMedia.mjs';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
5
|
const AvatarView = ({
|
|
@@ -8,7 +7,6 @@ const AvatarView = ({
|
|
|
8
7
|
size = 48,
|
|
9
8
|
...props
|
|
10
9
|
}) => {
|
|
11
|
-
useListItemMedia(size);
|
|
12
10
|
return /*#__PURE__*/jsx(AvatarView$1, {
|
|
13
11
|
...props,
|
|
14
12
|
size: size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemAvatarView.mjs","sources":["../../../src/listItem/AvatarView/ListItemAvatarView.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport AvatarViewComp, { AvatarViewProps } from '../../avatarView';\
|
|
1
|
+
{"version":3,"file":"ListItemAvatarView.mjs","sources":["../../../src/listItem/AvatarView/ListItemAvatarView.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport AvatarViewComp, { AvatarViewProps } from '../../avatarView';\n\nexport type ListItemAvatarViewProps = Omit<AvatarViewProps, 'size' | 'interactive'> & {\n size?: 32 | 40 | 48 | 56 | 72;\n};\n\n/**\n * This component renders a single avatar. It's a thin wrapper around the\n * [AvatarView component](https://storybook.wise.design/?path=/docs/content-avatarview--docs), but offers only\n * a subset of its sizes, in line with the ListItem's constraints. <br />\n * <br />\n * Please refer to the [Design documentation](https://wise.design/components/list-item#avatar) for details.\n */\nexport const AvatarView = ({ className, size = 48, ...props }: ListItemAvatarViewProps) => {\n return (\n <AvatarViewComp\n {...props}\n size={size}\n className={clsx('wds-list-item-media-avatar-view', className)}\n />\n );\n};\nAvatarView.displayName = 'ListItem.AvatarView';\n"],"names":["AvatarView","className","size","props","_jsx","AvatarViewComp","clsx","displayName"],"mappings":";;;;AAcO,MAAMA,UAAU,GAAGA,CAAC;EAAEC,SAAS;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAE,GAAGC;AAAK,CAA2B,KAAI;EACxF,oBACEC,GAAA,CAACC,YAAc,EAAA;AAAA,IAAA,GACTF,KAAK;AACTD,IAAAA,IAAI,EAAEA,IAAK;AACXD,IAAAA,SAAS,EAAEK,IAAI,CAAC,iCAAiC,EAAEL,SAAS;AAAE,GAAA,CAC9D;AAEN;AACAD,UAAU,CAACO,WAAW,GAAG,qBAAqB;;;;"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var Image$1 = require('../../image/Image.js');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
|
-
var useListItemMedia = require('../useListItemMedia.js');
|
|
6
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
6
|
|
|
8
7
|
const Image = ({
|
|
@@ -10,11 +9,10 @@ const Image = ({
|
|
|
10
9
|
size = 48,
|
|
11
10
|
...props
|
|
12
11
|
}) => {
|
|
13
|
-
useListItemMedia.useListItemMedia(size);
|
|
14
12
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
15
13
|
className: clsx.clsx('wds-list-item-media-image'),
|
|
16
14
|
style: {
|
|
17
|
-
'--
|
|
15
|
+
'--item-media-image-size': `${size}px`
|
|
18
16
|
},
|
|
19
17
|
children: /*#__PURE__*/jsxRuntime.jsx(Image$1.default, {
|
|
20
18
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemImage.js","sources":["../../../src/listItem/Image/ListItemImage.tsx"],"sourcesContent":["import ImageComp, { type ImageProps } from '../../image';\nimport { clsx } from 'clsx';\
|
|
1
|
+
{"version":3,"file":"ListItemImage.js","sources":["../../../src/listItem/Image/ListItemImage.tsx"],"sourcesContent":["import ImageComp, { type ImageProps } from '../../image';\nimport { clsx } from 'clsx';\n\ntype SizeProp = {};\n\nexport type ListItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt' | 'role'> & {\n /**\n * The size of square container for the image, matching available avatar sizes.\n */\n size?: 32 | 40 | 48 | 56 | 72;\n /**\n * When unset, it will force `role=\"presentation\"` on the image. Otherwise, it will set `role=\"graphics-symbol\"`.\n */\n alt?: string;\n};\n\n/**\n * This component should be used as a last resort, for rare cases when `<ListItem.AvatarView />`\n * or `<ListItem.AvatarLayout />` are insufficient.\n * It's a wrapper around the\n * [Image component](https://storybook.wise.design/?path=/docs/content-image--docs), but offers only\n * a subset of its props, in line with the ListItem's constraints.\n *\n * > **NB**: This component is [not intended for use with illustrations](https://wise.design/foundations/illustration#scale).\n */\nexport const Image = ({ alt = '', size = 48, ...props }: ListItemImageProps) => {\n return (\n <div\n className={clsx('wds-list-item-media-image')}\n style={\n {\n '--item-media-image-size': `${size}px`,\n } as React.CSSProperties\n }\n >\n <ImageComp {...props} alt={alt} role={alt ? 'graphics-symbol' : 'presentation'} />\n </div>\n );\n};\nImage.displayName = 'ListItem.Image';\n"],"names":["Image","alt","size","props","_jsx","className","clsx","style","children","ImageComp","role","displayName"],"mappings":";;;;;;AAyBO,MAAMA,KAAK,GAAGA,CAAC;AAAEC,EAAAA,GAAG,GAAG,EAAE;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAE,GAAGC;AAAK,CAAsB,KAAI;AAC7E,EAAA,oBACEC,cAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,SAAS,EAAEC,SAAI,CAAC,2BAA2B,CAAE;AAC7CC,IAAAA,KAAK,EACH;MACE,yBAAyB,EAAE,GAAGL,IAAI,CAAA,EAAA;KAErC;IAAAM,QAAA,eAEDJ,cAAA,CAACK,eAAS,EAAA;AAAA,MAAA,GAAKN,KAAK;AAAEF,MAAAA,GAAG,EAAEA,GAAI;AAACS,MAAAA,IAAI,EAAET,GAAG,GAAG,iBAAiB,GAAG;KAAe;AACjF,GAAK,CAAC;AAEV;AACAD,KAAK,CAACW,WAAW,GAAG,gBAAgB;;;;"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Image$1 from '../../image/Image.mjs';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
|
-
import { useListItemMedia } from '../useListItemMedia.mjs';
|
|
4
3
|
import { jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
5
|
const Image = ({
|
|
@@ -8,11 +7,10 @@ const Image = ({
|
|
|
8
7
|
size = 48,
|
|
9
8
|
...props
|
|
10
9
|
}) => {
|
|
11
|
-
useListItemMedia(size);
|
|
12
10
|
return /*#__PURE__*/jsx("div", {
|
|
13
11
|
className: clsx('wds-list-item-media-image'),
|
|
14
12
|
style: {
|
|
15
|
-
'--
|
|
13
|
+
'--item-media-image-size': `${size}px`
|
|
16
14
|
},
|
|
17
15
|
children: /*#__PURE__*/jsx(Image$1, {
|
|
18
16
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemImage.mjs","sources":["../../../src/listItem/Image/ListItemImage.tsx"],"sourcesContent":["import ImageComp, { type ImageProps } from '../../image';\nimport { clsx } from 'clsx';\
|
|
1
|
+
{"version":3,"file":"ListItemImage.mjs","sources":["../../../src/listItem/Image/ListItemImage.tsx"],"sourcesContent":["import ImageComp, { type ImageProps } from '../../image';\nimport { clsx } from 'clsx';\n\ntype SizeProp = {};\n\nexport type ListItemImageProps = Omit<ImageProps, 'stretch' | 'shrink' | 'id' | 'alt' | 'role'> & {\n /**\n * The size of square container for the image, matching available avatar sizes.\n */\n size?: 32 | 40 | 48 | 56 | 72;\n /**\n * When unset, it will force `role=\"presentation\"` on the image. Otherwise, it will set `role=\"graphics-symbol\"`.\n */\n alt?: string;\n};\n\n/**\n * This component should be used as a last resort, for rare cases when `<ListItem.AvatarView />`\n * or `<ListItem.AvatarLayout />` are insufficient.\n * It's a wrapper around the\n * [Image component](https://storybook.wise.design/?path=/docs/content-image--docs), but offers only\n * a subset of its props, in line with the ListItem's constraints.\n *\n * > **NB**: This component is [not intended for use with illustrations](https://wise.design/foundations/illustration#scale).\n */\nexport const Image = ({ alt = '', size = 48, ...props }: ListItemImageProps) => {\n return (\n <div\n className={clsx('wds-list-item-media-image')}\n style={\n {\n '--item-media-image-size': `${size}px`,\n } as React.CSSProperties\n }\n >\n <ImageComp {...props} alt={alt} role={alt ? 'graphics-symbol' : 'presentation'} />\n </div>\n );\n};\nImage.displayName = 'ListItem.Image';\n"],"names":["Image","alt","size","props","_jsx","className","clsx","style","children","ImageComp","role","displayName"],"mappings":";;;;AAyBO,MAAMA,KAAK,GAAGA,CAAC;AAAEC,EAAAA,GAAG,GAAG,EAAE;AAAEC,EAAAA,IAAI,GAAG,EAAE;EAAE,GAAGC;AAAK,CAAsB,KAAI;AAC7E,EAAA,oBACEC,GAAA,CAAA,KAAA,EAAA;AACEC,IAAAA,SAAS,EAAEC,IAAI,CAAC,2BAA2B,CAAE;AAC7CC,IAAAA,KAAK,EACH;MACE,yBAAyB,EAAE,GAAGL,IAAI,CAAA,EAAA;KAErC;IAAAM,QAAA,eAEDJ,GAAA,CAACK,OAAS,EAAA;AAAA,MAAA,GAAKN,KAAK;AAAEF,MAAAA,GAAG,EAAEA,GAAI;AAACS,MAAAA,IAAI,EAAET,GAAG,GAAG,iBAAiB,GAAG;KAAe;AACjF,GAAK,CAAC;AAEV;AACAD,KAAK,CAACW,WAAW,GAAG,gBAAgB;;;;"}
|
|
@@ -66,7 +66,6 @@ const ListItem = ({
|
|
|
66
66
|
const idPrefix = React.useId();
|
|
67
67
|
const [controlProps, setControlProps] = React.useState({});
|
|
68
68
|
const [controlType, setControlType] = React.useState('non-interactive');
|
|
69
|
-
const [mediaSize, setMediaSize] = React.useState();
|
|
70
69
|
const ids = {
|
|
71
70
|
title: `${idPrefix}_title`,
|
|
72
71
|
...(subtitle ? {
|
|
@@ -97,15 +96,13 @@ const ListItem = ({
|
|
|
97
96
|
const listItemContext = React.useMemo(() => ({
|
|
98
97
|
setControlType,
|
|
99
98
|
setControlProps,
|
|
100
|
-
setMediaSize,
|
|
101
99
|
ids,
|
|
102
100
|
props: {
|
|
103
101
|
disabled,
|
|
104
102
|
inverted
|
|
105
103
|
},
|
|
106
|
-
mediaSize,
|
|
107
104
|
describedByIds
|
|
108
|
-
}), [describedByIds
|
|
105
|
+
}), [describedByIds]);
|
|
109
106
|
const gridColumnsStyle = {
|
|
110
107
|
'--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',
|
|
111
108
|
'--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr'
|
|
@@ -144,7 +141,7 @@ const ListItem = ({
|
|
|
144
141
|
};
|
|
145
142
|
return /*#__PURE__*/jsxRuntime.jsx(ListItemContext.ListItemContext.Provider, {
|
|
146
143
|
value: listItemContext,
|
|
147
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
144
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(ListItemElement, {
|
|
148
145
|
className: clsx.clsx('wds-list-item', `wds-list-item-${controlType}`, getFeatureClassName(), {
|
|
149
146
|
'wds-list-item-interactive': isFullyInteractive,
|
|
150
147
|
'wds-list-item-partially-interactive': isPartiallyInteractive,
|
|
@@ -155,7 +152,11 @@ const ListItem = ({
|
|
|
155
152
|
role: role,
|
|
156
153
|
"aria-disabled": disabled,
|
|
157
154
|
"aria-labelledby": ariaLabelledby,
|
|
158
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
155
|
+
children: [spotlight === 'inactive' && /*#__PURE__*/jsxRuntime.jsx("svg", {
|
|
156
|
+
"aria-hidden": "true",
|
|
157
|
+
className: "wds-list-item-spotlight__border",
|
|
158
|
+
children: /*#__PURE__*/jsxRuntime.jsx("rect", {})
|
|
159
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(View, {
|
|
159
160
|
isPartiallyInteractive,
|
|
160
161
|
subtitle,
|
|
161
162
|
additionalInfo,
|
|
@@ -171,9 +172,6 @@ const ListItem = ({
|
|
|
171
172
|
className: "wds-list-item-body",
|
|
172
173
|
style: valueColumnWidth ? gridColumnsStyle : undefined,
|
|
173
174
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
174
|
-
className: clsx.clsx({
|
|
175
|
-
'wds-list-item-body-center': title && !subtitle
|
|
176
|
-
}),
|
|
177
175
|
children: (() => {
|
|
178
176
|
const titles = [/*#__PURE__*/jsxRuntime.jsx(Body.default, {
|
|
179
177
|
id: ids.title,
|
|
@@ -192,8 +190,7 @@ const ListItem = ({
|
|
|
192
190
|
})()
|
|
193
191
|
}), (valueTitle || valueSubtitle) && /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
194
192
|
className: clsx.clsx('wds-list-item-value', {
|
|
195
|
-
'flex-column': valueTitle !== undefined || valueSubtitle !== undefined
|
|
196
|
-
'wds-list-item-body-center': valueTitle && !valueSubtitle || !valueTitle && valueSubtitle
|
|
193
|
+
'flex-column': valueTitle !== undefined || valueSubtitle !== undefined
|
|
197
194
|
}),
|
|
198
195
|
children: (() => {
|
|
199
196
|
const values = [];
|
|
@@ -219,12 +216,9 @@ const ListItem = ({
|
|
|
219
216
|
className: clsx.clsx('wds-list-item-control-wrapper', {
|
|
220
217
|
'wds-list-item-button-control': controlType === 'button'
|
|
221
218
|
}),
|
|
222
|
-
style: {
|
|
223
|
-
'--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto'
|
|
224
|
-
},
|
|
225
219
|
children: control
|
|
226
220
|
})]
|
|
227
|
-
})
|
|
221
|
+
})]
|
|
228
222
|
})
|
|
229
223
|
});
|
|
230
224
|
};
|
|
@@ -259,6 +253,7 @@ function View({
|
|
|
259
253
|
href: controlProps?.href,
|
|
260
254
|
target: controlProps?.target,
|
|
261
255
|
className: clsx.clsx('wds-list-item-view d-flex flex-row', {
|
|
256
|
+
'align-items-center': !subtitle,
|
|
262
257
|
'wds-list-item-control': controlType === 'navigation'
|
|
263
258
|
}),
|
|
264
259
|
disabled: disabled,
|
|
@@ -271,7 +266,9 @@ function View({
|
|
|
271
266
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
272
267
|
className: clsx.clsx('wds-list-item-gridWrapper', className),
|
|
273
268
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
274
|
-
className: clsx.clsx('wds-list-item-view d-flex flex-row'
|
|
269
|
+
className: clsx.clsx('wds-list-item-view d-flex flex-row', {
|
|
270
|
+
'align-items-center': !subtitle
|
|
271
|
+
}),
|
|
275
272
|
children: children
|
|
276
273
|
}), renderExtras()]
|
|
277
274
|
});
|
|
@@ -284,6 +281,7 @@ function View({
|
|
|
284
281
|
children: [/*#__PURE__*/jsxRuntime.jsx("label", {
|
|
285
282
|
htmlFor: ids.control,
|
|
286
283
|
className: clsx.clsx('wds-list-item-view', {
|
|
284
|
+
'align-items-center': !subtitle,
|
|
287
285
|
clickable: !disabled,
|
|
288
286
|
fullyInteractive: !isPartiallyInteractive
|
|
289
287
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":["../../src/listItem/ListItem.tsx"],"sourcesContent":["/* eslint-disable functional/immutable-data */\nimport {\n useContext,\n useId,\n useMemo,\n useState,\n useEffect,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\nimport { Typography } from '../common';\nimport Body from '../body';\nimport { AdditionalInfo } from './AdditionalInfo';\nimport { IconButton, type ListItemIconButtonProps } from './IconButton';\nimport { Checkbox, type ListItemCheckboxProps } from './Checkbox';\nimport { Navigation, type ListItemNavigationProps } from './Navigation';\nimport { clsx } from 'clsx';\nimport { Button, type ListItemButtonProps } from './Button';\nimport { Radio, type ListItemRadioProps } from './Radio';\nimport { Switch, type ListItemSwitchProps } from './Switch';\nimport { AvatarLayout } from './AvatarLayout';\nimport { AvatarView } from './AvatarView';\nimport { Image } from './Image';\nimport { Prompt } from './Prompt';\nimport { PrimitiveAnchor } from '../primitives';\nimport {\n ListItemContext,\n type ListItemContextData,\n type ListItemMediaSize,\n} from './ListItemContext';\n\nexport type ListItemTypes =\n | 'non-interactive'\n | 'navigation'\n | 'radio'\n | 'checkbox'\n | 'switch'\n | 'button'\n | 'icon-button';\n\nexport type ListItemControlProps =\n | ListItemNavigationProps\n | ListItemCheckboxProps\n | ListItemButtonProps\n | ListItemIconButtonProps\n | ListItemRadioProps\n | ListItemSwitchProps;\n\nexport type Props = {\n as?: 'li' | 'div';\n /**\n * Swaps vertical hierarchy of title and subtitle and their corresponding right values.\n */\n inverted?: boolean;\n disabled?: boolean;\n /**\n * Highlights the list item as an action to be taken or already taken. <br />\n */\n spotlight?: 'active' | 'inactive';\n title: ReactNode;\n subtitle?: ReactNode;\n /**\n * Requires `<ListItem.AdditionalInfo />` component as a sole child. <br />\n * Can be only rendered if `subtitle` is also provided.\n */\n additionalInfo?: ReactNode;\n valueTitle?: ReactNode;\n valueSubtitle?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br />\n * `<ListItem.AvatarView />`,\n * `<ListItem.AvatarLayout />` or\n * `<ListItem.Image />`\n */\n media?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br/>\n * `<ListItem.Button />`, <br/>\n * `<ListItem.Checkbox />`, <br/>\n * `<ListItem.IconButton />`, <br/>\n * `<ListItem.Navigation />`, <br/>\n * `<ListItem.Radio />`, or\n * `<ListItem.Switch />`\n */\n control?: ReactNode;\n /**\n * Requires `<ListItem.Prompt />` component as a sole child.\n */\n prompt?: ReactNode;\n className?: string;\n /**\n * A number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration. E.g. `valueColumnWidth={25}` will result in a `75fr 25fr`. <br />\n * Controls the width ratio of left side content (title and subtitle) to the right side content.\n */\n valueColumnWidth?: number;\n id?: string;\n role?: string;\n 'aria-labelledby'?: string;\n};\n\n/**\n * @see [Design documentation](https://wise.design/components/list-item)\n * @see [Storybook documentation](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n */\nexport const ListItem = ({\n as: ListItemElement = 'li',\n title,\n subtitle,\n additionalInfo,\n prompt,\n inverted,\n media,\n spotlight,\n valueTitle,\n valueSubtitle,\n control = null,\n disabled,\n className,\n valueColumnWidth,\n role,\n id,\n 'aria-labelledby': ariaLabelledby,\n}: Props) => {\n const idPrefix = useId();\n const [controlProps, setControlProps] = useState<ListItemControlProps>({});\n const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');\n const [mediaSize, setMediaSize] = useState<ListItemMediaSize | undefined>();\n\n const ids: ListItemContextData['ids'] = {\n title: `${idPrefix}_title`,\n ...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),\n ...(valueTitle ? { valueTitle: `${idPrefix}_value-title` } : {}),\n ...(valueSubtitle ? { valueSubtitle: `${idPrefix}_value-subtitle` } : {}),\n control: `${idPrefix}_control`,\n ...(prompt ? { prompt: `${idPrefix}_prompt` } : {}),\n ...(additionalInfo ? { additionalInfo: `${idPrefix}_additional-info` } : {}),\n };\n\n const isPartiallyInteractive = Boolean(\n (controlType === 'button' || controlType === 'icon-button') &&\n (controlProps as ListItemButtonProps | ListItemIconButtonProps)?.partiallyInteractive,\n );\n const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;\n const isButtonAsLink =\n (controlType === 'button' || controlType === 'icon-button') &&\n Boolean((controlProps as ListItemButtonProps | ListItemIconButtonProps)?.href);\n\n const titlesAndValues = [\n inverted ? ids.subtitle : ids.title,\n inverted ? ids.title : ids.subtitle,\n inverted ? ids.valueSubtitle : ids.valueTitle,\n inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');\n\n const describedByIds = useMemo(() => {\n return isFullyInteractive && !isButtonAsLink\n ? additionalInfoPrompt\n : `${titlesAndValues} ${additionalInfoPrompt}`;\n }, [isFullyInteractive]);\n\n const listItemContext = useMemo(\n () => ({\n setControlType,\n setControlProps,\n setMediaSize,\n ids,\n props: { disabled, inverted },\n mediaSize,\n describedByIds,\n }),\n [describedByIds, mediaSize],\n );\n const gridColumnsStyle = {\n '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',\n '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr',\n } as React.CSSProperties;\n\n const getFeatureClassName = () => {\n const partials = [];\n const hasMedia = Boolean(media);\n const hasControl = Boolean(control);\n const hasInfo = Boolean(additionalInfo);\n const hasPrompt = Boolean(prompt);\n\n if (hasMedia && hasControl) {\n partials.push('wds-list-item-hasMedia-hasControl');\n }\n\n if (hasMedia && !hasControl) {\n partials.push('wds-list-item-hasMedia-noControl');\n }\n\n if (!hasMedia && hasControl) {\n partials.push('wds-list-item-noMedia-hasControl');\n }\n\n if (!hasMedia && !hasControl) {\n partials.push('wds-list-item-noMedia-noControl');\n }\n\n if (hasInfo && hasPrompt) {\n partials.push('wds-list-item-hasInfo-hasPrompt');\n }\n if (hasInfo && !hasPrompt) {\n partials.push('wds-list-item-hasInfo-noPrompt');\n }\n if (!hasInfo && hasPrompt) {\n partials.push('wds-list-item-noInfo-hasPrompt');\n }\n if (!hasInfo && !hasPrompt) {\n partials.push('wds-list-item-noInfo-noPrompt');\n }\n\n return partials.join(' ');\n };\n\n return (\n <ListItemContext.Provider value={listItemContext}>\n <ListItemElement\n className={clsx(\n 'wds-list-item',\n `wds-list-item-${controlType}`,\n getFeatureClassName(),\n {\n 'wds-list-item-interactive': isFullyInteractive,\n 'wds-list-item-partially-interactive': isPartiallyInteractive,\n [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]:\n isFullyInteractive && !!spotlight,\n disabled,\n },\n className,\n )}\n id={id}\n role={role}\n aria-disabled={disabled}\n aria-labelledby={ariaLabelledby}\n >\n <View\n {...{\n isPartiallyInteractive,\n subtitle,\n additionalInfo,\n disabled,\n prompt,\n controlType,\n controlProps,\n }}\n className={getFeatureClassName()}\n >\n {media && <div className=\"wds-list-item-media\">{media}</div>}\n\n {/* Title + Subtitle + Values - Group */}\n <div\n className=\"wds-list-item-body\"\n style={valueColumnWidth ? gridColumnsStyle : undefined}\n >\n {/* Title + Subtitle + Values - Group */}\n <span\n className={clsx({\n 'wds-list-item-body-center': title && !subtitle,\n })}\n >\n {(() => {\n const titles = [\n <Body\n key={ids.title}\n id={ids.title}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title\"\n >\n {title}\n </Body>,\n ];\n if (subtitle) {\n titles.push(\n <Body key={ids.subtitle} id={ids.subtitle} className=\"wds-list-item-subtitle\">\n {subtitle}\n </Body>,\n );\n }\n return inverted ? [...titles].reverse() : titles;\n })()}\n </span>\n\n {(valueTitle || valueSubtitle) && (\n <span\n className={clsx('wds-list-item-value', {\n 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,\n 'wds-list-item-body-center':\n (valueTitle && !valueSubtitle) || (!valueTitle && valueSubtitle),\n })}\n >\n {(() => {\n const values = [];\n if (valueTitle) {\n values.push(\n <Body\n key={ids.valueTitle}\n id={ids.valueTitle}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title-value\"\n >\n {valueTitle}\n </Body>,\n );\n }\n if (valueSubtitle) {\n values.push(\n <Body\n key={ids.valueSubtitle}\n id={ids.valueSubtitle}\n className=\"wds-list-item-subtitle-value\"\n >\n {valueSubtitle}\n </Body>,\n );\n }\n return inverted ? [...values].reverse() : values;\n })()}\n </span>\n )}\n </div>\n\n {control === null ? null : (\n <Body\n className={clsx('wds-list-item-control-wrapper', {\n 'wds-list-item-button-control': controlType === 'button',\n })}\n style={\n {\n '--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto',\n } as React.CSSProperties\n }\n >\n {control}\n </Body>\n )}\n </View>\n </ListItemElement>\n </ListItemContext.Provider>\n );\n};\n\ntype ViewProps = PropsWithChildren<{\n isPartiallyInteractive: boolean;\n controlType?: ListItemTypes;\n controlProps?: ListItemControlProps;\n}> &\n Pick<Props, 'subtitle' | 'additionalInfo' | 'disabled' | 'prompt' | 'className'>;\n\nfunction View({\n children,\n subtitle,\n additionalInfo,\n prompt,\n disabled,\n isPartiallyInteractive,\n controlType = 'non-interactive',\n controlProps,\n className = '',\n}: ViewProps) {\n const { ids, describedByIds } = useContext<ListItemContextData>(ListItemContext);\n const isLinkControl = ['navigation'].includes(controlType);\n\n const isHrefProvided =\n isLinkControl &&\n !!(controlProps as ListItemNavigationProps)?.href &&\n (controlProps as ListItemNavigationProps)?.href !== '#';\n\n const renderExtras = () => (\n <>\n {Boolean(subtitle) && additionalInfo}\n {prompt}\n </>\n );\n\n if (isLinkControl && isHrefProvided) {\n return (\n // for link instances of .Navigation, .IconButton, .Button\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <PrimitiveAnchor\n aria-describedby={describedByIds}\n href={(controlProps as ListItemNavigationProps)?.href}\n target={(controlProps as ListItemNavigationProps)?.target}\n className={clsx('wds-list-item-view d-flex flex-row', {\n 'wds-list-item-control': controlType === 'navigation',\n })}\n disabled={disabled}\n >\n {children}\n </PrimitiveAnchor>\n\n {renderExtras()}\n </div>\n );\n }\n\n if (isPartiallyInteractive || controlType === 'non-interactive') {\n return (\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <div className={clsx('wds-list-item-view d-flex flex-row')}>{children}</div>\n\n {renderExtras()}\n </div>\n );\n }\n\n // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc\n // Radio cannot be wrapped in a <fieldset> element to announce it as a group.\n const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';\n return (\n <InputWrapper className={clsx('wds-list-item-gridWrapper', className)}>\n <label\n htmlFor={ids.control}\n className={clsx('wds-list-item-view', {\n clickable: !disabled,\n fullyInteractive: !isPartiallyInteractive,\n })}\n >\n {children}\n </label>\n\n {renderExtras()}\n </InputWrapper>\n );\n}\n\nListItem.Image = Image;\nListItem.AvatarView = AvatarView;\nListItem.AvatarLayout = AvatarLayout;\nListItem.AdditionalInfo = AdditionalInfo;\nListItem.Checkbox = Checkbox;\nListItem.Radio = Radio;\nListItem.IconButton = IconButton;\nListItem.Navigation = Navigation;\nListItem.Button = Button;\nListItem.Switch = Switch;\nListItem.Prompt = Prompt;\n\nexport default ListItem;\n"],"names":["ListItem","as","ListItemElement","title","subtitle","additionalInfo","prompt","inverted","media","spotlight","valueTitle","valueSubtitle","control","disabled","className","valueColumnWidth","role","id","ariaLabelledby","idPrefix","useId","controlProps","setControlProps","useState","controlType","setControlType","mediaSize","setMediaSize","ids","isPartiallyInteractive","Boolean","partiallyInteractive","isFullyInteractive","isButtonAsLink","href","titlesAndValues","join","additionalInfoPrompt","filter","describedByIds","useMemo","listItemContext","props","gridColumnsStyle","getFeatureClassName","partials","hasMedia","hasControl","hasInfo","hasPrompt","push","_jsx","ListItemContext","Provider","value","children","clsx","_jsxs","View","style","undefined","titles","Body","type","Typography","BODY_LARGE_BOLD","reverse","values","useContext","isLinkControl","includes","isHrefProvided","renderExtras","_Fragment","PrimitiveAnchor","target","InputWrapper","htmlFor","clickable","fullyInteractive","Image","AvatarView","AvatarLayout","AdditionalInfo","Checkbox","Radio","IconButton","Navigation","Button","Switch","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAwGO,MAAMA,QAAQ,GAAGA,CAAC;EACvBC,EAAE,EAAEC,eAAe,GAAG,IAAI;EAC1BC,KAAK;EACLC,QAAQ;EACRC,cAAc;EACdC,MAAM;EACNC,QAAQ;EACRC,KAAK;EACLC,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MAAM,GAAGA,qBAAM;;;;;"}
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":["../../src/listItem/ListItem.tsx"],"sourcesContent":["/* eslint-disable functional/immutable-data */\nimport {\n useContext,\n useId,\n useMemo,\n useState,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\nimport { Typography } from '../common';\nimport Body from '../body';\nimport { AdditionalInfo } from './AdditionalInfo';\nimport { IconButton, type ListItemIconButtonProps } from './IconButton';\nimport { Checkbox, type ListItemCheckboxProps } from './Checkbox';\nimport { Navigation, type ListItemNavigationProps } from './Navigation';\nimport { clsx } from 'clsx';\nimport { Button, type ListItemButtonProps } from './Button';\nimport { Radio, type ListItemRadioProps } from './Radio';\nimport { Switch, type ListItemSwitchProps } from './Switch';\nimport { AvatarLayout } from './AvatarLayout';\nimport { AvatarView } from './AvatarView';\nimport { Image } from './Image';\nimport { Prompt } from './Prompt';\nimport { PrimitiveAnchor } from '../primitives';\nimport { ListItemContext, type ListItemContextData } from './ListItemContext';\n\nexport type ListItemTypes =\n | 'non-interactive'\n | 'navigation'\n | 'radio'\n | 'checkbox'\n | 'switch'\n | 'button'\n | 'icon-button';\n\nexport type ListItemControlProps =\n | ListItemNavigationProps\n | ListItemCheckboxProps\n | ListItemButtonProps\n | ListItemIconButtonProps\n | ListItemRadioProps\n | ListItemSwitchProps;\n\nexport type Props = {\n as?: 'li' | 'div';\n /**\n * Swaps vertical hierarchy of title and subtitle and their corresponding right values.\n */\n inverted?: boolean;\n disabled?: boolean;\n /**\n * Highlights the list item as an action to be taken or already taken. <br />\n */\n spotlight?: 'active' | 'inactive';\n title: ReactNode;\n subtitle?: ReactNode;\n /**\n * Requires `<ListItem.AdditionalInfo />` component as a sole child. <br />\n * Can be only rendered if `subtitle` is also provided.\n */\n additionalInfo?: ReactNode;\n valueTitle?: ReactNode;\n valueSubtitle?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br />\n * `<ListItem.AvatarView />`,\n * `<ListItem.AvatarLayout />` or\n * `<ListItem.Image />`\n */\n media?: ReactNode;\n /**\n * Requires one of the following as a sole child: <br/>\n * `<ListItem.Button />`, <br/>\n * `<ListItem.Checkbox />`, <br/>\n * `<ListItem.IconButton />`, <br/>\n * `<ListItem.Navigation />`, <br/>\n * `<ListItem.Radio />`, or\n * `<ListItem.Switch />`\n */\n control?: ReactNode;\n /**\n * Requires `<ListItem.Prompt />` component as a sole child.\n */\n prompt?: ReactNode;\n className?: string;\n /**\n * A number between `0–100` which resolves to a `fr` value of a `grid-template-columns` declaration. E.g. `valueColumnWidth={25}` will result in a `75fr 25fr`. <br />\n * Controls the width ratio of left side content (title and subtitle) to the right side content.\n */\n valueColumnWidth?: number;\n id?: string;\n role?: string;\n 'aria-labelledby'?: string;\n};\n\n/**\n * @see [Design documentation](https://wise.design/components/list-item)\n * @see [Storybook documentation](https://storybook.wise.design/?path=/docs/content-listitem--docs)\n */\nexport const ListItem = ({\n as: ListItemElement = 'li',\n title,\n subtitle,\n additionalInfo,\n prompt,\n inverted,\n media,\n spotlight,\n valueTitle,\n valueSubtitle,\n control = null,\n disabled,\n className,\n valueColumnWidth,\n role,\n id,\n 'aria-labelledby': ariaLabelledby,\n}: Props) => {\n const idPrefix = useId();\n const [controlProps, setControlProps] = useState<ListItemControlProps>({});\n const [controlType, setControlType] = useState<ListItemTypes>('non-interactive');\n const ids: ListItemContextData['ids'] = {\n title: `${idPrefix}_title`,\n ...(subtitle ? { subtitle: `${idPrefix}_subtitle` } : {}),\n ...(valueTitle ? { valueTitle: `${idPrefix}_value-title` } : {}),\n ...(valueSubtitle ? { valueSubtitle: `${idPrefix}_value-subtitle` } : {}),\n control: `${idPrefix}_control`,\n ...(prompt ? { prompt: `${idPrefix}_prompt` } : {}),\n ...(additionalInfo ? { additionalInfo: `${idPrefix}_additional-info` } : {}),\n };\n\n const isPartiallyInteractive = Boolean(\n (controlType === 'button' || controlType === 'icon-button') &&\n (controlProps as ListItemButtonProps | ListItemIconButtonProps)?.partiallyInteractive,\n );\n const isFullyInteractive = controlType !== 'non-interactive' && !isPartiallyInteractive;\n const isButtonAsLink =\n (controlType === 'button' || controlType === 'icon-button') &&\n Boolean((controlProps as ListItemButtonProps | ListItemIconButtonProps)?.href);\n\n const titlesAndValues = [\n inverted ? ids.subtitle : ids.title,\n inverted ? ids.title : ids.subtitle,\n inverted ? ids.valueSubtitle : ids.valueTitle,\n inverted ? ids.valueTitle : ids.valueSubtitle,\n ].join(' ');\n const additionalInfoPrompt = [ids.additionalInfo, ids.prompt].filter(Boolean).join(' ');\n\n const describedByIds = useMemo(() => {\n return isFullyInteractive && !isButtonAsLink\n ? additionalInfoPrompt\n : `${titlesAndValues} ${additionalInfoPrompt}`;\n }, [isFullyInteractive]);\n\n const listItemContext = useMemo(\n () => ({\n setControlType,\n setControlProps,\n ids,\n props: { disabled, inverted },\n describedByIds,\n }),\n [describedByIds],\n );\n const gridColumnsStyle = {\n '--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',\n '--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr',\n } as React.CSSProperties;\n\n const getFeatureClassName = () => {\n const partials = [];\n const hasMedia = Boolean(media);\n const hasControl = Boolean(control);\n const hasInfo = Boolean(additionalInfo);\n const hasPrompt = Boolean(prompt);\n\n if (hasMedia && hasControl) {\n partials.push('wds-list-item-hasMedia-hasControl');\n }\n\n if (hasMedia && !hasControl) {\n partials.push('wds-list-item-hasMedia-noControl');\n }\n\n if (!hasMedia && hasControl) {\n partials.push('wds-list-item-noMedia-hasControl');\n }\n\n if (!hasMedia && !hasControl) {\n partials.push('wds-list-item-noMedia-noControl');\n }\n\n if (hasInfo && hasPrompt) {\n partials.push('wds-list-item-hasInfo-hasPrompt');\n }\n if (hasInfo && !hasPrompt) {\n partials.push('wds-list-item-hasInfo-noPrompt');\n }\n if (!hasInfo && hasPrompt) {\n partials.push('wds-list-item-noInfo-hasPrompt');\n }\n if (!hasInfo && !hasPrompt) {\n partials.push('wds-list-item-noInfo-noPrompt');\n }\n\n return partials.join(' ');\n };\n\n return (\n <ListItemContext.Provider value={listItemContext}>\n <ListItemElement\n className={clsx(\n 'wds-list-item',\n `wds-list-item-${controlType}`,\n getFeatureClassName(),\n {\n 'wds-list-item-interactive': isFullyInteractive,\n 'wds-list-item-partially-interactive': isPartiallyInteractive,\n [`wds-list-item-spotlight wds-list-item-spotlight-${spotlight}`]:\n isFullyInteractive && !!spotlight,\n disabled,\n },\n className,\n )}\n id={id}\n role={role}\n aria-disabled={disabled}\n aria-labelledby={ariaLabelledby}\n >\n {spotlight === 'inactive' && (\n <svg aria-hidden=\"true\" className=\"wds-list-item-spotlight__border\">\n <rect />\n </svg>\n )}\n\n <View\n {...{\n isPartiallyInteractive,\n subtitle,\n additionalInfo,\n disabled,\n prompt,\n controlType,\n controlProps,\n }}\n className={getFeatureClassName()}\n >\n {media && <div className=\"wds-list-item-media\">{media}</div>}\n\n {/* Title + Subtitle + Values - Group */}\n <div\n className=\"wds-list-item-body\"\n style={valueColumnWidth ? gridColumnsStyle : undefined}\n >\n {/* Title + Subtitle + Values - Group */}\n <span>\n {(() => {\n const titles = [\n <Body\n key={ids.title}\n id={ids.title}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title\"\n >\n {title}\n </Body>,\n ];\n if (subtitle) {\n titles.push(\n <Body key={ids.subtitle} id={ids.subtitle} className=\"wds-list-item-subtitle\">\n {subtitle}\n </Body>,\n );\n }\n return inverted ? [...titles].reverse() : titles;\n })()}\n </span>\n\n {(valueTitle || valueSubtitle) && (\n <span\n className={clsx('wds-list-item-value', {\n 'flex-column': valueTitle !== undefined || valueSubtitle !== undefined,\n })}\n >\n {(() => {\n const values = [];\n if (valueTitle) {\n values.push(\n <Body\n key={ids.valueTitle}\n id={ids.valueTitle}\n type={Typography.BODY_LARGE_BOLD}\n className=\"wds-list-item-title-value\"\n >\n {valueTitle}\n </Body>,\n );\n }\n if (valueSubtitle) {\n values.push(\n <Body\n key={ids.valueSubtitle}\n id={ids.valueSubtitle}\n className=\"wds-list-item-subtitle-value\"\n >\n {valueSubtitle}\n </Body>,\n );\n }\n return inverted ? [...values].reverse() : values;\n })()}\n </span>\n )}\n </div>\n\n {control === null ? null : (\n <Body\n className={clsx('wds-list-item-control-wrapper', {\n 'wds-list-item-button-control': controlType === 'button',\n })}\n >\n {control}\n </Body>\n )}\n </View>\n </ListItemElement>\n </ListItemContext.Provider>\n );\n};\n\ntype ViewProps = PropsWithChildren<{\n isPartiallyInteractive: boolean;\n controlType?: ListItemTypes;\n controlProps?: ListItemControlProps;\n}> &\n Pick<Props, 'subtitle' | 'additionalInfo' | 'disabled' | 'prompt' | 'className'>;\n\nfunction View({\n children,\n subtitle,\n additionalInfo,\n prompt,\n disabled,\n isPartiallyInteractive,\n controlType = 'non-interactive',\n controlProps,\n className = '',\n}: ViewProps) {\n const { ids, describedByIds } = useContext<ListItemContextData>(ListItemContext);\n const isLinkControl = ['navigation'].includes(controlType);\n\n const isHrefProvided =\n isLinkControl &&\n !!(controlProps as ListItemNavigationProps)?.href &&\n (controlProps as ListItemNavigationProps)?.href !== '#';\n\n const renderExtras = () => (\n <>\n {Boolean(subtitle) && additionalInfo}\n {prompt}\n </>\n );\n\n if (isLinkControl && isHrefProvided) {\n return (\n // for link instances of .Navigation, .IconButton, .Button\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <PrimitiveAnchor\n aria-describedby={describedByIds}\n href={(controlProps as ListItemNavigationProps)?.href}\n target={(controlProps as ListItemNavigationProps)?.target}\n className={clsx('wds-list-item-view d-flex flex-row', {\n 'align-items-center': !subtitle,\n 'wds-list-item-control': controlType === 'navigation',\n })}\n disabled={disabled}\n >\n {children}\n </PrimitiveAnchor>\n\n {renderExtras()}\n </div>\n );\n }\n\n if (isPartiallyInteractive || controlType === 'non-interactive') {\n return (\n <div className={clsx('wds-list-item-gridWrapper', className)}>\n <div\n className={clsx('wds-list-item-view d-flex flex-row', {\n 'align-items-center': !subtitle,\n })}\n >\n {children}\n </div>\n\n {renderExtras()}\n </div>\n );\n }\n\n // for form control instances of .Radio, .Checkbox, .Switch, .Button, .Navigation etc\n // Radio cannot be wrapped in a <fieldset> element to announce it as a group.\n const InputWrapper = controlType === 'radio' ? 'div' : 'fieldset';\n return (\n <InputWrapper className={clsx('wds-list-item-gridWrapper', className)}>\n <label\n htmlFor={ids.control}\n className={clsx('wds-list-item-view', {\n 'align-items-center': !subtitle,\n clickable: !disabled,\n fullyInteractive: !isPartiallyInteractive,\n })}\n >\n {children}\n </label>\n\n {renderExtras()}\n </InputWrapper>\n );\n}\n\nListItem.Image = Image;\nListItem.AvatarView = AvatarView;\nListItem.AvatarLayout = AvatarLayout;\nListItem.AdditionalInfo = AdditionalInfo;\nListItem.Checkbox = Checkbox;\nListItem.Radio = Radio;\nListItem.IconButton = IconButton;\nListItem.Navigation = Navigation;\nListItem.Button = Button;\nListItem.Switch = Switch;\nListItem.Prompt = Prompt;\n\nexport default ListItem;\n"],"names":["ListItem","as","ListItemElement","title","subtitle","additionalInfo","prompt","inverted","media","spotlight","valueTitle","valueSubtitle","control","disabled","className","valueColumnWidth","role","id","ariaLabelledby","idPrefix","useId","controlProps","setControlProps","useState","controlType","setControlType","ids","isPartiallyInteractive","Boolean","partiallyInteractive","isFullyInteractive","isButtonAsLink","href","titlesAndValues","join","additionalInfoPrompt","filter","describedByIds","useMemo","listItemContext","props","gridColumnsStyle","getFeatureClassName","partials","hasMedia","hasControl","hasInfo","hasPrompt","push","_jsx","ListItemContext","Provider","value","children","_jsxs","clsx","View","style","undefined","titles","Body","type","Typography","BODY_LARGE_BOLD","reverse","values","useContext","isLinkControl","includes","isHrefProvided","renderExtras","_Fragment","PrimitiveAnchor","target","InputWrapper","htmlFor","clickable","fullyInteractive","Image","AvatarView","AvatarLayout","AdditionalInfo","Checkbox","Radio","IconButton","Navigation","Button","Switch","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAmGO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F,QAAQ,CAACsF,MAAM,GAAGA,qBAAM;AACxBtF,QAAQ,CAACuF,MAAM,GAAGA,qBAAM;AACxBvF,QAAQ,CAACwF,MAAM,GAAGA,qBAAM;;;;;"}
|
|
@@ -62,7 +62,6 @@ const ListItem = ({
|
|
|
62
62
|
const idPrefix = useId();
|
|
63
63
|
const [controlProps, setControlProps] = useState({});
|
|
64
64
|
const [controlType, setControlType] = useState('non-interactive');
|
|
65
|
-
const [mediaSize, setMediaSize] = useState();
|
|
66
65
|
const ids = {
|
|
67
66
|
title: `${idPrefix}_title`,
|
|
68
67
|
...(subtitle ? {
|
|
@@ -93,15 +92,13 @@ const ListItem = ({
|
|
|
93
92
|
const listItemContext = useMemo(() => ({
|
|
94
93
|
setControlType,
|
|
95
94
|
setControlProps,
|
|
96
|
-
setMediaSize,
|
|
97
95
|
ids,
|
|
98
96
|
props: {
|
|
99
97
|
disabled,
|
|
100
98
|
inverted
|
|
101
99
|
},
|
|
102
|
-
mediaSize,
|
|
103
100
|
describedByIds
|
|
104
|
-
}), [describedByIds
|
|
101
|
+
}), [describedByIds]);
|
|
105
102
|
const gridColumnsStyle = {
|
|
106
103
|
'--wds-list-item-body-left': valueColumnWidth ? `${100 - valueColumnWidth}fr` : '50fr',
|
|
107
104
|
'--wds-list-item-body-right': valueColumnWidth ? `${valueColumnWidth}fr` : '50fr'
|
|
@@ -140,7 +137,7 @@ const ListItem = ({
|
|
|
140
137
|
};
|
|
141
138
|
return /*#__PURE__*/jsx(ListItemContext.Provider, {
|
|
142
139
|
value: listItemContext,
|
|
143
|
-
children: /*#__PURE__*/
|
|
140
|
+
children: /*#__PURE__*/jsxs(ListItemElement, {
|
|
144
141
|
className: clsx('wds-list-item', `wds-list-item-${controlType}`, getFeatureClassName(), {
|
|
145
142
|
'wds-list-item-interactive': isFullyInteractive,
|
|
146
143
|
'wds-list-item-partially-interactive': isPartiallyInteractive,
|
|
@@ -151,7 +148,11 @@ const ListItem = ({
|
|
|
151
148
|
role: role,
|
|
152
149
|
"aria-disabled": disabled,
|
|
153
150
|
"aria-labelledby": ariaLabelledby,
|
|
154
|
-
children: /*#__PURE__*/
|
|
151
|
+
children: [spotlight === 'inactive' && /*#__PURE__*/jsx("svg", {
|
|
152
|
+
"aria-hidden": "true",
|
|
153
|
+
className: "wds-list-item-spotlight__border",
|
|
154
|
+
children: /*#__PURE__*/jsx("rect", {})
|
|
155
|
+
}), /*#__PURE__*/jsxs(View, {
|
|
155
156
|
isPartiallyInteractive,
|
|
156
157
|
subtitle,
|
|
157
158
|
additionalInfo,
|
|
@@ -167,9 +168,6 @@ const ListItem = ({
|
|
|
167
168
|
className: "wds-list-item-body",
|
|
168
169
|
style: valueColumnWidth ? gridColumnsStyle : undefined,
|
|
169
170
|
children: [/*#__PURE__*/jsx("span", {
|
|
170
|
-
className: clsx({
|
|
171
|
-
'wds-list-item-body-center': title && !subtitle
|
|
172
|
-
}),
|
|
173
171
|
children: (() => {
|
|
174
172
|
const titles = [/*#__PURE__*/jsx(Body, {
|
|
175
173
|
id: ids.title,
|
|
@@ -188,8 +186,7 @@ const ListItem = ({
|
|
|
188
186
|
})()
|
|
189
187
|
}), (valueTitle || valueSubtitle) && /*#__PURE__*/jsx("span", {
|
|
190
188
|
className: clsx('wds-list-item-value', {
|
|
191
|
-
'flex-column': valueTitle !== undefined || valueSubtitle !== undefined
|
|
192
|
-
'wds-list-item-body-center': valueTitle && !valueSubtitle || !valueTitle && valueSubtitle
|
|
189
|
+
'flex-column': valueTitle !== undefined || valueSubtitle !== undefined
|
|
193
190
|
}),
|
|
194
191
|
children: (() => {
|
|
195
192
|
const values = [];
|
|
@@ -215,12 +212,9 @@ const ListItem = ({
|
|
|
215
212
|
className: clsx('wds-list-item-control-wrapper', {
|
|
216
213
|
'wds-list-item-button-control': controlType === 'button'
|
|
217
214
|
}),
|
|
218
|
-
style: {
|
|
219
|
-
'--wds-list-item-control-wrapper-height': mediaSize ? `${mediaSize}px` : 'auto'
|
|
220
|
-
},
|
|
221
215
|
children: control
|
|
222
216
|
})]
|
|
223
|
-
})
|
|
217
|
+
})]
|
|
224
218
|
})
|
|
225
219
|
});
|
|
226
220
|
};
|
|
@@ -255,6 +249,7 @@ function View({
|
|
|
255
249
|
href: controlProps?.href,
|
|
256
250
|
target: controlProps?.target,
|
|
257
251
|
className: clsx('wds-list-item-view d-flex flex-row', {
|
|
252
|
+
'align-items-center': !subtitle,
|
|
258
253
|
'wds-list-item-control': controlType === 'navigation'
|
|
259
254
|
}),
|
|
260
255
|
disabled: disabled,
|
|
@@ -267,7 +262,9 @@ function View({
|
|
|
267
262
|
return /*#__PURE__*/jsxs("div", {
|
|
268
263
|
className: clsx('wds-list-item-gridWrapper', className),
|
|
269
264
|
children: [/*#__PURE__*/jsx("div", {
|
|
270
|
-
className: clsx('wds-list-item-view d-flex flex-row'
|
|
265
|
+
className: clsx('wds-list-item-view d-flex flex-row', {
|
|
266
|
+
'align-items-center': !subtitle
|
|
267
|
+
}),
|
|
271
268
|
children: children
|
|
272
269
|
}), renderExtras()]
|
|
273
270
|
});
|
|
@@ -280,6 +277,7 @@ function View({
|
|
|
280
277
|
children: [/*#__PURE__*/jsx("label", {
|
|
281
278
|
htmlFor: ids.control,
|
|
282
279
|
className: clsx('wds-list-item-view', {
|
|
280
|
+
'align-items-center': !subtitle,
|
|
283
281
|
clickable: !disabled,
|
|
284
282
|
fullyInteractive: !isPartiallyInteractive
|
|
285
283
|
}),
|