@biblioteksentralen/react 3.0.0-beta.11 → 3.0.0-beta.13
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/README.md +11 -11
- package/dist/index.d.ts +31 -59
- package/dist/index.js +172 -350
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +88 -161
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# React library for reusable code in Biblioteksentralens js-apps
|
|
2
|
-
|
|
3
|
-
Simple React utility library for usage in Biblioteksentralen. Feel free to use, but functionality might not work as expected outside Biblioteksentralen context.
|
|
4
|
-
|
|
5
|
-
Written in typescript.
|
|
6
|
-
|
|
7
|
-
React components are written for usage in Nextjs, and might rely upon nextjs to work properly.
|
|
8
|
-
|
|
9
|
-
## Storybook
|
|
10
|
-
|
|
11
|
-
We have a storybook you can visit to see our components here: [https://biblioteksentralen.github.io/js-utils](https://biblioteksentralen.github.io/js-utils)
|
|
1
|
+
# React library for reusable code in Biblioteksentralens js-apps
|
|
2
|
+
|
|
3
|
+
Simple React utility library for usage in Biblioteksentralen. Feel free to use, but functionality might not work as expected outside Biblioteksentralen context.
|
|
4
|
+
|
|
5
|
+
Written in typescript.
|
|
6
|
+
|
|
7
|
+
React components are written for usage in Nextjs, and might rely upon nextjs to work properly.
|
|
8
|
+
|
|
9
|
+
## Storybook
|
|
10
|
+
|
|
11
|
+
We have a storybook you can visit to see our components here: [https://biblioteksentralen.github.io/js-utils](https://biblioteksentralen.github.io/js-utils)
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { AlertRootProps, ButtonProps
|
|
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,
|
|
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$
|
|
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
|
|
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
|
|
29
|
-
type
|
|
27
|
+
type ButtonVariants = ButtonProps["variant"] | CustomButtonVariants;
|
|
28
|
+
type ButtonBSProps = Modify<ButtonProps, {
|
|
30
29
|
variant?: ButtonVariants;
|
|
31
30
|
}>;
|
|
32
|
-
declare const
|
|
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
|
|
39
|
-
type
|
|
37
|
+
type IconButtonVariants = IconButtonProps["variant"] | CustomButtonVariants;
|
|
38
|
+
type IconButtonBSProps = Modify<IconButtonProps, {
|
|
40
39
|
variant?: IconButtonVariants;
|
|
41
40
|
}>;
|
|
42
|
-
declare const
|
|
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;
|
|
@@ -73,31 +52,21 @@ interface Props$4 extends InputProps {
|
|
|
73
52
|
* Creating custom input-component to make sure label is always set (for accessibility)
|
|
74
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
|
|
75
54
|
*/
|
|
76
|
-
declare const
|
|
77
|
-
|
|
78
|
-
type CustomLinkVariants = "plain" | "underline";
|
|
55
|
+
declare const InputBS: (props: Props$4) => React.JSX.Element;
|
|
79
56
|
|
|
57
|
+
type Props$3 = {
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
wrapper: FunctionComponent<{
|
|
60
|
+
children: ReactNode;
|
|
61
|
+
}>;
|
|
62
|
+
condition: boolean;
|
|
63
|
+
};
|
|
80
64
|
/**
|
|
81
|
-
*
|
|
82
|
-
* 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.
|
|
83
66
|
*/
|
|
84
|
-
|
|
85
|
-
declare const Link: ComponentWithAs<"a", Modify<LinkProps, {
|
|
86
|
-
variant?: LinkVariants;
|
|
87
|
-
}>>;
|
|
88
|
-
|
|
89
|
-
interface Props$3 extends HTMLAttributes<HTMLSpanElement> {
|
|
90
|
-
children: ReactNode;
|
|
91
|
-
}
|
|
92
|
-
declare function VisuallyHidden({ children, ...rest }: Props$3): React.JSX.Element;
|
|
67
|
+
declare const ConditionalWrapperBS: FunctionComponent<Props$3>;
|
|
93
68
|
|
|
94
69
|
interface Props$2 {
|
|
95
|
-
children: ReactNode;
|
|
96
|
-
customTheme?: SystemConfig;
|
|
97
|
-
}
|
|
98
|
-
declare const BiblioteksentralenProvider: (props: Props$2) => React.JSX.Element;
|
|
99
|
-
|
|
100
|
-
interface Props$1 {
|
|
101
70
|
boundaryName?: string;
|
|
102
71
|
children: ReactNode;
|
|
103
72
|
}
|
|
@@ -106,7 +75,7 @@ interface State {
|
|
|
106
75
|
error?: Error;
|
|
107
76
|
errorInfo?: ErrorInfo;
|
|
108
77
|
}
|
|
109
|
-
declare class
|
|
78
|
+
declare class ErrorBoundaryBS extends React.Component<Props$2, State> {
|
|
110
79
|
constructor(props: any);
|
|
111
80
|
static getDerivedStateFromError(error: any): {
|
|
112
81
|
hasError: boolean;
|
|
@@ -115,7 +84,7 @@ declare class ErrorBoundary extends React.Component<Props$1, State> {
|
|
|
115
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;
|
|
116
85
|
}
|
|
117
86
|
|
|
118
|
-
interface Props {
|
|
87
|
+
interface Props$1 {
|
|
119
88
|
id: string;
|
|
120
89
|
/**
|
|
121
90
|
* angir hvor mye luft til vil ha over HashLinkTarget ved bruk av hash-lenke, eks '4rem'
|
|
@@ -126,11 +95,14 @@ interface Props {
|
|
|
126
95
|
*/
|
|
127
96
|
focusOnParent?: boolean;
|
|
128
97
|
}
|
|
129
|
-
declare function
|
|
98
|
+
declare function HashLinkTargetBS(props: Props$1): React.JSX.Element;
|
|
130
99
|
|
|
131
|
-
declare const
|
|
100
|
+
declare const withErrorBoundaryBS: <Props>(Component: React.ComponentType<Props>, boundaryName: string) => (props: Props & React.JSX.IntrinsicAttributes) => React.JSX.Element;
|
|
132
101
|
|
|
133
|
-
|
|
134
|
-
|
|
102
|
+
interface Props {
|
|
103
|
+
children: ReactNode;
|
|
104
|
+
customTheme?: SystemConfig;
|
|
105
|
+
}
|
|
106
|
+
declare const BiblioteksentralenProvider: (props: Props) => React.JSX.Element;
|
|
135
107
|
|
|
136
|
-
export {
|
|
108
|
+
export { AlertBS, BiblioteksentralenProvider, ButtonBS, type ButtonBSProps, ConditionalWrapperBS, ErrorBoundaryBS, HashLinkTargetBS, IconButtonBS, type IconButtonBSProps, InputBS, withErrorBoundaryBS };
|