@biblioteksentralen/react 3.0.0-beta.8 → 3.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.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,14 @@
1
- import { AlertRootProps, ButtonProps as ButtonProps$1, IconButtonProps as IconButtonProps$1, BoxProps, InputProps, FieldLabelProps, LinkProps, SystemConfig, ToastRootProps } from '@chakra-ui/react';
1
+ import { AlertRootProps, ButtonProps, IconButtonProps, InputProps, FieldLabelProps, SystemConfig } from '@chakra-ui/react';
2
2
  export * from '@chakra-ui/react';
3
- import { ComponentWithAs, ThemeTypings } from '@chakra-ui/system';
4
- export { ResponsiveObject, StyleProps } from '@chakra-ui/system';
5
3
  import { Modify } from '@biblioteksentralen/types';
6
- import React, { ReactNode, FunctionComponent, HTMLAttributes, ErrorInfo } from 'react';
4
+ import React, { ReactNode, RefObject, FunctionComponent, ErrorInfo } from 'react';
5
+ import { ComponentWithAs } from '@chakra-ui/system';
7
6
  export { colors } from '@biblioteksentralen/utils';
8
7
 
9
8
  type Status = "info" | "warning" | "success" | "error";
10
9
  type CustomVariants = "inline";
11
10
  type Variants = AlertRootProps["variant"] | CustomVariants;
