@sb1/ffe-cards-react 14.0.0 → 15.0.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.
Files changed (43) hide show
  1. package/es/CardBase.js +35 -40
  2. package/es/IconCard/IconCard.js +33 -42
  3. package/es/ImageCard/ImageCard.js +35 -40
  4. package/es/StippledCard/StippledCard.js +35 -45
  5. package/es/TextCard/TextCard.js +31 -32
  6. package/es/components/CardName.js +27 -17
  7. package/es/components/ComponentBase.js +25 -20
  8. package/es/components/Subtext.js +27 -17
  9. package/es/components/Text.js +27 -17
  10. package/es/components/Title.js +29 -23
  11. package/es/components/index.js +4 -4
  12. package/es/fixedForwardRef.js +2 -0
  13. package/es/index.js +5 -5
  14. package/es/types.js +1 -0
  15. package/lib/CardBase.js +41 -47
  16. package/lib/IconCard/IconCard.js +38 -50
  17. package/lib/ImageCard/ImageCard.js +40 -49
  18. package/lib/StippledCard/StippledCard.js +40 -51
  19. package/lib/TextCard/TextCard.js +35 -40
  20. package/lib/components/CardName.js +33 -23
  21. package/lib/components/ComponentBase.js +31 -26
  22. package/lib/components/Subtext.js +33 -23
  23. package/lib/components/Text.js +33 -23
  24. package/lib/components/Title.js +35 -29
  25. package/lib/components/index.js +10 -33
  26. package/lib/fixedForwardRef.js +5 -0
  27. package/lib/index.js +12 -40
  28. package/lib/types.js +2 -0
  29. package/package.json +7 -8
  30. package/types/CardBase.d.ts +23 -0
  31. package/types/IconCard/IconCard.d.ts +16 -0
  32. package/types/ImageCard/ImageCard.d.ts +16 -0
  33. package/types/StippledCard/StippledCard.d.ts +22 -0
  34. package/types/TextCard/TextCard.d.ts +14 -0
  35. package/types/components/CardName.d.ts +4 -0
  36. package/types/components/ComponentBase.d.ts +6 -0
  37. package/types/components/Subtext.d.ts +4 -0
  38. package/types/components/Text.d.ts +4 -0
  39. package/types/components/Title.d.ts +7 -0
  40. package/types/components/index.d.ts +4 -0
  41. package/types/fixedForwardRef.d.ts +4 -0
  42. package/types/index.d.ts +5 -87
  43. package/types/types.d.ts +15 -0
package/types/index.d.ts CHANGED
@@ -1,87 +1,5 @@
1
- import * as React from 'react';
2
-
3
- export type ComponentBaseProps = {
4
- element?: HTMLElement | string | React.ElementType;
5
- } & (React.ComponentProps<'button'> | React.ComponentProps<'a'>);
6
-
7
- type TitleProps = {
8
- overflowEllipsis?: boolean;
9
- } & ComponentBaseProps;
10
-
11
- type SubtextProps = ComponentBaseProps;
12
- type TextProps = ComponentBaseProps;
13
- type CardNameProps = ComponentBaseProps;
14
-
15
- export interface CardRenderProps {
16
- CardName: React.FC<CardNameProps>;
17
- Title: React.FC<TitleProps>;
18
- Subtext: React.FC<SubtextProps>;
19
- Text: React.FC<TextProps>;
20
- }
21
-
22
- type NoInfer<T> = [T][T extends any ? 0 : never];
23
-
24
- export interface BaseCardProps<T = {}>
25
- extends Omit<ComponentBaseProps, 'children'> {
26
- children?: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
27
- bgColor?: 'sand-30' | 'sand-70' | 'frost-30' | 'syrin-30' | 'syrin-70';
28
- bgDarkmodeColor?: 'svart' | 'natt' | 'koksgraa';
29
- shadow?: boolean;
30
- noMargin?: boolean;
31
- textCenter?: boolean;
32
- }
33
- export interface ImageCardProps<T = {}>
34
- extends Omit<ComponentBaseProps, 'children'> {
35
- imageSrc: string;
36
- imageAltText: string;
37
- children?: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
38
- }
39
-
40
- export interface IconCardProps<T = {}>
41
- extends Omit<ComponentBaseProps, 'children'> {
42
- icon: React.ReactNode;
43
- condensed?: boolean;
44
- children?: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
45
- }
46
-
47
- export interface StippledCardProps<T = {}>
48
- extends Omit<ComponentBaseProps, 'children'> {
49
- img?: {
50
- element: React.ReactNode;
51
- type: 'icon' | 'custom';
52
- };
53
- condensed?: boolean;
54
- children?: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
55
- }
56
-
57
- export interface TextCardProps extends Omit<ComponentBaseProps, 'children'> {
58
- leftAlign?: boolean;
59
- children: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
60
- }
61
-
62
- declare class CardBase<T = {}> extends React.Component<
63
- NoInfer<T> & BaseCardProps,
64
- any
65
- > {}
66
- declare class IconCard<T = {}> extends React.Component<
67
- NoInfer<T> & IconCardProps,
68
- any
69
- > {}
70
-
71
- declare class StippledCard<T = {}> extends React.Component<
72
- NoInfer<T> & StippledCardProps,
73
- any
74
- > {}
75
-
76
- declare class ImageCard<T = {}> extends React.Component<
77
- NoInfer<T> & ImageCardProps,
78
- any
79
- > {}
80
- declare class TextCard<T = {}> extends React.Component<
81
- NoInfer<T> & TextCardProps,
82
- any
83
- > {}
84
- declare class ComponentBase<T = {}> extends React.Component<
85
- NoInfer<T> & ComponentBaseProps,
86
- any
87
- > {}
1
+ export { CardBase, CardBaseProps } from './CardBase';
2
+ export { TextCard, TextCardProps } from './TextCard/TextCard';
3
+ export { IconCard, IconCardProps } from './IconCard/IconCard';
4
+ export { ImageCard, ImageCardProps } from './ImageCard/ImageCard';
5
+ export { StippledCard, StippledCardProps } from './StippledCard/StippledCard';
@@ -0,0 +1,15 @@
1
+ import React, { ComponentPropsWithRef, ElementType, ForwardedRef } from 'react';
2
+ import { CardNameProps, SubtextProps, TextProps, TitleProps } from './components';
3
+ export type DistributiveOmit<T, Omitted extends PropertyKey> = T extends any ? Omit<T, Omitted> : never;
4
+ export type ComponentAsPropParams<As extends ElementType> = {
5
+ as?: As;
6
+ } & DistributiveOmit<ComponentPropsWithRef<ElementType extends As ? 'a' : As>, 'as' & {
7
+ ref: ForwardedRef<any>;
8
+ }>;
9
+ export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
10
+ export interface CardRenderProps {
11
+ CardName: React.ElementType<CardNameProps>;
12
+ Title: React.ElementType<TitleProps>;
13
+ Subtext: React.ElementType<SubtextProps>;
14
+ Text: React.ElementType<TextProps>;
15
+ }