@biblioteksentralen/react 2.0.1 → 3.0.0-beta.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/dist/index.d.ts CHANGED
@@ -1,18 +1,23 @@
1
- import { FlexProps, AlertProps, ComponentWithAs, ButtonProps, ThemeTypings, BoxProps, InputProps, FormLabelProps, LinkProps, ChakraTheme } from '@chakra-ui/react';
1
+ import { AlertRootProps, ButtonProps as ButtonProps$1, IconButtonProps as IconButtonProps$1, BoxProps, InputProps, FieldLabelProps, LinkProps, SystemConfig, ToastRootProps } from '@chakra-ui/react';
2
2
  export * from '@chakra-ui/react';
3
- import React, { ReactNode, FunctionComponent, HTMLAttributes, ErrorInfo } from 'react';
3
+ import { ComponentWithAs, ThemeTypings } from '@chakra-ui/system';
4
+ export { ResponsiveObject, StyleProps } from '@chakra-ui/system';
4
5
  import { Modify } from '@biblioteksentralen/types';
6
+ import React, { ReactNode, FunctionComponent, HTMLAttributes, ErrorInfo } from 'react';
5
7
  export { colors } from '@biblioteksentralen/utils';
6
- import { ChakraTheme as ChakraTheme$1 } from '@chakra-ui/theme';
7
8
 
8
- type Status = Exclude<AlertProps["status"], undefined | "loading">;
9
- type Variants = "inline";
10
- interface Props$7 extends FlexProps {
9
+ type Status = "info" | "warning" | "success" | "error";
10
+ type CustomVariants = "inline";
11
+ type Variants = AlertRootProps["variant"] | CustomVariants;
12
+ interface Props$7 extends Modify<AlertRootProps, {
13
+ variant?: Variants;
14
+ }> {
11
15
  children: ReactNode;
16
+ header?: ReactNode;
12
17
  status: Status;
13
18
  variant?: Variants;
14
19
  }
15
- declare function Alert({ status, children, variant, ...rest }: Props$7): React.JSX.Element;
20
+ declare function Alert({ status, children, variant, header, ...rest }: Props$7): React.JSX.Element;
16
21
 
17
22
  type CustomButtonVariants = "primary" | "secondary" | "tertiary";
18
23
 
@@ -20,10 +25,21 @@ type CustomButtonVariants = "primary" | "secondary" | "tertiary";
20
25
  * Re-exporting chackras Button with a customised types
21
26
  * This causes both chakras native variants and our home-made variants to show up in auto-complete
22
27
  */
23
- type ButtonVariants = ButtonProps["variant"] | CustomButtonVariants;
24
- declare const Button: ComponentWithAs<"button", Modify<ButtonProps, {
28
+ type ButtonVariants = ButtonProps$1["variant"] | CustomButtonVariants;
29
+ type ButtonProps = Modify<ButtonProps$1, {
25
30
  variant?: ButtonVariants;
26
- }>>;
31
+ }>;
32
+ declare const Button: ComponentWithAs<"button", ButtonProps>;
33
+
34
+ /**
35
+ * Re-exporting chackras IconButton with a customised types
36
+ * This causes both chakras native variants and our home-made variants to show up in auto-complete
37
+ */
38
+ type IconButtonVariants = IconButtonProps$1["variant"] | CustomButtonVariants;
39
+ type IconButtonProps = Modify<IconButtonProps$1, {
40
+ variant?: IconButtonVariants;
41
+ }>;
42
+ declare const IconButton: ComponentWithAs<"button", IconButtonProps>;
27
43
 
28
44
  type Props$6 = {
29
45
  children: ReactNode;
@@ -48,7 +64,7 @@ declare const HideWithCSS: FunctionComponent<Props$5>;
48
64
  interface Props$4 extends InputProps {
49
65
  label: string;
50
66
  hideLabel?: boolean;
51
- labelProps?: FormLabelProps;
67
+ labelProps?: FieldLabelProps;
52
68
  helperText?: string;
53
69
  errorMessage?: string;
54
70
  }
@@ -56,9 +72,9 @@ interface Props$4 extends InputProps {
56
72
  * Creating custom input-component to make sure label is always set (for accessibility)
57
73
  * Also handles some common needs (helper text and error message. For more advanced input-components we leave it to the consumers to compose custom input-components based on Chakra
58
74
  */
59
- declare const Input: React.ForwardRefExoticComponent<Props$4 & React.RefAttributes<unknown>>;
75
+ declare const Input: (props: Props$4) => React.JSX.Element;
60
76
 
61
- type CustomLinkVariants = "plain";
77
+ type CustomLinkVariants = "plain" | "underline";
62
78
 
63
79
  /**
64
80
  * Re-exporting chackras Link with a customised types
@@ -76,7 +92,7 @@ declare function VisuallyHidden({ children, ...rest }: Props$3): React.JSX.Eleme
76
92
 
77
93
  interface Props$2 {
78
94
  children: ReactNode;
79
- customTheme?: Partial<ChakraTheme>;
95
+ customTheme?: SystemConfig;
80
96
  }
81
97
  declare const BiblioteksentralenProvider: (props: Props$2) => React.JSX.Element;
82
98
 
@@ -95,7 +111,7 @@ declare class ErrorBoundary extends React.Component<Props$1, State> {
95
111
  hasError: boolean;
96
112
  };
97
113
  componentDidCatch(error: any, errorInfo: any): void;
98
- render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
114
+ render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
99
115
  }
100
116
 
101
117
  interface Props {
@@ -111,8 +127,9 @@ interface Props {
111
127
  }
112
128
  declare function HashLinkTarget(props: Props): React.JSX.Element;
113
129
 
114
- declare const withErrorBoundary: <Props>(Component: React.ComponentType<Props>, boundaryName: string) => React.ForwardRefExoticComponent<React.PropsWithoutRef<Props> & React.RefAttributes<unknown>>;
130
+ declare const withErrorBoundary: <Props>(Component: React.ComponentType<Props>, boundaryName: string) => (props: Props & React.JSX.IntrinsicAttributes) => React.JSX.Element;
115
131
 
116
- declare const biblioteksentralenChakraTheme: Partial<ChakraTheme$1>;
132
+ declare const toaster: ToastRootProps;
133
+ declare const Toaster: () => React.JSX.Element;
117
134
 
118
- export { Alert, BiblioteksentralenProvider, Button, ConditionalWrapper, ErrorBoundary, HashLinkTarget, HideWithCSS, Input, Link, VisuallyHidden, biblioteksentralenChakraTheme, withErrorBoundary };
135
+ export { Alert, BiblioteksentralenProvider, Button, type ButtonProps, ConditionalWrapper, ErrorBoundary, HashLinkTarget, HideWithCSS, IconButton, type IconButtonProps, Input, Link, Toaster, VisuallyHidden, toaster, withErrorBoundary };