@lumx/react 4.9.0 → 4.10.0-next.1

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
@@ -3358,21 +3358,38 @@ declare const Link: Comp<LinkProps, HTMLButtonElement | HTMLAnchorElement>;
3358
3358
  /**
3359
3359
  * Defines the props of the component.
3360
3360
  */
3361
- interface LinkPreviewProps extends GenericProps$1, HasTheme$1 {
3361
+ interface LinkPreviewProps$1 extends HasClassName, HasTheme {
3362
3362
  /** Description. */
3363
3363
  description?: string;
3364
3364
  /** Link URL. */
3365
3365
  link: string;
3366
- /** Custom react component for the link (can be used to inject react router Link). */
3366
+ /** Custom component for the link (can be used to inject a router Link). */
3367
3367
  linkAs?: 'a' | any;
3368
3368
  /** Props to pass to the link (minus those already set by the LinkPreview props). */
3369
- linkProps?: Omit<LinkProps, 'color' | 'colorVariant' | 'href' | 'target'>;
3369
+ linkProps?: GenericProps;
3370
3370
  /** Size variant. */
3371
- size?: Extract<Size$1, 'regular' | 'big'>;
3371
+ size?: Extract<Size, 'regular' | 'big'>;
3372
3372
  /** Thumbnail for the link preview. */
3373
- thumbnailProps?: ThumbnailProps;
3373
+ thumbnailProps?: GenericProps;
3374
3374
  /** Title. */
3375
3375
  title?: string;
3376
+ /** Ref forwarded to the root article element. */
3377
+ ref?: CommonRef;
3378
+ /** Heading element used to wrap the title. */
3379
+ TitleHeading: any;
3380
+ /** Link component injected by the framework wrapper. */
3381
+ Link: any;
3382
+ /** Thumbnail component injected by the framework wrapper. */
3383
+ Thumbnail: any;
3384
+ }
3385
+ type LinkPreviewPropsToOverride = 'linkProps' | 'TitleHeading' | 'Link' | 'Thumbnail' | 'thumbnailProps';
3386
+
3387
+ /**
3388
+ * Defines the props of the component.
3389
+ */
3390
+ interface LinkPreviewProps extends GenericProps$1, ReactToJSX<LinkPreviewProps$1, LinkPreviewPropsToOverride> {
3391
+ /** Props to pass to the link (minus those already set by the LinkPreview props). */
3392
+ linkProps?: Omit<LinkProps, 'color' | 'colorVariant' | 'href' | 'target'>;
3376
3393
  /** Customize the title heading tag. */
3377
3394
  titleHeading?: HeadingElement$1;
3378
3395
  }
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, NOTIFICATION_TRANSITION_DURATION, Alignment as Alignment$1 } from '@lumx/core/js/constants';
1
+ import { Kind as Kind$1, Size as Size$1, ColorPalette as ColorPalette$1, Emphasis as Emphasis$1, ColorVariant as ColorVariant$1, 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';
@@ -725,7 +725,7 @@ function resolveColorWithVariants(colorWithVariants, colorVariant) {
725
725
  * color('font', undefined); // undefined
726
726
  */
727
727
  function color(type, propColor, propColorVariant) {
728
- const [cColor, cColorVariant = ColorVariant.N] = resolveColorWithVariants(propColor, propColorVariant);
728
+ const [cColor, cColorVariant = ColorVariant$1.N] = resolveColorWithVariants(propColor, propColorVariant);
729
729
  return `lumx-color-${type}-${cColor}-${cColorVariant}`;
730
730
  }
731
731
 
@@ -972,6 +972,12 @@ const ColorPalette = {
972
972
  yellow: 'yellow',
973
973
  red: 'red',
974
974
  light: 'light'};
975
+ /**
976
+ * See SCSS variable $lumx-color-variants
977
+ */
978
+ const ColorVariant = {
979
+ N: 'N'
980
+ };
975
981
 
976
982
  /** ColorPalette with all possible color variant combination */
977
983
 
@@ -13609,13 +13615,13 @@ const CLASSNAME$E = 'lumx-link-preview';
13609
13615
  const {
13610
13616
  block: block$x,
13611
13617
  element: element$p
13612
- } = classNames.bem(CLASSNAME$E);
13618
+ } = bem(CLASSNAME$E);
13613
13619
 
13614
13620
  /**
13615
13621
  * Component default props.
13616
13622
  */
13617
13623
  const DEFAULT_PROPS$D = {
13618
- size: Size$1.regular,
13624
+ size: Size.regular,
13619
13625
  titleHeading: 'h2'
13620
13626
  };
13621
13627
 
@@ -13626,8 +13632,7 @@ const DEFAULT_PROPS$D = {
13626
13632
  * @param ref Component ref.
13627
13633
  * @return React element.
13628
13634
  */
13629
- const LinkPreview = forwardRef((props, ref) => {
13630
- const defaultTheme = useTheme() || Theme$1.light;
13635
+ const LinkPreview$1 = props => {
13631
13636
  const {
13632
13637
  className,
13633
13638
  description,
@@ -13635,19 +13640,21 @@ const LinkPreview = forwardRef((props, ref) => {
13635
13640
  linkAs,
13636
13641
  linkProps,
13637
13642
  size = DEFAULT_PROPS$D.size,
13638
- theme = defaultTheme,
13643
+ theme,
13639
13644
  thumbnailProps,
13645
+ ref,
13640
13646
  title,
13641
- titleHeading = DEFAULT_PROPS$D.titleHeading,
13647
+ TitleHeading,
13648
+ Link,
13649
+ Thumbnail,
13642
13650
  ...forwardedProps
13643
13651
  } = props;
13644
13652
  // Use title heading as title wrapper (see DEFAULT_PROPS for the default value).
13645
- const TitleHeading = titleHeading;
13646
- const adjustedSize = size === Size$1.big && thumbnailProps ? Size$1.big : Size$1.regular;
13653
+ const adjustedSize = size === Size.big && thumbnailProps ? Size.big : Size.regular;
13647
13654
  return /*#__PURE__*/jsx("article", {
13648
13655
  ref: ref,
13649
13656
  ...forwardedProps,
13650
- className: classNames.join(className, block$x({
13657
+ className: classnames(className, block$x({
13651
13658
  [`size-${adjustedSize}`]: Boolean(adjustedSize),
13652
13659
  [`theme-${theme}`]: Boolean(theme)
13653
13660
  })),
@@ -13665,7 +13672,7 @@ const LinkPreview = forwardRef((props, ref) => {
13665
13672
  // Avoid redundant links in focus order
13666
13673
  tabIndex: -1
13667
13674
  },
13668
- aspectRatio: AspectRatio$1.free,
13675
+ aspectRatio: AspectRatio.free,
13669
13676
  fillHeight: true
13670
13677
  })
13671
13678
  }), /*#__PURE__*/jsxs("div", {
@@ -13677,7 +13684,7 @@ const LinkPreview = forwardRef((props, ref) => {
13677
13684
  linkAs: linkAs,
13678
13685
  target: "_blank",
13679
13686
  href: link,
13680
- color: theme === Theme$1.light ? ColorPalette$1.dark : ColorPalette$1.light,
13687
+ color: theme === Theme.light ? ColorPalette.dark : ColorPalette.light,
13681
13688
  colorVariant: ColorVariant.N,
13682
13689
  children: title
13683
13690
  })
@@ -13689,10 +13696,10 @@ const LinkPreview = forwardRef((props, ref) => {
13689
13696
  children: /*#__PURE__*/jsx(Link, {
13690
13697
  ...linkProps,
13691
13698
  linkAs: linkAs,
13692
- className: classNames.join(element$p('link'), linkProps?.className),
13699
+ className: classnames(element$p('link'), linkProps?.className),
13693
13700
  target: "_blank",
13694
13701
  href: link,
13695
- color: theme === Theme$1.light ? ColorPalette$1.primary : ColorPalette$1.light,
13702
+ color: theme === Theme.light ? ColorPalette.primary : ColorPalette.light,
13696
13703
  colorVariant: ColorVariant.N
13697
13704
  // Avoid redundant links in focus order
13698
13705
  ,
@@ -13703,6 +13710,36 @@ const LinkPreview = forwardRef((props, ref) => {
13703
13710
  })]
13704
13711
  })
13705
13712
  });
13713
+ };
13714
+
13715
+ /**
13716
+ * Defines the props of the component.
13717
+ */
13718
+
13719
+ /**
13720
+ * LinkPreview component.
13721
+ *
13722
+ * @param props Component props.
13723
+ * @param ref Component ref.
13724
+ * @return React element.
13725
+ */
13726
+ const LinkPreview = forwardRef((props, ref) => {
13727
+ const defaultTheme = useTheme() || Theme$1.light;
13728
+ const {
13729
+ theme = defaultTheme,
13730
+ titleHeading = DEFAULT_PROPS$D.titleHeading,
13731
+ ...forwardedProps
13732
+ } = props;
13733
+ // Use title heading as title wrapper (see DEFAULT_PROPS for the default value).
13734
+ const TitleHeading = titleHeading;
13735
+ return LinkPreview$1({
13736
+ theme,
13737
+ TitleHeading,
13738
+ ref,
13739
+ Link,
13740
+ Thumbnail,
13741
+ ...forwardedProps
13742
+ });
13706
13743
  });
13707
13744
  LinkPreview.displayName = COMPONENT_NAME$D;
13708
13745
  LinkPreview.className = CLASSNAME$E;