@chayns-components/gallery 5.5.30 → 5.5.31-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/AGENTS.md +2 -0
  2. package/lib/cjs/components/Gallery.js +4 -1
  3. package/lib/cjs/components/Gallery.js.map +1 -1
  4. package/lib/cjs/components/Gallery.types.js.map +1 -1
  5. package/lib/cjs/components/gallery-editor/GalleryEditor.js +6 -3
  6. package/lib/cjs/components/gallery-editor/GalleryEditor.js.map +1 -1
  7. package/lib/cjs/components/gallery-editor/GalleryEditor.types.js.map +1 -1
  8. package/lib/cjs/components/gallery-editor/add-file/AddFile.js +16 -2
  9. package/lib/cjs/components/gallery-editor/add-file/AddFile.js.map +1 -1
  10. package/lib/cjs/components/gallery-editor/add-file/AddFile.types.js.map +1 -1
  11. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +10 -1
  12. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
  13. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -1
  14. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +3 -1
  15. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -1
  16. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -1
  17. package/lib/cjs/components/gallery-viewer/GalleryViewer.js +2 -0
  18. package/lib/cjs/components/gallery-viewer/GalleryViewer.js.map +1 -1
  19. package/lib/cjs/components/gallery-viewer/GalleryViewer.types.js.map +1 -1
  20. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +4 -2
  21. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -1
  22. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -1
  23. package/lib/cjs/components/media-content/MediaContent.js +20 -1
  24. package/lib/cjs/components/media-content/MediaContent.js.map +1 -1
  25. package/lib/cjs/components/media-content/MediaContent.types.js.map +1 -1
  26. package/lib/esm/components/Gallery.js +4 -1
  27. package/lib/esm/components/Gallery.js.map +1 -1
  28. package/lib/esm/components/Gallery.types.js.map +1 -1
  29. package/lib/esm/components/gallery-editor/GalleryEditor.js +6 -3
  30. package/lib/esm/components/gallery-editor/GalleryEditor.js.map +1 -1
  31. package/lib/esm/components/gallery-editor/GalleryEditor.types.js.map +1 -1
  32. package/lib/esm/components/gallery-editor/add-file/AddFile.js +18 -4
  33. package/lib/esm/components/gallery-editor/add-file/AddFile.js.map +1 -1
  34. package/lib/esm/components/gallery-editor/add-file/AddFile.types.js.map +1 -1
  35. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +12 -3
  36. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
  37. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -1
  38. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +3 -1
  39. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -1
  40. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -1
  41. package/lib/esm/components/gallery-viewer/GalleryViewer.js +2 -0
  42. package/lib/esm/components/gallery-viewer/GalleryViewer.js.map +1 -1
  43. package/lib/esm/components/gallery-viewer/GalleryViewer.types.js.map +1 -1
  44. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +4 -2
  45. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -1
  46. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -1
  47. package/lib/esm/components/media-content/MediaContent.js +21 -2
  48. package/lib/esm/components/media-content/MediaContent.js.map +1 -1
  49. package/lib/esm/components/media-content/MediaContent.types.js.map +1 -1
  50. package/lib/types/components/Gallery.types.d.ts +4 -0
  51. package/lib/types/components/gallery-editor/GalleryEditor.types.d.ts +4 -0
  52. package/lib/types/components/gallery-editor/add-file/AddFile.types.d.ts +4 -0
  53. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.d.ts +4 -0
  54. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.d.ts +4 -0
  55. package/lib/types/components/gallery-viewer/GalleryViewer.types.d.ts +4 -0
  56. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.d.ts +4 -0
  57. package/lib/types/components/media-content/MediaContent.types.d.ts +4 -0
  58. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import { Icon } from '@chayns-components/core';
