blue-react 8.3.1 → 8.3.4

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.
Files changed (74) hide show
  1. package/LICENSE +164 -164
  2. package/README.md +59 -59
  3. package/dist/components/ActionMenu.js +2 -2
  4. package/dist/components/ActionMenuSwitch.js +2 -2
  5. package/dist/components/Body.js +2 -2
  6. package/dist/components/BodyRounded.js +2 -2
  7. package/dist/components/Caret.js +2 -2
  8. package/dist/components/DocumentView.js +2 -2
  9. package/dist/components/Grid.js +287 -287
  10. package/dist/components/Header.js +2 -2
  11. package/dist/components/HeaderTitle.js +3 -3
  12. package/dist/components/Intro.js +2 -2
  13. package/dist/components/Layout.js +19 -19
  14. package/dist/components/MenuItem.js +11 -3
  15. package/dist/components/Modal.js +5 -5
  16. package/dist/components/Outside.js +6 -6
  17. package/dist/components/Page.js +2 -2
  18. package/dist/components/Search.js +9 -5
  19. package/dist/components/SidebarMenu.js +2 -2
  20. package/dist/components/Switch.js +2 -2
  21. package/dist/components/Utilities.js +2 -2
  22. package/dist/style.css +4973 -8707
  23. package/dist/style.min.css +12 -10
  24. package/dist/style.scss +28 -28
  25. package/dist/styles/_action-menu.scss +81 -81
  26. package/dist/styles/_bootstrap-mixins_overwritten.scss +106 -106
  27. package/dist/styles/_bootstrap-optimizations.scss +13 -13
  28. package/dist/styles/_bootstrap-variables.scss +15 -15
  29. package/dist/styles/_bootstrap.scss +56 -56
  30. package/dist/styles/_caret.scss +50 -50
  31. package/dist/styles/_document-view.scss +6 -6
  32. package/dist/styles/_general.scss +177 -177
  33. package/dist/styles/_grid.scss +381 -381
  34. package/dist/styles/_hover.scss +42 -42
  35. package/dist/styles/_keyframes.scss +73 -73
  36. package/dist/styles/_mixins.scss +6 -6
  37. package/dist/styles/_router.scss +18 -18
  38. package/dist/styles/_search.scss +61 -61
  39. package/dist/styles/_status.scss +149 -149
  40. package/dist/styles/_switch.scss +21 -21
  41. package/dist/styles/_tooltips.scss +189 -189
  42. package/dist/styles/_variables.scss +97 -97
  43. package/dist/styles/mixins/_action-menu.scss +68 -68
  44. package/dist/styles/mixins/_custom-property.scss +10 -10
  45. package/dist/styles/mixins/_misc.scss +33 -33
  46. package/dist/styles/mixins/_scroll-shadow.scss +9 -9
  47. package/dist/styles/mixins/_sidebar.scss +156 -156
  48. package/dist/styles/mixins/_switch.scss +85 -85
  49. package/dist/types/components/ActionMenu.d.ts +22 -22
  50. package/dist/types/components/ActionMenuSwitch.d.ts +11 -11
  51. package/dist/types/components/Body.d.ts +21 -21
  52. package/dist/types/components/BodyRounded.d.ts +10 -10
  53. package/dist/types/components/Caret.d.ts +16 -16
  54. package/dist/types/components/DocumentView.d.ts +23 -23
  55. package/dist/types/components/Grid.d.ts +110 -110
  56. package/dist/types/components/Header.d.ts +8 -8
  57. package/dist/types/components/HeaderTitle.d.ts +29 -29
  58. package/dist/types/components/Intro.d.ts +23 -23
  59. package/dist/types/components/Layout.d.ts +120 -120
  60. package/dist/types/components/MenuItem.d.ts +101 -69
  61. package/dist/types/components/Modal.d.ts +25 -25
  62. package/dist/types/components/ModalProvider.d.ts +11 -11
  63. package/dist/types/components/Outside.d.ts +14 -14
  64. package/dist/types/components/Page.d.ts +12 -12
  65. package/dist/types/components/Search.d.ts +32 -30
  66. package/dist/types/components/SidebarMenu.d.ts +32 -32
  67. package/dist/types/components/Status.d.ts +12 -12
  68. package/dist/types/components/StatusProvider.d.ts +15 -15
  69. package/dist/types/components/Switch.d.ts +21 -21
  70. package/dist/types/components/Utilities.d.ts +17 -17
  71. package/dist/types/components/shared.d.ts +15 -15
  72. package/index.d.ts +65 -65
  73. package/index.js +27 -27
  74. package/package.json +88 -88
