@chayns-components/core 5.5.45 → 5.5.52
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/lib/cjs/api/image/post.js +2 -4
- package/lib/cjs/api/image/post.js.map +1 -1
- package/lib/cjs/api/video/post.js +2 -1
- package/lib/cjs/api/video/post.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.js +3 -1
- package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.test.js +137 -0
- package/lib/cjs/components/list/list-item/ListItem.test.js.map +1 -0
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +2 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/cjs/constants/uploadUrls.js +52 -0
- package/lib/cjs/constants/uploadUrls.js.map +1 -0
- package/lib/esm/api/image/post.js +1 -3
- package/lib/esm/api/image/post.js.map +1 -1
- package/lib/esm/api/video/post.js +2 -1
- package/lib/esm/api/video/post.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.js +3 -1
- package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.test.js +133 -0
- package/lib/esm/components/list/list-item/ListItem.test.js.map +1 -0
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +2 -1
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/esm/constants/uploadUrls.js +46 -0
- package/lib/esm/constants/uploadUrls.js.map +1 -0
- package/lib/types/components/list/list-item/ListItem.d.ts +17 -0
- package/lib/types/components/list/list-item/list-item-head/ListItemHead.d.ts +1 -0
- package/lib/types/constants/uploadUrls.d.ts +24 -0
- package/package.json +2 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VIDEO_SERVICE_URL = exports.IMAGE_SERVICE_API_V3_URL = exports.IMAGE_RESIZER_API_URL = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Reads an environment variable defensively so that accessing `process.env` does
|
|
9
|
+
* not throw a `ReferenceError` in browser environments where `process` is not
|
|
10
|
+
* defined. Returns `undefined` if the variable is not set or not accessible.
|
|
11
|
+
*/
|
|
12
|
+
const readEnv = key => {
|
|
13
|
+
try {
|
|
14
|
+
if (typeof process !== 'undefined' && process.env) {
|
|
15
|
+
const value = process.env[key];
|
|
16
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
} catch {
|
|
21
|
+
// Accessing `process` can throw in some sandboxed environments.
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* URL of the image service used to upload images.
|
|
28
|
+
*
|
|
29
|
+
* Can be overridden via the `CHAYNS_IMAGE_SERVICE_URL` environment variable
|
|
30
|
+
* (e.g. for OnPremise deployments with a self-hosted image service). Falls back
|
|
31
|
+
* to the default chayns image service when the variable is not defined.
|
|
32
|
+
*/
|
|
33
|
+
const IMAGE_SERVICE_API_V3_URL = exports.IMAGE_SERVICE_API_V3_URL = readEnv('CHAYNS_IMAGE_SERVICE_URL') ?? 'https://cube.tobit.cloud/image-service/v3/Images';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* URL of the image resizer service used to upload images larger than 10 MB.
|
|
37
|
+
*
|
|
38
|
+
* Can be overridden via the `CHAYNS_IMAGE_RESIZER_URL` environment variable
|
|
39
|
+
* (e.g. for OnPremise deployments with a self-hosted image service). Falls back
|
|
40
|
+
* to the default chayns image resizer when the variable is not defined.
|
|
41
|
+
*/
|
|
42
|
+
const IMAGE_RESIZER_API_URL = exports.IMAGE_RESIZER_API_URL = readEnv('CHAYNS_IMAGE_RESIZER_URL') ?? 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* URL of the streaming service used to upload videos.
|
|
46
|
+
*
|
|
47
|
+
* Can be overridden via the `CHAYNS_VIDEO_SERVICE_URL` environment variable
|
|
48
|
+
* (e.g. for OnPremise deployments with a self-hosted video service). Falls back
|
|
49
|
+
* to the default chayns streaming service when the variable is not defined.
|
|
50
|
+
*/
|
|
51
|
+
const VIDEO_SERVICE_URL = exports.VIDEO_SERVICE_URL = readEnv('CHAYNS_VIDEO_SERVICE_URL') ?? 'https://streamingservice.chayns.space/video';
|
|
52
|
+
//# sourceMappingURL=uploadUrls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uploadUrls.js","names":["readEnv","key","process","env","value","length","undefined","IMAGE_SERVICE_API_V3_URL","exports","IMAGE_RESIZER_API_URL","VIDEO_SERVICE_URL"],"sources":["../../../src/constants/uploadUrls.ts"],"sourcesContent":["/**\n * Reads an environment variable defensively so that accessing `process.env` does\n * not throw a `ReferenceError` in browser environments where `process` is not\n * defined. Returns `undefined` if the variable is not set or not accessible.\n */\nconst readEnv = (key: string): string | undefined => {\n try {\n if (typeof process !== 'undefined' && process.env) {\n const value = process.env[key];\n\n if (typeof value === 'string' && value.length > 0) {\n return value;\n }\n }\n } catch {\n // Accessing `process` can throw in some sandboxed environments.\n }\n\n return undefined;\n};\n\n/**\n * URL of the image service used to upload images.\n *\n * Can be overridden via the `CHAYNS_IMAGE_SERVICE_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted image service). Falls back\n * to the default chayns image service when the variable is not defined.\n */\nexport const IMAGE_SERVICE_API_V3_URL =\n readEnv('CHAYNS_IMAGE_SERVICE_URL') ?? 'https://cube.tobit.cloud/image-service/v3/Images';\n\n/**\n * URL of the image resizer service used to upload images larger than 10 MB.\n *\n * Can be overridden via the `CHAYNS_IMAGE_RESIZER_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted image service). Falls back\n * to the default chayns image resizer when the variable is not defined.\n */\nexport const IMAGE_RESIZER_API_URL =\n readEnv('CHAYNS_IMAGE_RESIZER_URL') ??\n 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';\n\n/**\n * URL of the streaming service used to upload videos.\n *\n * Can be overridden via the `CHAYNS_VIDEO_SERVICE_URL` environment variable\n * (e.g. for OnPremise deployments with a self-hosted video service). Falls back\n * to the default chayns streaming service when the variable is not defined.\n */\nexport const VIDEO_SERVICE_URL =\n readEnv('CHAYNS_VIDEO_SERVICE_URL') ?? 'https://streamingservice.chayns.space/video';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA,MAAMA,OAAO,GAAIC,GAAW,IAAyB;EACjD,IAAI;IACA,IAAI,OAAOC,OAAO,KAAK,WAAW,IAAIA,OAAO,CAACC,GAAG,EAAE;MAC/C,MAAMC,KAAK,GAAGF,OAAO,CAACC,GAAG,CAACF,GAAG,CAAC;MAE9B,IAAI,OAAOG,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;QAC/C,OAAOD,KAAK;MAChB;IACJ;EACJ,CAAC,CAAC,MAAM;IACJ;EAAA;EAGJ,OAAOE,SAAS;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GACjCP,OAAO,CAAC,0BAA0B,CAAC,IAAI,kDAAkD;;AAE7F;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMS,qBAAqB,GAAAD,OAAA,CAAAC,qBAAA,GAC9BT,OAAO,CAAC,0BAA0B,CAAC,IACnC,+DAA+D;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMU,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAC1BV,OAAO,CAAC,0BAA0B,CAAC,IAAI,6CAA6C","ignoreList":[]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { getAccessToken, getSite, getUser } from 'chayns-api';
|
|
2
|
-
|
|
3
|
-
const IMAGE_RESIZER_API_URL = 'https://cube.tobit.cloud/image-resizer-backend/api/v1.0/image';
|
|
4
|
-
|
|
2
|
+
import { IMAGE_RESIZER_API_URL, IMAGE_SERVICE_API_V3_URL } from '../../constants/uploadUrls';
|
|
5
3
|
/**
|
|
6
4
|
* Uploads an image to the tsimg cloud service
|
|
7
5
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","names":["getAccessToken","getSite","getUser","
|
|
1
|
+
{"version":3,"file":"post.js","names":["getAccessToken","getSite","getUser","IMAGE_RESIZER_API_URL","IMAGE_SERVICE_API_V3_URL","postImage","file","shouldUploadImageToSite","accessToken","user","site","personId","undefined","body","FormData","append","url","size","id","response","fetch","headers","Accept","Authorization","method","ok","image","baseDomain","json","key","path","base","endsWith","slice","meta","preview","width","String","height","Error","status"],"sources":["../../../../src/api/image/post.ts"],"sourcesContent":["import { getAccessToken, getSite, getUser } from 'chayns-api';\nimport { IMAGE_RESIZER_API_URL, IMAGE_SERVICE_API_V3_URL } from '../../constants/uploadUrls';\nimport type { Meta } from '../../types/file';\n\nexport interface PostImageResult {\n key: string;\n base: string;\n meta?: Meta;\n}\n\ninterface Result {\n requestId: string;\n image: Image;\n baseDomain: string;\n signature: Signature;\n}\n\nexport interface Image {\n path: string;\n width: number;\n height: number;\n size: number;\n hash: string;\n preview: string;\n isSecured: boolean;\n format: string;\n fileExtension: string;\n}\n\nexport interface Signature {\n verify: string;\n signature: string;\n expires: Date;\n}\n\ninterface PostImageOptions {\n file: File;\n shouldUploadImageToSite?: boolean;\n}\n\n/**\n * Uploads an image to the tsimg cloud service\n */\nexport const postImage = async ({\n file,\n shouldUploadImageToSite,\n}: PostImageOptions): Promise<PostImageResult | undefined> => {\n const { accessToken } = await getAccessToken();\n const user = getUser();\n const site = getSite();\n\n if (!accessToken || !user?.personId) {\n return undefined;\n }\n\n // const body = await getFileAsArrayBuffer(file);\n\n const body = new FormData();\n\n body.append('File', file);\n\n const url =\n file.size > 10 * 1024 * 1024\n ? `${IMAGE_RESIZER_API_URL}/${shouldUploadImageToSite ? site.id : user.personId}`\n : `${IMAGE_SERVICE_API_V3_URL}/${shouldUploadImageToSite ? site.id : user.personId}`;\n\n const response = await fetch(url, {\n body,\n headers: {\n Accept: 'application/json',\n Authorization: `bearer ${accessToken}`,\n },\n method: 'POST',\n });\n\n if (response.ok) {\n const { image, baseDomain } = (await response.json()) as Result;\n // Maps image-service-api-v3 result to v2 result.\n return {\n key: image.path,\n // Removes trailing slash from baseDomain, since image-service-api-v2 doesn't have a trailing slash on base.\n base: baseDomain.endsWith('/') ? baseDomain.slice(0, -1) : baseDomain,\n meta: {\n preview: image.preview,\n width: String(image.width),\n height: String(image.height),\n },\n };\n }\n\n throw Error(`Failed to POST image (status code: ${response.status}).`);\n};\n"],"mappings":"AAAA,SAASA,cAAc,EAAEC,OAAO,EAAEC,OAAO,QAAQ,YAAY;AAC7D,SAASC,qBAAqB,EAAEC,wBAAwB,QAAQ,4BAA4B;AAuC5F;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MAAAA,CAAO;EAC5BC,IAAI;EACJC;AACc,CAAC,KAA2C;EAC1D,MAAM;IAAEC;EAAY,CAAC,GAAG,MAAMR,cAAc,CAAC,CAAC;EAC9C,MAAMS,IAAI,GAAGP,OAAO,CAAC,CAAC;EACtB,MAAMQ,IAAI,GAAGT,OAAO,CAAC,CAAC;EAEtB,IAAI,CAACO,WAAW,IAAI,CAACC,IAAI,EAAEE,QAAQ,EAAE;IACjC,OAAOC,SAAS;EACpB;;EAEA;;EAEA,MAAMC,IAAI,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAE3BD,IAAI,CAACE,MAAM,CAAC,MAAM,EAAET,IAAI,CAAC;EAEzB,MAAMU,GAAG,GACLV,IAAI,CAACW,IAAI,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,GACtB,GAAGd,qBAAqB,IAAII,uBAAuB,GAAGG,IAAI,CAACQ,EAAE,GAAGT,IAAI,CAACE,QAAQ,EAAE,GAC/E,GAAGP,wBAAwB,IAAIG,uBAAuB,GAAGG,IAAI,CAACQ,EAAE,GAAGT,IAAI,CAACE,QAAQ,EAAE;EAE5F,MAAMQ,QAAQ,GAAG,MAAMC,KAAK,CAACJ,GAAG,EAAE;IAC9BH,IAAI;IACJQ,OAAO,EAAE;MACLC,MAAM,EAAE,kBAAkB;MAC1BC,aAAa,EAAE,UAAUf,WAAW;IACxC,CAAC;IACDgB,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIL,QAAQ,CAACM,EAAE,EAAE;IACb,MAAM;MAAEC,KAAK;MAAEC;IAAW,CAAC,GAAI,MAAMR,QAAQ,CAACS,IAAI,CAAC,CAAY;IAC/D;IACA,OAAO;MACHC,GAAG,EAAEH,KAAK,CAACI,IAAI;MACf;MACAC,IAAI,EAAEJ,UAAU,CAACK,QAAQ,CAAC,GAAG,CAAC,GAAGL,UAAU,CAACM,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAGN,UAAU;MACrEO,IAAI,EAAE;QACFC,OAAO,EAAET,KAAK,CAACS,OAAO;QACtBC,KAAK,EAAEC,MAAM,CAACX,KAAK,CAACU,KAAK,CAAC;QAC1BE,MAAM,EAAED,MAAM,CAACX,KAAK,CAACY,MAAM;MAC/B;IACJ,CAAC;EACL;EAEA,MAAMC,KAAK,CAAC,sCAAsCpB,QAAQ,CAACqB,MAAM,IAAI,CAAC;AAC1E,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getAccessToken } from 'chayns-api';
|
|
2
|
+
import { VIDEO_SERVICE_URL } from '../../constants/uploadUrls';
|
|
2
3
|
/**
|
|
3
4
|
* Uploads a video to the streaming service
|
|
4
5
|
*/
|
|
@@ -13,7 +14,7 @@ export const postVideo = async ({
|
|
|
13
14
|
}
|
|
14
15
|
const formData = new FormData();
|
|
15
16
|
formData.append('files', file);
|
|
16
|
-
const response = await fetch(
|
|
17
|
+
const response = await fetch(`${VIDEO_SERVICE_URL}?disableIntercom=true`, {
|
|
17
18
|
body: formData,
|
|
18
19
|
headers: {
|
|
19
20
|
Authorization: `bearer ${accessToken}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","names":["getAccessToken","postVideo","file","accessToken","undefined","formData","FormData","append","response","fetch","body","headers","Authorization","method","ok","data","json","Error","status"],"sources":["../../../../src/api/video/post.ts"],"sourcesContent":["import { getAccessToken } from 'chayns-api';\n\nexport interface PostVideoResult {\n id: string;\n originalVideoQuality: string;\n thumbnailUrl: string;\n url: string;\n urlMP4: string;\n}\n\ninterface PostVideoOptions {\n file: File | Blob;\n}\n\n/**\n * Uploads a video to the streaming service\n */\nexport const postVideo = async ({\n file,\n}: PostVideoOptions): Promise<PostVideoResult | undefined> => {\n const { accessToken } = await getAccessToken();\n\n if (!accessToken) {\n return undefined;\n }\n\n const formData = new FormData();\n\n formData.append('files', file);\n\n const response = await fetch(
|
|
1
|
+
{"version":3,"file":"post.js","names":["getAccessToken","VIDEO_SERVICE_URL","postVideo","file","accessToken","undefined","formData","FormData","append","response","fetch","body","headers","Authorization","method","ok","data","json","Error","status"],"sources":["../../../../src/api/video/post.ts"],"sourcesContent":["import { getAccessToken } from 'chayns-api';\nimport { VIDEO_SERVICE_URL } from '../../constants/uploadUrls';\n\nexport interface PostVideoResult {\n id: string;\n originalVideoQuality: string;\n thumbnailUrl: string;\n url: string;\n urlMP4: string;\n}\n\ninterface PostVideoOptions {\n file: File | Blob;\n}\n\n/**\n * Uploads a video to the streaming service\n */\nexport const postVideo = async ({\n file,\n}: PostVideoOptions): Promise<PostVideoResult | undefined> => {\n const { accessToken } = await getAccessToken();\n\n if (!accessToken) {\n return undefined;\n }\n\n const formData = new FormData();\n\n formData.append('files', file);\n\n const response = await fetch(`${VIDEO_SERVICE_URL}?disableIntercom=true`, {\n body: formData,\n headers: {\n Authorization: `bearer ${accessToken}`,\n },\n method: 'POST',\n });\n\n if (response.ok) {\n const data = (await response.json()) as PostVideoResult[];\n\n return data[0];\n }\n\n throw Error(`Failed to POST video (status code: ${response.status}).`);\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAC3C,SAASC,iBAAiB,QAAQ,4BAA4B;AAc9D;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MAAAA,CAAO;EAC5BC;AACc,CAAC,KAA2C;EAC1D,MAAM;IAAEC;EAAY,CAAC,GAAG,MAAMJ,cAAc,CAAC,CAAC;EAE9C,IAAI,CAACI,WAAW,EAAE;IACd,OAAOC,SAAS;EACpB;EAEA,MAAMC,QAAQ,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAE/BD,QAAQ,CAACE,MAAM,CAAC,OAAO,EAAEL,IAAI,CAAC;EAE9B,MAAMM,QAAQ,GAAG,MAAMC,KAAK,CAAC,GAAGT,iBAAiB,uBAAuB,EAAE;IACtEU,IAAI,EAAEL,QAAQ;IACdM,OAAO,EAAE;MACLC,aAAa,EAAE,UAAUT,WAAW;IACxC,CAAC;IACDU,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIL,QAAQ,CAACM,EAAE,EAAE;IACb,MAAMC,IAAI,GAAI,MAAMP,QAAQ,CAACQ,IAAI,CAAC,CAAuB;IAEzD,OAAOD,IAAI,CAAC,CAAC,CAAC;EAClB;EAEA,MAAME,KAAK,CAAC,sCAAsCT,QAAQ,CAACU,MAAM,IAAI,CAAC;AAC1E,CAAC","ignoreList":[]}
|
|
@@ -41,6 +41,7 @@ const ListItem = /*#__PURE__*/forwardRef(({
|
|
|
41
41
|
shouldOpenImageOnClick = false,
|
|
42
42
|
shouldHideImageOrIconBackground,
|
|
43
43
|
shouldHideIndicator = false,
|
|
44
|
+
shouldAnimateLayout = false,
|
|
44
45
|
shouldPreventLayoutAnimation = false,
|
|
45
46
|
shouldRenderClosed = false,
|
|
46
47
|
shouldShowRoundImageOrIcon,
|
|
@@ -222,7 +223,7 @@ const ListItem = /*#__PURE__*/forwardRef(({
|
|
|
222
223
|
key: `list-item-${uuid}`,
|
|
223
224
|
ref: listItemRef,
|
|
224
225
|
"data-uuid": `${listGroupUuid ?? ''}---${uuid}`,
|
|
225
|
-
layout: shouldPreventLayoutAnimation
|
|
226
|
+
layout: shouldAnimateLayout && !shouldPreventLayoutAnimation && !shouldDisableAnimation ? 'position' : undefined,
|
|
226
227
|
$backgroundColor: backgroundColor,
|
|
227
228
|
$isClickable: isClickable,
|
|
228
229
|
$isInAccordion: typeof isParentAccordionWrapped === 'boolean' && !areaProvider.shouldDisableListItemPadding,
|
|
@@ -279,6 +280,7 @@ const ListItem = /*#__PURE__*/forwardRef(({
|
|
|
279
280
|
titleElement: titleElement,
|
|
280
281
|
setShouldEnableTooltip: setShouldEnableTooltip,
|
|
281
282
|
shouldDisableAnimation: shouldDisableAnimation,
|
|
283
|
+
shouldAnimateLayout: shouldAnimateLayout && !shouldPreventLayoutAnimation && !shouldDisableAnimation,
|
|
282
284
|
onImageError: onImageError
|
|
283
285
|
})), /*#__PURE__*/React.createElement(AnimatePresence, {
|
|
284
286
|
initial: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","names":["AnimatePresence","motion","React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","useTheme","useUuid","AccordionContext","AreaContextProvider","AreaContext","useColorScheme","ListContext","handleHorizontalArrowNavigation","handleListItemTabNavigation","handleListItemToggleKey","handleVerticalListGroupNavigation","ListItemBody","ListItemHead","StyledListItem","StyledListItemTooltip","Tooltip","useIsInsideDialog","useFocusRingPortal","useKeyboardFocusHighlighting","useListItemFocus","ListItem","backgroundColor","careOfLocationId","children","cornerImage","hoverItem","icons","imageBackground","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldShowTooltipOnTitleOverflow","shouldForceBackground","shouldForceBottomLine","shouldForceHover","shouldHideBottomLine","shouldOpenImageOnClick","shouldHideImageOrIconBackground","shouldHideIndicator","shouldPreventLayoutAnimation","shouldRenderClosed","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","onImageError","onSizeChange","onTitleInputChange","titleElement","titleInputProps","shouldDisableAnimation","cornerElement","isSelected","shouldEnableKeyboardHighlighting","shouldEnableKeyboardHighlightingProp","ref","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","shouldEnableKeyboardHighlightingContext","listGroupUuid","listItemUuids","registerListItemUuid","unregisterListItemUuid","activeListItemUuid","updateActiveListItemUuid","colorScheme","theme","isInsideListContext","isParentAccordionWrapped","areaProvider","isInitialRenderRef","listItemRef","isInDialog","uuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","shouldEnableTooltip","setShouldEnableTooltip","titleWidth","setTitleWidth","titleMaxWidth","setTitleMaxWidth","current","handleHeadClick","event","shouldOnlyOpen","isClickable","handleTitleWidthChange","width","maxWidth","shouldShowKeyboardHighlighting","isEnabled","borderRadius","cardBorderRadius","isInKeyboardNavigationGroup","tabIndex","handleKeyDown","isCurrentListItemTarget","currentTarget","target","currentListItemElement","targetElement","currentUuid","toggleItem","some","handleKey","isFocusWithinListItem","handleFocus","handleBlur","shouldForceHoverItem","createElement","as","div","animate","height","opacity","className","exit","initial","key","layout","$backgroundColor","$isClickable","$isInAccordion","shouldDisableListItemPadding","$isOpen","$isWrapped","$isInDialog","$isSelected","$shouldChangeColor","shouldChangeColor","$shouldForceBackground","$shouldForceBottomLine","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","onKeyDown","onFocus","onBlur","shouldUseFullWidth","isDisabled","item","style","cursor","onTitleWidthChange","id","shouldHideBody","displayName"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence, motion } from 'motion/react';\nimport React, {\n ChangeEventHandler,\n CSSProperties,\n forwardRef,\n KeyboardEvent,\n MouseEventHandler,\n ReactNode,\n SyntheticEvent,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport type { InputProps } from '../../input/Input';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';\nimport { type Theme, useColorScheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { ListContext } from '../List';\nimport {\n handleHorizontalArrowNavigation,\n handleListItemTabNavigation,\n handleListItemToggleKey,\n handleVerticalListGroupNavigation,\n} from '../List.utils';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledListItem, StyledListItemTooltip } from './ListItem.styles';\nimport Tooltip from '../../tooltip/Tooltip';\nimport { useIsInsideDialog } from '../../../hooks/element';\nimport { useFocusRingPortal } from '../../../hooks/useFocusRingPortal';\nimport { useKeyboardFocusHighlighting } from '../../../hooks/useKeyboardFocusHighlighting';\nimport { useListItemFocus } from './useListItemFocus';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport interface ListItemSize {\n titleWidth: number;\n titleMaxWidth: number;\n}\n\nexport type ListItemProps = {\n /**\n * The background color of the `ListItem`.\n */\n backgroundColor?: CSSProperties['backgroundColor'];\n /**\n * DEPRECATED: Use `cornerImage` instead.\n */\n careOfLocationId?: number;\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * The image that is displayed in the bottom right corner of the grouped image of list item.\n */\n cornerImage?: string;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * The background of the image. This is only used if images are passed.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Whether the item is selected.\n */\n isSelected?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the line should be forced, e.g., so that it is also displayed if the item is the last element in the list.\n */\n shouldForceBottomLine?: boolean;\n /**\n * Whether the hover item should be forced.\n */\n shouldForceHover?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * This will render the ListItem closed on the first render.\n */\n shouldRenderClosed?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should always be used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Whether a Tooltip should be displayed on hover if the title is cut.\n */\n shouldShowTooltipOnTitleOverflow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n /**\n * Whether the ListItem Animation should be disabled.\n */\n shouldDisableAnimation?: boolean;\n /**\n * Optional Element to display in the right corner of the image\n */\n cornerElement?: ReactNode;\n /**\n * Optional handler for image load errors.\n */\n onImageError?: (event: SyntheticEvent<HTMLImageElement, Event>, index: number) => void;\n /**\n * Function to be executed if the size are changed.\n */\n onSizeChange?: (sizes: ListItemSize) => void;\n /**\n * Enables keyboard-only focus highlighting. Overrides the value from the List context.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Function that is executed when the text of the title input changes.\n * When this function is given, the title is displayed as an input.\n */\n onTitleInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * The props of the title input.\n */\n titleInputProps?: InputProps;\n};\n\nexport type ListItemRef = ListItemSize;\n\nconst ListItem = forwardRef<ListItemRef, ListItemProps>(\n (\n {\n backgroundColor,\n careOfLocationId,\n children,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldShowTooltipOnTitleOverflow = false,\n shouldForceBackground = false,\n shouldForceBottomLine = false,\n shouldForceHover = false,\n shouldHideBottomLine = false,\n shouldOpenImageOnClick = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldPreventLayoutAnimation = false,\n shouldRenderClosed = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n onImageError,\n onSizeChange,\n onTitleInputChange,\n titleElement,\n titleInputProps,\n shouldDisableAnimation = false,\n cornerElement,\n isSelected = false,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingProp,\n },\n ref,\n ) => {\n const {\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingContext,\n listGroupUuid,\n listItemUuids,\n registerListItemUuid,\n unregisterListItemUuid,\n activeListItemUuid,\n updateActiveListItemUuid,\n } = useContext(ListContext);\n const colorScheme = useColorScheme();\n const theme = useTheme() as Theme;\n const isInsideListContext = typeof listGroupUuid === 'string';\n\n const shouldEnableKeyboardHighlighting =\n shouldEnableKeyboardHighlightingProp ??\n (isInsideListContext\n ? shouldEnableKeyboardHighlightingContext\n : (colorScheme?.shouldEnableKeyboardHighlighting ?? false));\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const areaProvider = useContext(AreaContext);\n\n const isInitialRenderRef = useRef(true);\n\n const listItemRef = useRef<HTMLDivElement>(null);\n\n const isInDialog = useIsInsideDialog<HTMLDivElement>(listItemRef);\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n const [shouldEnableTooltip, setShouldEnableTooltip] = useState(false);\n const [titleWidth, setTitleWidth] = useState(0);\n const [titleMaxWidth, setTitleMaxWidth] = useState(0);\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n useEffect(() => {\n if (typeof onSizeChange === 'function') {\n onSizeChange({\n titleWidth,\n titleMaxWidth,\n });\n }\n }, [onSizeChange, titleMaxWidth, titleWidth]);\n\n useImperativeHandle(\n ref,\n () => ({\n titleWidth,\n titleMaxWidth,\n }),\n [titleMaxWidth, titleWidth],\n );\n\n const handleTitleWidthChange = useCallback((width: number, maxWidth: number) => {\n setTitleWidth(width);\n setTitleMaxWidth(maxWidth);\n }, []);\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(listItemRef, {\n isEnabled: shouldShowKeyboardHighlighting,\n borderRadius: `${theme.cardBorderRadius}px`,\n });\n\n const isInKeyboardNavigationGroup =\n shouldEnableKeyboardHighlighting &&\n typeof listGroupUuid === 'string' &&\n typeof updateActiveListItemUuid === 'function';\n\n useEffect(() => {\n if (\n shouldEnableKeyboardHighlighting &&\n typeof registerListItemUuid === 'function' &&\n typeof unregisterListItemUuid === 'function'\n ) {\n registerListItemUuid(uuid);\n\n return () => {\n unregisterListItemUuid(uuid);\n };\n }\n\n return undefined;\n }, [shouldEnableKeyboardHighlighting, registerListItemUuid, unregisterListItemUuid, uuid]);\n\n const tabIndex = useMemo(\n () => (shouldEnableKeyboardHighlighting ? 0 : -1),\n [shouldEnableKeyboardHighlighting],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const isCurrentListItemTarget = event.currentTarget === event.target;\n const currentListItemElement = event.currentTarget as HTMLDivElement;\n const targetElement = event.target as HTMLElement | null;\n\n [\n () =>\n shouldEnableKeyboardHighlighting &&\n handleHorizontalArrowNavigation({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n }),\n () =>\n handleListItemTabNavigation({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid: uuid,\n listGroupUuid,\n updateActiveListItemUuid,\n }),\n () =>\n handleVerticalListGroupNavigation({\n event,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid: uuid,\n listGroupUuid,\n updateActiveListItemUuid,\n }),\n () =>\n handleListItemToggleKey({\n event,\n isCurrentListItemTarget,\n isExpandable,\n isItemOpen,\n shouldEnableKeyboardHighlighting,\n toggleItem: () =>\n handleHeadClick(\n event as unknown as React.MouseEvent<HTMLDivElement>,\n ),\n }),\n ].some((handleKey) => handleKey());\n },\n [\n handleHeadClick,\n isExpandable,\n isInKeyboardNavigationGroup,\n isItemOpen,\n listGroupUuid,\n listItemUuids,\n shouldEnableKeyboardHighlighting,\n updateActiveListItemUuid,\n uuid,\n ],\n );\n\n const { isFocusWithinListItem, handleFocus, handleBlur } = useListItemFocus({\n uuid,\n listGroupUuid,\n isInKeyboardNavigationGroup,\n updateActiveListItemUuid,\n });\n const shouldForceHoverItem = shouldForceHover || isFocusWithinListItem;\n\n useEffect(() => {\n if (\n isInKeyboardNavigationGroup &&\n activeListItemUuid == null &&\n typeof updateActiveListItemUuid === 'function' &&\n listItemUuids?.[0] === uuid\n ) {\n updateActiveListItemUuid(uuid);\n }\n }, [\n activeListItemUuid,\n isInKeyboardNavigationGroup,\n listItemUuids,\n updateActiveListItemUuid,\n uuid,\n ]);\n\n return (\n <StyledListItem\n as={shouldDisableAnimation ? undefined : motion.div}\n animate={shouldDisableAnimation ? undefined : { height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={shouldDisableAnimation ? undefined : { height: 0, opacity: 0 }}\n initial={shouldDisableAnimation ? undefined : { height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n ref={listItemRef}\n data-uuid={`${listGroupUuid ?? ''}---${uuid}`}\n layout={\n shouldPreventLayoutAnimation || shouldDisableAnimation ? undefined : 'position'\n }\n $backgroundColor={backgroundColor}\n $isClickable={isClickable}\n $isInAccordion={\n typeof isParentAccordionWrapped === 'boolean' &&\n !areaProvider.shouldDisableListItemPadding\n }\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $isInDialog={isInDialog}\n $isSelected={isSelected}\n $shouldChangeColor={areaProvider.shouldChangeColor}\n $shouldForceBackground={shouldForceBackground}\n $shouldForceBottomLine={shouldForceBottomLine}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n data-should-show-keyboard-highlighting={\n shouldShowKeyboardHighlighting ? 'true' : undefined\n }\n tabIndex={tabIndex}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n <Tooltip\n shouldUseFullWidth\n isDisabled={!shouldShowTooltipOnTitleOverflow || !shouldEnableTooltip}\n item={\n <StyledListItemTooltip\n style={{ cursor: 'default' }}\n key={`list-item-tooltip-${uuid}`}\n >\n {title}\n </StyledListItemTooltip>\n }\n >\n <ListItemHead\n hoverItem={hoverItem}\n careOfLocationId={careOfLocationId}\n cornerElement={cornerElement}\n cornerImage={cornerImage}\n icons={icons}\n imageBackground={imageBackground}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n shouldForceHover={shouldForceHoverItem}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n onTitleInputChange={onTitleInputChange}\n onTitleWidthChange={handleTitleWidthChange}\n titleInputProps={titleInputProps}\n titleElement={titleElement}\n setShouldEnableTooltip={setShouldEnableTooltip}\n shouldDisableAnimation={shouldDisableAnimation}\n onImageError={onImageError}\n />\n </Tooltip>\n <AnimatePresence initial={false}>\n {isExpandable && (isItemOpen || shouldRenderClosed) && (\n <ListItemBody\n id={uuid}\n key={`listItemBody-${uuid}`}\n shouldHideBody={shouldRenderClosed && !isItemOpen}\n >\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledListItem>\n );\n },\n);\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":"AAAA,SAASA,eAAe,EAAEC,MAAM,QAAQ,cAAc;AACtD,OAAOC,KAAK,IAGRC,UAAU,EAMVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,OAAO;AACd,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,SAASC,OAAO,QAAQ,qBAAqB;AAG7C,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,OAAOC,mBAAmB,IAAIC,WAAW,QAAQ,yCAAyC;AAC1F,SAAqBC,cAAc,QAAQ,iDAAiD;AAC5F,SAASC,WAAW,QAAQ,SAAS;AACrC,SACIC,+BAA+B,EAC/BC,2BAA2B,EAC3BC,uBAAuB,EACvBC,iCAAiC,QAC9B,eAAe;AACtB,OAAOC,YAAY,MAAM,+BAA+B;AACxD,O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BC,KAAK,EAAEA,KAAM;IACbG,kBAAkB,EAAEA,kBAAmB;IACvCsG,kBAAkB,EAAEzD,sBAAuB;IAC3C3C,eAAe,EAAEA,eAAgB;IACjCD,YAAY,EAAEA,YAAa;IAC3BkC,sBAAsB,EAAEA,sBAAuB;IAC/ChC,sBAAsB,EAAEA,sBAAuB;IAC/CL,YAAY,EAAEA;EAAa,CAC9B,CACI,CAAC,eACV7D,KAAA,CAAAmI,aAAA,CAACrI,eAAe;IAAC6I,OAAO,EAAE;EAAM,GAC3B/C,YAAY,KAAKE,UAAU,IAAItC,kBAAkB,CAAC,iBAC/CxD,KAAA,CAAAmI,aAAA,CAAC/G,YAAY;IACTkJ,EAAE,EAAE3E,IAAK;IACTiD,GAAG,EAAE,gBAAgBjD,IAAI,EAAG;IAC5B4E,cAAc,EAAE/G,kBAAkB,IAAI,CAACsC;EAAW,gBAElD9F,KAAA,CAAAmI,aAAA,CAACvH,mBAAmB,QAAEoB,QAA8B,CAC1C,CAEL,CACL,CAAC;AAEzB,CACJ,CAAC;AAEDH,QAAQ,CAAC2I,WAAW,GAAG,UAAU;AAEjC,eAAe3I,QAAQ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ListItem.js","names":["AnimatePresence","motion","React","forwardRef","useCallback","useContext","useEffect","useImperativeHandle","useMemo","useRef","useState","useTheme","useUuid","AccordionContext","AreaContextProvider","AreaContext","useColorScheme","ListContext","handleHorizontalArrowNavigation","handleListItemTabNavigation","handleListItemToggleKey","handleVerticalListGroupNavigation","ListItemBody","ListItemHead","StyledListItem","StyledListItemTooltip","Tooltip","useIsInsideDialog","useFocusRingPortal","useKeyboardFocusHighlighting","useListItemFocus","ListItem","backgroundColor","careOfLocationId","children","cornerImage","hoverItem","icons","imageBackground","images","isDefaultOpen","isOpen","isTitleGreyed","leftElements","onClick","onClose","onLongPress","onOpen","rightElements","shouldShowTooltipOnTitleOverflow","shouldForceBackground","shouldForceBottomLine","shouldForceHover","shouldHideBottomLine","shouldOpenImageOnClick","shouldHideImageOrIconBackground","shouldHideIndicator","shouldAnimateLayout","shouldPreventLayoutAnimation","shouldRenderClosed","shouldShowRoundImageOrIcon","shouldShowSeparatorBelow","subtitle","title","onImageError","onSizeChange","onTitleInputChange","titleElement","titleInputProps","shouldDisableAnimation","cornerElement","isSelected","shouldEnableKeyboardHighlighting","shouldEnableKeyboardHighlightingProp","ref","isAnyItemExpandable","isWrapped","openItemUuid","updateOpenItemUuid","shouldEnableKeyboardHighlightingContext","listGroupUuid","listItemUuids","registerListItemUuid","unregisterListItemUuid","activeListItemUuid","updateActiveListItemUuid","colorScheme","theme","isInsideListContext","isParentAccordionWrapped","areaProvider","isInitialRenderRef","listItemRef","isInDialog","uuid","isExpandable","undefined","isItemOpen","onCloseRef","onOpenRef","shouldEnableTooltip","setShouldEnableTooltip","titleWidth","setTitleWidth","titleMaxWidth","setTitleMaxWidth","current","handleHeadClick","event","shouldOnlyOpen","isClickable","handleTitleWidthChange","width","maxWidth","shouldShowKeyboardHighlighting","isEnabled","borderRadius","cardBorderRadius","isInKeyboardNavigationGroup","tabIndex","handleKeyDown","isCurrentListItemTarget","currentTarget","target","currentListItemElement","targetElement","currentUuid","toggleItem","some","handleKey","isFocusWithinListItem","handleFocus","handleBlur","shouldForceHoverItem","createElement","as","div","animate","height","opacity","className","exit","initial","key","layout","$backgroundColor","$isClickable","$isInAccordion","shouldDisableListItemPadding","$isOpen","$isWrapped","$isInDialog","$isSelected","$shouldChangeColor","shouldChangeColor","$shouldForceBackground","$shouldForceBottomLine","$shouldHideBottomLine","$shouldHideIndicator","$shouldShowSeparatorBelow","onKeyDown","onFocus","onBlur","shouldUseFullWidth","isDisabled","item","style","cursor","onTitleWidthChange","id","shouldHideBody","displayName"],"sources":["../../../../../src/components/list/list-item/ListItem.tsx"],"sourcesContent":["import { AnimatePresence, motion } from 'motion/react';\nimport React, {\n ChangeEventHandler,\n CSSProperties,\n forwardRef,\n KeyboardEvent,\n MouseEventHandler,\n ReactNode,\n SyntheticEvent,\n TouchEventHandler,\n useCallback,\n useContext,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { useTheme } from 'styled-components';\nimport { useUuid } from '../../../hooks/uuid';\nimport type { IListItemRightElements } from '../../../types/list';\nimport type { InputProps } from '../../input/Input';\nimport { AccordionContext } from '../../accordion/Accordion';\nimport AreaContextProvider, { AreaContext } from '../../area-provider/AreaContextProvider';\nimport { type Theme, useColorScheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { ListContext } from '../List';\nimport {\n handleHorizontalArrowNavigation,\n handleListItemTabNavigation,\n handleListItemToggleKey,\n handleVerticalListGroupNavigation,\n} from '../List.utils';\nimport ListItemBody from './list-item-body/ListItemBody';\nimport ListItemHead from './list-item-head/ListItemHead';\nimport { StyledListItem, StyledListItemTooltip } from './ListItem.styles';\nimport Tooltip from '../../tooltip/Tooltip';\nimport { useIsInsideDialog } from '../../../hooks/element';\nimport { useFocusRingPortal } from '../../../hooks/useFocusRingPortal';\nimport { useKeyboardFocusHighlighting } from '../../../hooks/useKeyboardFocusHighlighting';\nimport { useListItemFocus } from './useListItemFocus';\n\nexport type ListItemElements = [ReactNode, ...ReactNode[]];\n\nexport interface ListItemSize {\n titleWidth: number;\n titleMaxWidth: number;\n}\n\nexport type ListItemProps = {\n /**\n * The background color of the `ListItem`.\n */\n backgroundColor?: CSSProperties['backgroundColor'];\n /**\n * DEPRECATED: Use `cornerImage` instead.\n */\n careOfLocationId?: number;\n /**\n * The content of the `ListItem` body. When the `ListItem` has children,\n * it can be opened and also gets an icon as an indicator automatically.\n */\n children?: ReactNode;\n /**\n * The image that is displayed in the bottom right corner of the grouped image of list item.\n */\n cornerImage?: string;\n /**\n * Element that is displayed when hovering over the `ListItem` on the right\n * side. On mobile devices, this element is not displayed.\n */\n hoverItem?: ReactNode;\n /**\n * The FontAwesome or tobit icons to render like an image on the left side\n * of the header. Multiple icons are stacked. See the `Icon` component\n * documentation for more information.\n */\n icons?: string[];\n /**\n * The background of the image. This is only used if images are passed.\n */\n imageBackground?: CSSProperties['background'];\n /**\n * A list of image URLs that are displayed on the left side of the header.\n * If multiple URLs are passed, the image is assembled from the first three\n * image URLs as a puzzle.\n */\n images?: string[];\n /**\n * This can be used to automatically expand the `ListItem` during the first render.\n */\n isDefaultOpen?: boolean;\n /**\n * This overrides the internal opening state of the item and makes it controlled.\n */\n isOpen?: boolean;\n /**\n * Whether the ListItem locks disabled but has full functionality.\n */\n isTitleGreyed?: boolean;\n /**\n * Whether the item is selected.\n */\n isSelected?: boolean;\n /**\n * Elements that are displayed on the left side of the header. If multiple\n * elements are specified, they are displayed one aside the other.\n */\n leftElements?: ListItemElements;\n /**\n * Function to be executed when the header of the `ListItem` was clicked\n */\n onClick?: MouseEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is closed.\n */\n onClose?: VoidFunction;\n /**\n * Function to be executed when the header of the `ListItem` is pressed for\n * 400 milliseconds.\n */\n onLongPress?: TouchEventHandler<HTMLDivElement>;\n /**\n * Function to be executed when the ListItem is opened.\n */\n onOpen?: VoidFunction;\n /**\n * Elements that are displayed on the right side of the header. If multiple\n * elements are specified, they are displayed one below the other.\n */\n rightElements?: IListItemRightElements;\n /**\n * This will force the background color of the ListItem to be used even if it is closed and not hovered.\n */\n shouldForceBackground?: boolean;\n /**\n * Whether the line should be forced, e.g., so that it is also displayed if the item is the last element in the list.\n */\n shouldForceBottomLine?: boolean;\n /**\n * Whether the hover item should be forced.\n */\n shouldForceHover?: boolean;\n /**\n * Whether the bottom line should be hidden.\n */\n shouldHideBottomLine?: boolean;\n /**\n * Whether the background and border of the shape on which the image or icon of the element is displayed should be\n * hidden.\n */\n shouldHideImageOrIconBackground?: boolean;\n /**\n * If the `ListItem` is expandable, the indicator is displayed on the left\n * side of the header. If this property is set to true, the indicator is\n * hidden.\n */\n shouldHideIndicator?: boolean;\n /**\n * Whether the image should be opened on click.\n */\n shouldOpenImageOnClick?: boolean;\n /**\n * Whether the framer-motion layout projection (`layout=\"position\"`) should be\n * enabled. This animates the `ListItem` smoothly into its new position when\n * sibling items are reordered, expanded or resized.\n *\n * This is opt-in and disabled by default, because framer-motions layout\n * projection is viewport-global: every layout change anywhere in the document\n * (window resize, height animation, ...) forces a re-measurement of **all**\n * layout-projection nodes via `getBoundingClientRect`. In lists with many\n * `ListItem`s this scales linearly and causes noticeable layout thrash. The\n * enter/exit height/opacity animation is unaffected and stays enabled.\n */\n shouldAnimateLayout?: boolean;\n /**\n * Whether the layout animation should be prevented. This is useful when the\n * `ListItem` is used in a list with a lot of items and the layout animation\n * is not desired.\n *\n * @deprecated The layout projection is now disabled by default. Use\n * `shouldAnimateLayout` to opt into it instead. When set to `true`, this\n * prop keeps forcing the layout projection off.\n */\n shouldPreventLayoutAnimation?: boolean;\n /**\n * This will render the ListItem closed on the first render.\n */\n shouldRenderClosed?: boolean;\n /**\n * Whether the image or icon should be displayed in a round shape. This should always be used for images of persons.\n */\n shouldShowRoundImageOrIcon?: boolean;\n /**\n * Whether a separator should be displayed below this item. In this case, the border is displayed thicker than normal.\n */\n shouldShowSeparatorBelow?: boolean;\n /**\n * Whether a Tooltip should be displayed on hover if the title is cut.\n */\n shouldShowTooltipOnTitleOverflow?: boolean;\n /**\n * Subtitle of the `ListItem` displayed in the head below the title\n */\n subtitle?: ReactNode;\n /**\n * Title of the `ListItem` displayed in the head\n */\n title: ReactNode;\n /**\n * Additional elements to be displayed in the header next to the title.\n */\n titleElement?: ReactNode;\n /**\n * Whether the ListItem Animation should be disabled.\n */\n shouldDisableAnimation?: boolean;\n /**\n * Optional Element to display in the right corner of the image\n */\n cornerElement?: ReactNode;\n /**\n * Optional handler for image load errors.\n */\n onImageError?: (event: SyntheticEvent<HTMLImageElement, Event>, index: number) => void;\n /**\n * Function to be executed if the size are changed.\n */\n onSizeChange?: (sizes: ListItemSize) => void;\n /**\n * Enables keyboard-only focus highlighting. Overrides the value from the List context.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Function that is executed when the text of the title input changes.\n * When this function is given, the title is displayed as an input.\n */\n onTitleInputChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * The props of the title input.\n */\n titleInputProps?: InputProps;\n};\n\nexport type ListItemRef = ListItemSize;\n\nconst ListItem = forwardRef<ListItemRef, ListItemProps>(\n (\n {\n backgroundColor,\n careOfLocationId,\n children,\n cornerImage,\n hoverItem,\n icons,\n imageBackground,\n images,\n isDefaultOpen,\n isOpen,\n isTitleGreyed,\n leftElements,\n onClick,\n onClose,\n onLongPress,\n onOpen,\n rightElements,\n shouldShowTooltipOnTitleOverflow = false,\n shouldForceBackground = false,\n shouldForceBottomLine = false,\n shouldForceHover = false,\n shouldHideBottomLine = false,\n shouldOpenImageOnClick = false,\n shouldHideImageOrIconBackground,\n shouldHideIndicator = false,\n shouldAnimateLayout = false,\n shouldPreventLayoutAnimation = false,\n shouldRenderClosed = false,\n shouldShowRoundImageOrIcon,\n shouldShowSeparatorBelow = false,\n subtitle,\n title,\n onImageError,\n onSizeChange,\n onTitleInputChange,\n titleElement,\n titleInputProps,\n shouldDisableAnimation = false,\n cornerElement,\n isSelected = false,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingProp,\n },\n ref,\n ) => {\n const {\n isAnyItemExpandable,\n isWrapped,\n openItemUuid,\n updateOpenItemUuid,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingContext,\n listGroupUuid,\n listItemUuids,\n registerListItemUuid,\n unregisterListItemUuid,\n activeListItemUuid,\n updateActiveListItemUuid,\n } = useContext(ListContext);\n const colorScheme = useColorScheme();\n const theme = useTheme() as Theme;\n const isInsideListContext = typeof listGroupUuid === 'string';\n\n const shouldEnableKeyboardHighlighting =\n shouldEnableKeyboardHighlightingProp ??\n (isInsideListContext\n ? shouldEnableKeyboardHighlightingContext\n : (colorScheme?.shouldEnableKeyboardHighlighting ?? false));\n\n const { isWrapped: isParentAccordionWrapped } = useContext(AccordionContext);\n\n const areaProvider = useContext(AreaContext);\n\n const isInitialRenderRef = useRef(true);\n\n const listItemRef = useRef<HTMLDivElement>(null);\n\n const isInDialog = useIsInsideDialog<HTMLDivElement>(listItemRef);\n\n const uuid = useUuid();\n\n const isExpandable = children !== undefined;\n const isItemOpen = isOpen ?? openItemUuid === uuid;\n\n const onCloseRef = useRef(onClose);\n const onOpenRef = useRef(onOpen);\n\n const [shouldEnableTooltip, setShouldEnableTooltip] = useState(false);\n const [titleWidth, setTitleWidth] = useState(0);\n const [titleMaxWidth, setTitleMaxWidth] = useState(0);\n\n useEffect(() => {\n onCloseRef.current = onClose;\n onOpenRef.current = onOpen;\n }, [isOpen, onClose, onOpen]);\n\n useEffect(() => {\n if (isInitialRenderRef.current) {\n isInitialRenderRef.current = false;\n } else if (isItemOpen) {\n if (typeof onOpenRef.current === 'function') {\n onOpenRef.current();\n }\n } else if (typeof onCloseRef.current === 'function') {\n onCloseRef.current();\n }\n }, [isItemOpen]);\n\n const handleHeadClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (event) => {\n if (isExpandable) {\n updateOpenItemUuid(uuid);\n }\n\n if (typeof onClick === 'function') {\n onClick(event);\n }\n },\n [isExpandable, onClick, updateOpenItemUuid, uuid],\n );\n\n useEffect(() => {\n if (isDefaultOpen) {\n updateOpenItemUuid(uuid, { shouldOnlyOpen: true });\n }\n }, [isDefaultOpen, updateOpenItemUuid, uuid]);\n\n const isClickable = typeof onClick === 'function' || isExpandable;\n\n useEffect(() => {\n if (typeof onSizeChange === 'function') {\n onSizeChange({\n titleWidth,\n titleMaxWidth,\n });\n }\n }, [onSizeChange, titleMaxWidth, titleWidth]);\n\n useImperativeHandle(\n ref,\n () => ({\n titleWidth,\n titleMaxWidth,\n }),\n [titleMaxWidth, titleWidth],\n );\n\n const handleTitleWidthChange = useCallback((width: number, maxWidth: number) => {\n setTitleWidth(width);\n setTitleMaxWidth(maxWidth);\n }, []);\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(listItemRef, {\n isEnabled: shouldShowKeyboardHighlighting,\n borderRadius: `${theme.cardBorderRadius}px`,\n });\n\n const isInKeyboardNavigationGroup =\n shouldEnableKeyboardHighlighting &&\n typeof listGroupUuid === 'string' &&\n typeof updateActiveListItemUuid === 'function';\n\n useEffect(() => {\n if (\n shouldEnableKeyboardHighlighting &&\n typeof registerListItemUuid === 'function' &&\n typeof unregisterListItemUuid === 'function'\n ) {\n registerListItemUuid(uuid);\n\n return () => {\n unregisterListItemUuid(uuid);\n };\n }\n\n return undefined;\n }, [shouldEnableKeyboardHighlighting, registerListItemUuid, unregisterListItemUuid, uuid]);\n\n const tabIndex = useMemo(\n () => (shouldEnableKeyboardHighlighting ? 0 : -1),\n [shouldEnableKeyboardHighlighting],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const isCurrentListItemTarget = event.currentTarget === event.target;\n const currentListItemElement = event.currentTarget as HTMLDivElement;\n const targetElement = event.target as HTMLElement | null;\n\n [\n () =>\n shouldEnableKeyboardHighlighting &&\n handleHorizontalArrowNavigation({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n }),\n () =>\n handleListItemTabNavigation({\n event,\n currentListItemElement,\n targetElement,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid: uuid,\n listGroupUuid,\n updateActiveListItemUuid,\n }),\n () =>\n handleVerticalListGroupNavigation({\n event,\n isCurrentListItemTarget,\n isInKeyboardNavigationGroup,\n listItemUuids,\n currentUuid: uuid,\n listGroupUuid,\n updateActiveListItemUuid,\n }),\n () =>\n handleListItemToggleKey({\n event,\n isCurrentListItemTarget,\n isExpandable,\n isItemOpen,\n shouldEnableKeyboardHighlighting,\n toggleItem: () =>\n handleHeadClick(\n event as unknown as React.MouseEvent<HTMLDivElement>,\n ),\n }),\n ].some((handleKey) => handleKey());\n },\n [\n handleHeadClick,\n isExpandable,\n isInKeyboardNavigationGroup,\n isItemOpen,\n listGroupUuid,\n listItemUuids,\n shouldEnableKeyboardHighlighting,\n updateActiveListItemUuid,\n uuid,\n ],\n );\n\n const { isFocusWithinListItem, handleFocus, handleBlur } = useListItemFocus({\n uuid,\n listGroupUuid,\n isInKeyboardNavigationGroup,\n updateActiveListItemUuid,\n });\n const shouldForceHoverItem = shouldForceHover || isFocusWithinListItem;\n\n useEffect(() => {\n if (\n isInKeyboardNavigationGroup &&\n activeListItemUuid == null &&\n typeof updateActiveListItemUuid === 'function' &&\n listItemUuids?.[0] === uuid\n ) {\n updateActiveListItemUuid(uuid);\n }\n }, [\n activeListItemUuid,\n isInKeyboardNavigationGroup,\n listItemUuids,\n updateActiveListItemUuid,\n uuid,\n ]);\n\n return (\n <StyledListItem\n as={shouldDisableAnimation ? undefined : motion.div}\n animate={shouldDisableAnimation ? undefined : { height: 'auto', opacity: 1 }}\n className=\"beta-chayns-list-item\"\n exit={shouldDisableAnimation ? undefined : { height: 0, opacity: 0 }}\n initial={shouldDisableAnimation ? undefined : { height: 0, opacity: 0 }}\n key={`list-item-${uuid}`}\n ref={listItemRef}\n data-uuid={`${listGroupUuid ?? ''}---${uuid}`}\n layout={\n shouldAnimateLayout && !shouldPreventLayoutAnimation && !shouldDisableAnimation\n ? 'position'\n : undefined\n }\n $backgroundColor={backgroundColor}\n $isClickable={isClickable}\n $isInAccordion={\n typeof isParentAccordionWrapped === 'boolean' &&\n !areaProvider.shouldDisableListItemPadding\n }\n $isOpen={isItemOpen}\n $isWrapped={isWrapped}\n $isInDialog={isInDialog}\n $isSelected={isSelected}\n $shouldChangeColor={areaProvider.shouldChangeColor}\n $shouldForceBackground={shouldForceBackground}\n $shouldForceBottomLine={shouldForceBottomLine}\n $shouldHideBottomLine={shouldHideBottomLine}\n $shouldHideIndicator={shouldHideIndicator}\n $shouldShowSeparatorBelow={shouldShowSeparatorBelow}\n data-should-show-keyboard-highlighting={\n shouldShowKeyboardHighlighting ? 'true' : undefined\n }\n tabIndex={tabIndex}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n >\n <Tooltip\n shouldUseFullWidth\n isDisabled={!shouldShowTooltipOnTitleOverflow || !shouldEnableTooltip}\n item={\n <StyledListItemTooltip\n style={{ cursor: 'default' }}\n key={`list-item-tooltip-${uuid}`}\n >\n {title}\n </StyledListItemTooltip>\n }\n >\n <ListItemHead\n hoverItem={hoverItem}\n careOfLocationId={careOfLocationId}\n cornerElement={cornerElement}\n cornerImage={cornerImage}\n icons={icons}\n imageBackground={imageBackground}\n images={images}\n isAnyItemExpandable={isAnyItemExpandable}\n isExpandable={isExpandable}\n isOpen={isItemOpen}\n isTitleGreyed={isTitleGreyed}\n leftElements={leftElements}\n onClick={isClickable ? handleHeadClick : undefined}\n onLongPress={onLongPress}\n shouldForceHover={shouldForceHoverItem}\n rightElements={rightElements}\n shouldHideImageOrIconBackground={shouldHideImageOrIconBackground}\n shouldHideIndicator={shouldHideIndicator}\n shouldOpenImageOnClick={shouldOpenImageOnClick}\n shouldShowRoundImageOrIcon={shouldShowRoundImageOrIcon}\n subtitle={subtitle}\n title={title}\n onTitleInputChange={onTitleInputChange}\n onTitleWidthChange={handleTitleWidthChange}\n titleInputProps={titleInputProps}\n titleElement={titleElement}\n setShouldEnableTooltip={setShouldEnableTooltip}\n shouldDisableAnimation={shouldDisableAnimation}\n shouldAnimateLayout={\n shouldAnimateLayout &&\n !shouldPreventLayoutAnimation &&\n !shouldDisableAnimation\n }\n onImageError={onImageError}\n />\n </Tooltip>\n <AnimatePresence initial={false}>\n {isExpandable && (isItemOpen || shouldRenderClosed) && (\n <ListItemBody\n id={uuid}\n key={`listItemBody-${uuid}`}\n shouldHideBody={shouldRenderClosed && !isItemOpen}\n >\n <AreaContextProvider>{children}</AreaContextProvider>\n </ListItemBody>\n )}\n </AnimatePresence>\n </StyledListItem>\n );\n },\n);\n\nListItem.displayName = 'ListItem';\n\nexport default ListItem;\n"],"mappings":"AAAA,SAASA,eAAe,E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8B,CAC1C,CAEL,CACL,CAAC;AAEzB,CACJ,CAAC;AAEDH,QAAQ,CAAC4I,WAAW,GAAG,UAAU;AAEjC,eAAe5I,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
2
|
+
import { act, render } from '@testing-library/react';
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { ThemeProvider } from 'styled-components';
|
|
6
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
7
|
+
import List from '../List';
|
|
8
|
+
import ListItem from './ListItem';
|
|
9
|
+
vi.mock('@chayns/textstrings', () => ({
|
|
10
|
+
useTranslation: () => ({
|
|
11
|
+
t: textString => typeof textString === 'string' ? textString : textString.fallback
|
|
12
|
+
})
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Regression guard for the framer-motion layout-projection thrash.
|
|
17
|
+
*
|
|
18
|
+
* framer-motions layout projection (`layout` / `layout="position"`) is
|
|
19
|
+
* viewport-global: all layout-projection nodes share a single projection tree, so
|
|
20
|
+
* a layout change on *any* node forces a re-measurement of *all* nodes via
|
|
21
|
+
* `getBoundingClientRect`. With many `ListItem`s this scales linearly with N.
|
|
22
|
+
*
|
|
23
|
+
* The tests below render a projection node (`motion.div layout`) *outside* the
|
|
24
|
+
* list and change its layout. They then count how many `getBoundingClientRect`
|
|
25
|
+
* calls hit the rendered `ListItem` elements:
|
|
26
|
+
* - default (no `shouldAnimateLayout`): the items are not projection nodes, so
|
|
27
|
+
* the external change does not re-measure them (reads === 0).
|
|
28
|
+
* - `shouldAnimateLayout`: the items join the shared projection tree, so they are
|
|
29
|
+
* re-measured by the unrelated external change (reads > 0).
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const ITEM_COUNT = 20;
|
|
33
|
+
let boundingRectCalls;
|
|
34
|
+
let originalGetBoundingClientRect;
|
|
35
|
+
const isInsideList = element => Boolean(element.closest('.beta-chayns-list-item'));
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
boundingRectCalls = 0;
|
|
38
|
+
originalGetBoundingClientRect = Element.prototype.getBoundingClientRect;
|
|
39
|
+
Element.prototype.getBoundingClientRect = function getBoundingClientRect() {
|
|
40
|
+
if (isInsideList(this)) {
|
|
41
|
+
boundingRectCalls += 1;
|
|
42
|
+
}
|
|
43
|
+
return originalGetBoundingClientRect.apply(this);
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
afterEach(() => {
|
|
47
|
+
Element.prototype.getBoundingClientRect = originalGetBoundingClientRect;
|
|
48
|
+
});
|
|
49
|
+
const theme = {
|
|
50
|
+
'100-rgb': '255, 255, 255',
|
|
51
|
+
'102-rgb': '255, 255, 255',
|
|
52
|
+
'headline-rgb': '0, 0, 0',
|
|
53
|
+
cardBackgroundOpacity: 1,
|
|
54
|
+
accordionLines: true,
|
|
55
|
+
accordionIcon: 'fa-chevron-right',
|
|
56
|
+
iconStyle: 'fa-regular'
|
|
57
|
+
};
|
|
58
|
+
const Harness = ({
|
|
59
|
+
shouldAnimateLayout,
|
|
60
|
+
isExternalExpanded
|
|
61
|
+
}) => /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
62
|
+
theme: theme
|
|
63
|
+
}, /*#__PURE__*/React.createElement(motion.div, {
|
|
64
|
+
layout: true,
|
|
65
|
+
"data-testid": "outside",
|
|
66
|
+
style: {
|
|
67
|
+
height: isExternalExpanded ? 500 : 100
|
|
68
|
+
}
|
|
69
|
+
}), /*#__PURE__*/React.createElement(List, null, Array.from({
|
|
70
|
+
length: ITEM_COUNT
|
|
71
|
+
}, (_, index) => /*#__PURE__*/React.createElement(ListItem, {
|
|
72
|
+
key: index,
|
|
73
|
+
title: `Item ${index}`,
|
|
74
|
+
shouldAnimateLayout: shouldAnimateLayout
|
|
75
|
+
}))));
|
|
76
|
+
const flushFrames = async () => {
|
|
77
|
+
await act(async () => {
|
|
78
|
+
await new Promise(resolve => {
|
|
79
|
+
requestAnimationFrame(() => requestAnimationFrame(() => resolve(undefined)));
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Render the list, then trigger a layout change on the external projection node
|
|
86
|
+
* and return the number of `getBoundingClientRect` calls that hit the list items.
|
|
87
|
+
*/
|
|
88
|
+
const measureExternalLayoutChange = async shouldAnimateLayout => {
|
|
89
|
+
const {
|
|
90
|
+
rerender
|
|
91
|
+
} = render(/*#__PURE__*/React.createElement(Harness, {
|
|
92
|
+
shouldAnimateLayout: shouldAnimateLayout,
|
|
93
|
+
isExternalExpanded: false
|
|
94
|
+
}));
|
|
95
|
+
await flushFrames();
|
|
96
|
+
boundingRectCalls = 0;
|
|
97
|
+
rerender(/*#__PURE__*/React.createElement(Harness, {
|
|
98
|
+
shouldAnimateLayout: shouldAnimateLayout,
|
|
99
|
+
isExternalExpanded: true
|
|
100
|
+
}));
|
|
101
|
+
await flushFrames();
|
|
102
|
+
return boundingRectCalls;
|
|
103
|
+
};
|
|
104
|
+
describe('ListItem layout projection', () => {
|
|
105
|
+
it('does not re-measure items on external layout changes by default', async () => {
|
|
106
|
+
const reads = await measureExternalLayoutChange(false);
|
|
107
|
+
expect(reads).toBe(0);
|
|
108
|
+
});
|
|
109
|
+
it('re-measures items on external layout changes when shouldAnimateLayout is set', async () => {
|
|
110
|
+
const reads = await measureExternalLayoutChange(true);
|
|
111
|
+
expect(reads).toBeGreaterThan(0);
|
|
112
|
+
});
|
|
113
|
+
it('keeps the enter/exit animation for added/removed items without layout projection', async () => {
|
|
114
|
+
const renderItems = titles => /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
115
|
+
theme: theme
|
|
116
|
+
}, /*#__PURE__*/React.createElement(List, null, titles.map(title => /*#__PURE__*/React.createElement(ListItem, {
|
|
117
|
+
key: title,
|
|
118
|
+
title: title
|
|
119
|
+
}))));
|
|
120
|
+
const {
|
|
121
|
+
rerender,
|
|
122
|
+
queryByText
|
|
123
|
+
} = render(renderItems(['A', 'B', 'C']));
|
|
124
|
+
await flushFrames();
|
|
125
|
+
|
|
126
|
+
// Remove the first item. AnimatePresence must keep it mounted while its
|
|
127
|
+
// exit (height/opacity) animation runs -- this is independent of the
|
|
128
|
+
// (disabled) layout projection.
|
|
129
|
+
rerender(renderItems(['B', 'C']));
|
|
130
|
+
expect(queryByText('A')).not.toBeNull();
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
//# sourceMappingURL=ListItem.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.test.js","names":["act","render","motion","React","ThemeProvider","afterEach","beforeEach","describe","expect","it","vi","List","ListItem","mock","useTranslation","t","textString","fallback","ITEM_COUNT","boundingRectCalls","originalGetBoundingClientRect","isInsideList","element","Boolean","closest","Element","prototype","getBoundingClientRect","apply","theme","cardBackgroundOpacity","accordionLines","accordionIcon","iconStyle","Harness","shouldAnimateLayout","isExternalExpanded","createElement","div","layout","style","height","Array","from","length","_","index","key","title","flushFrames","Promise","resolve","requestAnimationFrame","undefined","measureExternalLayoutChange","rerender","reads","toBe","toBeGreaterThan","renderItems","titles","map","queryByText","not","toBeNull"],"sources":["../../../../../src/components/list/list-item/ListItem.test.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-call */\nimport { act, render } from '@testing-library/react';\nimport { motion } from 'motion/react';\nimport React from 'react';\nimport { ThemeProvider } from 'styled-components';\nimport { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';\nimport type { Theme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport List from '../List';\nimport ListItem from './ListItem';\n\nvi.mock('@chayns/textstrings', () => ({\n useTranslation: () => ({\n t: (textString: { fallback?: string } | string) =>\n typeof textString === 'string' ? textString : textString.fallback,\n }),\n}));\n\n/**\n * Regression guard for the framer-motion layout-projection thrash.\n *\n * framer-motions layout projection (`layout` / `layout=\"position\"`) is\n * viewport-global: all layout-projection nodes share a single projection tree, so\n * a layout change on *any* node forces a re-measurement of *all* nodes via\n * `getBoundingClientRect`. With many `ListItem`s this scales linearly with N.\n *\n * The tests below render a projection node (`motion.div layout`) *outside* the\n * list and change its layout. They then count how many `getBoundingClientRect`\n * calls hit the rendered `ListItem` elements:\n * - default (no `shouldAnimateLayout`): the items are not projection nodes, so\n * the external change does not re-measure them (reads === 0).\n * - `shouldAnimateLayout`: the items join the shared projection tree, so they are\n * re-measured by the unrelated external change (reads > 0).\n */\n\nconst ITEM_COUNT = 20;\n\nlet boundingRectCalls: number;\nlet originalGetBoundingClientRect: typeof Element.prototype.getBoundingClientRect;\n\nconst isInsideList = (element: Element) => Boolean(element.closest('.beta-chayns-list-item'));\n\nbeforeEach(() => {\n boundingRectCalls = 0;\n originalGetBoundingClientRect = Element.prototype.getBoundingClientRect;\n\n Element.prototype.getBoundingClientRect = function getBoundingClientRect(\n this: Element,\n ): DOMRect {\n if (isInsideList(this)) {\n boundingRectCalls += 1;\n }\n\n return originalGetBoundingClientRect.apply(this) as DOMRect;\n };\n});\n\nafterEach(() => {\n Element.prototype.getBoundingClientRect = originalGetBoundingClientRect;\n});\n\nconst theme = {\n '100-rgb': '255, 255, 255',\n '102-rgb': '255, 255, 255',\n 'headline-rgb': '0, 0, 0',\n cardBackgroundOpacity: 1,\n accordionLines: true,\n accordionIcon: 'fa-chevron-right',\n iconStyle: 'fa-regular',\n} as unknown as Theme;\n\ntype HarnessProps = {\n shouldAnimateLayout: boolean;\n isExternalExpanded: boolean;\n};\n\nconst Harness = ({ shouldAnimateLayout, isExternalExpanded }: HarnessProps) => (\n <ThemeProvider theme={theme}>\n {/* A layout-projection node completely outside of the list. */}\n <motion.div\n layout\n data-testid=\"outside\"\n style={{ height: isExternalExpanded ? 500 : 100 }}\n />\n <List>\n {Array.from({ length: ITEM_COUNT }, (_, index) => (\n <ListItem\n key={index}\n title={`Item ${index}`}\n shouldAnimateLayout={shouldAnimateLayout}\n />\n ))}\n </List>\n </ThemeProvider>\n);\n\nconst flushFrames = async () => {\n await act(async () => {\n await new Promise((resolve) => {\n requestAnimationFrame(() => requestAnimationFrame(() => resolve(undefined)));\n });\n });\n};\n\n/**\n * Render the list, then trigger a layout change on the external projection node\n * and return the number of `getBoundingClientRect` calls that hit the list items.\n */\nconst measureExternalLayoutChange = async (shouldAnimateLayout: boolean) => {\n const { rerender } = render(\n <Harness shouldAnimateLayout={shouldAnimateLayout} isExternalExpanded={false} />,\n );\n\n await flushFrames();\n\n boundingRectCalls = 0;\n\n rerender(<Harness shouldAnimateLayout={shouldAnimateLayout} isExternalExpanded />);\n\n await flushFrames();\n\n return boundingRectCalls;\n};\n\ndescribe('ListItem layout projection', () => {\n it('does not re-measure items on external layout changes by default', async () => {\n const reads = await measureExternalLayoutChange(false);\n\n expect(reads).toBe(0);\n });\n\n it('re-measures items on external layout changes when shouldAnimateLayout is set', async () => {\n const reads = await measureExternalLayoutChange(true);\n\n expect(reads).toBeGreaterThan(0);\n });\n\n it('keeps the enter/exit animation for added/removed items without layout projection', async () => {\n const renderItems = (titles: string[]) => (\n <ThemeProvider theme={theme}>\n <List>\n {titles.map((title) => (\n <ListItem key={title} title={title} />\n ))}\n </List>\n </ThemeProvider>\n );\n\n const { rerender, queryByText } = render(renderItems(['A', 'B', 'C']));\n\n await flushFrames();\n\n // Remove the first item. AnimatePresence must keep it mounted while its\n // exit (height/opacity) animation runs -- this is independent of the\n // (disabled) layout projection.\n rerender(renderItems(['B', 'C']));\n\n expect(queryByText('A')).not.toBeNull();\n });\n});\n"],"mappings":"AAAA;AACA,SAASA,GAAG,EAAEC,MAAM,QAAQ,wBAAwB;AACpD,SAASC,MAAM,QAAQ,cAAc;AACrC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SAASC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAExE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reList":[]}
|
|
@@ -37,6 +37,7 @@ const ListItemHead = ({
|
|
|
37
37
|
titleElement,
|
|
38
38
|
setShouldEnableTooltip,
|
|
39
39
|
shouldDisableAnimation = false,
|
|
40
|
+
shouldAnimateLayout = false,
|
|
40
41
|
cornerElement,
|
|
41
42
|
onTitleWidthChange,
|
|
42
43
|
onImageError,
|
|
@@ -156,7 +157,7 @@ const ListItemHead = ({
|
|
|
156
157
|
$isOpen: isOpen
|
|
157
158
|
}, /*#__PURE__*/React.createElement(LayoutGroup, null, /*#__PURE__*/React.createElement(StyledListItemHeadTitle, {
|
|
158
159
|
as: shouldDisableAnimation ? undefined : motion.div,
|
|
159
|
-
layout:
|
|
160
|
+
layout: shouldAnimateLayout ? 'position' : undefined
|
|
160
161
|
}, hasTitleInput ?
|
|
161
162
|
/*#__PURE__*/
|
|
162
163
|
// eslint-disable-next-line react/jsx-no-constructed-context-values
|