blue-react 9.12.1 → 10.0.0-rc2
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 +37 -4
- package/dist/components/A.js +8 -23
- package/dist/components/ActionMenu.js +33 -65
- package/dist/components/ActionMenuItem.js +12 -36
- package/dist/components/Body.js +13 -27
- package/dist/components/Caret.js +6 -9
- package/dist/components/Chevron.js +14 -24
- package/dist/components/HashRouter.js +176 -0
- package/dist/components/Header.js +3 -13
- package/dist/components/HeaderTitle.js +24 -43
- package/dist/components/IconMenuItem.js +17 -33
- package/dist/components/Intro.js +12 -22
- package/dist/components/Layout.js +72 -360
- package/dist/components/MenuItem.js +41 -83
- package/dist/components/Modal.js +53 -86
- package/dist/components/ModalProvider.js +70 -125
- package/dist/components/Outside.js +13 -29
- package/dist/components/Page.js +18 -44
- package/dist/components/Search.js +47 -85
- package/dist/components/SidebarMenu.js +8 -68
- package/dist/components/SidebarMenuItem.js +34 -65
- package/dist/components/SidebarToggler.js +12 -22
- package/dist/components/SlimContainer.js +6 -16
- package/dist/components/Status.js +33 -44
- package/dist/components/StatusProvider.js +28 -65
- package/dist/components/Switch.js +17 -23
- package/dist/components/ToastProvider.js +43 -83
- package/dist/components/Utilities.js +23 -45
- package/dist/components/shared.js +1 -11
- package/dist/style.scss +1 -1
- package/dist/types/components/A.d.ts +9 -9
- package/dist/types/components/ActionMenu.d.ts +25 -25
- package/dist/types/components/ActionMenuItem.d.ts +34 -35
- package/dist/types/components/Body.d.ts +20 -21
- package/dist/types/components/Caret.d.ts +18 -18
- package/dist/types/components/Chevron.d.ts +17 -17
- package/dist/types/components/HashRouter.d.ts +76 -0
- package/dist/types/components/Header.d.ts +8 -8
- package/dist/types/components/HeaderTitle.d.ts +39 -40
- package/dist/types/components/IconMenuItem.d.ts +18 -19
- package/dist/types/components/Intro.d.ts +22 -23
- package/dist/types/components/Layout.d.ts +9 -144
- package/dist/types/components/MenuItem.d.ts +149 -149
- package/dist/types/components/Modal.d.ts +30 -30
- package/dist/types/components/ModalProvider.d.ts +21 -21
- package/dist/types/components/Outside.d.ts +17 -17
- package/dist/types/components/Page.d.ts +11 -12
- package/dist/types/components/Search.d.ts +36 -36
- package/dist/types/components/SidebarMenu.d.ts +31 -32
- package/dist/types/components/SidebarMenuItem.d.ts +21 -22
- package/dist/types/components/SidebarToggler.d.ts +10 -10
- package/dist/types/components/SlimContainer.d.ts +10 -10
- package/dist/types/components/Status.d.ts +12 -12
- package/dist/types/components/StatusProvider.d.ts +15 -15
- package/dist/types/components/Switch.d.ts +33 -33
- package/dist/types/components/ToastProvider.d.ts +22 -22
- package/dist/types/components/Utilities.d.ts +41 -41
- package/dist/types/components/shared.d.ts +15 -15
- package/index.d.ts +8 -12
- package/index.js +56 -29
- package/package.json +28 -45
- package/dist/components/ActionMenuSwitch.js +0 -44
- package/dist/style.css +0 -12836
- package/dist/style.min.css +0 -16
- package/dist/types/components/ActionMenuSwitch.d.ts +0 -12
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export default function ActionMenuItem({ children, ...props }: ActionMenuItemProps): JSX.Element;
|
|
1
|
+
import { MenuItemProps } from "./MenuItem";
|
|
2
|
+
export interface ActionMenuItemProps extends MenuItemProps {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Use this instead of `MenuItem` when you want to use it inside an `ActionMenu` to make it appear as a dropdown.
|
|
6
|
+
*
|
|
7
|
+
* It basically is a shortcut. Instead of writing:
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <ActionMenu>
|
|
11
|
+
* <div className="position-relative z-1">
|
|
12
|
+
* <MenuItem
|
|
13
|
+
* label="Parent"
|
|
14
|
+
* supportOutside
|
|
15
|
+
* dropdownClassName={`position-md-absolute end-0 d-flex flex-column`}
|
|
16
|
+
* >
|
|
17
|
+
* <MenuItem label="Item 1" />
|
|
18
|
+
* </MenuItem>
|
|
19
|
+
* </div>
|
|
20
|
+
* </ActionMenu>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* you can write:
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <ActionMenu>
|
|
26
|
+
* <ActionMenuItem label="Parent">
|
|
27
|
+
* <MenuItem label="Item 1" />
|
|
28
|
+
* </MenuItem>
|
|
29
|
+
* </ActionMenu>
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* The responsive utility class for absolute position (`position-md-absolute` in this example) is automatically added based on the `break` param of the parent `ActionMenu`.
|
|
33
|
+
*/
|
|
34
|
+
export default function ActionMenuItem({ children, ...props }: ActionMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export default function Body({ id, className, containerClass, hasActions, onClick, children, ...rest }: BodyProps): JSX.Element;
|
|
1
|
+
import { breakOption } from "./shared";
|
|
2
|
+
export interface BodyProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Class name for the container. More info: https://getbootstrap.com/docs/4.0/layout/overview/#containers
|
|
7
|
+
*/
|
|
8
|
+
containerClass?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Set `true` if this page uses `<Actions />`, so this component will get enough padding to avoid overlapping of the content.
|
|
11
|
+
*/
|
|
12
|
+
hasActions?: boolean;
|
|
13
|
+
break?: breakOption;
|
|
14
|
+
onClick?: (event: any) => void;
|
|
15
|
+
children?: any;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Contains the content of the page.
|
|
19
|
+
*/
|
|
20
|
+
export default function Body({ id, className, containerClass, hasActions, onClick, children, ...rest }: BodyProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { CSSProperties } from "react";
|
|
2
|
-
export interface CaretProps {
|
|
3
|
-
/**
|
|
4
|
-
* Indicates if open or not.
|
|
5
|
-
*/
|
|
6
|
-
open?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* By default the caret points to the right when closed. Set mirrored and it will point to the left.
|
|
9
|
-
*/
|
|
10
|
-
mirrored?: boolean;
|
|
11
|
-
className?: string;
|
|
12
|
-
style?: CSSProperties;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Will be replaced by the `Chevron` component in the next major version.
|
|
16
|
-
* Caret icon component.
|
|
17
|
-
*/
|
|
18
|
-
export default function Caret({ open, mirrored, className, style }: CaretProps): JSX.Element;
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
export interface CaretProps {
|
|
3
|
+
/**
|
|
4
|
+
* Indicates if open or not.
|
|
5
|
+
*/
|
|
6
|
+
open?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* By default the caret points to the right when closed. Set mirrored and it will point to the left.
|
|
9
|
+
*/
|
|
10
|
+
mirrored?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Will be replaced by the `Chevron` component in the next major version.
|
|
16
|
+
* Caret icon component.
|
|
17
|
+
*/
|
|
18
|
+
export default function Caret({ open, mirrored, className, style }: CaretProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { CSSProperties } from "react";
|
|
2
|
-
export interface ChevronProps {
|
|
3
|
-
/**
|
|
4
|
-
* Indicates if open or not.
|
|
5
|
-
*/
|
|
6
|
-
open?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* By default the chevron points to the right when closed. Set mirrored and it will point to the left.
|
|
9
|
-
*/
|
|
10
|
-
mirrored?: boolean;
|
|
11
|
-
className?: string;
|
|
12
|
-
style?: CSSProperties;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Chevron icon component with open state.
|
|
16
|
-
*/
|
|
17
|
-
export default function Chevron({ open, mirrored, className, style }: ChevronProps): JSX.Element;
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
export interface ChevronProps {
|
|
3
|
+
/**
|
|
4
|
+
* Indicates if open or not.
|
|
5
|
+
*/
|
|
6
|
+
open?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* By default the chevron points to the right when closed. Set mirrored and it will point to the left.
|
|
9
|
+
*/
|
|
10
|
+
mirrored?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Chevron icon component with open state.
|
|
16
|
+
*/
|
|
17
|
+
export default function Chevron({ open, mirrored, className, style }: ChevronProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Component, ReactNode } from "react";
|
|
2
|
+
declare global {
|
|
3
|
+
interface Window {
|
|
4
|
+
blueHashRouterRef: any;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export interface HashRouterProps {
|
|
8
|
+
/**
|
|
9
|
+
* Registers pages for the built-in routing system. Example: `[{name: "home", component: <HomePage />}]`
|
|
10
|
+
*/
|
|
11
|
+
pages?: {
|
|
12
|
+
name: string;
|
|
13
|
+
component: ReactNode;
|
|
14
|
+
}[];
|
|
15
|
+
/**
|
|
16
|
+
* When `true`, always the "home" route will be rendered.
|
|
17
|
+
*/
|
|
18
|
+
unrouteable?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* By default, the document title will automatically set. Set this prop to `true` to disable this behaviour.
|
|
21
|
+
*/
|
|
22
|
+
disableTitleSet?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Define a function, that will be fired when switching routes. When your function returns `true`, the default route behaviour will be blocked.
|
|
25
|
+
* You can use something like `window.blueHashRouterRef.setState({ blockRouting: onHashChange })` globally to set the value from anywhere in your app.
|
|
26
|
+
*/
|
|
27
|
+
blockRouting?: (newMatch: string[], currentMatch: string[]) => void | boolean;
|
|
28
|
+
children?: any;
|
|
29
|
+
}
|
|
30
|
+
export interface HashRouterState {
|
|
31
|
+
match: any;
|
|
32
|
+
history: string[];
|
|
33
|
+
hash: string;
|
|
34
|
+
hashHistory: string[];
|
|
35
|
+
blockRouting?: (newMatch: string[], currentMatch: string[]) => void | boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Component for simple hash routing. It's recommended to use solutions like `react-router-dom` for more complex routing.
|
|
39
|
+
*
|
|
40
|
+
* As soon this component is mounted, it is globally available under `window.blueHashRouterRef`.
|
|
41
|
+
* You can also append your own event listeners.
|
|
42
|
+
*
|
|
43
|
+
* Allowed events:
|
|
44
|
+
*
|
|
45
|
+
* * **componentDidUpdate** - Component was updated.
|
|
46
|
+
* Example: `window.blueHashRouterRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
47
|
+
* * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
|
|
48
|
+
* Example: `window.blueHashRouterRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
49
|
+
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
50
|
+
* Example: `window.blueHashRouterRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
51
|
+
*
|
|
52
|
+
* Method to add event listeners:
|
|
53
|
+
* * `window.blueHashRouterRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
|
|
54
|
+
*
|
|
55
|
+
* Methods to remove event listeners:
|
|
56
|
+
* * `window.blueHashRouterRef.`**removeEventListener**`(eventName: string, listenerId: string)`
|
|
57
|
+
* * `window.blueHashRouterRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
|
|
58
|
+
*/
|
|
59
|
+
export default class HashRouter extends Component<HashRouterProps, HashRouterState> {
|
|
60
|
+
defaultMatch: string[];
|
|
61
|
+
eventListeners: any[];
|
|
62
|
+
constructor(props: HashRouterProps);
|
|
63
|
+
onHashChange(): void;
|
|
64
|
+
static get defaultProps(): {
|
|
65
|
+
unrouteable: boolean;
|
|
66
|
+
disableTitleSet: boolean;
|
|
67
|
+
};
|
|
68
|
+
componentDidMount(): void;
|
|
69
|
+
componentWillUnmount(): void;
|
|
70
|
+
componentDidUpdate(prevProps: HashRouterProps, prevState: HashRouterState): void;
|
|
71
|
+
initMatch(): void;
|
|
72
|
+
addEventListener(param1: any, param2: any, param3: any, listenerId?: string): void;
|
|
73
|
+
removeEventListener(type: string, listenerId: string): void;
|
|
74
|
+
removeDuplicatedEventListeners(): void;
|
|
75
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
export interface HeaderProps {
|
|
3
|
-
children?: ReactNode;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* The top of a page.
|
|
7
|
-
*/
|
|
8
|
-
export default function Header({ children }: HeaderProps): JSX.Element;
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface HeaderProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The top of a page.
|
|
7
|
+
*/
|
|
8
|
+
export default function Header({ children }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
export default function HeaderTitle({ logo, logoAlt, appTitle, keepAppTitle, children, className, sidebar, elementType, to, href }: HeaderTitleProps): JSX.Element;
|
|
1
|
+
export interface HeaderTitleProps {
|
|
2
|
+
/**
|
|
3
|
+
* Can be an image. Will be placed inside of the `src` attribute.
|
|
4
|
+
*/
|
|
5
|
+
logo?: string;
|
|
6
|
+
logoAlt?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Text next to the logo.
|
|
9
|
+
*/
|
|
10
|
+
appTitle?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Disables that the app title will disappear at a specific view width.
|
|
13
|
+
*/
|
|
14
|
+
keepAppTitle?: boolean;
|
|
15
|
+
children?: any;
|
|
16
|
+
/**
|
|
17
|
+
* Extends `className` from parent element.
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Is the component used on the sidebar?
|
|
22
|
+
*/
|
|
23
|
+
sidebar?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* By default, MenuItem is a `"a"`.
|
|
26
|
+
* If you want to have it another type, you can pass a component reference with this prop (e.g. `Link`).
|
|
27
|
+
*/
|
|
28
|
+
elementType?: any;
|
|
29
|
+
/**
|
|
30
|
+
* Sets `to` prop, e.g. when you use the `Link` component from React Router.
|
|
31
|
+
*/
|
|
32
|
+
to?: string;
|
|
33
|
+
href?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The title area at the header bar.
|
|
37
|
+
* Depending on its content, the document's title will be set aswell (what will be shown in the browser title bar).
|
|
38
|
+
*/
|
|
39
|
+
export default function HeaderTitle({ logo, logoAlt, appTitle, keepAppTitle, children, className, sidebar, elementType, to, href }: HeaderTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export default function IconMenuItem({ label, outerClass, tooltipClass, horizontalOnOpenSidebar, className, ...props }: IconMenuItemProps): JSX.Element;
|
|
1
|
+
import { MenuItemProps } from "./MenuItem";
|
|
2
|
+
export interface IconMenuItemProps extends MenuItemProps {
|
|
3
|
+
outerClass?: string;
|
|
4
|
+
/**
|
|
5
|
+
* Tooltip will be placed to the end/right by default. You can change the direction with this prop.
|
|
6
|
+
*/
|
|
7
|
+
tooltipClass?: string;
|
|
8
|
+
/**
|
|
9
|
+
* When used inside of the sidebar: active indicator will be displayed underneath instead of before.
|
|
10
|
+
* The prop to `false` to disable this behavior.
|
|
11
|
+
*/
|
|
12
|
+
horizontalOnOpenSidebar?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Variant of `MenuItem` to primarily display an icon without a label.
|
|
16
|
+
* The label prop will be displayed as a tooltip.
|
|
17
|
+
*/
|
|
18
|
+
export default function IconMenuItem({ label, outerClass, tooltipClass, horizontalOnOpenSidebar, className, ...props }: IconMenuItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export default function Intro({ logo, logoMaxWidth, title, children }: IntroProps): JSX.Element;
|
|
1
|
+
export interface IntroProps {
|
|
2
|
+
/**
|
|
3
|
+
* Can be an image. Will be placed inside of the `src` attribute.
|
|
4
|
+
*/
|
|
5
|
+
logo?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Max width from the logo.
|
|
8
|
+
*/
|
|
9
|
+
logoMaxWidth?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Text which will be placed under the logo.
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Content
|
|
16
|
+
*/
|
|
17
|
+
children?: any;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Can be used for a sign-in page.
|
|
21
|
+
*/
|
|
22
|
+
export default function Intro({ logo, logoMaxWidth, title, children }: IntroProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,144 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* By default, the side bar is "in".
|
|
12
|
-
* You can control the state from outside, by also using `onChangeSidebarIn`.
|
|
13
|
-
*/
|
|
14
|
-
sidebarIn?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* React to changes of the `sidebarIn` state.
|
|
17
|
-
*/
|
|
18
|
-
onChangeSidebarIn?: (sidebarIn: boolean) => void;
|
|
19
|
-
style?: CSSProperties;
|
|
20
|
-
/**
|
|
21
|
-
* Set `true` to hide button to toggle `expandSidebar` state.
|
|
22
|
-
*/
|
|
23
|
-
hideToggleExpandSidebar?: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Sidebar is automatically expanded on wider views.
|
|
26
|
-
*/
|
|
27
|
-
expandSidebar?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* React to changes of the `expandSidebar` state.
|
|
30
|
-
*/
|
|
31
|
-
onChangeExpandSidebar?: (expandSidebar: boolean) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Disables sidebar.
|
|
34
|
-
*/
|
|
35
|
-
hideSidebarMenu?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Registers pages for the built-in routing system. Example: `[{name: "home", component: <HomePage />}]`
|
|
38
|
-
*/
|
|
39
|
-
pages?: {
|
|
40
|
-
name: string;
|
|
41
|
-
component: JSX.Element;
|
|
42
|
-
}[];
|
|
43
|
-
/**
|
|
44
|
-
* When `true`, always the "home" route will be rendered.
|
|
45
|
-
*/
|
|
46
|
-
unrouteable?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Extends `className`.
|
|
49
|
-
*/
|
|
50
|
-
className?: string;
|
|
51
|
-
/**
|
|
52
|
-
* By default, the document title will automatically set. Set this prop to `true` to disable this behaviour.
|
|
53
|
-
*/
|
|
54
|
-
disableTitleSet?: boolean;
|
|
55
|
-
/**
|
|
56
|
-
* If you don't use blueicon, you can define another icon element for the sidebar toggle button.
|
|
57
|
-
*/
|
|
58
|
-
sidebarToggleIconComponent?: any;
|
|
59
|
-
/**
|
|
60
|
-
* Set `true` if you want to use the Utilities functions for status and alert.
|
|
61
|
-
* Set `false` if you want to use `StatusProvider` instead.
|
|
62
|
-
*/
|
|
63
|
-
enableStatus?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Will replace status icons with custom ones. This will also overwrite the `useBlueicons` option.
|
|
66
|
-
* This can be a SVG component or a normal element component.
|
|
67
|
-
*/
|
|
68
|
-
statusIcons?: {
|
|
69
|
-
danger: any;
|
|
70
|
-
info: any;
|
|
71
|
-
success: any;
|
|
72
|
-
warning: any;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Disables the header bars on pages.
|
|
76
|
-
*/
|
|
77
|
-
disableHeaders?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Define a function, that will be fired when switching routes. When your function returns `true`, the default route behaviour will be blocked.
|
|
80
|
-
* You can use something like `window.blueLayoutRef.setState({ blockRouting: onHashChange })` globally to set the value from anywhere in your app.
|
|
81
|
-
*/
|
|
82
|
-
blockRouting?: (newMatch: string[], currentMatch: string[]) => void | boolean;
|
|
83
|
-
children?: any;
|
|
84
|
-
}
|
|
85
|
-
export interface LayoutState {
|
|
86
|
-
sidebarIn: boolean;
|
|
87
|
-
expandSidebar: boolean;
|
|
88
|
-
match: any;
|
|
89
|
-
history: string[];
|
|
90
|
-
hash: string;
|
|
91
|
-
hashHistory: string[];
|
|
92
|
-
blockRouting?: (newMatch: string[], currentMatch: string[]) => void | boolean;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
|
|
96
|
-
* You can also append your own event listeners.
|
|
97
|
-
*
|
|
98
|
-
* Allowed events:
|
|
99
|
-
*
|
|
100
|
-
* * **componentDidUpdate** - Component was updated.
|
|
101
|
-
* Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
|
|
102
|
-
* * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
|
|
103
|
-
* Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
|
|
104
|
-
* * **pageDidHide** - This page disappeared and another page appears instead.
|
|
105
|
-
* Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
|
|
106
|
-
*
|
|
107
|
-
* Method to add event listeners:
|
|
108
|
-
* * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
|
|
109
|
-
*
|
|
110
|
-
* Methods to remove event listeners:
|
|
111
|
-
* * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
|
|
112
|
-
* * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
|
|
113
|
-
*/
|
|
114
|
-
export default class Layout extends Component<LayoutProps, LayoutState> {
|
|
115
|
-
defaultMatch: string[];
|
|
116
|
-
eventListeners: any[];
|
|
117
|
-
constructor(props: LayoutProps);
|
|
118
|
-
onHashChange(): void;
|
|
119
|
-
static get defaultProps(): {
|
|
120
|
-
hideSidebarMenu: boolean;
|
|
121
|
-
unrouteable: boolean;
|
|
122
|
-
disableTitleSet: boolean;
|
|
123
|
-
sidebarToggleIconComponent: JSX.Element;
|
|
124
|
-
enableStatus: boolean;
|
|
125
|
-
statusIcons: {
|
|
126
|
-
danger: JSX.Element;
|
|
127
|
-
info: JSX.Element;
|
|
128
|
-
success: JSX.Element;
|
|
129
|
-
warning: JSX.Element;
|
|
130
|
-
};
|
|
131
|
-
hideToggleExpandSidebar: boolean;
|
|
132
|
-
};
|
|
133
|
-
componentDidMount(): void;
|
|
134
|
-
componentWillUnmount(): void;
|
|
135
|
-
componentDidUpdate(prevProps: LayoutProps, prevState: LayoutState): void;
|
|
136
|
-
toggleSidebar(event: any): void;
|
|
137
|
-
hideSidebar(e: any): void;
|
|
138
|
-
initMatch(): void;
|
|
139
|
-
addEventListener(param1: any, param2: any, param3: any, listenerId?: string): void;
|
|
140
|
-
removeEventListener(type: string, listenerId: string): void;
|
|
141
|
-
removeDuplicatedEventListeners(): void;
|
|
142
|
-
toggleExpandSidebar(): void;
|
|
143
|
-
render(): JSX.Element;
|
|
144
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "blue-web/dist/js/side-layout";
|
|
3
|
+
export interface LayoutProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
header?: React.ReactNode;
|
|
6
|
+
side?: React.ReactNode;
|
|
7
|
+
noPageBorder?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export default function Layout({ children, header, side, noPageBorder }: LayoutProps): import("react/jsx-runtime").JSX.Element;
|