@chayns-components/gallery 5.2.4 → 5.2.6

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 (120) hide show
  1. package/AGENTS.md +132 -13
  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.constants.js +12 -0
  6. package/lib/cjs/components/gallery-editor/GalleryEditor.constants.js.map +1 -0
  7. package/lib/cjs/components/gallery-editor/GalleryEditor.js +40 -178
  8. package/lib/cjs/components/gallery-editor/GalleryEditor.js.map +1 -1
  9. package/lib/cjs/components/gallery-editor/GalleryEditor.styles.js +3 -1
  10. package/lib/cjs/components/gallery-editor/GalleryEditor.styles.js.map +1 -1
  11. package/lib/cjs/components/gallery-editor/GalleryEditor.types.js.map +1 -1
  12. package/lib/cjs/components/gallery-editor/GalleryEditor.utils.js +27 -0
  13. package/lib/cjs/components/gallery-editor/GalleryEditor.utils.js.map +1 -0
  14. package/lib/cjs/components/gallery-editor/add-file/AddFile.js +1 -1
  15. package/lib/cjs/components/gallery-editor/add-file/AddFile.js.map +1 -1
  16. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +48 -19
  17. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
  18. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js +10 -3
  19. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js.map +1 -1
  20. package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -1
  21. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +10 -4
  22. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -1
  23. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -1
  24. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js +7 -10
  25. package/lib/cjs/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js.map +1 -1
  26. package/lib/cjs/components/gallery-editor/useGalleryEditorState.js +161 -0
  27. package/lib/cjs/components/gallery-editor/useGalleryEditorState.js.map +1 -0
  28. package/lib/cjs/components/gallery-viewer/GalleryViewer.constants.js +8 -0
  29. package/lib/cjs/components/gallery-viewer/GalleryViewer.constants.js.map +1 -0
  30. package/lib/cjs/components/gallery-viewer/GalleryViewer.js +9 -5
  31. package/lib/cjs/components/gallery-viewer/GalleryViewer.js.map +1 -1
  32. package/lib/cjs/components/gallery-viewer/GalleryViewer.types.js.map +1 -1
  33. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +15 -9
  34. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -1
  35. package/lib/cjs/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -1
  36. package/lib/cjs/components/media-content/MediaContent.constants.js +11 -0
  37. package/lib/cjs/components/media-content/MediaContent.constants.js.map +1 -0
  38. package/lib/cjs/components/media-content/MediaContent.js +84 -21
  39. package/lib/cjs/components/media-content/MediaContent.js.map +1 -1
  40. package/lib/cjs/components/media-content/MediaContent.styles.js +37 -6
  41. package/lib/cjs/components/media-content/MediaContent.styles.js.map +1 -1
  42. package/lib/cjs/components/media-content/MediaContent.types.js.map +1 -1
  43. package/lib/cjs/components/media-content/MediaContent.utils.js +22 -0
  44. package/lib/cjs/components/media-content/MediaContent.utils.js.map +1 -0
  45. package/lib/cjs/utils/gallery.js +2 -2
  46. package/lib/cjs/utils/gallery.js.map +1 -1
  47. package/lib/esm/components/Gallery.js +4 -1
  48. package/lib/esm/components/Gallery.js.map +1 -1
  49. package/lib/esm/components/Gallery.types.js.map +1 -1
  50. package/lib/esm/components/gallery-editor/GalleryEditor.constants.js +6 -0
  51. package/lib/esm/components/gallery-editor/GalleryEditor.constants.js.map +1 -0
  52. package/lib/esm/components/gallery-editor/GalleryEditor.js +37 -174
  53. package/lib/esm/components/gallery-editor/GalleryEditor.js.map +1 -1
  54. package/lib/esm/components/gallery-editor/GalleryEditor.styles.js +3 -1
  55. package/lib/esm/components/gallery-editor/GalleryEditor.styles.js.map +1 -1
  56. package/lib/esm/components/gallery-editor/GalleryEditor.types.js.map +1 -1
  57. package/lib/esm/components/gallery-editor/GalleryEditor.utils.js +17 -0
  58. package/lib/esm/components/gallery-editor/GalleryEditor.utils.js.map +1 -0
  59. package/lib/esm/components/gallery-editor/add-file/AddFile.js +2 -2
  60. package/lib/esm/components/gallery-editor/add-file/AddFile.js.map +1 -1
  61. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +47 -19
  62. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
  63. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js +9 -2
  64. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.js.map +1 -1
  65. package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.js.map +1 -1
  66. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js +9 -4
  67. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.js.map +1 -1
  68. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.js.map +1 -1
  69. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js +6 -9
  70. package/lib/esm/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.js.map +1 -1
  71. package/lib/esm/components/gallery-editor/useGalleryEditorState.js +150 -0
  72. package/lib/esm/components/gallery-editor/useGalleryEditorState.js.map +1 -0
  73. package/lib/esm/components/gallery-viewer/GalleryViewer.constants.js +2 -0
  74. package/lib/esm/components/gallery-viewer/GalleryViewer.constants.js.map +1 -0
  75. package/lib/esm/components/gallery-viewer/GalleryViewer.js +10 -6
  76. package/lib/esm/components/gallery-viewer/GalleryViewer.js.map +1 -1
  77. package/lib/esm/components/gallery-viewer/GalleryViewer.types.js.map +1 -1
  78. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js +14 -9
  79. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.js.map +1 -1
  80. package/lib/esm/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.js.map +1 -1
  81. package/lib/esm/components/media-content/MediaContent.constants.js +5 -0
  82. package/lib/esm/components/media-content/MediaContent.constants.js.map +1 -0
  83. package/lib/esm/components/media-content/MediaContent.js +83 -21
  84. package/lib/esm/components/media-content/MediaContent.js.map +1 -1
  85. package/lib/esm/components/media-content/MediaContent.styles.js +36 -5
  86. package/lib/esm/components/media-content/MediaContent.styles.js.map +1 -1
  87. package/lib/esm/components/media-content/MediaContent.types.js.map +1 -1
  88. package/lib/esm/components/media-content/MediaContent.utils.js +12 -0
  89. package/lib/esm/components/media-content/MediaContent.utils.js.map +1 -0
  90. package/lib/esm/utils/gallery.js +2 -2
  91. package/lib/esm/utils/gallery.js.map +1 -1
  92. package/lib/types/components/Gallery.types.d.ts +12 -0
  93. package/lib/types/components/gallery-editor/GalleryEditor.constants.d.ts +5 -0
  94. package/lib/types/components/gallery-editor/GalleryEditor.styles.d.ts +7 -3
  95. package/lib/types/components/gallery-editor/GalleryEditor.types.d.ts +11 -0
  96. package/lib/types/components/gallery-editor/GalleryEditor.utils.d.ts +5 -0
  97. package/lib/types/components/gallery-editor/add-file/AddFile.d.ts +3 -3
  98. package/lib/types/components/gallery-editor/add-file/AddFile.styles.d.ts +5 -3
  99. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.d.ts +3 -3
  100. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.styles.d.ts +13 -3
  101. package/lib/types/components/gallery-editor/gallery-editor-item/GalleryEditorItem.types.d.ts +8 -0
  102. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.d.ts +3 -3
  103. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.styles.d.ts +3 -1
  104. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-media-item/GalleryEditorMediaItem.types.d.ts +15 -0
  105. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.d.ts +3 -3
  106. package/lib/types/components/gallery-editor/gallery-editor-item/gallery-editor-preview-item/GalleryEditorPreviewItem.styles.d.ts +12 -6
  107. package/lib/types/components/gallery-editor/useGalleryEditorState.d.ts +21 -0
  108. package/lib/types/components/gallery-viewer/GalleryViewer.constants.d.ts +1 -0
  109. package/lib/types/components/gallery-viewer/GalleryViewer.d.ts +3 -3
  110. package/lib/types/components/gallery-viewer/GalleryViewer.styles.d.ts +7 -3
  111. package/lib/types/components/gallery-viewer/GalleryViewer.types.d.ts +11 -0
  112. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.d.ts +3 -3
  113. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.styles.d.ts +2 -2
  114. package/lib/types/components/gallery-viewer/gallery-viewer-item/GalleryViewerItem.types.d.ts +8 -0
  115. package/lib/types/components/media-content/MediaContent.constants.d.ts +4 -0
  116. package/lib/types/components/media-content/MediaContent.d.ts +3 -3
  117. package/lib/types/components/media-content/MediaContent.styles.d.ts +50 -9
  118. package/lib/types/components/media-content/MediaContent.types.d.ts +16 -0
  119. package/lib/types/components/media-content/MediaContent.utils.d.ts +5 -0
  120. package/package.json +4 -4
