@lumx/react 4.9.0-next.14 → 4.9.0-next.16

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 CHANGED
@@ -2881,6 +2881,71 @@ interface IconProps extends ReactToJSX<IconProps$1>, GenericProps$1 {
2881
2881
  */
2882
2882
  declare const Icon: Comp<IconProps, HTMLElement>;
2883
2883
 
2884
+ type ImageCaptionMetadata$1 = {
2885
+ /** Image title to display in the caption. */
2886
+ title?: string;
2887
+ /** Props to pass to the title. */
2888
+ titleProps?: GenericProps;
2889
+ /** Image description. Can be either a string, ReactNode, or sanitized html object. */
2890
+ description?: JSXElement | {
2891
+ __html: string;
2892
+ };
2893
+ /** Props to pass to the description. */
2894
+ descriptionProps?: GenericProps;
2895
+ /** Tag content. */
2896
+ tags?: JSXElement;
2897
+ /** Caption custom CSS style. */
2898
+ captionStyle?: GenericProps;
2899
+ /** Props to pass to the wrapper FlexBox element. */
2900
+ wrapperProps?: GenericProps;
2901
+ /** FlexBox component injected by the framework wrapper (React or Vue). */
2902
+ FlexBox: any;
2903
+ /** Text component injected by the framework wrapper (React or Vue). */
2904
+ Text: any;
2905
+ };
2906
+ type ImageCaptionPropsToOverride = 'FlexBox' | 'Text' | 'wrapperProps';
2907
+
2908
+ /**
2909
+ * Image block variants.
2910
+ */
2911
+ declare const ImageBlockCaptionPosition: {
2912
+ readonly below: "below";
2913
+ readonly over: "over";
2914
+ };
2915
+ type ImageBlockCaptionPosition = ValueOf<typeof ImageBlockCaptionPosition>;
2916
+ /**
2917
+ * Image block sizes.
2918
+ */
2919
+ type ImageBlockSize$1 = Extract<Size, 'xl' | 'xxl'>;
2920
+ /**
2921
+ * Defines the props of the component.
2922
+ */
2923
+ interface ImageBlockProps$1 extends HasClassName, HasTheme, Omit<ImageCaptionMetadata$1, ImageCaptionPropsToOverride> {
2924
+ /** Action toolbar content. */
2925
+ actions?: JSXElement;
2926
+ /** Alignment. */
2927
+ align?: HorizontalAlignment;
2928
+ /** Image alternative text. */
2929
+ alt: string;
2930
+ /** Caption position. */
2931
+ captionPosition?: ImageBlockCaptionPosition;
2932
+ /** Whether the image has to fill its container height or not. */
2933
+ fillHeight?: boolean;
2934
+ /** Image URL. */
2935
+ image: string;
2936
+ /** Size variant. */
2937
+ size?: ImageBlockSize$1;
2938
+ /** Props to pass to the thumbnail (minus those already set by the ImageBlock props). */
2939
+ thumbnailProps?: GenericProps;
2940
+ /** reference to the root element */
2941
+ ref?: CommonRef;
2942
+ /** component for rendering the thumbnail */
2943
+ Thumbnail: any;
2944
+ /** component for rendering the image caption */
2945
+ ImageCaption: any;
2946
+ }
2947
+ type ImageBlockPropsToOverride = 'Thumbnail' | 'ImageCaption' | 'thumbnailProps';
2948
+
2884
2949
  /**
2885
2950
  * Loading attribute is not yet supported in typescript, so we need
2886
2951
  * to add it in order to avoid a ts error.
@@ -3030,44 +3095,6 @@ interface ThumbnailProps extends GenericProps$1, ReactToJSX<ThumbnailProps$1, 'l
3030
3095
  */
3031
3096
  declare const Thumbnail: Comp<ThumbnailProps, HTMLElement>;
3032
3097
 
3033
- type ImageCaptionMetadata$1 = {
3034
- /** Image title to display in the caption. */
3035
- title?: string;
3036
- /** Props to pass to the title. */
3037
- titleProps?: GenericProps;
3038
- /** Image description. Can be either a string, ReactNode, or sanitized html object. */
3039
- description?: JSXElement | {
3040
- __html: string;
3041
- };
3042
- /** Props to pass to the title. */
3043
- descriptionProps?: GenericProps;
3044
- /** Tag content. */
3045
- tags?: JSXElement;
3046
- /** Caption custom CSS style. */
3047
- captionStyle?: GenericProps;
3048
- FlexBox: any;
3049
- Text: any;
3050
- };
3051
- type ImageCaptionPropsToOverride = 'FlexBox' | 'Text' | 'titleProps' | 'descriptionProps' | 'captionStyle';
3052
-
3053
- type ForwardedTextProps = Omit<TextProps, 'as' | 'typography' | 'color' | 'colorVariant'>;
3054
- type ImageCaptionMetadata = Omit<ImageCaptionMetadata$1, ImageCaptionPropsToOverride> & {
3055
- /** Props to pass to the title. */
3056
- titleProps?: ForwardedTextProps;
3057
- /** Props to pass to the title. */
3058
- descriptionProps?: ForwardedTextProps;
3059
- /** Caption custom CSS style. */
3060
- captionStyle?: CSSProperties;
3061
- };
3062
-
3063
- /**
3064
- * Image block variants.
3065
- */
3066
- declare const ImageBlockCaptionPosition: {
3067
- readonly below: "below";
3068
- readonly over: "over";
3069
- };
3070
- type ImageBlockCaptionPosition = ValueOf$1<typeof ImageBlockCaptionPosition>;
3071
3098
  /**
3072
3099
  * Image block sizes.
3073
3100
  */
@@ -3075,21 +3102,7 @@ type ImageBlockSize = Extract<Size$1, 'xl' | 'xxl'>;
3075
3102
  /**
3076
3103
  * Defines the props of the component.
3077
3104
  */
3078
- interface ImageBlockProps extends GenericProps$1, HasTheme$1, ImageCaptionMetadata {
3079
- /** Action toolbar content. */
3080
- actions?: ReactNode;
3081
- /** Alignment. */
3082
- align?: HorizontalAlignment$1;
3083
- /** Image alternative text. */
3084
- alt: string;
3085
- /** Caption position. */
3086
- captionPosition?: ImageBlockCaptionPosition;
3087
- /** Whether the image has to fill its container height or not. */
3088
- fillHeight?: boolean;
3089
- /** Image URL. */
3090
- image: string;
3091
- /** Size variant. */
3092
- size?: ImageBlockSize;
3105
+ interface ImageBlockProps extends GenericProps$1, ReactToJSX<ImageBlockProps$1, ImageBlockPropsToOverride> {
3093
3106
  /** Props to pass to the thumbnail (minus those already set by the ImageBlock props). */
3094
3107
  thumbnailProps?: Omit<ThumbnailProps, 'image' | 'size' | 'theme' | 'align' | 'fillHeight'>;
3095
3108
  }
@@ -3102,6 +3115,16 @@ interface ImageBlockProps extends GenericProps$1, HasTheme$1, ImageCaptionMetada
3102
3115
  */
3103
3116
  declare const ImageBlock: Comp<ImageBlockProps, HTMLDivElement>;
3104
3117
 
3118
+ type ForwardedTextProps = Omit<TextProps, 'as' | 'typography' | 'color' | 'colorVariant'>;
3119
+ type ImageCaptionMetadata = Omit<ImageCaptionMetadata$1, ImageCaptionPropsToOverride> & {
3120
+ /** Props to pass to the title. */
3121
+ titleProps?: ForwardedTextProps;
3122
+ /** Props to pass to the title. */
3123
+ descriptionProps?: ForwardedTextProps;
3124
+ /** Caption custom CSS style. */
3125
+ captionStyle?: CSSProperties;
3126
+ };
3127
+
3105
3128
  type InheritedSlideShowProps = Pick<SlideshowProps, 'slideshowControlsProps' | 'slideGroupLabel'>;
3106
3129
  interface ZoomButtonProps {
3107
3130
  /** Zoom in button props */
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, ColorVariant, VISUALLY_HIDDEN, Theme as Theme$1, AspectRatio as AspectRatio$1, DOCUMENT, IS_BROWSER as IS_BROWSER$1, WINDOW, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, Alignment as Alignment$1, NOTIFICATION_TRANSITION_DURATION } from '@lumx/core/js/constants';
1
+ import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, ColorVariant, VISUALLY_HIDDEN, Theme as Theme$1, AspectRatio as AspectRatio$1, DOCUMENT, IS_BROWSER as IS_BROWSER$1, WINDOW, DIALOG_TRANSITION_DURATION, Orientation as Orientation$1, NOTIFICATION_TRANSITION_DURATION, Alignment as Alignment$1 } from '@lumx/core/js/constants';
2
2
  export * from '@lumx/core/js/constants';
3
3
  export * from '@lumx/core/js/types';
4
4
  import * as React from 'react';
@@ -12247,6 +12247,112 @@ Icon.displayName = Icon$1.displayName;
12247
12247
  Icon.className = Icon$1.className;
12248
12248
  Icon.defaultProps = Icon$1.defaultProps;
12249
12249
 
12250
+ /**
12251
+ * Image block variants.
12252
+ */
12253
+ const ImageBlockCaptionPosition = {
12254
+ below: 'below',
12255
+ over: 'over'
12256
+ };
12257
+
12258
+ /**
12259
+ * Image block sizes.
12260
+ */
12261
+
12262
+ /**
12263
+ * Defines the props of the component.
12264
+ */
12265
+
12266
+ /**
12267
+ * Component display name.
12268
+ */
12269
+ const COMPONENT_NAME$I = 'ImageBlock';
12270
+
12271
+ /**
12272
+ * Component default class name and class prefix.
12273
+ */
12274
+ const CLASSNAME$J = 'lumx-image-block';
12275
+ const {
12276
+ block: block$B,
12277
+ element: element$v
12278
+ } = bem(CLASSNAME$J);
12279
+
12280
+ /**
12281
+ * Component default props.
12282
+ */
12283
+ const DEFAULT_PROPS$F = {
12284
+ captionPosition: ImageBlockCaptionPosition.below,
12285
+ align: Alignment.left
12286
+ };
12287
+
12288
+ /**
12289
+ * ImageBlock component.
12290
+ *
12291
+ * @param props Component props.
12292
+ * @param ref Component ref.
12293
+ * @return React element.
12294
+ */
12295
+ const ImageBlock$1 = props => {
12296
+ const {
12297
+ actions,
12298
+ align = DEFAULT_PROPS$F.align,
12299
+ alt,
12300
+ captionPosition = DEFAULT_PROPS$F.captionPosition,
12301
+ captionStyle,
12302
+ className,
12303
+ description,
12304
+ descriptionProps,
12305
+ fillHeight,
12306
+ image,
12307
+ size,
12308
+ tags,
12309
+ ref,
12310
+ theme,
12311
+ thumbnailProps,
12312
+ title,
12313
+ titleProps,
12314
+ Thumbnail,
12315
+ ImageCaption,
12316
+ ...forwardedProps
12317
+ } = props;
12318
+ return /*#__PURE__*/jsxs("figure", {
12319
+ ref: ref,
12320
+ ...forwardedProps,
12321
+ className: classnames(className, block$B({
12322
+ [`caption-position-${captionPosition}`]: Boolean(captionPosition),
12323
+ [`align-${align}`]: Boolean(align),
12324
+ [`size-${size}`]: Boolean(size),
12325
+ [`theme-${theme}`]: Boolean(theme),
12326
+ 'fill-height': fillHeight
12327
+ })),
12328
+ children: [/*#__PURE__*/jsx(Thumbnail, {
12329
+ ...thumbnailProps,
12330
+ className: classnames(element$v('image'), thumbnailProps?.className),
12331
+ fillHeight: fillHeight,
12332
+ align: align,
12333
+ image: image,
12334
+ size: size,
12335
+ theme: theme,
12336
+ alt: alt || title
12337
+ }), /*#__PURE__*/jsx(ImageCaption, {
12338
+ as: "figcaption",
12339
+ baseClassName: CLASSNAME$J,
12340
+ theme: theme,
12341
+ title: title,
12342
+ titleProps: titleProps,
12343
+ description: description,
12344
+ descriptionProps: descriptionProps,
12345
+ tags: tags,
12346
+ captionStyle: captionStyle,
12347
+ align: align,
12348
+ truncate: captionPosition === 'over'
12349
+ }), actions && /*#__PURE__*/jsx("div", {
12350
+ className: element$v('actions'),
12351
+ children: actions
12352
+ })]
12353
+ });
12354
+ };
12355
+
12250
12356
  /** Internal component used to render image captions */
12251
12357
  const ImageCaption$1 = props => {
12252
12358
  const {
@@ -12262,7 +12368,11 @@ const ImageCaption$1 = props => {
12262
12368
  align,
12263
12369
  truncate,
12264
12370
  FlexBox,
12265
- Text
12371
+ Text,
12372
+ wrapperProps = {
12373
+ vAlign: align,
12374
+ hAlign: align === 'center' ? align : undefined
12375
+ }
12266
12376
  } = props;
12267
12377
  if (!title && !description && !tags) return null;
12268
12378
  const titleColor = {
@@ -12277,9 +12387,8 @@ const ImageCaption$1 = props => {
12277
12387
  className: classnames(baseClassName && `${baseClassName}__wrapper`),
12278
12388
  style: captionStyle,
12279
12389
  orientation: "vertical",
12280
- vAlign: align,
12281
- hAlign: align === 'center' ? align : undefined,
12282
12390
  gap: "regular",
12391
+ ...wrapperProps,
12283
12392
  children: [(title || description) && /*#__PURE__*/jsxs(Text, {
12284
12393
  as: "p",
12285
12394
  className: classnames(baseClassName && `${baseClassName}__caption`),
@@ -12329,11 +12438,6 @@ const ImageCaption = props => {
12329
12438
  });
12330
12439
  };
12331
12440
 
12332
- const ImageBlockCaptionPosition = {
12333
- below: 'below',
12334
- over: 'over'
12335
- };
12336
-
12337
12441
  /**
12338
12442
  * Image block sizes.
12339
12443
  */
@@ -12342,28 +12446,6 @@ const ImageBlockCaptionPosition = {
12342
12446
  * Defines the props of the component.
12343
12447
  */
12344
12448
 
12345
- /**
12346
- * Component display name.
12347
- */
12348
- const COMPONENT_NAME$I = 'ImageBlock';
12349
-
12350
- /**
12351
- * Component default class name and class prefix.
12352
- */
12353
- const CLASSNAME$J = 'lumx-image-block';
12354
- const {
12355
- block: block$B,
12356
- element: element$v
12357
- } = classNames.bem(CLASSNAME$J);
12358
-
12359
- /**
12360
- * Component default props.
12361
- */
12362
- const DEFAULT_PROPS$F = {
12363
- captionPosition: ImageBlockCaptionPosition.below,
12364
- align: Alignment$1.left
12365
- };
12366
-
12367
12449
  /**
12368
12450
  * ImageBlock component.
12369
12451
  *
@@ -12374,59 +12456,15 @@ const DEFAULT_PROPS$F = {
12374
12456
  const ImageBlock = forwardRef((props, ref) => {
12375
12457
  const defaultTheme = useTheme() || Theme$1.light;
12376
12458
  const {
12377
- actions,
12378
- align = DEFAULT_PROPS$F.align,
12379
- alt,
12380
- captionPosition = DEFAULT_PROPS$F.captionPosition,
12381
- captionStyle,
12382
- className,
12383
- description,
12384
- descriptionProps,
12385
- fillHeight,
12386
- image,
12387
- size,
12388
- tags,
12389
12459
  theme = defaultTheme,
12390
- thumbnailProps,
12391
- title,
12392
- titleProps,
12393
12460
  ...forwardedProps
12394
12461
  } = props;
12395
- return /*#__PURE__*/jsxs("figure", {
12396
- ref: ref,
12462
+ return ImageBlock$1({
12463
+ ref,
12464
+ theme,
12397
12465
  ...forwardedProps,
12398
- className: classNames.join(className, block$B({
12399
- [`caption-position-${captionPosition}`]: Boolean(captionPosition),
12400
- [`align-${align}`]: Boolean(align),
12401
- [`size-${size}`]: Boolean(size),
12402
- [`theme-${theme}`]: Boolean(theme),
12403
- 'fill-height': fillHeight
12404
- })),
12405
- children: [/*#__PURE__*/jsx(Thumbnail, {
12406
- ...thumbnailProps,
12407
- className: classNames.join(element$v('image'), thumbnailProps?.className),
12408
- fillHeight: fillHeight,
12409
- align: align,
12410
- image: image,
12411
- size: size,
12412
- theme: theme,
12413
- alt: alt || title
12414
- }), /*#__PURE__*/jsx(ImageCaption, {
12415
- as: "figcaption",
12416
- baseClassName: CLASSNAME$J,
12417
- theme: theme,
12418
- title: title,
12419
- titleProps: titleProps,
12420
- description: description,
12421
- descriptionProps: descriptionProps,
12422
- tags: tags,
12423
- captionStyle: captionStyle,
12424
- align: align,
12425
- truncate: captionPosition === 'over'
12426
- }), actions && /*#__PURE__*/jsx("div", {
12427
- className: element$v('actions'),
12428
- children: actions
12429
- })]
12466
+ Thumbnail,
12467
+ ImageCaption
12430
12468
  });
12431
12469
  });
12432
12470
  ImageBlock.displayName = COMPONENT_NAME$I;