@chayns-components/gallery 5.5.31-alpha.0 → 5.5.34
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/components/gallery-editor/GalleryEditor.js +5 -2
- package/lib/cjs/components/gallery-editor/GalleryEditor.js.map +1 -1
- package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +6 -1
- package/lib/cjs/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
- package/lib/cjs/constants/textStrings.js +17 -0
- package/lib/cjs/constants/textStrings.js.map +1 -0
- package/lib/esm/components/gallery-editor/GalleryEditor.js +5 -2
- package/lib/esm/components/gallery-editor/GalleryEditor.js.map +1 -1
- package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js +6 -1
- package/lib/esm/components/gallery-editor/gallery-editor-item/GalleryEditorItem.js.map +1 -1
- package/lib/esm/constants/textStrings.js +11 -0
- package/lib/esm/constants/textStrings.js.map +1 -0
- package/lib/types/constants/textStrings.d.ts +11 -0
- package/package.json +4 -3
|
@@ -11,6 +11,7 @@ var _GalleryEditor = require("./GalleryEditor.styles");
|
|
|
11
11
|
var _GalleryEditorItem = _interopRequireDefault(require("./gallery-editor-item/GalleryEditorItem"));
|
|
12
12
|
var _GalleryEditor2 = require("./GalleryEditor.constants");
|
|
13
13
|
var _useGalleryEditorState = _interopRequireDefault(require("./useGalleryEditorState"));
|
|
14
|
+
var _textstrings = require("@chayns/textstrings");
|
|
14
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
17
|
const GalleryEditor = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
@@ -46,7 +47,9 @@ const GalleryEditor = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
46
47
|
clear: handleClear
|
|
47
48
|
}), [handleClear]);
|
|
48
49
|
const shouldShowAddFileTile = !maxFiles || maxFiles > fileItems.length;
|
|
49
|
-
return /*#__PURE__*/_react2.default.createElement(
|
|
50
|
+
return /*#__PURE__*/_react2.default.createElement(_textstrings.TextStringProvider, {
|
|
51
|
+
libraries: "@chayns-components-gallery"
|
|
52
|
+
}, /*#__PURE__*/_react2.default.createElement(_GalleryEditor.StyledGalleryEditor, null, /*#__PURE__*/_react2.default.createElement(_GalleryEditor.StyledGalleryEditorGrid, {
|
|
50
53
|
$fileMinWidth: fileMinWidth,
|
|
51
54
|
$gap: _GalleryEditor2.GALLERY_EDITOR_GRID_GAP_PX,
|
|
52
55
|
onDragOver: event => event.preventDefault(),
|
|
@@ -64,7 +67,7 @@ const GalleryEditor = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
64
67
|
addFileIcon: addFileIcon,
|
|
65
68
|
onAdd: handleAddFiles,
|
|
66
69
|
shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlighting
|
|
67
|
-
})));
|
|
70
|
+
}))));
|
|
68
71
|
});
|
|
69
72
|
GalleryEditor.displayName = 'GalleryEditor';
|
|
70
73
|
var _default = exports.default = GalleryEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryEditor.js","names":["_react","require","_react2","_interopRequireWildcard","_AddFile","_interopRequireDefault","_GalleryEditor","_GalleryEditorItem","_GalleryEditor2","_useGalleryEditorState","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditor","forwardRef","allowDragAndDrop","addFileIcon","doubleFileDialogMessage","fileMinWidth","files","maxFiles","onAdd","onFileCountChange","onRemove","shouldLoadImages","shouldEnableKeyboardHighlighting","ref","fileItems","handleAddFiles","handleClear","handleDeleteFile","handleDrop","handleOpenFiles","useGalleryEditorState","useImperativeHandle","clear","shouldShowAddFileTile","length","createElement","StyledGalleryEditor","StyledGalleryEditorGrid","$fileMinWidth","$gap","GALLERY_EDITOR_GRID_GAP_PX","onDragOver","event","preventDefault","onDrop","AnimatePresence","initial","map","file","key","id","fileItem","onClick","displayName","_default","exports"],"sources":["../../../../src/components/gallery-editor/GalleryEditor.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { forwardRef, useImperativeHandle } from 'react';\nimport AddFile from './add-file/AddFile';\nimport { StyledGalleryEditor, StyledGalleryEditorGrid } from './GalleryEditor.styles';\nimport type { GalleryEditorProps, GalleryEditorRef } from './GalleryEditor.types';\nimport GalleryEditorItem from './gallery-editor-item/GalleryEditorItem';\nimport { GALLERY_EDITOR_GRID_GAP_PX } from './GalleryEditor.constants';\nimport useGalleryEditorState from './useGalleryEditorState';\n\nconst GalleryEditor = forwardRef<GalleryEditorRef, GalleryEditorProps>(\n (\n {\n allowDragAndDrop = false,\n addFileIcon = 'fa fa-plus',\n doubleFileDialogMessage = 'Diese Datei ist bereits vorhanden',\n fileMinWidth = 100,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n },\n ref,\n ) => {\n const {\n fileItems,\n handleAddFiles,\n handleClear,\n handleDeleteFile,\n handleDrop,\n handleOpenFiles,\n } = useGalleryEditorState({\n allowDragAndDrop,\n doubleFileDialogMessage,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n clear: handleClear,\n }),\n [handleClear],\n );\n\n const shouldShowAddFileTile = !maxFiles || maxFiles > fileItems.length;\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"GalleryEditor.js","names":["_react","require","_react2","_interopRequireWildcard","_AddFile","_interopRequireDefault","_GalleryEditor","_GalleryEditorItem","_GalleryEditor2","_useGalleryEditorState","_textstrings","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditor","forwardRef","allowDragAndDrop","addFileIcon","doubleFileDialogMessage","fileMinWidth","files","maxFiles","onAdd","onFileCountChange","onRemove","shouldLoadImages","shouldEnableKeyboardHighlighting","ref","fileItems","handleAddFiles","handleClear","handleDeleteFile","handleDrop","handleOpenFiles","useGalleryEditorState","useImperativeHandle","clear","shouldShowAddFileTile","length","createElement","TextStringProvider","libraries","StyledGalleryEditor","StyledGalleryEditorGrid","$fileMinWidth","$gap","GALLERY_EDITOR_GRID_GAP_PX","onDragOver","event","preventDefault","onDrop","AnimatePresence","initial","map","file","key","id","fileItem","onClick","displayName","_default","exports"],"sources":["../../../../src/components/gallery-editor/GalleryEditor.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { forwardRef, useImperativeHandle } from 'react';\nimport AddFile from './add-file/AddFile';\nimport { StyledGalleryEditor, StyledGalleryEditorGrid } from './GalleryEditor.styles';\nimport type { GalleryEditorProps, GalleryEditorRef } from './GalleryEditor.types';\nimport GalleryEditorItem from './gallery-editor-item/GalleryEditorItem';\nimport { GALLERY_EDITOR_GRID_GAP_PX } from './GalleryEditor.constants';\nimport useGalleryEditorState from './useGalleryEditorState';\nimport { TextStringProvider } from '@chayns/textstrings';\n\nconst GalleryEditor = forwardRef<GalleryEditorRef, GalleryEditorProps>(\n (\n {\n allowDragAndDrop = false,\n addFileIcon = 'fa fa-plus',\n doubleFileDialogMessage = 'Diese Datei ist bereits vorhanden',\n fileMinWidth = 100,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n },\n ref,\n ) => {\n const {\n fileItems,\n handleAddFiles,\n handleClear,\n handleDeleteFile,\n handleDrop,\n handleOpenFiles,\n } = useGalleryEditorState({\n allowDragAndDrop,\n doubleFileDialogMessage,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n clear: handleClear,\n }),\n [handleClear],\n );\n\n const shouldShowAddFileTile = !maxFiles || maxFiles > fileItems.length;\n\n return (\n <TextStringProvider libraries=\"@chayns-components-gallery\">\n <StyledGalleryEditor>\n <StyledGalleryEditorGrid\n $fileMinWidth={fileMinWidth}\n $gap={GALLERY_EDITOR_GRID_GAP_PX}\n onDragOver={(event) => event.preventDefault()}\n onDrop={(event) => void handleDrop(event)}\n >\n <AnimatePresence initial={false}>\n {fileItems.map((file) => (\n <GalleryEditorItem\n key={file.id}\n fileItem={file}\n handleDeleteFile={handleDeleteFile}\n onClick={handleOpenFiles}\n shouldLoadImages={shouldLoadImages}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n />\n ))}\n </AnimatePresence>\n\n {shouldShowAddFileTile && (\n <AddFile\n addFileIcon={addFileIcon}\n onAdd={handleAddFiles}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n />\n )}\n </StyledGalleryEditorGrid>\n </StyledGalleryEditor>\n </TextStringProvider>\n );\n },\n);\n\nGalleryEditor.displayName = 'GalleryEditor';\n\nexport default GalleryEditor;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AAEA,IAAAM,kBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAJ,sBAAA,CAAAJ,OAAA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ACd0D,GAAG,EAAED,IAAI,CAACE,EAAG;IACbC,QAAQ,EAAEH,IAAK;IACfvB,gBAAgB,EAAEA,gBAAiB;IACnC2B,OAAO,EAAEzB,eAAgB;IACzBR,gBAAgB,EAAEA,gBAAiB;IACnCC,gCAAgC,EAC5BA;EACH,CACJ,CACJ,CACY,CAAC,EAEjBW,qBAAqB,iBAClBnD,OAAA,CAAAW,OAAA,CAAA0C,aAAA,CAACnD,QAAA,CAAAS,OAAO;IACJoB,WAAW,EAAEA,WAAY;IACzBK,KAAK,EAAEO,cAAe;IACtBH,gCAAgC,EAAEA;EAAiC,CACtE,CAEgB,CACR,CACL,CAAC;AAE7B,CACJ,CAAC;AAEDZ,aAAa,CAAC6C,WAAW,GAAG,eAAe;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhE,OAAA,GAE7BiB,aAAa","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ var _GalleryEditorItem = require("./GalleryEditorItem.styles");
|
|
|
10
10
|
var _GalleryEditorMediaItem = _interopRequireDefault(require("./gallery-editor-media-item/GalleryEditorMediaItem"));
|
|
11
11
|
var _GalleryEditorPreviewItem = _interopRequireDefault(require("./gallery-editor-preview-item/GalleryEditorPreviewItem"));
|
|
12
12
|
var _GalleryEditor = require("../GalleryEditor.constants");
|
|
13
|
+
var _textstrings = require("@chayns/textstrings");
|
|
14
|
+
var _textStrings = _interopRequireDefault(require("../../../constants/textStrings"));
|
|
13
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
16
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
17
|
const GalleryEditorItem = ({
|
|
@@ -20,6 +22,9 @@ const GalleryEditorItem = ({
|
|
|
20
22
|
ratio = 1,
|
|
21
23
|
onClick
|
|
22
24
|
}) => {
|
|
25
|
+
const {
|
|
26
|
+
t
|
|
27
|
+
} = (0, _textstrings.useTranslation)();
|
|
23
28
|
const deleteButtonRef = (0, _react.useRef)(null);
|
|
24
29
|
const shouldShowKeyboardHighlighting = (0, _core.useKeyboardFocusHighlighting)(shouldEnableKeyboardHighlighting);
|
|
25
30
|
(0, _core.useFocusRingPortal)(deleteButtonRef, {
|
|
@@ -68,7 +73,7 @@ const GalleryEditorItem = ({
|
|
|
68
73
|
handleDeleteFile(fileItem.id);
|
|
69
74
|
},
|
|
70
75
|
$zIndex: _GalleryEditor.GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX,
|
|
71
|
-
"aria-label":
|
|
76
|
+
"aria-label": t(_textStrings.default.galleryEditor.accessibility.removeImage)
|
|
72
77
|
}, /*#__PURE__*/_react.default.createElement(_core.Icon, {
|
|
73
78
|
size: 20,
|
|
74
79
|
icons: ['ts-wrong']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryEditorItem.js","names":["_core","require","_react","_interopRequireWildcard","_GalleryEditorItem","_GalleryEditorMediaItem","_interopRequireDefault","_GalleryEditorPreviewItem","_GalleryEditor","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditorItem","fileItem","handleDeleteFile","shouldLoadImages","shouldEnableKeyboardHighlighting","ratio","onClick","deleteButtonRef","useRef","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","useFocusRingPortal","isEnabled","padding","shouldRenderPreview","state","shouldRenderMedia","Boolean","previewUrl","uploadedFile","mediaContent","createElement","openSelectedFile","StyledMotionGalleryEditorItem","initial","opacity","scale","animate","exit","transition","duration","GALLERY_EDITOR_ITEM_FADE_DURATION_S","StyledGalleryEditorItemDeleteButton","ref","type","event","stopPropagation","id","$zIndex","GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX","Icon","size","icons","displayName","_default","exports","memo"],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.tsx"],"sourcesContent":["import { Icon, useFocusRingPortal, useKeyboardFocusHighlighting } from '@chayns-components/core';\nimport React, { FC, ReactNode, memo, useRef } from 'react';\nimport {\n StyledMotionGalleryEditorItem,\n StyledGalleryEditorItemDeleteButton,\n} from './GalleryEditorItem.styles';\nimport GalleryEditorMediaItem from './gallery-editor-media-item/GalleryEditorMediaItem';\nimport GalleryEditorPreviewItem from './gallery-editor-preview-item/GalleryEditorPreviewItem';\nimport type { GalleryEditorItemProps } from './GalleryEditorItem.types';\nimport {\n GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX,\n GALLERY_EDITOR_ITEM_FADE_DURATION_S,\n} from '../GalleryEditor.constants';\n\nconst GalleryEditorItem: FC<GalleryEditorItemProps> = ({\n fileItem,\n handleDeleteFile,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n ratio = 1,\n onClick,\n}) => {\n const deleteButtonRef = useRef<HTMLButtonElement>(null);\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(deleteButtonRef, { isEnabled: shouldShowKeyboardHighlighting, padding: -1 });\n\n const shouldRenderPreview = fileItem.state === 'uploading';\n const shouldRenderMedia =\n fileItem.state !== 'none' &&\n (Boolean(fileItem.previewUrl) || Boolean(fileItem.uploadedFile));\n\n let mediaContent: ReactNode = null;\n\n if (shouldRenderPreview) {\n mediaContent = <GalleryEditorPreviewItem ratio={ratio} fileItem={fileItem} />;\n } else if (shouldRenderMedia) {\n mediaContent = (\n <GalleryEditorMediaItem\n fileItem={fileItem}\n ratio={ratio}\n openSelectedFile={onClick}\n previewUrl={fileItem.previewUrl}\n shouldLoadImages={shouldLoadImages}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n />\n );\n }\n\n return (\n <StyledMotionGalleryEditorItem\n initial={{ opacity: 0, scale: 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.98 }}\n transition={{ duration: GALLERY_EDITOR_ITEM_FADE_DURATION_S }}\n >\n {mediaContent}\n <StyledGalleryEditorItemDeleteButton\n ref={deleteButtonRef}\n type=\"button\"\n onClick={(event) => {\n event.stopPropagation();\n handleDeleteFile(fileItem.id);\n }}\n $zIndex={GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX}\n aria-label
|
|
1
|
+
{"version":3,"file":"GalleryEditorItem.js","names":["_core","require","_react","_interopRequireWildcard","_GalleryEditorItem","_GalleryEditorMediaItem","_interopRequireDefault","_GalleryEditorPreviewItem","_GalleryEditor","_textstrings","_textStrings","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","GalleryEditorItem","fileItem","handleDeleteFile","shouldLoadImages","shouldEnableKeyboardHighlighting","ratio","onClick","useTranslation","deleteButtonRef","useRef","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","useFocusRingPortal","isEnabled","padding","shouldRenderPreview","state","shouldRenderMedia","Boolean","previewUrl","uploadedFile","mediaContent","createElement","openSelectedFile","StyledMotionGalleryEditorItem","initial","opacity","scale","animate","exit","transition","duration","GALLERY_EDITOR_ITEM_FADE_DURATION_S","StyledGalleryEditorItemDeleteButton","ref","type","event","stopPropagation","id","$zIndex","GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX","textStrings","galleryEditor","accessibility","removeImage","Icon","size","icons","displayName","_default","exports","memo"],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.tsx"],"sourcesContent":["import { Icon, useFocusRingPortal, useKeyboardFocusHighlighting } from '@chayns-components/core';\nimport React, { FC, ReactNode, memo, useRef } from 'react';\nimport {\n StyledMotionGalleryEditorItem,\n StyledGalleryEditorItemDeleteButton,\n} from './GalleryEditorItem.styles';\nimport GalleryEditorMediaItem from './gallery-editor-media-item/GalleryEditorMediaItem';\nimport GalleryEditorPreviewItem from './gallery-editor-preview-item/GalleryEditorPreviewItem';\nimport type { GalleryEditorItemProps } from './GalleryEditorItem.types';\nimport {\n GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX,\n GALLERY_EDITOR_ITEM_FADE_DURATION_S,\n} from '../GalleryEditor.constants';\nimport { useTranslation } from '@chayns/textstrings';\nimport textStrings from '../../../constants/textStrings';\n\nconst GalleryEditorItem: FC<GalleryEditorItemProps> = ({\n fileItem,\n handleDeleteFile,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n ratio = 1,\n onClick,\n}) => {\n const { t } = useTranslation();\n const deleteButtonRef = useRef<HTMLButtonElement>(null);\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(deleteButtonRef, { isEnabled: shouldShowKeyboardHighlighting, padding: -1 });\n\n const shouldRenderPreview = fileItem.state === 'uploading';\n const shouldRenderMedia =\n fileItem.state !== 'none' &&\n (Boolean(fileItem.previewUrl) || Boolean(fileItem.uploadedFile));\n\n let mediaContent: ReactNode = null;\n\n if (shouldRenderPreview) {\n mediaContent = <GalleryEditorPreviewItem ratio={ratio} fileItem={fileItem} />;\n } else if (shouldRenderMedia) {\n mediaContent = (\n <GalleryEditorMediaItem\n fileItem={fileItem}\n ratio={ratio}\n openSelectedFile={onClick}\n previewUrl={fileItem.previewUrl}\n shouldLoadImages={shouldLoadImages}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n />\n );\n }\n\n return (\n <StyledMotionGalleryEditorItem\n initial={{ opacity: 0, scale: 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.98 }}\n transition={{ duration: GALLERY_EDITOR_ITEM_FADE_DURATION_S }}\n >\n {mediaContent}\n <StyledGalleryEditorItemDeleteButton\n ref={deleteButtonRef}\n type=\"button\"\n onClick={(event) => {\n event.stopPropagation();\n handleDeleteFile(fileItem.id);\n }}\n $zIndex={GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX}\n aria-label={t(textStrings.galleryEditor.accessibility.removeImage)}\n >\n <Icon size={20} icons={['ts-wrong']} />\n </StyledGalleryEditorItemDeleteButton>\n </StyledMotionGalleryEditorItem>\n );\n};\n\nGalleryEditorItem.displayName = 'GalleryEditorItem';\n\nexport default memo(GalleryEditorItem);\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAIA,IAAAI,uBAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,yBAAA,GAAAD,sBAAA,CAAAL,OAAA;AAEA,IAAAO,cAAA,GAAAP,OAAA;AAIA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAJ,sBAAA,CAAAL,OAAA;AAAyD,SAAAK,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAQ,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAA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;IAC9C,cAAYxD,CAAC,CAACyD,oBAAW,CAACC,aAAa,CAACC,aAAa,CAACC,WAAW;EAAE,gBAEnExE,MAAA,CAAAW,OAAA,CAAAuC,aAAA,CAACpD,KAAA,CAAA2E,IAAI;IAACC,IAAI,EAAE,EAAG;IAACC,KAAK,EAAE,CAAC,UAAU;EAAE,CAAE,CACL,CACV,CAAC;AAExC,CAAC;AAED/C,iBAAiB,CAACgD,WAAW,GAAG,mBAAmB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnE,OAAA,gBAErC,IAAAoE,WAAI,EAACnD,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = exports.default = {
|
|
8
|
+
galleryEditor: {
|
|
9
|
+
accessibility: {
|
|
10
|
+
removeImage: {
|
|
11
|
+
stringName: 'txt_chayns_components_gallery_galleryEditor_accessibility_removeImage',
|
|
12
|
+
fallback: 'Bild entfernen'
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=textStrings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textStrings.js","names":["galleryEditor","accessibility","removeImage","stringName","fallback"],"sources":["../../../src/constants/textStrings.ts"],"sourcesContent":["export default {\n galleryEditor: {\n accessibility: {\n removeImage: {\n stringName: 'txt_chayns_components_gallery_galleryEditor_accessibility_removeImage',\n fallback: 'Bild entfernen',\n },\n },\n },\n} as const;\n"],"mappings":";;;;;;iCAAe;EACXA,aAAa,EAAE;IACXC,aAAa,EAAE;MACXC,WAAW,EAAE;QACTC,UAAU,EAAE,uEAAuE;QACnFC,QAAQ,EAAE;MACd;IACJ;EACJ;AACJ,CAAC","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ import { StyledGalleryEditor, StyledGalleryEditorGrid } from './GalleryEditor.st
|
|
|
5
5
|
import GalleryEditorItem from './gallery-editor-item/GalleryEditorItem';
|
|
6
6
|
import { GALLERY_EDITOR_GRID_GAP_PX } from './GalleryEditor.constants';
|
|
7
7
|
import useGalleryEditorState from './useGalleryEditorState';
|
|
8
|
+
import { TextStringProvider } from '@chayns/textstrings';
|
|
8
9
|
const GalleryEditor = /*#__PURE__*/forwardRef(({
|
|
9
10
|
allowDragAndDrop = false,
|
|
10
11
|
addFileIcon = 'fa fa-plus',
|
|
@@ -38,7 +39,9 @@ const GalleryEditor = /*#__PURE__*/forwardRef(({
|
|
|
38
39
|
clear: handleClear
|
|
39
40
|
}), [handleClear]);
|
|
40
41
|
const shouldShowAddFileTile = !maxFiles || maxFiles > fileItems.length;
|
|
41
|
-
return /*#__PURE__*/React.createElement(
|
|
42
|
+
return /*#__PURE__*/React.createElement(TextStringProvider, {
|
|
43
|
+
libraries: "@chayns-components-gallery"
|
|
44
|
+
}, /*#__PURE__*/React.createElement(StyledGalleryEditor, null, /*#__PURE__*/React.createElement(StyledGalleryEditorGrid, {
|
|
42
45
|
$fileMinWidth: fileMinWidth,
|
|
43
46
|
$gap: GALLERY_EDITOR_GRID_GAP_PX,
|
|
44
47
|
onDragOver: event => event.preventDefault(),
|
|
@@ -56,7 +59,7 @@ const GalleryEditor = /*#__PURE__*/forwardRef(({
|
|
|
56
59
|
addFileIcon: addFileIcon,
|
|
57
60
|
onAdd: handleAddFiles,
|
|
58
61
|
shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlighting
|
|
59
|
-
})));
|
|
62
|
+
}))));
|
|
60
63
|
});
|
|
61
64
|
GalleryEditor.displayName = 'GalleryEditor';
|
|
62
65
|
export default GalleryEditor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryEditor.js","names":["AnimatePresence","React","forwardRef","useImperativeHandle","AddFile","StyledGalleryEditor","StyledGalleryEditorGrid","GalleryEditorItem","GALLERY_EDITOR_GRID_GAP_PX","useGalleryEditorState","GalleryEditor","allowDragAndDrop","addFileIcon","doubleFileDialogMessage","fileMinWidth","files","maxFiles","onAdd","onFileCountChange","onRemove","shouldLoadImages","shouldEnableKeyboardHighlighting","ref","fileItems","handleAddFiles","handleClear","handleDeleteFile","handleDrop","handleOpenFiles","clear","shouldShowAddFileTile","length","createElement","$fileMinWidth","$gap","onDragOver","event","preventDefault","onDrop","initial","map","file","key","id","fileItem","onClick","displayName"],"sources":["../../../../src/components/gallery-editor/GalleryEditor.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { forwardRef, useImperativeHandle } from 'react';\nimport AddFile from './add-file/AddFile';\nimport { StyledGalleryEditor, StyledGalleryEditorGrid } from './GalleryEditor.styles';\nimport type { GalleryEditorProps, GalleryEditorRef } from './GalleryEditor.types';\nimport GalleryEditorItem from './gallery-editor-item/GalleryEditorItem';\nimport { GALLERY_EDITOR_GRID_GAP_PX } from './GalleryEditor.constants';\nimport useGalleryEditorState from './useGalleryEditorState';\n\nconst GalleryEditor = forwardRef<GalleryEditorRef, GalleryEditorProps>(\n (\n {\n allowDragAndDrop = false,\n addFileIcon = 'fa fa-plus',\n doubleFileDialogMessage = 'Diese Datei ist bereits vorhanden',\n fileMinWidth = 100,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n },\n ref,\n ) => {\n const {\n fileItems,\n handleAddFiles,\n handleClear,\n handleDeleteFile,\n handleDrop,\n handleOpenFiles,\n } = useGalleryEditorState({\n allowDragAndDrop,\n doubleFileDialogMessage,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n clear: handleClear,\n }),\n [handleClear],\n );\n\n const shouldShowAddFileTile = !maxFiles || maxFiles > fileItems.length;\n\n return (\n <
|
|
1
|
+
{"version":3,"file":"GalleryEditor.js","names":["AnimatePresence","React","forwardRef","useImperativeHandle","AddFile","StyledGalleryEditor","StyledGalleryEditorGrid","GalleryEditorItem","GALLERY_EDITOR_GRID_GAP_PX","useGalleryEditorState","TextStringProvider","GalleryEditor","allowDragAndDrop","addFileIcon","doubleFileDialogMessage","fileMinWidth","files","maxFiles","onAdd","onFileCountChange","onRemove","shouldLoadImages","shouldEnableKeyboardHighlighting","ref","fileItems","handleAddFiles","handleClear","handleDeleteFile","handleDrop","handleOpenFiles","clear","shouldShowAddFileTile","length","createElement","libraries","$fileMinWidth","$gap","onDragOver","event","preventDefault","onDrop","initial","map","file","key","id","fileItem","onClick","displayName"],"sources":["../../../../src/components/gallery-editor/GalleryEditor.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { forwardRef, useImperativeHandle } from 'react';\nimport AddFile from './add-file/AddFile';\nimport { StyledGalleryEditor, StyledGalleryEditorGrid } from './GalleryEditor.styles';\nimport type { GalleryEditorProps, GalleryEditorRef } from './GalleryEditor.types';\nimport GalleryEditorItem from './gallery-editor-item/GalleryEditorItem';\nimport { GALLERY_EDITOR_GRID_GAP_PX } from './GalleryEditor.constants';\nimport useGalleryEditorState from './useGalleryEditorState';\nimport { TextStringProvider } from '@chayns/textstrings';\n\nconst GalleryEditor = forwardRef<GalleryEditorRef, GalleryEditorProps>(\n (\n {\n allowDragAndDrop = false,\n addFileIcon = 'fa fa-plus',\n doubleFileDialogMessage = 'Diese Datei ist bereits vorhanden',\n fileMinWidth = 100,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n },\n ref,\n ) => {\n const {\n fileItems,\n handleAddFiles,\n handleClear,\n handleDeleteFile,\n handleDrop,\n handleOpenFiles,\n } = useGalleryEditorState({\n allowDragAndDrop,\n doubleFileDialogMessage,\n files,\n maxFiles,\n onAdd,\n onFileCountChange,\n onRemove,\n });\n\n useImperativeHandle(\n ref,\n () => ({\n clear: handleClear,\n }),\n [handleClear],\n );\n\n const shouldShowAddFileTile = !maxFiles || maxFiles > fileItems.length;\n\n return (\n <TextStringProvider libraries=\"@chayns-components-gallery\">\n <StyledGalleryEditor>\n <StyledGalleryEditorGrid\n $fileMinWidth={fileMinWidth}\n $gap={GALLERY_EDITOR_GRID_GAP_PX}\n onDragOver={(event) => event.preventDefault()}\n onDrop={(event) => void handleDrop(event)}\n >\n <AnimatePresence initial={false}>\n {fileItems.map((file) => (\n <GalleryEditorItem\n key={file.id}\n fileItem={file}\n handleDeleteFile={handleDeleteFile}\n onClick={handleOpenFiles}\n shouldLoadImages={shouldLoadImages}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n />\n ))}\n </AnimatePresence>\n\n {shouldShowAddFileTile && (\n <AddFile\n addFileIcon={addFileIcon}\n onAdd={handleAddFiles}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n />\n )}\n </StyledGalleryEditorGrid>\n </StyledGalleryEditor>\n </TextStringProvider>\n );\n },\n);\n\nGalleryEditor.displayName = 'GalleryEditor';\n\nexport default GalleryEditor;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,IAAIC,UAAU,EAAEC,mBAAmB,QAAQ,OAAO;AAC9D,OAAOC,OAAO,MAAM,oBAAoB;AACxC,SAASC,mBAAmB,EAAEC,uBAAuB,QAAQ,wBAAwB;AAErF,OAAOC,iBAAiB,MAAM,yCAAyC;AACvE,SAASC,0BAA0B,QAAQ,2BAA2B;AACtE,OAAOC,qBAAqB,MAAM,yBAAyB;AAC3D,SAASC,kBAAkB,QAAQ,qBAAqB;AAExD,MAAMC,aAAa,gBAAGT,UAAU,CAC5B,CACI;EACIU,gBAAgB,GAAG,KAAK;EACxBC,WAAW,GAAG,YAAY;EAC1BC,uBAAuB,GAAG,mCAAmC;EAC7DC,YAAY,GAAG,GAAG;EAClBC,KAAK;EACLC,QAAQ;EACRC,KAAK;EACLC,iB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,qBAAqB,iBAClB9B,KAAA,CAAAgC,aAAA,CAAC7B,OAAO;IACJS,WAAW,EAAEA,WAAY;IACzBK,KAAK,EAAEO,cAAe;IACtBH,gCAAgC,EAAEA;EAAiC,CACtE,CAEgB,CACR,CACL,CAAC;AAE7B,CACJ,CAAC;AAEDX,aAAa,CAACqC,WAAW,GAAG,eAAe;AAE3C,eAAerC,aAAa","ignoreList":[]}
|
|
@@ -4,6 +4,8 @@ import { StyledMotionGalleryEditorItem, StyledGalleryEditorItemDeleteButton } fr
|
|
|
4
4
|
import GalleryEditorMediaItem from './gallery-editor-media-item/GalleryEditorMediaItem';
|
|
5
5
|
import GalleryEditorPreviewItem from './gallery-editor-preview-item/GalleryEditorPreviewItem';
|
|
6
6
|
import { GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX, GALLERY_EDITOR_ITEM_FADE_DURATION_S } from '../GalleryEditor.constants';
|
|
7
|
+
import { useTranslation } from '@chayns/textstrings';
|
|
8
|
+
import textStrings from '../../../constants/textStrings';
|
|
7
9
|
const GalleryEditorItem = ({
|
|
8
10
|
fileItem,
|
|
9
11
|
handleDeleteFile,
|
|
@@ -12,6 +14,9 @@ const GalleryEditorItem = ({
|
|
|
12
14
|
ratio = 1,
|
|
13
15
|
onClick
|
|
14
16
|
}) => {
|
|
17
|
+
const {
|
|
18
|
+
t
|
|
19
|
+
} = useTranslation();
|
|
15
20
|
const deleteButtonRef = useRef(null);
|
|
16
21
|
const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(shouldEnableKeyboardHighlighting);
|
|
17
22
|
useFocusRingPortal(deleteButtonRef, {
|
|
@@ -60,7 +65,7 @@ const GalleryEditorItem = ({
|
|
|
60
65
|
handleDeleteFile(fileItem.id);
|
|
61
66
|
},
|
|
62
67
|
$zIndex: GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX,
|
|
63
|
-
"aria-label":
|
|
68
|
+
"aria-label": t(textStrings.galleryEditor.accessibility.removeImage)
|
|
64
69
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
65
70
|
size: 20,
|
|
66
71
|
icons: ['ts-wrong']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GalleryEditorItem.js","names":["Icon","useFocusRingPortal","useKeyboardFocusHighlighting","React","memo","useRef","StyledMotionGalleryEditorItem","StyledGalleryEditorItemDeleteButton","GalleryEditorMediaItem","GalleryEditorPreviewItem","GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX","GALLERY_EDITOR_ITEM_FADE_DURATION_S","GalleryEditorItem","fileItem","handleDeleteFile","shouldLoadImages","shouldEnableKeyboardHighlighting","ratio","onClick","deleteButtonRef","shouldShowKeyboardHighlighting","isEnabled","padding","shouldRenderPreview","state","shouldRenderMedia","Boolean","previewUrl","uploadedFile","mediaContent","createElement","openSelectedFile","initial","opacity","scale","animate","exit","transition","duration","ref","type","event","stopPropagation","id","$zIndex","size","icons","displayName"],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.tsx"],"sourcesContent":["import { Icon, useFocusRingPortal, useKeyboardFocusHighlighting } from '@chayns-components/core';\nimport React, { FC, ReactNode, memo, useRef } from 'react';\nimport {\n StyledMotionGalleryEditorItem,\n StyledGalleryEditorItemDeleteButton,\n} from './GalleryEditorItem.styles';\nimport GalleryEditorMediaItem from './gallery-editor-media-item/GalleryEditorMediaItem';\nimport GalleryEditorPreviewItem from './gallery-editor-preview-item/GalleryEditorPreviewItem';\nimport type { GalleryEditorItemProps } from './GalleryEditorItem.types';\nimport {\n GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX,\n GALLERY_EDITOR_ITEM_FADE_DURATION_S,\n} from '../GalleryEditor.constants';\n\nconst GalleryEditorItem: FC<GalleryEditorItemProps> = ({\n fileItem,\n handleDeleteFile,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n ratio = 1,\n onClick,\n}) => {\n const deleteButtonRef = useRef<HTMLButtonElement>(null);\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(deleteButtonRef, { isEnabled: shouldShowKeyboardHighlighting, padding: -1 });\n\n const shouldRenderPreview = fileItem.state === 'uploading';\n const shouldRenderMedia =\n fileItem.state !== 'none' &&\n (Boolean(fileItem.previewUrl) || Boolean(fileItem.uploadedFile));\n\n let mediaContent: ReactNode = null;\n\n if (shouldRenderPreview) {\n mediaContent = <GalleryEditorPreviewItem ratio={ratio} fileItem={fileItem} />;\n } else if (shouldRenderMedia) {\n mediaContent = (\n <GalleryEditorMediaItem\n fileItem={fileItem}\n ratio={ratio}\n openSelectedFile={onClick}\n previewUrl={fileItem.previewUrl}\n shouldLoadImages={shouldLoadImages}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n />\n );\n }\n\n return (\n <StyledMotionGalleryEditorItem\n initial={{ opacity: 0, scale: 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.98 }}\n transition={{ duration: GALLERY_EDITOR_ITEM_FADE_DURATION_S }}\n >\n {mediaContent}\n <StyledGalleryEditorItemDeleteButton\n ref={deleteButtonRef}\n type=\"button\"\n onClick={(event) => {\n event.stopPropagation();\n handleDeleteFile(fileItem.id);\n }}\n $zIndex={GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX}\n aria-label
|
|
1
|
+
{"version":3,"file":"GalleryEditorItem.js","names":["Icon","useFocusRingPortal","useKeyboardFocusHighlighting","React","memo","useRef","StyledMotionGalleryEditorItem","StyledGalleryEditorItemDeleteButton","GalleryEditorMediaItem","GalleryEditorPreviewItem","GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX","GALLERY_EDITOR_ITEM_FADE_DURATION_S","useTranslation","textStrings","GalleryEditorItem","fileItem","handleDeleteFile","shouldLoadImages","shouldEnableKeyboardHighlighting","ratio","onClick","t","deleteButtonRef","shouldShowKeyboardHighlighting","isEnabled","padding","shouldRenderPreview","state","shouldRenderMedia","Boolean","previewUrl","uploadedFile","mediaContent","createElement","openSelectedFile","initial","opacity","scale","animate","exit","transition","duration","ref","type","event","stopPropagation","id","$zIndex","galleryEditor","accessibility","removeImage","size","icons","displayName"],"sources":["../../../../../src/components/gallery-editor/gallery-editor-item/GalleryEditorItem.tsx"],"sourcesContent":["import { Icon, useFocusRingPortal, useKeyboardFocusHighlighting } from '@chayns-components/core';\nimport React, { FC, ReactNode, memo, useRef } from 'react';\nimport {\n StyledMotionGalleryEditorItem,\n StyledGalleryEditorItemDeleteButton,\n} from './GalleryEditorItem.styles';\nimport GalleryEditorMediaItem from './gallery-editor-media-item/GalleryEditorMediaItem';\nimport GalleryEditorPreviewItem from './gallery-editor-preview-item/GalleryEditorPreviewItem';\nimport type { GalleryEditorItemProps } from './GalleryEditorItem.types';\nimport {\n GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX,\n GALLERY_EDITOR_ITEM_FADE_DURATION_S,\n} from '../GalleryEditor.constants';\nimport { useTranslation } from '@chayns/textstrings';\nimport textStrings from '../../../constants/textStrings';\n\nconst GalleryEditorItem: FC<GalleryEditorItemProps> = ({\n fileItem,\n handleDeleteFile,\n shouldLoadImages = true,\n shouldEnableKeyboardHighlighting,\n ratio = 1,\n onClick,\n}) => {\n const { t } = useTranslation();\n const deleteButtonRef = useRef<HTMLButtonElement>(null);\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(deleteButtonRef, { isEnabled: shouldShowKeyboardHighlighting, padding: -1 });\n\n const shouldRenderPreview = fileItem.state === 'uploading';\n const shouldRenderMedia =\n fileItem.state !== 'none' &&\n (Boolean(fileItem.previewUrl) || Boolean(fileItem.uploadedFile));\n\n let mediaContent: ReactNode = null;\n\n if (shouldRenderPreview) {\n mediaContent = <GalleryEditorPreviewItem ratio={ratio} fileItem={fileItem} />;\n } else if (shouldRenderMedia) {\n mediaContent = (\n <GalleryEditorMediaItem\n fileItem={fileItem}\n ratio={ratio}\n openSelectedFile={onClick}\n previewUrl={fileItem.previewUrl}\n shouldLoadImages={shouldLoadImages}\n shouldEnableKeyboardHighlighting={shouldEnableKeyboardHighlighting}\n />\n );\n }\n\n return (\n <StyledMotionGalleryEditorItem\n initial={{ opacity: 0, scale: 0.98 }}\n animate={{ opacity: 1, scale: 1 }}\n exit={{ opacity: 0, scale: 0.98 }}\n transition={{ duration: GALLERY_EDITOR_ITEM_FADE_DURATION_S }}\n >\n {mediaContent}\n <StyledGalleryEditorItemDeleteButton\n ref={deleteButtonRef}\n type=\"button\"\n onClick={(event) => {\n event.stopPropagation();\n handleDeleteFile(fileItem.id);\n }}\n $zIndex={GALLERY_EDITOR_DELETE_BUTTON_Z_INDEX}\n aria-label={t(textStrings.galleryEditor.accessibility.removeImage)}\n >\n <Icon size={20} icons={['ts-wrong']} />\n </StyledGalleryEditorItemDeleteButton>\n </StyledMotionGalleryEditorItem>\n );\n};\n\nGalleryEditorItem.displayName = 'GalleryEditorItem';\n\nexport default memo(GalleryEditorItem);\n"],"mappings":"AAAA,SAASA,IAAI,EAAEC,kBAAkB,EAAEC,4BAA4B,QAAQ,yBAAyB;AAChG,OAAOC,KAAK,IAAmBC,IAAI,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SACIC,6BAA6B,EAC7BC,mCAAmC,QAChC,4BAA4B;AACnC,OAAOC,sBAAsB,MAAM,oDAAoD;AACvF,OAAOC,wBAAwB,MAAM,wDAAwD;AAE7F,SACIC,oCAAoC,EACpCC,mCAAmC,QAChC,4BAA4B;AACnC,SAASC,cAAc,QAAQ,qBAAqB;AACpD,OAAOC,WAAW,MAAM,gCAAgC;AAExD,MAAMC,iBAA6C,GAAGA,CAAC;EACnDC,QAAQ;EACRC,gBAAgB;EAChBC,gBAAgB,GAAG,IAAI;EACvBC,gCAAgC;EAChCC,KAAK,GAAG,CAAC;EACTC;AACJ,CAAC,KAAK;EACF,MAAM;IAAEC;EAAE,CAAC,GAAGT,cAAc,CAAC,CAAC;EAC9B,MAAM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E9B;IAAoC;EAAE,GAE7DqB,YAAY,eACb7B,KAAA,CAAA8B,aAAA,CAAC1B,mCAAmC;IAChCmC,GAAG,EAAEpB,eAAgB;IACrBqB,IAAI,EAAC,QAAQ;IACbvB,OAAO,EAAGwB,KAAK,IAAK;MAChBA,KAAK,CAACC,eAAe,CAAC,CAAC;MACvB7B,gBAAgB,CAACD,QAAQ,CAAC+B,EAAE,CAAC;IACjC,CAAE;IACFC,OAAO,EAAErC,oCAAqC;IAC9C,cAAYW,CAAC,CAACR,WAAW,CAACmC,aAAa,CAACC,aAAa,CAACC,WAAW;EAAE,gBAEnE/C,KAAA,CAAA8B,aAAA,CAACjC,IAAI;IAACmD,IAAI,EAAE,EAAG;IAACC,KAAK,EAAE,CAAC,UAAU;EAAE,CAAE,CACL,CACV,CAAC;AAExC,CAAC;AAEDtC,iBAAiB,CAACuC,WAAW,GAAG,mBAAmB;AAEnD,4BAAejD,IAAI,CAACU,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textStrings.js","names":["galleryEditor","accessibility","removeImage","stringName","fallback"],"sources":["../../../src/constants/textStrings.ts"],"sourcesContent":["export default {\n galleryEditor: {\n accessibility: {\n removeImage: {\n stringName: 'txt_chayns_components_gallery_galleryEditor_accessibility_removeImage',\n fallback: 'Bild entfernen',\n },\n },\n },\n} as const;\n"],"mappings":"AAAA,eAAe;EACXA,aAAa,EAAE;IACXC,aAAa,EAAE;MACXC,WAAW,EAAE;QACTC,UAAU,EAAE,uEAAuE;QACnFC,QAAQ,EAAE;MACd;IACJ;EACJ;AACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
readonly galleryEditor: {
|
|
3
|
+
readonly accessibility: {
|
|
4
|
+
readonly removeImage: {
|
|
5
|
+
readonly stringName: "txt_chayns_components_gallery_galleryEditor_accessibility_removeImage";
|
|
6
|
+
readonly fallback: "Bild entfernen";
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/gallery",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.34",
|
|
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,8 @@
|
|
|
69
69
|
"typescript": "^5.9.3"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@chayns-components/core": "^5.5.
|
|
72
|
+
"@chayns-components/core": "^5.5.34",
|
|
73
|
+
"@chayns/textstrings": "^1.0.1",
|
|
73
74
|
"react-compiler-runtime": "^1.0.0",
|
|
74
75
|
"uuid": "^10.0.0"
|
|
75
76
|
},
|
|
@@ -83,5 +84,5 @@
|
|
|
83
84
|
"publishConfig": {
|
|
84
85
|
"access": "public"
|
|
85
86
|
},
|
|
86
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "ab87bd2ddf52043b3eb87219b04ea6721fe7c16f"
|
|
87
88
|
}
|