gantri-components 2.109.0 → 2.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- import { ResolutionAwareProp } from '../../types/resolution-aware-prop.type';
2
- import { ImageTransformationsVariant, Transformations } from './image.types';
3
- import { Optional } from '../../types/common';
4
- export declare const TRANSFORMATION_VARIANTS_MAP: Record<ImageTransformationsVariant, Optional<ResolutionAwareProp<Transformations>>>;
1
+ import { ResolutionAwarePropBase } from '../../types/resolution-aware-prop.type';
2
+ import { ImageTransformationsVariantOption, Transformations } from './image.types';
3
+ export declare const TRANSFORMATION_VARIANTS_MAP: Record<ImageTransformationsVariantOption, ResolutionAwarePropBase<Transformations>>;
@@ -1,7 +1,9 @@
1
1
  import { IGravity } from '@cloudinary/url-gen/qualifiers/gravity/GravityQualifier';
2
- import { AspectRatio, Dpr, ImageDimension, ImageProps, ImageSource, TransformationMode, TransformationQuality, TransformationType } from './image.types';
2
+ import { AspectRatio, Dpr, ImageDimension, ImageProps, ImageSource, ImageTransformationsVariant, TransformationMode, TransformationQuality, Transformations, TransformationType } from './image.types';
3
3
  import { ResolutionAwarePropBase } from '../../types/resolution-aware-prop.type';
4
4
  import { Optional } from '../../types/common';
5
5
  export declare const extractSizePropertyValue: (prop: Optional<ImageDimension>) => Optional<ImageDimension>;
6
6
  export declare const generateCloudinaryUrl: (source: ImageSource, imageName?: string, aspectRatio?: AspectRatio, width?: Optional<ImageDimension>, height?: Optional<ImageDimension>, mode?: Optional<TransformationMode>, quality?: Optional<TransformationQuality>, dpr?: Optional<Dpr>, type?: Optional<TransformationType>, gravity?: Optional<IGravity>) => string;
7
7
  export declare const generateImages: (params: Partial<ImageProps>, type?: TransformationType) => string | ResolutionAwarePropBase<string>;
8
+ /** Converts transformation variant shorthand to full transformations. */
9
+ export declare const getVariantTransformation: (transformationsVariant: Optional<ImageTransformationsVariant>) => ResolutionAwarePropBase<Transformations> | null;
@@ -7,7 +7,8 @@ import { Optional } from '../../types/common';
7
7
  export type AspectRatio = 'unset' | string | number;
8
8
  export type ImageDimension = string | number | 'unset';
9
9
  export type Dpr = number | 'auto';
10
- export type ImageTransformationsVariant = 'f' | 'h' | 'q' | 'ffh' | 'hff' | 'hhf';
10
+ export type ImageTransformationsVariantOption = 'f' | 'h' | 'q';
11
+ export type ImageTransformationsVariant = ImageTransformationsVariantOption | `${ImageTransformationsVariantOption}${ImageTransformationsVariantOption}` | `${ImageTransformationsVariantOption}${ImageTransformationsVariantOption}${ImageTransformationsVariantOption}`;
11
12
  export interface ImageProps {
12
13
  alt: string;
13
14
  className?: string;
@@ -40,12 +41,21 @@ export interface ImageProps {
40
41
  transformations?: Optional<ResolutionAwareProp<Transformations>>;
41
42
  /**
42
43
  * Used to define common transformation for images.
44
+ *
45
+ * @example
46
+ * ```text
43
47
  * f => full width
48
+ *
44
49
  * h => half width
50
+ *
45
51
  * q => quarter width
52
+ *
46
53
  * ffh => desktop full width, tablet full width, mobile half width
54
+ *
47
55
  * hff => desktop half width, tablet full width, mobile full width
56
+ *
48
57
  * hhf => desktop half width, tablet half width, mobile full width
58
+ * ```
49
59
  */
50
60
  transformationsVariant?: Optional<ImageTransformationsVariant>;
51
61
  width?: Optional<ResolutionAwareProp<ImageDimension>>;