@lumx/react 3.7.6-alpha.0 → 3.7.6-alpha.10
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.d.ts +15 -12
- package/index.js +225 -182
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/image-block/ImageBlock.tsx +15 -2
- package/src/components/image-block/ImageCaption.tsx +17 -22
- package/src/components/image-lightbox/ImageLightbox.stories.tsx +10 -8
- package/src/components/image-lightbox/internal/ImageSlide.tsx +13 -5
- package/src/components/image-lightbox/internal/ImageSlideshow.tsx +21 -6
- package/src/components/image-lightbox/types.ts +14 -13
- package/src/components/image-lightbox/useImageLightbox.tsx +30 -22
- package/src/components/thumbnail/Thumbnail.stories.tsx +29 -0
- package/src/components/thumbnail/Thumbnail.tsx +16 -0
- package/src/hooks/useElementSizeDependentOfWindowSize.ts +2 -2
- package/src/stories/generated/ImageLightbox/Demos.stories.tsx +6 -0
- package/src/utils/findImage.tsx +2 -2
- package/src/components/image-block/constants.ts +0 -11
package/index.d.ts
CHANGED
|
@@ -1301,6 +1301,8 @@ interface ThumbnailProps extends GenericProps, HasTheme {
|
|
|
1301
1301
|
size?: ThumbnailSize;
|
|
1302
1302
|
/** Image loading mode. */
|
|
1303
1303
|
loading?: ImgHTMLProps['loading'];
|
|
1304
|
+
/** Ref of an existing placeholder image to display while loading. */
|
|
1305
|
+
loadingPlaceholderImageRef?: React.RefObject<HTMLImageElement>;
|
|
1304
1306
|
/** On click callback. */
|
|
1305
1307
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
|
1306
1308
|
/** On key press callback. */
|
|
@@ -1376,34 +1378,35 @@ interface ImageBlockProps extends GenericProps, HasTheme, ImageCaptionMetadata {
|
|
|
1376
1378
|
*/
|
|
1377
1379
|
declare const ImageBlock: Comp<ImageBlockProps, HTMLDivElement>;
|
|
1378
1380
|
|
|
1379
|
-
type InheritedSlideShowProps = Pick<SlideshowProps, '
|
|
1380
|
-
interface
|
|
1381
|
-
/** */
|
|
1381
|
+
type InheritedSlideShowProps = Pick<SlideshowProps, 'slideshowControlsProps' | 'slideGroupLabel'>;
|
|
1382
|
+
interface ZoomButtonProps {
|
|
1383
|
+
/** Zoom in button props */
|
|
1382
1384
|
zoomInButtonProps?: IconButtonProps;
|
|
1385
|
+
/** Zoom out button props */
|
|
1383
1386
|
zoomOutButtonProps?: IconButtonProps;
|
|
1384
1387
|
}
|
|
1385
|
-
type InheritedThumbnailProps = Pick<ThumbnailProps, 'image' | 'alt' | 'imgProps' | 'imgRef'>;
|
|
1388
|
+
type InheritedThumbnailProps = Pick<ThumbnailProps, 'image' | 'alt' | 'imgProps' | 'imgRef' | 'loadingPlaceholderImageRef'>;
|
|
1386
1389
|
type InheritedImageMetadata = Pick<ImageCaptionMetadata, 'title' | 'description' | 'tags'>;
|
|
1387
1390
|
type ImageProps = InheritedThumbnailProps & InheritedImageMetadata;
|
|
1388
1391
|
interface ImagesProps {
|
|
1389
|
-
/** Index of the active
|
|
1392
|
+
/** Index of the active image to show on open */
|
|
1390
1393
|
activeImageIndex?: number;
|
|
1391
1394
|
/** List of images to display */
|
|
1392
1395
|
images: Array<ImageProps>;
|
|
1393
1396
|
/** Ref of the active image when the lightbox is open */
|
|
1394
1397
|
activeImageRef?: React.Ref<HTMLImageElement>;
|
|
1395
1398
|
}
|
|
1396
|
-
type InheritedLightboxProps = Pick<LightboxProps, 'isOpen' | 'parentElement' | 'onClose' | 'closeButtonProps'>;
|
|
1397
|
-
type InheritedAriaAttributes = Pick<React.AriaAttributes, 'aria-label' | 'aria-labelledby'>;
|
|
1399
|
+
type InheritedLightboxProps = Pick<LightboxProps, 'isOpen' | 'parentElement' | 'onClose' | 'closeButtonProps' | 'aria-label' | 'aria-labelledby'>;
|
|
1398
1400
|
type ForwardedProps = React.ComponentPropsWithoutRef<'div'>;
|
|
1399
1401
|
/**
|
|
1400
1402
|
* ImageLightbox component props
|
|
1401
1403
|
*/
|
|
1402
|
-
interface ImageLightboxProps extends HasClassName,
|
|
1404
|
+
interface ImageLightboxProps extends HasClassName, ZoomButtonProps, ImagesProps, InheritedSlideShowProps, InheritedLightboxProps, ForwardedProps {
|
|
1403
1405
|
}
|
|
1404
1406
|
|
|
1405
1407
|
/** Subset of the ImageLightboxProps managed by the useImageLightbox hook */
|
|
1406
1408
|
type ManagedProps = Pick<ImageLightboxProps, 'isOpen' | 'images' | 'parentElement' | 'activeImageRef' | 'onClose' | 'activeImageIndex'>;
|
|
1409
|
+
type TriggerOptions = Pick<ImageLightboxProps, 'activeImageIndex'>;
|
|
1407
1410
|
/**
|
|
1408
1411
|
* Set up an ImageLightbox with images and triggers.
|
|
1409
1412
|
*
|
|
@@ -1411,19 +1414,19 @@ type ManagedProps = Pick<ImageLightboxProps, 'isOpen' | 'images' | 'parentElemen
|
|
|
1411
1414
|
* - Associate a trigger with an image to display on open
|
|
1412
1415
|
* - Automatically provide a view transition between an image trigger and the displayed image on open & close
|
|
1413
1416
|
*
|
|
1414
|
-
* @param
|
|
1417
|
+
* @param initialProps Images to display in the image lightbox
|
|
1415
1418
|
*/
|
|
1416
|
-
declare function useImageLightbox(
|
|
1419
|
+
declare function useImageLightbox<P extends Partial<ImageLightboxProps>>(initialProps: P): {
|
|
1417
1420
|
/**
|
|
1418
1421
|
* Generates trigger props
|
|
1419
1422
|
* @param index Provide an index to choose which image to display when the image lightbox opens.
|
|
1420
1423
|
* */
|
|
1421
|
-
getTriggerProps: (
|
|
1424
|
+
getTriggerProps: (options?: TriggerOptions) => {
|
|
1422
1425
|
onClick: React.MouseEventHandler;
|
|
1423
1426
|
ref: React.Ref<any>;
|
|
1424
1427
|
};
|
|
1425
1428
|
/** Props to forward to the ImageLightbox */
|
|
1426
|
-
imageLightboxProps: ManagedProps;
|
|
1429
|
+
imageLightboxProps: P & ManagedProps;
|
|
1427
1430
|
};
|
|
1428
1431
|
|
|
1429
1432
|
/**
|