1
+ import { Icon, useFocusRingPortal, useKeyboardFocusHighlighting } from '@chayns-components/core';
2
2
  import React, { memo, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { StyledMediaContentImage, StyledMediaContentImageWrapper, StyledMediaContentPlayIcon, StyledMediaContentPreviewImage, StyledMediaContentVideo, StyledMediaContentVideoWrapper } from './MediaContent.styles';
4
4
  import { getMediaPreviewUrl, getMediaSourceUrl, getResponsiveImageServiceUrl, isVideoFile } from './MediaContent.utils';
@@ -10,6 +10,7 @@ const MediaContent = ({
10
10
  ratio,
11
11
  onClick,
12
12
  shouldLoadImages = true,
13
+ shouldEnableKeyboardHighlighting,
13
14
  playIconSize = 50
14
15
  }) => {
15
16
  const isVideo = isVideoFile(file);
@@ -19,6 +20,7 @@ const MediaContent = ({
19
20
  const [resolvedFinalSourceUrl, setResolvedFinalSourceUrl] = useState();
20
21
  const [containerElement, setContainerElement] = useState(null);
21
22
  const imageRef = useRef(null);
23
+ const contentRef = useRef(null);
22
24
  const videoRef = useRef(null);
23
25
  const renderSize = useMediaContentSize(containerElement);
24
26
  const devicePixelRatio = typeof window !== 'undefined' && Number.isFinite(window.devicePixelRatio) && window.devicePixelRatio > 0 ? window.devicePixelRatio : 1;
@@ -64,9 +66,21 @@ const MediaContent = ({
64
66
  }, [finalSourceUrl, isVideo, shouldLoadImages]);
65
67
  const shouldRenderFinalImage = shouldLoadImages && Boolean(finalSourceUrl);
66
68
  const shouldShowPreview = Boolean(displayPreviewUrl);
69
+ const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting);
70
+ useFocusRingPortal(contentRef, {
71
+ isEnabled: shouldShowKeyboardHighlighting
72
+ });
73
+ const handleKeyDown = event => {
74
+ if (event.key === 'Enter' || event.key === ' ') {
75
+ event.preventDefault();
76
+ onClick();
77
+ }
78
+ };
67
79
  if (isVideo) {
68
80
  return /*#__PURE__*/React.createElement(StyledMediaContentVideoWrapper, {
69
81
  ref: setContainerElement,
82
+ tabIndex: 0,
83
+ onKeyDown: handleKeyDown,
70
84
  onClick: onClick,
71
85
  $ratio: ratio
72
86
  }, displayPreviewUrl && /*#__PURE__*/React.createElement(StyledMediaContentPreviewImage, {
@@ -90,7 +104,12 @@ const MediaContent = ({
90
104
  })));
91
105
  }
92
106
  return /*#__PURE__*/React.createElement(StyledMediaContentImageWrapper, {
93
- ref: setContainerElement,
107
+ ref: element => {
108
+ setContainerElement(element);
109
+ contentRef.current = element;
110
+ },
111
+ tabIndex: 0,
112
+ onKeyDown: handleKeyDown,
94
113
  onClick: onClick,
95
114
  $ratio: ratio
96
115
  }, shouldShowPreview && /*#__PURE__*/React.createElement(StyledMediaContentPreviewImage, {
@@ -1 +1 @@
1
- {"version":3,"file":"MediaContent.js","names":["Icon","React","memo","useEffect","useMemo","useRef","useState","StyledMediaContentImage","StyledMediaContentImageWrapper","StyledMediaContentPlayIcon","StyledMediaContentPreviewImage","StyledMediaContentVideo","StyledMediaContentVideoWrapper","getMediaPreviewUrl","getMediaSourceUrl","getResponsiveImageServiceUrl","isVideoFile","MEDIA_CONTENT_IMAGE_FADE_DURATION_MS","useMediaContentSize","MediaContent","file","previewUrl","ratio","onClick","shouldLoadImages","playIconSize","isVideo","sourceKey","previewSourceUrl","hasLoadedFinalMedia","setHasLoadedFinalMedia","resolvedFinalSourceUrl","setResolvedFinalSourceUrl","containerElement","setContainerElement","imageRef","videoRef","renderSize","devicePixelRatio","window","Number","isFinite","displayPreviewUrl","undefined","finalSourceUrl","shouldHidePreview","previewLayerStyle","opacity","filter","finalMediaStyle","transition","current","complete","naturalWidth","readyState","shouldRenderFinalImage","Boolean","shouldShowPreview","createElement","ref","$ratio","draggable","src","alt","style","size","icons","poster","preload","onLoadedData","type","onLoad","displayName"],"sources":["../../../../src/components/media-content/MediaContent.tsx"],"sourcesContent":["import { Icon } from '@chayns-components/core';\nimport React, { FC, memo, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledMediaContentImage,\n StyledMediaContentImageWrapper,\n StyledMediaContentPlayIcon,\n StyledMediaContentPreviewImage,\n StyledMediaContentVideo,\n StyledMediaContentVideoWrapper,\n} from './MediaContent.styles';\nimport type { MediaContentProps } from './MediaContent.types';\nimport {\n getMediaPreviewUrl,\n getMediaSourceUrl,\n getResponsiveImageServiceUrl,\n isVideoFile,\n} from './MediaContent.utils';\nimport { MEDIA_CONTENT_IMAGE_FADE_DURATION_MS } from './MediaContent.constants';\nimport useMediaContentSize from './useMediaContentSize';\n\nconst MediaContent: FC<MediaContentProps> = ({\n file,\n previewUrl,\n ratio,\n onClick,\n shouldLoadImages = true,\n playIconSize = 50,\n}) => {\n const isVideo = isVideoFile(file);\n const sourceKey = getMediaSourceUrl(file);\n const previewSourceUrl = getMediaPreviewUrl(file, previewUrl);\n const [hasLoadedFinalMedia, setHasLoadedFinalMedia] = useState(false);\n const [resolvedFinalSourceUrl, setResolvedFinalSourceUrl] = useState<string>();\n const [containerElement, setContainerElement] = useState<HTMLDivElement | null>(null);\n const imageRef = useRef<HTMLImageElement>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const renderSize = useMediaContentSize(containerElement);\n const devicePixelRatio =\n typeof window !== 'undefined' &&\n Number.isFinite(window.devicePixelRatio) &&\n window.devicePixelRatio > 0\n ? window.devicePixelRatio\n : 1;\n const displayPreviewUrl = useMemo(\n () =>\n previewSourceUrl\n ? getResponsiveImageServiceUrl(previewSourceUrl, renderSize, devicePixelRatio)\n : undefined,\n [devicePixelRatio, previewSourceUrl, renderSize],\n );\n const finalSourceUrl = isVideo ? sourceKey : resolvedFinalSourceUrl;\n const shouldHidePreview = shouldLoadImages && hasLoadedFinalMedia;\n const previewLayerStyle = {\n opacity: shouldHidePreview ? 0 : 1,\n filter: shouldHidePreview ? 'blur(0px)' : undefined,\n };\n const finalMediaStyle = {\n opacity: hasLoadedFinalMedia || !displayPreviewUrl ? 1 : 0,\n transition: `opacity ${MEDIA_CONTENT_IMAGE_FADE_DURATION_MS}ms ease`,\n };\n\n useEffect(() => {\n setHasLoadedFinalMedia(false);\n }, [sourceKey]);\n\n useEffect(() => {\n if (!shouldLoadImages) {\n setResolvedFinalSourceUrl(undefined);\n return;\n }\n\n if (isVideo) {\n setResolvedFinalSourceUrl(sourceKey);\n return;\n }\n\n if (!renderSize) {\n setResolvedFinalSourceUrl(undefined);\n return;\n }\n\n setResolvedFinalSourceUrl(\n getResponsiveImageServiceUrl(sourceKey, renderSize, devicePixelRatio),\n );\n }, [devicePixelRatio, isVideo, renderSize, shouldLoadImages, sourceKey]);\n\n useEffect(() => {\n if (!shouldLoadImages || !finalSourceUrl) {\n return;\n }\n\n if (!isVideo && imageRef.current?.complete && imageRef.current.naturalWidth > 0) {\n setHasLoadedFinalMedia(true);\n }\n\n if (isVideo && videoRef.current?.readyState && videoRef.current.readyState >= 2) {\n setHasLoadedFinalMedia(true);\n }\n }, [finalSourceUrl, isVideo, shouldLoadImages]);\n\n const shouldRenderFinalImage = shouldLoadImages && Boolean(finalSourceUrl);\n const shouldShowPreview = Boolean(displayPreviewUrl);\n\n if (isVideo) {\n return (\n <StyledMediaContentVideoWrapper\n ref={setContainerElement}\n onClick={onClick}\n $ratio={ratio}\n >\n {displayPreviewUrl && (\n <StyledMediaContentPreviewImage\n draggable={false}\n src={displayPreviewUrl}\n alt=\"\"\n aria-hidden=\"true\"\n style={previewLayerStyle}\n />\n )}\n <StyledMediaContentPlayIcon>\n <Icon size={playIconSize} icons={['fa fa-play']} />\n </StyledMediaContentPlayIcon>\n {shouldRenderFinalImage && (\n <StyledMediaContentVideo\n ref={videoRef}\n poster={displayPreviewUrl}\n preload=\"metadata\"\n onLoadedData={() => setHasLoadedFinalMedia(true)}\n style={finalMediaStyle}\n >\n <source src={finalSourceUrl} type=\"video/mp4\" />\n </StyledMediaContentVideo>\n )}\n </StyledMediaContentVideoWrapper>\n );\n }\n\n return (\n <StyledMediaContentImageWrapper ref={setContainerElement} onClick={onClick} $ratio={ratio}>\n {shouldShowPreview && (\n <StyledMediaContentPreviewImage\n draggable={false}\n src={displayPreviewUrl}\n alt=\"\"\n aria-hidden=\"true\"\n style={previewLayerStyle}\n />\n )}\n {shouldRenderFinalImage && (\n <StyledMediaContentImage\n ref={imageRef}\n draggable={false}\n src={finalSourceUrl}\n alt=\"\"\n onLoad={() => setHasLoadedFinalMedia(true)}\n style={finalMediaStyle}\n />\n )}\n </StyledMediaContentImageWrapper>\n );\n};\n\nMediaContent.displayName = 'MediaContent';\n\nexport default memo(MediaContent);\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,yBAAyB;AAC9C,OAAOC,KAAK,IAAQC,IAAI,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC7E,SACIC,uBAAuB,EACvBC,8BAA8B,EAC9BC,0BAA0B,EAC1BC,8BAA8B,EAC9BC,uBAAuB,EACvBC,8BAA8B,QAC3B,uBAAuB;AAE9B,SACIC,kBAAkB,EAClBC,iBAAiB,EACjBC,4BAA4B,EAC5BC,WAAW,QACR,sBAAs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aAAA,CAAClD,8BAA8B;IAACmD,GAAG,EAAEzB,mBAAoB;IAACX,OAAO,EAAEA,OAAQ;IAACqC,MAAM,EAAEtC;EAAM,GACrFmC,iBAAiB,iBACdxD,KAAA,CAAAyD,aAAA,CAAChD,8BAA8B;IAC3BmD,SAAS,EAAE,KAAM;IACjBC,GAAG,EAAEpB,iBAAkB;IACvBqB,GAAG,EAAC,EAAE;IACN,eAAY,MAAM;IAClBC,KAAK,EAAElB;EAAkB,CAC5B,CACJ,EACAS,sBAAsB,iBACnBtD,KAAA,CAAAyD,aAAA,CAACnD,uBAAuB;IACpBoD,GAAG,EAAExB,QAAS;IACd0B,SAAS,EAAE,KAAM;IACjBC,GAAG,EAAElB,cAAe;IACpBmB,GAAG,EAAC,EAAE;IACNQ,MAAM,EAAEA,CAAA,KAAMzC,sBAAsB,CAAC,IAAI,CAAE;IAC3CkC,KAAK,EAAEf;EAAgB,CAC1B,CAEuB,CAAC;AAEzC,CAAC;AAED9B,YAAY,CAACqD,WAAW,GAAG,cAAc;AAEzC,4BAAetE,IAAI,CAACiB,YAAY,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"MediaContent.js","names":["Icon","useFocusRingPortal","useKeyboardFocusHighlighting","React","memo","useEffect","useMemo","useRef","useState","StyledMediaContentImage","StyledMediaContentImageWrapper","StyledMediaContentPlayIcon","StyledMediaContentPreviewImage","StyledMediaContentVideo","StyledMediaContentVideoWrapper","getMediaPreviewUrl","getMediaSourceUrl","getResponsiveImageServiceUrl","isVideoFile","MEDIA_CONTENT_IMAGE_FADE_DURATION_MS","useMediaContentSize","MediaContent","file","previewUrl","ratio","onClick","shouldLoadImages","shouldEnableKeyboardHighlighting","playIconSize","isVideo","sourceKey","previewSourceUrl","hasLoadedFinalMedia","setHasLoadedFinalMedia","resolvedFinalSourceUrl","setResolvedFinalSourceUrl","containerElement","setContainerElement","imageRef","contentRef","videoRef","renderSize","devicePixelRatio","window","Number","isFinite","displayPreviewUrl","undefined","finalSourceUrl","shouldHidePreview","previewLayerStyle","opacity","filter","finalMediaStyle","transition","current","complete","naturalWidth","readyState","shouldRenderFinalImage","Boolean","shouldShowPreview","shouldShowKeyboardHighlighting","isEnabled","handleKeyDown","event","key","preventDefault","createElement","ref","tabIndex","onKeyDown","$ratio","draggable","src","alt","style","size","icons","poster","preload","onLoadedData","type","element","onLoad","displayName"],"sources":["../../../../src/components/media-content/MediaContent.tsx"],"sourcesContent":["import { Icon, useFocusRingPortal, useKeyboardFocusHighlighting } from '@chayns-components/core';\nimport React, { FC, KeyboardEventHandler, memo, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n StyledMediaContentImage,\n StyledMediaContentImageWrapper,\n StyledMediaContentPlayIcon,\n StyledMediaContentPreviewImage,\n StyledMediaContentVideo,\n StyledMediaContentVideoWrapper,\n} from './MediaContent.styles';\nimport type { MediaContentProps } from './MediaContent.types';\nimport {\n getMediaPreviewUrl,\n getMediaSourceUrl,\n getResponsiveImageServiceUrl,\n isVideoFile,\n} from './MediaContent.utils';\nimport { MEDIA_CONTENT_IMAGE_FADE_DURATION_MS } from './MediaContent.constants';\nimport useMediaContentSize from './useMediaContentSize';\n\nconst MediaContent: FC<MediaContentProps> = ({\n file,\n previewUrl,\n ratio,\n onClick,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n playIconSize = 50,\n}) => {\n const isVideo = isVideoFile(file);\n const sourceKey = getMediaSourceUrl(file);\n const previewSourceUrl = getMediaPreviewUrl(file, previewUrl);\n const [hasLoadedFinalMedia, setHasLoadedFinalMedia] = useState(false);\n const [resolvedFinalSourceUrl, setResolvedFinalSourceUrl] = useState<string>();\n const [containerElement, setContainerElement] = useState<HTMLDivElement | null>(null);\n const imageRef = useRef<HTMLImageElement>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const renderSize = useMediaContentSize(containerElement);\n const devicePixelRatio =\n typeof window !== 'undefined' &&\n Number.isFinite(window.devicePixelRatio) &&\n window.devicePixelRatio > 0\n ? window.devicePixelRatio\n : 1;\n const displayPreviewUrl = useMemo(\n () =>\n previewSourceUrl\n ? getResponsiveImageServiceUrl(previewSourceUrl, renderSize, devicePixelRatio)\n : undefined,\n [devicePixelRatio, previewSourceUrl, renderSize],\n );\n const finalSourceUrl = isVideo ? sourceKey : resolvedFinalSourceUrl;\n const shouldHidePreview = shouldLoadImages && hasLoadedFinalMedia;\n const previewLayerStyle = {\n opacity: shouldHidePreview ? 0 : 1,\n filter: shouldHidePreview ? 'blur(0px)' : undefined,\n };\n const finalMediaStyle = {\n opacity: hasLoadedFinalMedia || !displayPreviewUrl ? 1 : 0,\n transition: `opacity ${MEDIA_CONTENT_IMAGE_FADE_DURATION_MS}ms ease`,\n };\n\n useEffect(() => {\n setHasLoadedFinalMedia(false);\n }, [sourceKey]);\n\n useEffect(() => {\n if (!shouldLoadImages) {\n setResolvedFinalSourceUrl(undefined);\n return;\n }\n\n if (isVideo) {\n setResolvedFinalSourceUrl(sourceKey);\n return;\n }\n\n if (!renderSize) {\n setResolvedFinalSourceUrl(undefined);\n return;\n }\n\n setResolvedFinalSourceUrl(\n getResponsiveImageServiceUrl(sourceKey, renderSize, devicePixelRatio),\n );\n }, [devicePixelRatio, isVideo, renderSize, shouldLoadImages, sourceKey]);\n\n useEffect(() => {\n if (!shouldLoadImages || !finalSourceUrl) {\n return;\n }\n\n if (!isVideo && imageRef.current?.complete && imageRef.current.naturalWidth > 0) {\n setHasLoadedFinalMedia(true);\n }\n\n if (isVideo && videoRef.current?.readyState && videoRef.current.readyState >= 2) {\n setHasLoadedFinalMedia(true);\n }\n }, [finalSourceUrl, isVideo, shouldLoadImages]);\n\n const shouldRenderFinalImage = shouldLoadImages && Boolean(finalSourceUrl);\n const shouldShowPreview = Boolean(displayPreviewUrl);\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(contentRef, { isEnabled: shouldShowKeyboardHighlighting });\n\n const handleKeyDown = ((event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n onClick();\n }\n }) as KeyboardEventHandler<HTMLDivElement>;\n\n if (isVideo) {\n return (\n <StyledMediaContentVideoWrapper\n ref={setContainerElement}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onClick={onClick}\n $ratio={ratio}\n >\n {displayPreviewUrl && (\n <StyledMediaContentPreviewImage\n draggable={false}\n src={displayPreviewUrl}\n alt=\"\"\n aria-hidden=\"true\"\n style={previewLayerStyle}\n />\n )}\n <StyledMediaContentPlayIcon>\n <Icon size={playIconSize} icons={['fa fa-play']} />\n </StyledMediaContentPlayIcon>\n {shouldRenderFinalImage && (\n <StyledMediaContentVideo\n ref={videoRef}\n poster={displayPreviewUrl}\n preload=\"metadata\"\n onLoadedData={() => setHasLoadedFinalMedia(true)}\n style={finalMediaStyle}\n >\n <source src={finalSourceUrl} type=\"video/mp4\" />\n </StyledMediaContentVideo>\n )}\n </StyledMediaContentVideoWrapper>\n );\n }\n\n return (\n <StyledMediaContentImageWrapper\n ref={(element) => {\n setContainerElement(element);\n contentRef.current = element;\n }}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onClick={onClick}\n $ratio={ratio}\n >\n {shouldShowPreview && (\n <StyledMediaContentPreviewImage\n draggable={false}\n src={displayPreviewUrl}\n alt=\"\"\n aria-hidden=\"true\"\n style={previewLayerStyle}\n />\n )}\n {shouldRenderFinalImage && (\n <StyledMediaContentImage\n ref={imageRef}\n draggable={false}\n src={finalSourceUrl}\n alt=\"\"\n onLoad={() => setHasLoadedFinalMedia(true)}\n style={finalMediaStyle}\n />\n )}\n </StyledMediaContentImageWrapper>\n );\n};\n\nMediaContent.displayName = 'MediaContent';\n\nexport default memo(MediaContent);\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,kBAAkB,EAAEC,4BAA4B,QAAQ,yBAAyB;AAChG,OAAOC,KAAK,IAA8BC,IAAI,EAAEC,SAAS,EAAEC,OAAO,EAAEC,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pB4D,GAAG,EAAE/B,QAAS;IACdmC,SAAS,EAAE,KAAM;IACjBC,GAAG,EAAE1B,cAAe;IACpB2B,GAAG,EAAC,EAAE;IACNS,MAAM,EAAEA,CAAA,KAAMnD,sBAAsB,CAAC,IAAI,CAAE;IAC3C2C,KAAK,EAAEvB;EAAgB,CAC1B,CAEuB,CAAC;AAEzC,CAAC;AAEDhC,YAAY,CAACgE,WAAW,GAAG,cAAc;AAEzC,4BAAejF,IAAI,CAACiB,YAAY,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"MediaContent.types.js","names":[],"sources":["../../../../src/components/media-content/MediaContent.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\n\n/**\n * Props for the low-level uploaded media renderer shared by viewer and editor.\n */\nexport interface MediaContentProps {\n /**\n * Provides the uploaded media item that should be rendered.\n * @description\n * This low-level renderer accepts already known image or video data and does not handle upload-specific state.\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} ratio={1} />\n */\n file: FileItem['file'];\n /**\n * Provides an optional preview source that can be displayed while the final media is still loading.\n * @description\n * This preview can be a base64 data URL or any low-resolution fallback image.\n * When provided, the component shows the preview first and swaps to the final image once it has finished loading.\n * @optional\n */\n previewUrl?: string;\n /**\n * Defines the aspect ratio that should be reserved for the media.\n * @description\n * The surrounding tile uses this value to reserve a deterministic media height before the asset finishes loading.\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} ratio={1.5} />\n */\n ratio: number;\n /**\n * Controls whether the final media source may be loaded immediately.\n * @description\n * When set to `false`, only the preview source is rendered until this flag becomes `true`.\n * @default true\n * @optional\n */\n shouldLoadImages?: boolean;\n /**\n * Is called when the media tile is selected.\n * @description\n * Use this callback to react to clicks on the rendered image or video tile.\n * @example\n * <MediaContent file={file.file} onClick={() => console.log('open')} ratio={1} />\n */\n onClick: () => void;\n /**\n * Defines the size of the video play icon.\n * @description\n * This prop only affects rendered videos. Image tiles ignore it.\n * @default 50\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} playIconSize={30} ratio={1} />\n * @optional\n */\n playIconSize?: number;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"MediaContent.types.js","names":[],"sources":["../../../../src/components/media-content/MediaContent.types.ts"],"sourcesContent":["import type { FileItem } from '@chayns-components/core';\n\n/**\n * Props for the low-level uploaded media renderer shared by viewer and editor.\n */\nexport interface MediaContentProps {\n /**\n * Provides the uploaded media item that should be rendered.\n * @description\n * This low-level renderer accepts already known image or video data and does not handle upload-specific state.\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} ratio={1} />\n */\n file: FileItem['file'];\n /**\n * Provides an optional preview source that can be displayed while the final media is still loading.\n * @description\n * This preview can be a base64 data URL or any low-resolution fallback image.\n * When provided, the component shows the preview first and swaps to the final image once it has finished loading.\n * @optional\n */\n previewUrl?: string;\n /**\n * Defines the aspect ratio that should be reserved for the media.\n * @description\n * The surrounding tile uses this value to reserve a deterministic media height before the asset finishes loading.\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} ratio={1.5} />\n */\n ratio: number;\n /**\n * Controls whether the final media source may be loaded immediately.\n * @description\n * When set to `false`, only the preview source is rendered until this flag becomes `true`.\n * @default true\n * @optional\n */\n shouldLoadImages?: boolean;\n /**\n * Enables keyboard-only focus highlighting for the media tile.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * Is called when the media tile is selected.\n * @description\n * Use this callback to react to clicks on the rendered image or video tile.\n * @example\n * <MediaContent file={file.file} onClick={() => console.log('open')} ratio={1} />\n */\n onClick: () => void;\n /**\n * Defines the size of the video play icon.\n * @description\n * This prop only affects rendered videos. Image tiles ignore it.\n * @default 50\n * @example\n * <MediaContent file={file.file} onClick={handleOpen} playIconSize={30} ratio={1} />\n * @optional\n */\n playIconSize?: number;\n}\n"],"mappings":"","ignoreList":[]}
@@ -94,6 +94,10 @@ export interface GalleryProps {
94
94
  * @optional
95
95
  */
96
96
  shouldLoadImages?: boolean;
97
+ /**
98
+ * Enables keyboard-only focus highlighting for interactive gallery tiles.
99
+ */
100
+ shouldEnableKeyboardHighlighting?: boolean;
97
101
  /**
98
102
  * Is called after a file has been uploaded successfully in edit mode.
99
103
  * @description
@@ -64,6 +64,10 @@ export interface GalleryEditorProps {
64
64
  * @optional
65
65
  */
66
66
  shouldLoadImages?: boolean;
67
+ /**
68
+ * Enables keyboard-only focus highlighting for interactive gallery tiles.
69
+ */
70
+ shouldEnableKeyboardHighlighting?: boolean;
67
71
  /**
68
72
  * Limits how many files can be managed by the editor.
69
73
  * @description
@@ -20,4 +20,8 @@ export interface AddFileProps {
20
20
  * <AddFile onAdd={(files) => console.log(files)} />
21
21
  */
22
22
  onAdd: (files: File[]) => void;
23
+ /**
24
+ * Enables keyboard-only focus highlighting for the add-file button.
25
+ */
26
+ shouldEnableKeyboardHighlighting?: boolean;
23
27
  }
@@ -19,6 +19,10 @@ export interface GalleryEditorItemProps {
19
19
  * @optional
20
20
  */
21
21
  shouldLoadImages?: boolean;
22
+ /**
23
+ * Enables keyboard-only focus highlighting for the media tile and delete button.
24
+ */
25
+ shouldEnableKeyboardHighlighting?: boolean;
22
26
  /**
23
27
  * Is called when the delete button is clicked in edit mode.
24
28
  * @description
@@ -19,6 +19,10 @@ export interface GalleryEditorMediaItemProps {
19
19
  * @optional
20
20
  */
21
21
  shouldLoadImages?: boolean;
22
+ /**
23
+ * Enables keyboard-only focus highlighting for the media tile.
24
+ */
25
+ shouldEnableKeyboardHighlighting?: boolean;
22
26
  /**
23
27
  * Is called when the media tile is selected.
24
28
  * @description
@@ -24,6 +24,10 @@ export interface GalleryViewerProps {
24
24
  * @optional
25
25
  */
26
26
  shouldLoadImages?: boolean;
27
+ /**
28
+ * Enables keyboard-only focus highlighting for media tiles.
29
+ */
30
+ shouldEnableKeyboardHighlighting?: boolean;
27
31
  /**
28
32
  * Defines how the media tiles are arranged in read-only mode.
29
33
  * @description
@@ -19,6 +19,10 @@ export interface GalleryViewerItemProps {
19
19
  * @optional
20
20
  */
21
21
  shouldLoadImages?: boolean;
22
+ /**
23
+ * Enables keyboard-only focus highlighting for the media tile.
24
+ */
25
+ shouldEnableKeyboardHighlighting?: boolean;
22
26
  /**
23
27
  * Defines the aspect ratio that should be reserved for the tile.
24
28
  * @description
@@ -35,6 +35,10 @@ export interface MediaContentProps {
35
35
  * @optional
36
36
  */
37
37
  shouldLoadImages?: boolean;
38
+ /**
39
+ * Enables keyboard-only focus highlighting for the media tile.
40
+ */
41
+ shouldEnableKeyboardHighlighting?: boolean;
38
42
  /**
39
43
  * Is called when the media tile is selected.
40
44
  * @description
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/gallery",
3
- "version": "5.5.30",
3
+ "version": "5.5.31-alpha.0",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -69,7 +69,7 @@
69
69
  "typescript": "^5.9.3"
70
70
  },
71
71
  "dependencies": {
72
- "@chayns-components/core": "^5.5.30",
72
+ "@chayns-components/core": "^5.5.31-alpha.0",
73
73
  "react-compiler-runtime": "^1.0.0",
74
74
  "uuid": "^10.0.0"
75
75
  },
@@ -83,5 +83,5 @@
83
83
  "publishConfig": {
84
84
  "access": "public"
85
85
  },
86
- "gitHead": "b90fd1685e1067d28e29580095f3d290be892769"
86
+ "gitHead": "7619ce466c615fadd5eb31f93c24a252683aff0e"
87
87
  }