Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(web, web-react, web-twig): Attachment image object fit #DS-1005 #1107

Merged
merged 3 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,29 @@ type AttachmentImagePreviewProps = {
imagePreview: string;
label: string;
meta?: FileMetadata;
imageObjectFit?: 'contain' | 'cover';
};

const AttachmentImagePreview = ({ label, imagePreview, meta }: AttachmentImagePreviewProps) => {
const { classProps } = useFileUploaderStyleProps({ meta });
const { imageCropStyles } = classProps;
const AttachmentImagePreview = ({ label, imagePreview, meta, imageObjectFit }: AttachmentImagePreviewProps) => {
const { classProps } = useFileUploaderStyleProps({ meta, imageObjectFit });
const { imageCropStyles, attachmentStyles } = classProps;

return (
<span className={classProps.attachment.image}>
<img src={imagePreview} width={IMAGE_DIMENSION} height={IMAGE_DIMENSION} alt={label} style={imageCropStyles} />
<img
src={imagePreview}
width={IMAGE_DIMENSION}
height={IMAGE_DIMENSION}
alt={label}
style={{ ...imageCropStyles, ...attachmentStyles }}
/>
</span>
);
};

AttachmentImagePreview.defaultProps = {
meta: undefined,
imageObjectFit: 'cover',
};

export default AttachmentImagePreview;
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ const FileUploaderAttachment = (props: SpiritFileUploaderAttachmentProps) => {
hasImagePreview,
iconName = DEFAULT_ICON_NAME,
id,
imageObjectFit,
label,
meta,
name,
onDismiss,
onEdit,
onError,
removeText,
meta,
...restProps
} = props;
const [imagePreview, setImagePreview] = useState<string>('');
Expand Down Expand Up @@ -83,7 +84,7 @@ const FileUploaderAttachment = (props: SpiritFileUploaderAttachmentProps) => {
className={classNames(classProps.attachment.root, styleProps.className)}
>
{hasImagePreview && imagePreview ? (
<AttachmentImagePreview label={label} imagePreview={imagePreview} meta={meta} />
<AttachmentImagePreview label={label} imagePreview={imagePreview} meta={meta} imageObjectFit={imageObjectFit} />
) : (
<Icon name={iconName} aria-hidden="true" />
)}
Expand Down
1 change: 1 addition & 0 deletions packages/web-react/src/components/FileUploader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ The rest of the properties are created from the default `<ul>` element. [More ab
| `hasImagePreview` | `bool` | false | ✕ | Show image preview |
| `iconName` | `string` | `file` | ✕ | Icon shown along the file |
| `id` | `string` | — | ✔ | FileUploaderAttachment id |
| `imageObjectFit` | [`cover` \| `contain`] | `cover` | ✕ | Defines FileUploaderAttachment image fit in container |
| `label` | `string` | — | ✔ | File name |
| `name` | `string` | — | ✔ | Input field name |
| `onDismiss` | `(key: string) => FileQueueMapType` | — | ✔ | Callback to delete an item from the queue |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
export const DEMO_ATTACHMENT_BASE64_IMAGE =
'/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJDAAABZAAAAChnVFJDAAABZAAAAChiVFJDAAABZAAAAChjcHJ0AAABjAAAADxtbHVjAAAAAAAAAAEAAAAMZW5VUwAAAAgAAAAcAHMAUgBHAEJYWVogAAAAAAAAb6IAADj1AAADkFhZWiAAAAAAAABimQAAt4UAABjaWFlaIAAAAA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/PHzqydM8BEJpyCEziHEpDZQUgAEhfkoEjjEWHbupNuNAJdBBS4B5jtY9cZpry9R6pYTqTjklxLSEpJN8fFeUYzp6i3DIM9P5WnpbqA9O6m4JUKO4vwtrSlJ4FkmrN1ZJ5yXqsL9aNKRqURkNJS4sSIzfxBlw8Ejz2kge1+2VOs6lGbS3HVDS88hI2PBe2qJ+0Ob/AMZP6U6kjwpwkaon9l8Pw5KUJ5WhVgGh5g8X6EemZaHOIJCJIWBpAKVH3XooQ0hbiHEjYQU7cMuOqY/jJRNhh1TC1UbNkel+pqucMLIwxuxKUjIe24WvRlxnZvibKbPCgquTRrGiA2yrqETeAhuIgAmh8QPfOeQpojBQWkkHnjzxn0/WSiGpLqUpTLTyofcSCQK+tYWUh1Pg3lSBpZUZHhUk55D8t9TdVvURY+fGV6XFpdu1Hggj5ZtV2Sq+e15ghWyQ2rvShftljYhQm4N0x6BMafaUy+rfuRs2KPCvTj17j8MMWVLXDmOBs0ULIB+uGMsqYgLSDcJN9NITlGdio+Xp/kcD+/8A2OGGK0/abn68/hVYj91+GYn7Q+n5jDDLCtez/wCPe/q/5hhhgpPWVqL22+Av/9k=';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Meta, StoryObj } from '@storybook/react';

import { DEMO_ATTACHMENT_BASE64_IMAGE } from '../demo/constants';
import { DEMO_ATTACHMENT_BASE64_IMAGE_40X52 } from '../demo/constants';
import { base64ToByteArray, FileUploader, FileUploaderAttachment } from '..';

const byteArray = base64ToByteArray(DEMO_ATTACHMENT_BASE64_IMAGE);
const byteArray = base64ToByteArray(DEMO_ATTACHMENT_BASE64_IMAGE_40X52);

const meta: Meta<typeof FileUploaderAttachment> = {
title: 'Components/FileUploader',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import { useClassNamePrefix } from '../../hooks';
import { FileMetadata, FileUploaderQueueLimitBehaviorType, Validation } from '../../types';

export interface FileUploaderStyleProps extends Validation {
isDragAndDropSupported?: boolean;
isLabelHidden?: boolean;
imageObjectFit?: 'contain' | 'cover';
isDisabled?: boolean;
isDisabledByQueueLimitBehavior?: boolean;
isDragAndDropSupported?: boolean;
isDragging?: boolean;
isDropZoneHidden?: boolean;
isFluid?: boolean;
queueLimitBehavior?: FileUploaderQueueLimitBehaviorType;
isLabelHidden?: boolean;
meta?: FileMetadata;
queueLimitBehavior?: FileUploaderQueueLimitBehaviorType;
}

type ImageCropCSS = {
Expand All @@ -23,6 +24,10 @@ type ImageCropCSS = {
[FileUploaderCropCSS.HEIGHT]?: string;
} & CSSProperties;

type ImageObjectFit = {
'--file-uploader-attachment-image-object-fit': string;
};

export interface FileUploaderStyleReturn {
/** className props */
classProps: {
Expand All @@ -49,6 +54,7 @@ export interface FileUploaderStyleReturn {
slot: string;
};
imageCropStyles?: ImageCropCSS;
attachmentStyles?: ImageObjectFit;
};
}

Expand Down Expand Up @@ -79,8 +85,9 @@ export const useFileUploaderStyleProps = (props?: FileUploaderStyleProps): FileU
const fileUploaderAttachmentImageClass = `${fileUploaderAttachmentClass}__image`;
const fileUploaderAttachmentSlotClass = `${fileUploaderAttachmentClass}__slot`;

const { meta } = props || {};
const { meta, imageObjectFit } = props || {};
let imageCropCSS: ImageCropCSS | undefined;
let imageObjectFitCSS: ImageObjectFit | undefined;
const hasCoords = meta && meta.x != null && meta.y != null && meta.width != null && meta.height != null;

if (hasCoords) {
Expand All @@ -94,6 +101,12 @@ export const useFileUploaderStyleProps = (props?: FileUploaderStyleProps): FileU
};
}

if (imageObjectFit) {
imageObjectFitCSS = {
'--file-uploader-attachment-image-object-fit': imageObjectFit,
};
}

return {
classProps: {
root: classNames(fileUploaderClass, { [fileUploaderFluidClass]: props?.isFluid }),
Expand Down Expand Up @@ -129,6 +142,7 @@ export const useFileUploaderStyleProps = (props?: FileUploaderStyleProps): FileU
slot: fileUploaderAttachmentSlotClass,
},
...(hasCoords && { imageCropStyles: imageCropCSS }),
...(imageObjectFit && { attachmentStyles: imageObjectFitCSS }),
},
};
};
1 change: 1 addition & 0 deletions packages/web-react/src/types/fileUploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export interface FileUploaderAttachmentBaseProps extends Omit<SpiritLItemElement
hasImagePreview?: boolean;
iconName?: string;
id: string;
imageObjectFit?: 'contain' | 'cover';
label: string;
meta?: FileMetadata;
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{%- set _fileName = props.fileName | default(null) -%}
{%- set _generateImagePreview = props.generateImagePreview | default(false) -%}
{%- set _iconName = props.iconName | default('file') -%}
{%- set _imageObjectFit = props.imageObjectFit | default(null) -%}
{%- set _imagePreview = props.imagePreview | default(null) -%}
{%- set _onEdit = props.onEdit | default(null) -%}
{%- set _removeText = props.removeText | default('Remove') -%}
Expand All @@ -18,6 +19,7 @@

{# Attributes #}
{%- set _dataImagePreviewAttr = _generateImagePreview ? 'data-spirit-imagePreview="true"' : null -%}
{%- set _imageObjectFitAttr = _imageObjectFit ? 'data-spirit-image-object-fit=' ~ _imageObjectFit : null -%}

{# Miscellaneous #}
{%- set _styleProps = useStyleProps(props) -%}
Expand All @@ -33,7 +35,7 @@
>
{% if _generateImagePreview or _imagePreview %}
<span class="{{ _imageClassName }}">
<img src="{{ _imagePreview }}" width="54" height="54" alt="{{- _fileName -}}" />
<img src="{{ _imagePreview }}" {{ _imageObjectFitAttr }} width="54" height="54" alt="{{- _fileName -}}" />
</span>
{% endif %}
{% if not _imagePreview %}
Expand Down
39 changes: 28 additions & 11 deletions packages/web-twig/src/Resources/components/FileUploader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,26 @@ FileUploader allows users to pick one or more files to upload.

FileUploader is a composition of a few subcomponents:

- [FileUploader](#fileuploader-1)
- [FileUploader](#fileuploader)
pavelklibani marked this conversation as resolved.
Show resolved Hide resolved
- [JavaScript Plugin](#javascript-plugin)
- [FileUploader](#fileuploader-1)
- [Fluid Width](#fluid-width)
- [API](#api)
- [FileUploaderInput](#fileuploaderinput)
- [Selecting Multiple Files at Once](#selecting-multiple-files-at-once)
- [Maximum File Size (JavaScript)](#maximum-file-size-javascript)
- [Maximum Number of Files in Queue (JavaScript)](#maximum-number-of-files-in-queue-javascript)
- [Input Behavior When the Queue is Filled (JavaScript)](#input-behavior-when-the-queue-is-filled-javascript)
- [Allowed File Types](#allowed-file-types)
- [Required Input](#required-input)
- [Validation States](#validation-states)
- [Disabled State](#disabled-state)
- [API](#api-1)
- [FileUploaderList](#fileuploaderlist)
- [FileUploaderAttachment](#fileuploaderattachment)
- [API](#api-2)
- [FileUploaderAttachment](#fileuploaderattachment)
- [API](#api-3)
- [Composition](#composition)

## JavaScript Plugin

Expand Down Expand Up @@ -283,15 +299,16 @@ With image preview:

### API

| Name | Type | Default | Required | Description |
| ---------------------- | -------- | -------- | -------- | -------------------------------------------------------------------------------------------------- |
| `editText` | `string` | `Edit` | ✕ | Edit button text |
| `fileName` | `string` | `null` | ✕ | File name |
| `generateImagePreview` | `bool` | `false` | ✕ | If true and used in the attachment template, the JS plugin will try to show a preview of the image |
| `iconName` | `string` | `file` | ✕ | Icon shown along the file |
| `imagePreview` | `string` | `null` | ✕ | URL or base64 of an image |
| `onEdit` | `func` | `null` | ✕ | Function to trigger on click on edit button |
| `removeText` | `string` | `Remove` | ✕ | Remove button text |
| Name | Type | Default | Required | Description |
| ---------------------- | ---------------------- | -------- | -------- | -------------------------------------------------------------------------------------------------- |
| `editText` | `string` | `Edit` | ✕ | Edit button text |
| `fileName` | `string` | `null` | ✕ | File name |
| `generateImagePreview` | `bool` | `false` | ✕ | If true and used in the attachment template, the JS plugin will try to show a preview of the image |
| `iconName` | `string` | `file` | ✕ | Icon shown along the file |
| `imagePreview` | `string` | `null` | ✕ | URL or base64 of an image |
| `imageObjectFit` | [`cover` \| `contain`] | `cover` | ✕ | Defines FileUploaderAttachment image fit in container |
| `onEdit` | `func` | `null` | ✕ | Function to trigger on click on edit button |
| `removeText` | `string` | `Remove` | ✕ | Remove button text |

On top of the API options, you can add `data-*` or `aria-*` attributes to
further extend component's descriptiveness and accessibility. Also, UNSAFE styling props are available,
Expand Down
Loading