@biblioteksentralen/react 3.0.0-beta.12 → 3.0.0-beta.14

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,14 +1,14 @@
1
- import { AlertRootProps, ButtonProps as ButtonProps$1, IconButtonProps as IconButtonProps$1, BoxProps, InputProps, FieldLabelProps, LinkProps, SystemConfig } from '@chakra-ui/react';
1
+ import { AlertRootProps, ButtonProps, IconButtonProps, InputProps, FieldLabelProps, SystemConfig } from '@chakra-ui/react';
2
2
  export * from '@chakra-ui/react';
3
3
  import { Modify } from '@biblioteksentralen/types';
4
- import React, { ReactNode, FunctionComponent, RefObject, HTMLAttributes, ErrorInfo } from 'react';
5
- import { ComponentWithAs, ThemeTypings } from '@chakra-ui/system';
4
+ import React, { ReactNode, RefObject, FunctionComponent, ErrorInfo } from 'react';
5
+ import { ComponentWithAs } from '@chakra-ui/system';
6
6
  export { colors } from '@biblioteksentralen/utils';
7
7
 
8
8
  type Status = "info" | "warning" | "success" | "error";
9
9
  type CustomVariants = "inline";
10
10
  type Variants = AlertRootProps["variant"] | CustomVariants;
11
- interface Props$7 extends Modify<AlertRootProps, {
11
+ interface Props$5 extends Modify<AlertRootProps, {
12
12
  variant?: Variants;
13
13
  }> {
14
14
  children: ReactNode;
@@ -16,7 +16,7 @@ interface Props$7 extends Modify<AlertRootProps, {
16
16
  status: Status;
17
17
  variant?: Variants;
18
18
  }
19
- 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;
20
20
 
21
21
  type CustomButtonVariants = "primary" | "secondary" | "tertiary";
22
22
 
@@ -24,41 +24,21 @@ type CustomButtonVariants = "primary" | "secondary" | "tertiary";
24
24
  * Re-exporting chackras Button with a customised types
25
25
  * This causes both chakras native variants and our home-made variants to show up in auto-complete
26
26
  */
27
- type ButtonVariants = ButtonProps$1["variant"] | CustomButtonVariants;
28
- type ButtonProps = Modify<ButtonProps$1, {
27
+ type ButtonVariants = ButtonProps["variant"] | CustomButtonVariants;
28
+ type ButtonBSProps = Modify<ButtonProps, {
29
29
  variant?: ButtonVariants;
30
30
  }>;
31
- declare const Button: ComponentWithAs<"button", ButtonProps>;
31
+ declare const ButtonBS: ComponentWithAs<"button", ButtonBSProps>;
32
32
 
33
33
  /**
34
34
  * Re-exporting chackras IconButton with a customised types
35
35
  * This causes both chakras native variants and our home-made variants to show up in auto-complete
36
36
  */
37
- type IconButtonVariants = IconButtonProps$1["variant"] | CustomButtonVariants;
38
- type IconButtonProps = Modify<IconButtonProps$1, {
37
+ type IconButtonVariants = IconButtonProps["variant"] | CustomButtonVariants;
38
+ type IconButtonBSProps = Modify<IconButtonProps, {
39
39
  variant?: IconButtonVariants;
40
40
  }>;
41
- declare const IconButton: ComponentWithAs<"button", IconButtonProps>;
42
-
43
- type Props$6 = {
44
- children: ReactNode;
45
- wrapper: FunctionComponent<{
46
- children: ReactNode;
47
- }>;
48
- condition: boolean;
49
- };
50
- /**
51
- * Conditionally wrapps children with a component. If conditions are not met children mounted without the wrapper.
52
- */
53
- declare const ConditionalWrapper: FunctionComponent<Props$6>;
54
-
55
- type Props$5 = {
56
- children: ReactNode;
57
- above?: ThemeTypings["breakpoints"];
58
- below?: ThemeTypings["breakpoints"];
59
- } & Omit<BoxProps, "display">;
60
- /** Chakras <Hide /> component uses client side javascript to hide components. Causes components to flash on mobile while loading */
61
- declare const HideWithCSS: FunctionComponent<Props$5>;
41
+ declare const IconButtonBS: ComponentWithAs<"button", IconButtonBSProps>;
62
42
 
63
43
  interface Props$4 extends InputProps {
64
44
  label: string;
@@ -72,31 +52,21 @@ interface Props$4 extends InputProps {
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,8 +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;
99
+
100
+ declare const withErrorBoundaryBS: <Props>(Component: React.ComponentType<Props>, boundaryName: string) => (props: Props & React.JSX.IntrinsicAttributes) => React.JSX.Element;
129
101
 
130
- declare const withErrorBoundary: <Props>(Component: React.ComponentType<Props>, boundaryName: string) => (props: Props & React.JSX.IntrinsicAttributes) => React.JSX.Element;
102
+ interface Props {
103
+ children: ReactNode;
104
+ customTheme?: SystemConfig;
105
+ }
106
+ declare const BiblioteksentralenProvider: (props: Props) => React.JSX.Element;
131
107
 
132
- export { Alert as AlertBS, BiblioteksentralenProvider, Button as ButtonBS, type ButtonProps as ButtonBSProps, ConditionalWrapper as ConditionalWrapperBS, ErrorBoundary as ErrorBoundaryBS, HashLinkTarget as HashLinkTargetBS, HideWithCSS as HideWithCSSBS, IconButton as IconButtonBS, type IconButtonProps as IconButtonBSProps, Input as InputBS, Link as LinkBS, VisuallyHidden as VisuallyHiddenBS, withErrorBoundary as withErrorBoundaryBS };
108
+ export { AlertBS, BiblioteksentralenProvider, ButtonBS, type ButtonBSProps, ConditionalWrapperBS, ErrorBoundaryBS, HashLinkTargetBS, IconButtonBS, type IconButtonBSProps, InputBS, withErrorBoundaryBS };