@trackunit/react-compound-components 0.0.203 → 0.0.205
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/index.cjs.js
CHANGED
|
@@ -174,6 +174,7 @@ const cvaGallery = cssClassVarianceUtilities.cvaMerge([
|
|
|
174
174
|
"[&_.image-gallery-slide-wrapper]:flex-col",
|
|
175
175
|
"[&_.image-gallery-slide-wrapper]:justify-center",
|
|
176
176
|
"[&_.image-gallery-slide]:flex",
|
|
177
|
+
"hover:[&_.image-gallery-icon]:text-blue-600",
|
|
177
178
|
// This centers thumbnails and makes the clickable area independent of image size
|
|
178
179
|
"[&_.image-gallery-thumbnail]:h-[100px]",
|
|
179
180
|
]);
|
|
@@ -186,7 +187,7 @@ const cvaGallery = cssClassVarianceUtilities.cvaMerge([
|
|
|
186
187
|
*/
|
|
187
188
|
const ImageCollection = (props) => {
|
|
188
189
|
var _a;
|
|
189
|
-
const { imageIds, actions,
|
|
190
|
+
const { imageIds, actions, emptyPlaceholderActionLabel, additionalItemClassName, uploading } = props;
|
|
190
191
|
const [openImageId, setOpenImageId] = React.useState(imageIds[0]);
|
|
191
192
|
const [isDeleting, setIsDeleting] = React.useState(false);
|
|
192
193
|
const { width } = reactComponents.useResize();
|
|
@@ -243,7 +244,7 @@ const ImageCollection = (props) => {
|
|
|
243
244
|
// @ts-ignore
|
|
244
245
|
id, }) => jsxRuntime.jsx("img", { alt: "thumbnail", "data-testid": `thumbnail-${id}`, loading: "lazy", src: thumbnail }), showFullscreenButton: false, showPlayButton: false, showThumbnails: width > 768,
|
|
245
246
|
// reduce sliding around during deletion
|
|
246
|
-
slideDuration: isDeleting ? 0 : 200, ...props }), uploadButton, (actions === null || actions === void 0 ? void 0 : actions.remove) ? (jsxRuntime.jsx(reactComponents.Button, { className: "absolute right-2 top-2", loading: isDeleting, onClick: onRemove, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "Trash", size: "small" }), variant: "secondary-danger", children: actions.remove.label })) : null] })) : (
|
|
247
|
+
slideDuration: isDeleting ? 0 : 200, ...props }), uploadButton, (actions === null || actions === void 0 ? void 0 : actions.remove) ? (jsxRuntime.jsx(reactComponents.Button, { className: "absolute right-2 top-2", loading: isDeleting, onClick: onRemove, prefix: jsxRuntime.jsx(reactComponents.Icon, { name: "Trash", size: "small" }), variant: "secondary-danger", children: actions.remove.label })) : null] })) : ((_a = actions === null || actions === void 0 ? void 0 : actions.upload) === null || _a === void 0 ? void 0 : _a.onUpload) ? (uploading ? (jsxRuntime.jsx(reactComponents.Spinner, {})) : (jsxRuntime.jsx(reactFormComponents.DropZone, { accept: ACCEPT_FOR_IMAGES, className: "h-screen", dataTestId: "site-images-dropzone", filesSelected: actions.upload.onUpload, label: emptyPlaceholderActionLabel, multiple: true }))) : null, jsxRuntime.jsx("input", {
|
|
247
248
|
// Users can still select other files on mobile devices
|
|
248
249
|
accept: ACCEPT_FOR_IMAGES, hidden: true, multiple: true, onChange: async (e) => {
|
|
249
250
|
if (!(e.target.files && (actions === null || actions === void 0 ? void 0 : actions.upload))) {
|
package/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-l
|
|
|
3
3
|
import { ConfirmationDialogProvider } from '@trackunit/react-core-hooks';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
6
|
-
import { Card, CardHeader, CardBody, CardFooter, Button, useResize, Icon,
|
|
6
|
+
import { Card, CardHeader, CardBody, CardFooter, Button, useResize, Icon, Spinner } from '@trackunit/react-components';
|
|
7
7
|
import { Modal } from '@trackunit/react-modal';
|
|
8
8
|
import { cvaMerge } from '@trackunit/css-class-variance-utilities';
|
|
9
9
|
import ImageGallery from 'react-image-gallery';
|
|
@@ -154,6 +154,7 @@ const cvaGallery = cvaMerge([
|
|
|
154
154
|
"[&_.image-gallery-slide-wrapper]:flex-col",
|
|
155
155
|
"[&_.image-gallery-slide-wrapper]:justify-center",
|
|
156
156
|
"[&_.image-gallery-slide]:flex",
|
|
157
|
+
"hover:[&_.image-gallery-icon]:text-blue-600",
|
|
157
158
|
// This centers thumbnails and makes the clickable area independent of image size
|
|
158
159
|
"[&_.image-gallery-thumbnail]:h-[100px]",
|
|
159
160
|
]);
|
|
@@ -166,7 +167,7 @@ const cvaGallery = cvaMerge([
|
|
|
166
167
|
*/
|
|
167
168
|
const ImageCollection = (props) => {
|
|
168
169
|
var _a;
|
|
169
|
-
const { imageIds, actions,
|
|
170
|
+
const { imageIds, actions, emptyPlaceholderActionLabel, additionalItemClassName, uploading } = props;
|
|
170
171
|
const [openImageId, setOpenImageId] = useState(imageIds[0]);
|
|
171
172
|
const [isDeleting, setIsDeleting] = useState(false);
|
|
172
173
|
const { width } = useResize();
|
|
@@ -223,7 +224,7 @@ const ImageCollection = (props) => {
|
|
|
223
224
|
// @ts-ignore
|
|
224
225
|
id, }) => jsx("img", { alt: "thumbnail", "data-testid": `thumbnail-${id}`, loading: "lazy", src: thumbnail }), showFullscreenButton: false, showPlayButton: false, showThumbnails: width > 768,
|
|
225
226
|
// reduce sliding around during deletion
|
|
226
|
-
slideDuration: isDeleting ? 0 : 200, ...props }), uploadButton, (actions === null || actions === void 0 ? void 0 : actions.remove) ? (jsx(Button, { className: "absolute right-2 top-2", loading: isDeleting, onClick: onRemove, prefix: jsx(Icon, { name: "Trash", size: "small" }), variant: "secondary-danger", children: actions.remove.label })) : null] })) : (
|
|
227
|
+
slideDuration: isDeleting ? 0 : 200, ...props }), uploadButton, (actions === null || actions === void 0 ? void 0 : actions.remove) ? (jsx(Button, { className: "absolute right-2 top-2", loading: isDeleting, onClick: onRemove, prefix: jsx(Icon, { name: "Trash", size: "small" }), variant: "secondary-danger", children: actions.remove.label })) : null] })) : ((_a = actions === null || actions === void 0 ? void 0 : actions.upload) === null || _a === void 0 ? void 0 : _a.onUpload) ? (uploading ? (jsx(Spinner, {})) : (jsx(DropZone, { accept: ACCEPT_FOR_IMAGES, className: "h-screen", dataTestId: "site-images-dropzone", filesSelected: actions.upload.onUpload, label: emptyPlaceholderActionLabel, multiple: true }))) : null, jsx("input", {
|
|
227
228
|
// Users can still select other files on mobile devices
|
|
228
229
|
accept: ACCEPT_FOR_IMAGES, hidden: true, multiple: true, onChange: async (e) => {
|
|
229
230
|
if (!(e.target.files && (actions === null || actions === void 0 ? void 0 : actions.upload))) {
|
package/package.json
CHANGED
|
@@ -74,7 +74,6 @@ export declare const Default: {
|
|
|
74
74
|
onRemove?: (id: string) => Promise<void>;
|
|
75
75
|
};
|
|
76
76
|
} | undefined;
|
|
77
|
-
emptyPlaceholderText?: string | undefined;
|
|
78
77
|
emptyPlaceholderActionLabel?: string | undefined;
|
|
79
78
|
additionalItemClassName?: string | undefined;
|
|
80
79
|
uploading?: boolean | undefined;
|
|
@@ -146,7 +145,6 @@ export declare const EmptyState: {
|
|
|
146
145
|
onRemove?: (id: string) => Promise<void>;
|
|
147
146
|
};
|
|
148
147
|
} | undefined;
|
|
149
|
-
emptyPlaceholderText?: string | undefined;
|
|
150
148
|
emptyPlaceholderActionLabel?: string | undefined;
|
|
151
149
|
additionalItemClassName?: string | undefined;
|
|
152
150
|
uploading?: boolean | undefined;
|