@@ -1,29 +1,29 @@
1
- /// <reference types="react" />
2
- export interface HeaderTitleProps {
3
- /**
4
- * Can be an image. Will be placed inside of the `src` attribute.
5
- */
6
- logo?: 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
- /**
26
- * The title area at the header bar.
27
- * Depending on its content, the document's title will be set aswell (what will be shown in the browser title bar).
28
- */
29
- export default function HeaderTitle({ logo, appTitle, keepAppTitle, children, className, sidebar }: HeaderTitleProps): JSX.Element;
1
+ /// <reference types="react" />
2
+ export interface HeaderTitleProps {
3
+ /**
4
+ * Can be an image. Will be placed inside of the `src` attribute.
5
+ */
6
+ logo?: 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
+ /**
26
+ * The title area at the header bar.
27
+ * Depending on its content, the document's title will be set aswell (what will be shown in the browser title bar).
28
+ */
29
+ export default function HeaderTitle({ logo, appTitle, keepAppTitle, children, className, sidebar }: HeaderTitleProps): JSX.Element;
@@ -1,23 +1,23 @@
1
- /// <reference types="react" />
2
- export interface IntroProps {
3
- /**
4
- * Can be an image. Will be placed inside of the `src` attribute.
5
- */
6
- logo?: string;
7
- /**
8
- * Max width from the logo.
9
- */
10
- logoMaxWidth?: string;
11
- /**
12
- * Text which will be placed under the logo.
13
- */
14
- title?: string;
15
- /**
16
- * Content
17
- */
18
- children?: any;
19
- }
20
- /**
21
- * Can be used for a sign-in page.
22
- */
23
- export default function Intro({ logo, logoMaxWidth, title, children }: IntroProps): JSX.Element;
1
+ /// <reference types="react" />
2
+ export interface IntroProps {
3
+ /**
4
+ * Can be an image. Will be placed inside of the `src` attribute.
5
+ */
6
+ logo?: string;
7
+ /**
8
+ * Max width from the logo.
9
+ */
10
+ logoMaxWidth?: string;
11
+ /**
12
+ * Text which will be placed under the logo.
13
+ */
14
+ title?: string;
15
+ /**
16
+ * Content
17
+ */
18
+ children?: any;
19
+ }
20
+ /**
21
+ * Can be used for a sign-in page.
22
+ */
23
+ export default function Intro({ logo, logoMaxWidth, title, children }: IntroProps): JSX.Element;
@@ -1,120 +1,120 @@
1
- import { Component, CSSProperties } from "react";
2
- declare global {
3
- interface Window {
4
- blueLayoutRef: any;
5
- toggleSidebarEvent: any;
6
- }
7
- }
8
- export interface LayoutProps {
9
- id?: string;
10
- sidebarIn?: boolean;
11
- style?: CSSProperties;
12
- /**
13
- * Sidebar is automatically expanded on wider views.
14
- */
15
- expandSidebar?: boolean;
16
- /**
17
- * Disables sidebar.
18
- */
19
- hideSidebarMenu?: boolean;
20
- /**
21
- * Registers pages for the built-in routing system. Example: `[{name: "home", component: <HomePage />}]`
22
- */
23
- pages?: {
24
- name: string;
25
- component: JSX.Element;
26
- }[];
27
- /**
28
- * When `true`, always the "home" route will be rendered.
29
- */
30
- unrouteable?: boolean;
31
- /**
32
- * Extends `className`.
33
- */
34
- className?: string;
35
- /**
36
- * By default, the document title will automatically set. Set this prop to `true` to disable this behaviour.
37
- */
38
- disableTitleSet?: boolean;
39
- /**
40
- * If you don't use blueicon, you can define another icon element for the sidebar toggle button.
41
- */
42
- sidebarToggleIconComponent?: any;
43
- /**
44
- * Will replace status icons with custom ones. This will also overwrite the `useBlueicons` option.
45
- * This can be a SVG component or a normal element component.
46
- */
47
- statusIcons?: {
48
- danger: any;
49
- info: any;
50
- success: any;
51
- warning: any;
52
- };
53
- /**
54
- * Disables the header bars on pages.
55
- */
56
- disableHeaders?: boolean;
57
- /**
58
- * Define a function, that will be fired when switching routes. When your function returns `true`, the default route behaviour will be blocked.
59
- * You can use something like `window.blueLayoutRef.setState({ blockRouting: onHashChange })` globally to set the value from anywhere in your app.
60
- */
61
- blockRouting?: (newMatch: string[], currentMatch: string[]) => void | boolean;
62
- children?: any;
63
- }
64
- export interface LayoutState {
65
- sidebarIn?: boolean;
66
- match: any;
67
- history: string[];
68
- hash: string;
69
- hashHistory: string[];
70
- blockRouting?: (newMatch: string[], currentMatch: string[]) => void | boolean;
71
- }
72
- /**
73
- * The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
74
- * You can also append your own event listeners.
75
- *
76
- * Allowed events:
77
- *
78
- * * **componentDidUpdate** - Component was updated.
79
- * Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
80
- * * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
81
- * Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
82
- * * **pageDidHide** - This page disappeared and another page appears instead.
83
- * Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
84
- *
85
- * Method to add event listeners:
86
- * * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
87
- *
88
- * Methods to remove event listeners:
89
- * * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
90
- * * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
91
- */
92
- export default class Layout extends Component<LayoutProps, LayoutState> {
93
- defaultMatch: string[];
94
- eventListeners: any[];
95
- constructor(props: LayoutProps);
96
- onHashChange(): void;
97
- static get defaultProps(): {
98
- expandSidebar: boolean;
99
- hideSidebarMenu: boolean;
100
- unrouteable: boolean;
101
- disableTitleSet: boolean;
102
- sidebarToggleIconComponent: JSX.Element;
103
- statusIcons: {
104
- danger: JSX.Element;
105
- info: JSX.Element;
106
- success: JSX.Element;
107
- warning: JSX.Element;
108
- };
109
- };
110
- componentDidMount(): void;
111
- componentWillUnmount(): void;
112
- componentDidUpdate(prevProps: LayoutProps, prevState: LayoutState): void;
113
- toggleSidebar(event: any): void;
114
- hideSidebar(e: any): void;
115
- initMatch(): void;
116
- addEventListener(param1: any, param2: any, param3: any, listenerId?: string): void;
117
- removeEventListener(type: string, listenerId: string): void;
118
- removeDuplicatedEventListeners(): void;
119
- render(): JSX.Element;
120
- }
1
+ import { Component, CSSProperties } from "react";
2
+ declare global {
3
+ interface Window {
4
+ blueLayoutRef: any;
5
+ toggleSidebarEvent: any;
6
+ }
7
+ }
8
+ export interface LayoutProps {
9
+ id?: string;
10
+ sidebarIn?: boolean;
11
+ style?: CSSProperties;
12
+ /**
13
+ * Sidebar is automatically expanded on wider views.
14
+ */
15
+ expandSidebar?: boolean;
16
+ /**
17
+ * Disables sidebar.
18
+ */
19
+ hideSidebarMenu?: boolean;
20
+ /**
21
+ * Registers pages for the built-in routing system. Example: `[{name: "home", component: <HomePage />}]`
22
+ */
23
+ pages?: {
24
+ name: string;
25
+ component: JSX.Element;
26
+ }[];
27
+ /**
28
+ * When `true`, always the "home" route will be rendered.
29
+ */
30
+ unrouteable?: boolean;
31
+ /**
32
+ * Extends `className`.
33
+ */
34
+ className?: string;
35
+ /**
36
+ * By default, the document title will automatically set. Set this prop to `true` to disable this behaviour.
37
+ */
38
+ disableTitleSet?: boolean;
39
+ /**
40
+ * If you don't use blueicon, you can define another icon element for the sidebar toggle button.
41
+ */
42
+ sidebarToggleIconComponent?: any;
43
+ /**
44
+ * Will replace status icons with custom ones. This will also overwrite the `useBlueicons` option.
45
+ * This can be a SVG component or a normal element component.
46
+ */
47
+ statusIcons?: {
48
+ danger: any;
49
+ info: any;
50
+ success: any;
51
+ warning: any;
52
+ };
53
+ /**
54
+ * Disables the header bars on pages.
55
+ */
56
+ disableHeaders?: boolean;
57
+ /**
58
+ * Define a function, that will be fired when switching routes. When your function returns `true`, the default route behaviour will be blocked.
59
+ * You can use something like `window.blueLayoutRef.setState({ blockRouting: onHashChange })` globally to set the value from anywhere in your app.
60
+ */
61
+ blockRouting?: (newMatch: string[], currentMatch: string[]) => void | boolean;
62
+ children?: any;
63
+ }
64
+ export interface LayoutState {
65
+ sidebarIn?: boolean;
66
+ match: any;
67
+ history: string[];
68
+ hash: string;
69
+ hashHistory: string[];
70
+ blockRouting?: (newMatch: string[], currentMatch: string[]) => void | boolean;
71
+ }
72
+ /**
73
+ * The main component. As soon this component is mounted, it is globally available under `window.blueLayoutRef`.
74
+ * You can also append your own event listeners.
75
+ *
76
+ * Allowed events:
77
+ *
78
+ * * **componentDidUpdate** - Component was updated.
79
+ * Example: `window.blueLayoutRef.addEventListener("componentDidUpdate", (prevProps, prevState) => { })`
80
+ * * **pageDidShowAgain** - Page appeared again with the same old state. In the callback function you can reinitialize things.
81
+ * Example: `window.blueLayoutRef.addEventListener("pageDidShowAgain", "home", (prevProps, prevState) => { })`
82
+ * * **pageDidHide** - This page disappeared and another page appears instead.
83
+ * Example: `window.blueLayoutRef.addEventListener("pageDidHide", "home", (prevProps, prevState) => { })`
84
+ *
85
+ * Method to add event listeners:
86
+ * * `window.blueLayoutRef.`**addEventListener**`(eventName: string, param2: any, param3: any, listenerId?: string)`
87
+ *
88
+ * Methods to remove event listeners:
89
+ * * `window.blueLayoutRef.`**removeEventListener**`(eventName: string, listenerId: string)`
90
+ * * `window.blueLayoutRef.`**removeDuplicatedEventListeners**`()` - Will automatically be called when running `addEventListener`
91
+ */
92
+ export default class Layout extends Component<LayoutProps, LayoutState> {
93
+ defaultMatch: string[];
94
+ eventListeners: any[];
95
+ constructor(props: LayoutProps);
96
+ onHashChange(): void;
97
+ static get defaultProps(): {
98
+ expandSidebar: boolean;
99
+ hideSidebarMenu: boolean;
100
+ unrouteable: boolean;
101
+ disableTitleSet: boolean;
102
+ sidebarToggleIconComponent: JSX.Element;
103
+ statusIcons: {
104
+ danger: JSX.Element;
105
+ info: JSX.Element;
106
+ success: JSX.Element;
107
+ warning: JSX.Element;
108
+ };
109
+ };
110
+ componentDidMount(): void;
111
+ componentWillUnmount(): void;
112
+ componentDidUpdate(prevProps: LayoutProps, prevState: LayoutState): void;
113
+ toggleSidebar(event: any): void;
114
+ hideSidebar(e: any): void;
115
+ initMatch(): void;
116
+ addEventListener(param1: any, param2: any, param3: any, listenerId?: string): void;
117
+ removeEventListener(type: string, listenerId: string): void;
118
+ removeDuplicatedEventListeners(): void;
119
+ render(): JSX.Element;
120
+ }
@@ -1,69 +1,101 @@
1
- import React from "react";
2
- export interface MenuItemProps {
3
- /**
4
- * Sets `to` prop, e.g. when you use the `NavLink` component from React Router.
5
- */
6
- to?: string;
7
- /**
8
- * Prop for components by React Router.
9
- */
10
- exact?: boolean;
11
- href?: string;
12
- onClick?: (event: React.MouseEvent) => void;
13
- /**
14
- * Will be fired after `onClick`
15
- */
16
- onClickAttached?: (event: React.MouseEvent) => void;
17
- /**
18
- * Icon component or a class name.
19
- */
20
- icon?: any;
21
- /**
22
- * Icon component or a class name when the MenuItem is active.
23
- */
24
- iconForActive?: any;
25
- /**
26
- * Label of the link.
27
- */
28
- label?: any;
29
- /**
30
- * Should be set as active.
31
- */
32
- isActive?: boolean;
33
- /**
34
- * When using Blue React's routing system: define this link as home page link.
35
- */
36
- isHome?: boolean;
37
- /**
38
- * Extends class name of the dropdown menu.
39
- */
40
- dropdownClassName?: string;
41
- /**
42
- * Set children to create a nested `MenuItem` as a dropdown.
43
- */
44
- children?: any;
45
- /**
46
- * Defines class name.
47
- */
48
- className?: any;
49
- /**
50
- * Defines dropdown status from outside.
51
- */
52
- showDropdown?: boolean;
53
- /**
54
- * Close on click outside.
55
- */
56
- supportOutside?: boolean;
57
- /**
58
- * By default, MenuItem is a `"button"</button>. If you set a `href`, it's a `"a"`.
59
- * If you want to have it another type, you can pass a component reference with this prop (e.g. `Link`).
60
- */
61
- elementType?: any;
62
- target?: string;
63
- rel?: string;
64
- title?: string;
65
- }
66
- /**
67
- * Link, button or custom component for Sidebar, Actions or ActionMenu
68
- */
69
- export default function MenuItem(props: MenuItemProps): JSX.Element;
1
+ import React from "react";
2
+ export interface MenuItemProps {
3
+ /**
4
+ * Sets `to` prop, e.g. when you use the `NavLink` component from React Router.
5
+ */
6
+ to?: string;
7
+ /**
8
+ * Prop for components by React Router.
9
+ */
10
+ exact?: boolean;
11
+ href?: string;
12
+ onClick?: (event: React.MouseEvent) => void;
13
+ /**
14
+ * Will be fired after `onClick`
15
+ */
16
+ onClickAttached?: (event: React.MouseEvent) => void;
17
+ /**
18
+ * Icon component or a class name.
19
+ */
20
+ icon?: any;
21
+ /**
22
+ * Icon component or a class name when the MenuItem is active.
23
+ */
24
+ iconForActive?: any;
25
+ /**
26
+ * Label of the link.
27
+ */
28
+ label?: any;
29
+ /**
30
+ * Should be set as active.
31
+ */
32
+ isActive?: boolean;
33
+ /**
34
+ * When using Blue React's routing system: define this link as home page link.
35
+ */
36
+ isHome?: boolean;
37
+ /**
38
+ * Extends class name of the dropdown menu.
39
+ */
40
+ dropdownClassName?: string;
41
+ /**
42
+ * Set children to create a nested `MenuItem` as a dropdown.
43
+ */
44
+ children?: any;
45
+ /**
46
+ * Defines class name.
47
+ */
48
+ className?: any;
49
+ /**
50
+ * Defines dropdown status from outside.
51
+ */
52
+ showDropdown?: boolean;
53
+ /**
54
+ * Close on click outside.
55
+ */
56
+ supportOutside?: boolean;
57
+ /**
58
+ * By default, MenuItem is a `"button"</button>. If you set a `href`, it's a `"a"`.
59
+ * If you want to have it another type, you can pass a component reference with this prop (e.g. `Link`).
60
+ */
61
+ elementType?: any;
62
+ target?: string;
63
+ rel?: string;
64
+ title?: string;
65
+ /**
66
+ * Fired on the draggable target (the source element): occurs when the user starts to drag an element
67
+ */
68
+ onDragStart?: (event: React.DragEvent) => void | React.DragEventHandler;
69
+ /**
70
+ * Fired on the draggable target (the source element): occurs when an element is being dragged
71
+ */
72
+ onDrag?: (event: React.DragEvent) => void | React.DragEventHandler;
73
+ /**
74
+ * Fired on the draggable target (the source element): occurs when the user has finished dragging the element
75
+ */
76
+ onDragEnd?: (event: React.DragEvent) => void | React.DragEventHandler;
77
+ /**
78
+ * Fired on the drop target: occurs when the dragged element enters the drop target
79
+ */
80
+ onDragEnter?: (event: React.DragEvent) => void | React.DragEventHandler;
81
+ /**
82
+ * Fired on the drop target: occurs when the dragged element is over the drop target
83
+ */
84
+ onDragOver?: (event: React.DragEvent) => void | React.DragEventHandler;
85
+ /**
86
+ * Fired on the drop target: occurs when the dragged element leaves the drop target
87
+ */
88
+ onDragLeave?: (event: React.DragEvent) => void | React.DragEventHandler;
89
+ /**
90
+ * Fired on the drop target: occurs when the dragged element is dropped on the drop target
91
+ */
92
+ onDrop?: (event: React.DragEvent) => void | React.DragEventHandler;
93
+ /**
94
+ * Specifies whether an element is draggable or not.
95
+ */
96
+ draggable?: boolean;
97
+ }
98
+ /**
99
+ * Link, button or custom component for Sidebar, Actions or ActionMenu
100
+ */
101
+ export default function MenuItem(props: MenuItemProps): JSX.Element;
@@ -1,25 +1,25 @@
1
- /// <reference types="react" />
2
- import { ModalType } from "./shared";
3
- export interface ModalProps {
4
- modalContent?: string;
5
- modalTitle?: string;
6
- unSetModalContent: (modalContent?: string) => void;
7
- /**
8
- * Type of `input` depends on `type` prop and which action occured.
9
- * When it's a string, the user entered something. When it's a boolean, the user clicked "Yes" or "No".
10
- * When it's `null`, the user cancelled the modal.
11
- */
12
- onSubmit?: (input: string | boolean | null) => void;
13
- defaultInput?: string;
14
- /**
15
- * `"ask"` | `"tell"` | `"verify"`
16
- */
17
- type: ModalType;
18
- }
19
- /**
20
- * Simple modal/dialog. Designed to work as an alternative to JavaScript's native `alert()`, `prompt()` and `confirm()` functions.
21
- * It uses Bootstrap's Modal components.
22
- *
23
- * For easy use, you should use the hook `useModal` together with `ModalProvider`. See the example there.
24
- */
25
- export default function Modal({ modalContent, modalTitle, unSetModalContent, onSubmit, defaultInput, type }: ModalProps): JSX.Element;
1
+ /// <reference types="react" />
2
+ import { ModalType } from "./shared";
3
+ export interface ModalProps {
4
+ modalContent?: string;
5
+ modalTitle?: string;
6
+ unSetModalContent: (modalContent?: string) => void;
7
+ /**
8
+ * Type of `input` depends on `type` prop and which action occured.
9
+ * When it's a string, the user entered something. When it's a boolean, the user clicked "Yes" or "No".
10
+ * When it's `null`, the user cancelled the modal.
11
+ */
12
+ onSubmit?: (input: string | boolean | null) => void;
13
+ defaultInput?: string;
14
+ /**
15
+ * `"ask"` | `"tell"` | `"verify"`
16
+ */
17
+ type: ModalType;
18
+ }
19
+ /**
20
+ * Simple modal/dialog. Designed to work as an alternative to JavaScript's native `alert()`, `prompt()` and `confirm()` functions.
21
+ * It uses Bootstrap's Modal components.
22
+ *
23
+ * For easy use, you should use the hook `useModal` together with `ModalProvider`. See the example there.
24
+ */
25
+ export default function Modal({ modalContent, modalTitle, unSetModalContent, onSubmit, defaultInput, type }: ModalProps): JSX.Element;
@@ -1,11 +1,11 @@
1
- import { ReactNode } from "react";
2
- export interface ModalProviderProps {
3
- children?: ReactNode;
4
- }
5
- declare const ModalProvider: ({ children, ...rest }: ModalProviderProps) => JSX.Element;
6
- declare const useModal: () => {
7
- ask: (text: string, title?: string | undefined) => Promise<string | boolean>;
8
- tell: (text: string, title?: string | undefined) => Promise<boolean>;
9
- verify: (text: string, title?: string | undefined) => Promise<boolean>;
10
- };
11
- export { ModalProvider, useModal };
1
+ import { ReactNode } from "react";
2
+ export interface ModalProviderProps {
3
+ children?: ReactNode;
4
+ }
5
+ declare const ModalProvider: ({ children, ...rest }: ModalProviderProps) => JSX.Element;
6
+ declare const useModal: () => {
7
+ ask: (text: string, title?: string | undefined) => Promise<string | boolean>;
8
+ tell: (text: string, title?: string | undefined) => Promise<boolean>;
9
+ verify: (text: string, title?: string | undefined) => Promise<boolean>;
10
+ };
11
+ export { ModalProvider, useModal };
@@ -1,14 +1,14 @@
1
- import { MutableRefObject } from "react";
2
- /**
3
- * Hook that alerts clicks outside of the passed ref
4
- */
5
- export declare function useOutside(ref: MutableRefObject<any>, callback?: (event: MouseEvent) => void): void;
6
- export interface OutsideProps {
7
- children: any;
8
- className?: string;
9
- onClickOutside?: (event: MouseEvent) => void;
10
- }
11
- /**
12
- * Component that fires an event if you click outside of it
13
- */
14
- export default function Outside({ children, className, onClickOutside }: OutsideProps): JSX.Element;
1
+ import { MutableRefObject } from "react";
2
+ /**
3
+ * Hook that alerts clicks outside of the passed ref
4
+ */
5
+ export declare function useOutside(ref: MutableRefObject<any>, callback?: (event: MouseEvent) => void): void;
6
+ export interface OutsideProps {
7
+ children: any;
8
+ className?: string;
9
+ onClickOutside?: (event: MouseEvent) => void;
10
+ }
11
+ /**
12
+ * Component that fires an event if you click outside of it
13
+ */
14
+ export default function Outside({ children, className, onClickOutside }: OutsideProps): JSX.Element;
@@ -1,12 +1,12 @@
1
- /// <reference types="react" />
2
- export interface PageProps {
3
- /**
4
- * Will be set to the document's `<title>` tag.
5
- */
6
- title?: string;
7
- children?: any;
8
- }
9
- /**
10
- * Main component for each page.
11
- */
12
- export default function Page({ children, title }: PageProps): JSX.Element;
1
+ /// <reference types="react" />
2
+ export interface PageProps {
3
+ /**
4
+ * Will be set to the document's `<title>` tag.
5
+ */
6
+ title?: string;
7
+ children?: any;
8
+ }
9
+ /**
10
+ * Main component for each page.
11
+ */
12
+ export default function Page({ children, title }: PageProps): JSX.Element;