@sb1/ffe-cards-react 10.0.4 → 11.0.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/types/index.d.ts +27 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-cards-react",
3
- "version": "10.0.4",
3
+ "version": "11.0.0",
4
4
  "description": "React implementation of ffe-react",
5
5
  "license": "MIT",
6
6
  "author": "SpareBank 1",
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "1ab898e744977e4cb4db1bee9b65369a0deeef9a"
43
+ "gitHead": "b919e0b93e9e793893c3f804eba92591cfad81d7"
44
44
  }
package/types/index.d.ts CHANGED
@@ -9,10 +9,6 @@ type ComponentBaseProps =
9
9
  | React.ComponentProps<'button'>
10
10
  | React.ComponentProps<'a'>;
11
11
 
12
- type CardBaseProps = {
13
- to?: string;
14
- } & ComponentBaseProps;
15
-
16
12
  type TitleProps = {
17
13
  overflowEllipsis?: boolean;
18
14
  } & ComponentBaseProps;
@@ -28,26 +24,45 @@ export interface CardRenderProps {
28
24
  Text: React.FC<TextProps>;
29
25
  }
30
26
 
31
- export interface ImageCardProps extends Omit<CardBaseProps, 'children'> {
27
+ type NoInfer<T> = [T][T extends any ? 0 : never];
28
+
29
+ export interface ImageCardProps<T = {}>
30
+ extends Omit<ComponentBaseProps, 'children'> {
32
31
  imageSrc: string;
33
32
  imageAltText: string;
34
33
  children?: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
35
34
  }
36
35
 
37
- export interface IconCardProps extends Omit<CardBaseProps, 'children'> {
36
+ export interface IconCardProps<T = {}>
37
+ extends Omit<ComponentBaseProps, 'children'> {
38
38
  icon: React.ReactNode;
39
39
  condensed?: boolean;
40
40
  greyCharcoal?: boolean;
41
41
  children?: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
42
42
  }
43
43
 
44
- export interface TextCardProps extends Omit<CardBaseProps, 'children'> {
44
+ export interface TextCardProps extends Omit<ComponentBaseProps, 'children'> {
45
45
  leftAlign?: boolean;
46
46
  children: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
47
47
  }
48
48
 
49
- declare class CardBase extends React.Component<CardBaseProps, any> {}
50
- declare class IconCard extends React.Component<IconCardProps, any> {}
51
- declare class ImageCard extends React.Component<ImageCardProps, any> {}
52
- declare class TextCard extends React.Component<TextCardProps, any> {}
53
- declare class ComponentBase extends React.Component<ComponentBaseProps, any> {}
49
+ declare class CardBase<T = {}> extends React.Component<
50
+ NoInfer<T> & ComponentBaseProps,
51
+ any
52
+ > {}
53
+ declare class IconCard<T = {}> extends React.Component<
54
+ NoInfer<T> & IconCardProps,
55
+ any
56
+ > {}
57
+ declare class ImageCard<T = {}> extends React.Component<
58
+ NoInfer<T> & ImageCardProps,
59
+ any
60
+ > {}
61
+ declare class TextCard<T = {}> extends React.Component<
62
+ NoInfer<T> & TextCardProps,
63
+ any
64
+ > {}
65
+ declare class ComponentBase<T = {}> extends React.Component<
66
+ NoInfer<T> & ComponentBaseProps,
67
+ any
68
+ > {}