@@ -11,6 +11,14 @@ export interface GalleryEditorItemProps {
11
11
  * <GalleryEditorItem fileItem={fileItem} handleDeleteFile={handleDeleteFile} onClick={handleOpen} />
12
12
  */
13
13
  fileItem: InternalFileItem;
14
+ /**
15
+ * Controls whether the item may load the final media source immediately.
16
+ * @description
17
+ * The item forwards this flag to the shared media renderer so uploaded media can stay on the preview until loading is allowed.
18
+ * @default true
19
+ * @optional
20
+ */
21
+ shouldLoadImages?: boolean;
14
22
  /**
15
23
  * Is called when the delete button is clicked in edit mode.
16
24
  * @description
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import type { GalleryEditorMediaItemProps } from './GalleryEditorMediaItem.types';
3
- declare const GalleryEditorMediaItem: FC<GalleryEditorMediaItemProps>;
4
- export default GalleryEditorMediaItem;
3
+ declare const _default: React.NamedExoticComponent<GalleryEditorMediaItemProps>;
4
+ export default _default;
@@ -1,3 +1,5 @@
1
1
  export declare const StyledMotionGalleryEditorMediaItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
2
2
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
- }, never>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
3
+ }, never> & Partial<Pick<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
4
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
5
+ }, never>>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
@@ -11,6 +11,14 @@ export interface GalleryEditorMediaItemProps {
11
11
  * <GalleryEditorMediaItem fileItem={fileItem} onClick={handleOpen} ratio={1} />
12
12
  */
13
13
  fileItem: InternalFileItem;
14
+ /**
15
+ * Controls whether the media renderer may load the final uploaded source immediately.
16
+ * @description
17
+ * When disabled, the shared media renderer keeps showing the preview until the parent gallery allows the final load.
18
+ * @default true
19
+ * @optional
20
+ */
21
+ shouldLoadImages?: boolean;
14
22
  /**
15
23
  * Is called when the media tile is selected.
16
24
  * @description
@@ -27,4 +35,11 @@ export interface GalleryEditorMediaItemProps {
27
35
  * <GalleryEditorMediaItem fileItem={fileItem} openSelectedFile={handleOpen} ratio={1.5} />
28
36
  */
29
37
  ratio: number;
38
+ /**
39
+ * Provides an optional preview source that can be shown before the final uploaded media loads.
40
+ * @description
41
+ * This is typically the local base64 preview generated while the file is still being uploaded.
42
+ * @optional
43
+ */
44
+ previewUrl?: string;
30
45
  }
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import type { GalleryEditorPreviewItemProps } from './GalleryEditorPreviewItem.types';
3
- declare const GalleryEditorPreviewItem: FC<GalleryEditorPreviewItemProps>;
4
- export default GalleryEditorPreviewItem;
3
+ declare const _default: React.NamedExoticComponent<GalleryEditorPreviewItemProps>;
4
+ export default _default;
@@ -1,10 +1,16 @@
1
1
  export declare const StyledMotionGalleryEditorPreviewItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