12
- interface Props$7 extends Modify<AlertRootProps, {
11
+ interface Props$5 extends Modify<AlertRootProps, {
13
12
  variant?: Variants;
14
13
  }> {
15
14
  children: ReactNode;
@@ -17,7 +16,7 @@ interface Props$7 extends Modify<AlertRootProps, {
17
16
  status: Status;
18
17
  variant?: Variants;
19
18
  }
20
- declare function Alert({ status, children, variant, header, ...rest }: Props$7): React.JSX.Element;
19
+ declare function AlertBS({ status, children, variant, header, ...rest }: Props$5): React.JSX.Element;
21
20
 
22
21
  type CustomButtonVariants = "primary" | "secondary" | "tertiary";
23
22
 
@@ -25,41 +24,21 @@ type CustomButtonVariants = "primary" | "secondary" | "tertiary";
25
24
  * Re-exporting chackras Button with a customised types
26
25
  * This causes both chakras native variants and our home-made variants to show up in auto-complete
27
26
  */
28
- type ButtonVariants = ButtonProps$1["variant"] | CustomButtonVariants;
29
- type ButtonProps = Modify<ButtonProps$1, {
27
+ type ButtonVariants = ButtonProps["variant"] | CustomButtonVariants;
28
+ type ButtonBSProps = Modify<ButtonProps, {
30
29
  variant?: ButtonVariants;
31
30
  }>;
32
- declare const Button: ComponentWithAs<"button", ButtonProps>;
31
+ declare const ButtonBS: ComponentWithAs<"button", ButtonBSProps>;
33
32
 
34
33
  /**
35
34
  * Re-exporting chackras IconButton with a customised types
36
35
  * This causes both chakras native variants and our home-made variants to show up in auto-complete
37
36
  */
38
- type IconButtonVariants = IconButtonProps$1["variant"] | CustomButtonVariants;
39
- type IconButtonProps = Modify<IconButtonProps$1, {
37
+ type IconButtonVariants = IconButtonProps["variant"] | CustomButtonVariants;
38
+ type IconButtonBSProps = Modify<IconButtonProps, {
40
39
  variant?: IconButtonVariants;
41
40
  }>;
42
- declare const IconButton: ComponentWithAs<"button", IconButtonProps>;
43
-
44
- type Props$6 = {
45
- children: ReactNode;
46
- wrapper: FunctionComponent<{
47
- children: ReactNode;
48
- }>;
49
- condition: boolean;
50
- };
51
- /**
52
- * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.
53
- */
54
- declare const ConditionalWrapper: FunctionComponent<Props$6>;
55
-
56
- type Props$5 = {
57
- children: ReactNode;
58
- above?: ThemeTypings["breakpoints"];
59
- below?: ThemeTypings["breakpoints"];
60
- } & Omit<BoxProps, "display">;
61
- /** Chakras <Hide /> component uses client side javascript to hide components. Causes components to flash on mobile while loading */
62
- declare const HideWithCSS: FunctionComponent<Props$5>;
41
+ declare const IconButtonBS: ComponentWithAs<"button", IconButtonBSProps>;
63
42
 
64
43
  interface Props$4 extends InputProps {
65
44
  label: string;
@@ -67,36 +46,27 @@ interface Props$4 extends InputProps {
67
46
  labelProps?: FieldLabelProps;
68
47
  helperText?: string;
69
48
  errorMessage?: string;
49
+ ref?: RefObject<HTMLInputElement | null>;
70
50
  }
71
51
  /**
72
52
  * Creating custom input-component to make sure label is always set (for accessibility)
73
53
  * 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
74
54
  */
75
- declare const Input: (props: Props$4) => React.JSX.Element;
76
-
77
- type CustomLinkVariants = "plain" | "underline";
55
+ declare const InputBS: (props: Props$4) => React.JSX.Element;
78
56
 
57
+ type Props$3 = {
58
+ children: ReactNode;
59
+ wrapper: FunctionComponent<{
60
+ children: ReactNode;
61
+ }>;
62
+ condition: boolean;
63
+ };
79
64
  /**
80
- * Re-exporting chackras Link with a customised types
81
- * This causes both chakras native variants and our home-made variants to show up in auto-complete
65
+ * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.
82
66
  */
83
- type LinkVariants = LinkProps["variant"] | CustomLinkVariants;
84
- declare const Link: ComponentWithAs<"a", Modify<LinkProps, {
85
- variant?: LinkVariants;
86
- }>>;
87
-
88
- interface Props$3 extends HTMLAttributes<HTMLSpanElement> {
89
- children: ReactNode;
90
- }
91
- declare function VisuallyHidden({ children, ...rest }: Props$3): React.JSX.Element;
67
+ declare const ConditionalWrapperBS: FunctionComponent<Props$3>;
92
68
 
93
69
  interface Props$2 {
94
- children: ReactNode;
95
- customTheme?: SystemConfig;
96
- }
97
- declare const BiblioteksentralenProvider: (props: Props$2) => React.JSX.Element;
98
-
99
- interface Props$1 {
100
70
  boundaryName?: string;
101
71
  children: ReactNode;
102
72
  }
@@ -105,7 +75,7 @@ interface State {
105
75
  error?: Error;
106
76
  errorInfo?: ErrorInfo;
107
77
  }
108
- declare class ErrorBoundary extends React.Component<Props$1, State> {
78
+ declare class ErrorBoundaryBS extends React.Component<Props$2, State> {
109
79
  constructor(props: any);
110
80
  static getDerivedStateFromError(error: any): {
111
81
  hasError: boolean;
@@ -114,7 +84,7 @@ declare class ErrorBoundary extends React.Component<Props$1, State> {
114
84
  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;
115
85
  }
116
86
 
117
- interface Props {
87
+ interface Props$1 {
118
88
  id: string;
119
89
  /**
120
90
  * angir hvor mye luft til vil ha over HashLinkTarget ved bruk av hash-lenke, eks '4rem'
@@ -125,11 +95,14 @@ interface Props {
125
95
  */
126
96
  focusOnParent?: boolean;
127
97
  }
128
- declare function HashLinkTarget(props: Props): React.JSX.Element;
98
+ declare function HashLinkTargetBS(props: Props$1): React.JSX.Element;
129
99
 
130
- declare const withErrorBoundary: <Props>(Component: React.ComponentType<Props>, boundaryName: string) => (props: Props & React.JSX.IntrinsicAttributes) => React.JSX.Element;
100
+ declare const withErrorBoundaryBS: <Props>(Component: React.ComponentType<Props>, boundaryName: string) => (props: Props & React.JSX.IntrinsicAttributes) => React.JSX.Element;
131
101
 
132
- declare const toaster: ToastRootProps;
133
- declare const Toaster: () => React.JSX.Element;
102
+ interface Props {
103
+ children: ReactNode;
104
+ customTheme?: SystemConfig;
105
+ }
106
+ declare const BiblioteksentralenProvider: (props: Props) => React.JSX.Element;
134
107
 
135
- export { Alert, BiblioteksentralenProvider, Button, type ButtonProps, ConditionalWrapper, ErrorBoundary, HashLinkTarget, HideWithCSS, IconButton, type IconButtonProps, Input, Link, Toaster, VisuallyHidden, toaster, withErrorBoundary };
108
+ export { AlertBS, BiblioteksentralenProvider, ButtonBS, type ButtonBSProps, ConditionalWrapperBS, ErrorBoundaryBS, HashLinkTargetBS, IconButtonBS, type IconButtonBSProps, InputBS, withErrorBoundaryBS };