2
2
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
3
- }, never>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
4
- export declare const StyledGalleryEditorPreviewItemImageWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
+ }, never> & Partial<Pick<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
4
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
5
+ }, never>>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof import("react").Component<any, {}, any>>;
6
+ export declare const StyledGalleryEditorPreviewItemImageWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$ratio"> & {
7
+ $ratio: number;
8
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$ratio"> & {
5
9
  $ratio: number;
6
- }>> & string;
7
- export declare const StyledGalleryEditorPreviewItemImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {
10
+ }, never>>> & string;
11
+ export declare const StyledGalleryEditorPreviewItemImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
12
+ theme: import("@chayns-components/core").Theme;
13
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
8
14
  theme: import("@chayns-components/core").Theme;
9
- }>> & string;
10
- export declare const StyledGalleryEditorPreviewItemLoadingIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
15
+ }, never>>> & string;
16
+ export declare const StyledGalleryEditorPreviewItemLoadingIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
@@ -0,0 +1,21 @@
1
+ import { type FileItem, type InternalFileItem } from '@chayns-components/core';
2
+ import { type DragEvent } from 'react';
3
+ type UseGalleryEditorStateOptions = {
4
+ allowDragAndDrop: boolean;
5
+ doubleFileDialogMessage: string;
6
+ files?: FileItem[];
7
+ maxFiles?: number;
8
+ onAdd?: (file: FileItem) => void;
9
+ onFileCountChange?: (fileCount: number) => void;
10
+ onRemove?: (file: FileItem) => void;
11
+ };
12
+ type GalleryEditorStateResult = {
13
+ fileItems: InternalFileItem[];
14
+ handleAddFiles: (filesToAdd: File[]) => void;
15
+ handleClear: () => void;
16
+ handleDeleteFile: (id?: string) => void;
17
+ handleDrop: (event: DragEvent<HTMLDivElement>) => void;
18
+ handleOpenFiles: (file: InternalFileItem) => void;
19
+ };
20
+ declare const useGalleryEditorState: ({ allowDragAndDrop, doubleFileDialogMessage, files, maxFiles, onAdd, onFileCountChange, onRemove, }: UseGalleryEditorStateOptions) => GalleryEditorStateResult;
21
+ export default useGalleryEditorState;
@@ -0,0 +1 @@
1
+ export declare const GALLERY_VIEWER_MAX_VISIBLE_ITEMS = 4;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import type { GalleryViewerProps } from './GalleryViewer.types';
3
- declare const GalleryViewer: FC<GalleryViewerProps>;
4
- export default GalleryViewer;
3
+ declare const _default: React.NamedExoticComponent<GalleryViewerProps>;
4
+ export default _default;
@@ -1,7 +1,11 @@
1
1
  import { GalleryViewMode } from '../../types/gallery';
2
- export declare const StyledGalleryViewer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
- export declare const StyledGalleryViewerItemWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
2
+ export declare const StyledGalleryViewer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
3
+ export declare const StyledGalleryViewerItemWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$ratio" | "$itemCount" | "$viewMode"> & {
4
4
  $itemCount: number;
5
5
  $ratio: number;
6
6
  $viewMode: GalleryViewMode;
7
- }>> & string;
7
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$ratio" | "$itemCount" | "$viewMode"> & {
8
+ $itemCount: number;
9
+ $ratio: number;
10
+ $viewMode: GalleryViewMode;
11
+ }, never>>> & string;
@@ -13,6 +13,17 @@ export interface GalleryViewerProps {
13
13
  * @optional
14
14
  */
15
15
  files?: FileItem[];
16
+ /**
17
+ * Controls whether the viewer may load the final media assets immediately.
18
+ * @description
19
+ * When set to `true`, the viewer renders and loads the actual images right away.
20
+ * When set to `false`, the viewer keeps showing previews first and defers the final image load until this flag becomes `true`.
21
+ * @default true
22
+ * @example
23
+ * <GalleryViewer files={files} shouldLoadImages={false} />
24
+ * @optional
25
+ */
26
+ shouldLoadImages?: boolean;
16
27
  /**
17
28
  * Defines how the media tiles are arranged in read-only mode.
18
29
  * @description
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import type { GalleryViewerItemProps } from './GalleryViewerItem.types';
3
- declare const GalleryViewerItem: FC<GalleryViewerItemProps>;
4
- export default GalleryViewerItem;
3
+ declare const _default: React.NamedExoticComponent<GalleryViewerItemProps>;
4
+ export default _default;
@@ -1,2 +1,2 @@
1
- export declare const StyledGalleryViewerItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
- export declare const StyledGalleryViewerMoreItemsIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
1
+ export declare const StyledGalleryViewerItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
2
+ export declare const StyledGalleryViewerMoreItemsIndicator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
@@ -11,6 +11,14 @@ export interface GalleryViewerItemProps {
11
11
  * <GalleryViewerItem fileItem={file} onClick={handleOpen} />
12
12
  */
13
13
  fileItem: FileItem;
14
+ /**
15
+ * Controls whether the item may load the final media source immediately.
16
+ * @description
17
+ * The item forwards this flag to the shared media renderer so preview-first rendering can be controlled by the parent gallery.
18
+ * @default true
19
+ * @optional
20
+ */
21
+ shouldLoadImages?: boolean;
14
22
  /**
15
23
  * Defines the aspect ratio that should be reserved for the tile.
16
24
  * @description
@@ -0,0 +1,4 @@
1
+ export declare const MEDIA_CONTENT_IMAGE_FADE_DURATION_MS = 180;
2
+ export declare const MEDIA_CONTENT_PREVIEW_BLUR = "blur(6px)";
3
+ export declare const MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DELAY_MS = 100;
4
+ export declare const MEDIA_CONTENT_PREVIEW_BLUR_REMOVE_DURATION_MS = 200;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import React from 'react';
2
2
  import type { MediaContentProps } from './MediaContent.types';
3
- declare const MediaContent: FC<MediaContentProps>;
4
- export default MediaContent;
3
+ declare const _default: React.NamedExoticComponent<MediaContentProps>;
4
+ export default _default;
@@ -1,13 +1,54 @@
1
- export declare const StyledMediaContentVideoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
1
+ export declare const StyledMediaContentVideoWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$ratio"> & {
2
2
  $ratio: number;
3
- }>> & string;
4
- export declare const StyledMediaContentImageWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
3
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$ratio"> & {
5
4
  $ratio: number;
6
- }>> & string;
7
- export declare const StyledMediaContentImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {
5
+ }, never>>> & string;
6
+ export declare const StyledMediaContentImageWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$ratio"> & {
7
+ $ratio: number;
8
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$ratio"> & {
9
+ $ratio: number;
10
+ }, never>>> & string;
11
+ export declare const StyledMediaContentPreviewImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
12
+ theme: import("@chayns-components/core").Theme;
13
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
14
+ theme: import("@chayns-components/core").Theme;
15
+ }, never>> & {
16
+ as?: import("styled-components").WebTarget | undefined;
17
+ forwardedAs?: import("styled-components").WebTarget | undefined;
18
+ }, "ref"> & {
19
+ ref?: ((instance: HTMLImageElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLImageElement> | null | undefined;
20
+ }, never> & Partial<Pick<Omit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
21
+ theme: import("@chayns-components/core").Theme;
22
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
23
+ theme: import("@chayns-components/core").Theme;
24
+ }, never>> & {
25
+ as?: import("styled-components").WebTarget | undefined;
26
+ forwardedAs?: import("styled-components").WebTarget | undefined;
27
+ }, "ref"> & {
28
+ ref?: ((instance: HTMLImageElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLImageElement> | null | undefined;
29
+ }, never>>> & string;
30
+ export declare const StyledMediaContentImage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
31
+ theme: import("@chayns-components/core").Theme;
32
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
33
+ theme: import("@chayns-components/core").Theme;
34
+ }, never>> & {
35
+ as?: import("styled-components").WebTarget | undefined;
36
+ forwardedAs?: import("styled-components").WebTarget | undefined;
37
+ }, "ref"> & {
38
+ ref?: ((instance: HTMLImageElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLImageElement> | null | undefined;
39
+ }, never> & Partial<Pick<Omit<import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
40
+ theme: import("@chayns-components/core").Theme;
41
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, "theme"> & {
42
+ theme: import("@chayns-components/core").Theme;
43
+ }, never>> & {
44
+ as?: import("styled-components").WebTarget | undefined;
45
+ forwardedAs?: import("styled-components").WebTarget | undefined;
46
+ }, "ref"> & {
47
+ ref?: ((instance: HTMLImageElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLImageElement> | null | undefined;
48
+ }, never>>> & string;
49
+ export declare const StyledMediaContentVideo: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "theme"> & {
8
50
  theme: import("@chayns-components/core").Theme;
9
- }>> & string;
10
- export declare const StyledMediaContentVideo: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, {
51
+ }, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, "theme"> & {
11
52
  theme: import("@chayns-components/core").Theme;
12
- }>> & string;
13
- export declare const StyledMediaContentPlayIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
53
+ }, never>>> & string;
54
+ export declare const StyledMediaContentPlayIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
@@ -11,6 +11,14 @@ export interface MediaContentProps {
11
11
  * <MediaContent file={file.file} onClick={handleOpen} ratio={1} />
12
12
  */
13
13
  file: FileItem['file'];
14
+ /**
15
+ * Provides an optional preview source that can be displayed while the final media is still loading.
16
+ * @description
17
+ * This preview can be a base64 data URL or any low-resolution fallback image.
18
+ * When provided, the component shows the preview first and swaps to the final image once it has finished loading.
19
+ * @optional
20
+ */
21
+ previewUrl?: string;
14
22
  /**
15
23
  * Defines the aspect ratio that should be reserved for the media.
16
24
  * @description
@@ -19,6 +27,14 @@ export interface MediaContentProps {
19
27
  * <MediaContent file={file.file} onClick={handleOpen} ratio={1.5} />
20
28
  */
21
29
  ratio: number;
30
+ /**
31
+ * Controls whether the final media source may be loaded immediately.
32
+ * @description
33
+ * When set to `false`, only the preview source is rendered until this flag becomes `true`.
34
+ * @default true
35
+ * @optional
36
+ */
37
+ shouldLoadImages?: boolean;
22
38
  /**
23
39
  * Is called when the media tile is selected.
24
40
  * @description
@@ -0,0 +1,5 @@
1
+ import type { FileItem, Video } from '@chayns-components/core';
2
+ export type GalleryMediaFile = FileItem['file'];
3
+ export declare const isVideoFile: (file: GalleryMediaFile) => file is Video;
4
+ export declare const getMediaSourceUrl: (file: GalleryMediaFile) => string;
5
+ export declare const getMediaPreviewUrl: (file: GalleryMediaFile, previewUrl?: string) => string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/gallery",
3
- "version": "5.2.4",
3
+ "version": "5.2.6",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -54,7 +54,7 @@
54
54
  "devDependencies": {
55
55
  "@babel/cli": "^7.28.6",
56
56
  "@babel/core": "^7.29.0",
57
- "@babel/preset-env": "^7.29.0",
57
+ "@babel/preset-env": "^7.29.5",
58
58
  "@babel/preset-react": "^7.28.5",
59
59
  "@babel/preset-typescript": "^7.28.5",
60
60
  "@types/react": "^18.3.28",
@@ -70,7 +70,7 @@
70
70
  "typescript": "^5.9.3"
71
71
  },
72
72
  "dependencies": {
73
- "@chayns-components/core": "^5.2.4",
73
+ "@chayns-components/core": "^5.2.5",
74
74
  "react-compiler-runtime": "^1.0.0",
75
75
  "uuid": "^10.0.0"
76
76
  },
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "ad65db8803761ed1bb154b1161a4a513c3ac9503"
87
+ "gitHead": "59187422f25173dbdf15343d50fe1363e93d16ff"
88
88
  }