blue-react 10.1.2 → 10.2.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.
Files changed (46) hide show
  1. package/dist/components/ActionMenu.d.ts +1 -0
  2. package/dist/components/ActionMenu.js +1 -0
  3. package/dist/components/ActionMenuItem.js +73 -0
  4. package/dist/components/ActionMenuSwitch.js +44 -0
  5. package/dist/components/Actions.d.ts +16 -0
  6. package/dist/components/Actions.js +60 -0
  7. package/dist/components/Caret.js +25 -0
  8. package/dist/components/Layout/LayoutHeader.js +1 -1
  9. package/dist/components/Layout.d.ts +4 -2
  10. package/dist/components/Layout.js +12 -11
  11. package/dist/components/SidebarMenuItem.js +115 -0
  12. package/dist/components/SimpleLayout.d.ts +4 -3
  13. package/dist/components/SimpleLayout.js +14 -13
  14. package/dist/components/Switch.js +65 -0
  15. package/dist/components/shared.js +2 -1
  16. package/dist/style.css +16286 -0
  17. package/dist/style.min.css +12 -0
  18. package/dist/types/components/A.d.ts +9 -0
  19. package/dist/types/components/ActionMenu.d.ts +25 -0
  20. package/dist/types/components/ActionMenuItem.d.ts +35 -0
  21. package/dist/types/components/ActionMenuSwitch.d.ts +12 -0
  22. package/dist/types/components/Body.d.ts +21 -0
  23. package/dist/types/components/Caret.d.ts +18 -0
  24. package/dist/types/components/Chevron.d.ts +17 -0
  25. package/dist/types/components/Header.d.ts +8 -0
  26. package/dist/types/components/HeaderTitle.d.ts +40 -0
  27. package/dist/types/components/IconMenuItem.d.ts +19 -0
  28. package/dist/types/components/Intro.d.ts +23 -0
  29. package/dist/types/components/Layout.d.ts +144 -0
  30. package/dist/types/components/MenuItem.d.ts +149 -0
  31. package/dist/types/components/Modal.d.ts +30 -0
  32. package/dist/types/components/ModalProvider.d.ts +21 -0
  33. package/dist/types/components/Outside.d.ts +17 -0
  34. package/dist/types/components/Page.d.ts +12 -0
  35. package/dist/types/components/Search.d.ts +36 -0
  36. package/dist/types/components/SidebarMenu.d.ts +32 -0
  37. package/dist/types/components/SidebarMenuItem.d.ts +22 -0
  38. package/dist/types/components/SidebarToggler.d.ts +10 -0
  39. package/dist/types/components/SlimContainer.d.ts +10 -0
  40. package/dist/types/components/Status.d.ts +12 -0
  41. package/dist/types/components/StatusProvider.d.ts +15 -0
  42. package/dist/types/components/Switch.d.ts +33 -0
  43. package/dist/types/components/ToastProvider.d.ts +22 -0
  44. package/dist/types/components/Utilities.d.ts +41 -0
  45. package/dist/types/components/shared.d.ts +15 -0
  46. package/package.json +2 -2
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ export interface AProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
3
+ }
4
+ /**
5
+ * The `<a>` element automatically sets `rel="noreferrer"` for external links with `target="_blank"`.\
6
+ * `A` allows all props of the `<a>` element.\
7
+ * `<A href="https://example.com" target="_blank">Example</A>` ➡️ `<a href="https://example.com" target="_blank" rel="noreferrer">Example</a>`
8
+ */
9
+ export default function A({ children, rel, ...rest }: AProps): JSX.Element;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { breakOption } from "./shared";
3
+ export declare const ActionMenuContext: React.Context<{
4
+ breakOption: breakOption | "none";
5
+ }>;
6
+ export interface ActionMenuProps {
7
+ /**
8
+ * Hides the toggle button in mobile view. Can be useful when using multiple ActionMenus and not show the toggle button for each menu.
9
+ */
10
+ hideToggleAction?: boolean;
11
+ children?: any;
12
+ /**
13
+ * Icon component for the toggle icon.
14
+ */
15
+ toggleIcon?: any;
16
+ className?: string;
17
+ /**
18
+ * "sm" | "md" | "lg" | "xl" | "none". Default is "lg". The responsive breakpoint at which the menu will be shown as a dropdown.
19
+ */
20
+ break?: breakOption | "none";
21
+ }
22
+ /**
23
+ * The Action Menu on the top right of a page. You can place Actions here which are in context of the current page.
24
+ */
25
+ export default function ActionMenu(props: ActionMenuProps): JSX.Element;
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import { MenuItemProps } from "./MenuItem";
3
+ export interface ActionMenuItemProps extends MenuItemProps {
4
+ }
5
+ /**
6
+ * Use this instead of `MenuItem` when you want to use it inside an `ActionMenu` to make it appear as a dropdown.
7
+ *
8
+ * It basically is a shortcut. Instead of writing:
9
+ *
10
+ * ```tsx
11
+ * <ActionMenu>
12
+ * <div className="position-relative z-1">
13
+ * <MenuItem
14
+ * label="Parent"
15
+ * supportOutside
16
+ * dropdownClassName={`position-md-absolute end-0 d-flex flex-column`}
17
+ * >
18
+ * <MenuItem label="Item 1" />
19
+ * </MenuItem>
20
+ * </div>
21
+ * </ActionMenu>
22
+ * ```
23
+ *
24
+ * you can write:
25
+ * ```tsx
26
+ * <ActionMenu>
27
+ * <ActionMenuItem label="Parent">
28
+ * <MenuItem label="Item 1" />
29
+ * </MenuItem>
30
+ * </ActionMenu>
31
+ * ```
32
+ *
33
+ * 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`.
34
+ */
35
+ export default function ActionMenuItem({ children, ...props }: ActionMenuItemProps): JSX.Element;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { SwitchProps } from "./Switch";
3
+ export interface ActionMenuSwitchProps extends SwitchProps {
4
+ onChange?: () => void;
5
+ label?: any;
6
+ }
7
+ /**
8
+ * @deprecated
9
+ * Use a solution with Bootstrap's `.form-check.form-switch` or `MenuItem` with a switch icon.
10
+ * Switch for the Action Menu.
11
+ */
12
+ export default function ActionMenuSwitch({ label, ...props }: ActionMenuSwitchProps): JSX.Element;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import { breakOption } from "./shared";
3
+ export interface BodyProps {
4
+ id?: string;
5
+ className?: string;
6
+ /**
7
+ * Class name for the container. More info: https://getbootstrap.com/docs/4.0/layout/overview/#containers
8
+ */
9
+ containerClass?: string;
10
+ /**
11
+ * Set `true` if this page uses `<Actions />`, so this component will get enough padding to avoid overlapping of the content.
12
+ */
13
+ hasActions?: boolean;
14
+ break?: breakOption;
15
+ onClick?: (event: any) => void;
16
+ children?: any;
17
+ }
18
+ /**
19
+ * Contains the content of the page.
20
+ */
21
+ export default function Body({ id, className, containerClass, hasActions, onClick, children, ...rest }: BodyProps): JSX.Element;
@@ -0,0 +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;
@@ -0,0 +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;
@@ -0,0 +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;
@@ -0,0 +1,40 @@
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
+ logoAlt?: string;
8
+ /**
9
+ * Text next to the logo.
10
+ */
11
+ appTitle?: string;
12
+ /**
13
+ * Disables that the app title will disappear at a specific view width.
14
+ */
15
+ keepAppTitle?: boolean;
16
+ children?: any;
17
+ /**
18
+ * Extends `className` from parent element.
19
+ */
20
+ className?: string;
21
+ /**
22
+ * Is the component used on the sidebar?
23
+ */
24
+ sidebar?: boolean;
25
+ /**
26
+ * By default, MenuItem is a `"a"`.
27
+ * If you want to have it another type, you can pass a component reference with this prop (e.g. `Link`).
28
+ */
29
+ elementType?: any;
30
+ /**
31
+ * Sets `to` prop, e.g. when you use the `Link` component from React Router.
32
+ */
33
+ to?: string;
34
+ href?: string;
35
+ }
36
+ /**
37
+ * The title area at the header bar.
38
+ * Depending on its content, the document's title will be set aswell (what will be shown in the browser title bar).
39
+ */
40
+ export default function HeaderTitle({ logo, logoAlt, appTitle, keepAppTitle, children, className, sidebar, elementType, to, href }: HeaderTitleProps): JSX.Element;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import { MenuItemProps } from "./MenuItem";
3
+ export interface IconMenuItemProps extends MenuItemProps {
4
+ outerClass?: string;
5
+ /**
6
+ * Tooltip will be placed to the end/right by default. You can change the direction with this prop.
7
+ */
8
+ tooltipClass?: string;
9
+ /**
10
+ * When used inside of the sidebar: active indicator will be displayed underneath instead of before.
11
+ * The prop to `false` to disable this behavior.
12
+ */
13
+ horizontalOnOpenSidebar?: boolean;
14
+ }
15
+ /**
16
+ * Variant of `MenuItem` to primarily display an icon without a label.
17
+ * The label prop will be displayed as a tooltip.
18
+ */
19
+ export default function IconMenuItem({ label, outerClass, tooltipClass, horizontalOnOpenSidebar, className, ...props }: IconMenuItemProps): JSX.Element;
@@ -0,0 +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;
@@ -0,0 +1,144 @@
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
+ /**
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
+ }
@@ -0,0 +1,149 @@
1
+ import React, { CSSProperties } 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
+ * Addition to class name of icon wrapper element
23
+ */
24
+ iconClassName?: string;
25
+ /**
26
+ * Icon component or a class name when the MenuItem is active.
27
+ */
28
+ iconForActive?: any;
29
+ /**
30
+ * Label of the link.
31
+ */
32
+ label?: any;
33
+ /**
34
+ * Addition to class name of label wrapper element
35
+ */
36
+ labelClassName?: string;
37
+ /**
38
+ * Addition to class name of caret
39
+ */
40
+ caretClassName?: string;
41
+ /**
42
+ * Addition to style of caret
43
+ */
44
+ caretStyle?: CSSProperties;
45
+ /**
46
+ * Should be set as active.
47
+ */
48
+ isActive?: boolean;
49
+ /**
50
+ * Set true to highlight the current menu item.
51
+ */
52
+ highlighted?: boolean;
53
+ /**
54
+ * When using Blue React's routing system: define this link as home page link.
55
+ */
56
+ isHome?: boolean;
57
+ /**
58
+ * Extends class name of the dropdown menu.
59
+ */
60
+ dropdownClassName?: string;
61
+ /**
62
+ * Extends style of the dropdown menu.
63
+ */
64
+ dropdownStyle?: CSSProperties;
65
+ /**
66
+ * Set children to create a nested `MenuItem` as a dropdown.
67
+ */
68
+ children?: any;
69
+ /**
70
+ * Defines class name.
71
+ */
72
+ className?: any;
73
+ /**
74
+ * Defines dropdown status from outside.
75
+ */
76
+ showDropdown?: boolean;
77
+ /**
78
+ * Callback when `showDropdown` changes.
79
+ */
80
+ onShowDropdown?: (showDropdown: boolean) => void;
81
+ /**
82
+ * Close on click outside.
83
+ */
84
+ supportOutside?: boolean;
85
+ /**
86
+ * Overrides default class list to be ignored on click outside.
87
+ * Hint: If you want this menu item to stay open when others will open, set:
88
+ * `outsideIgnoreClasses={["blue-menu-item-wrapper"]}`.
89
+ */
90
+ outsideIgnoreClasses?: string[];
91
+ /**
92
+ * By default, MenuItem is a `"button"`. If you set a `href`, it's a `"a"`.
93
+ * If you want to have it another type, you can pass a component reference with this prop (e.g. `Link`).
94
+ */
95
+ elementType?: any;
96
+ target?: string;
97
+ rel?: string;
98
+ title?: string;
99
+ type?: string;
100
+ /**
101
+ * Fired on the draggable target (the source element): occurs when the user starts to drag an element
102
+ */
103
+ onDragStart?: (event: React.DragEvent) => void | React.DragEventHandler;
104
+ /**
105
+ * Fired on the draggable target (the source element): occurs when an element is being dragged
106
+ */
107
+ onDrag?: (event: React.DragEvent) => void | React.DragEventHandler;
108
+ /**
109
+ * Fired on the draggable target (the source element): occurs when the user has finished dragging the element
110
+ */
111
+ onDragEnd?: (event: React.DragEvent) => void | React.DragEventHandler;
112
+ /**
113
+ * Fired on the drop target: occurs when the dragged element enters the drop target
114
+ */
115
+ onDragEnter?: (event: React.DragEvent) => void | React.DragEventHandler;
116
+ /**
117
+ * Fired on the drop target: occurs when the dragged element is over the drop target
118
+ */
119
+ onDragOver?: (event: React.DragEvent) => void | React.DragEventHandler;
120
+ /**
121
+ * Fired on the drop target: occurs when the dragged element leaves the drop target
122
+ */
123
+ onDragLeave?: (event: React.DragEvent) => void | React.DragEventHandler;
124
+ /**
125
+ * Fired on the drop target: occurs when the dragged element is dropped on the drop target
126
+ */
127
+ onDrop?: (event: React.DragEvent) => void | React.DragEventHandler;
128
+ /**
129
+ * Specifies whether an element is draggable or not.
130
+ *
131
+ * **Important:** To make draggable menu items work in Firefox, the elementType must not be `"button"`. Set it to something else, like `"div"`.
132
+ */
133
+ draggable?: boolean;
134
+ hideDraggableIcon?: boolean;
135
+ "data-tooltip"?: string;
136
+ /**
137
+ * Specifies whether an element is disabled or not.
138
+ */
139
+ disabled?: boolean;
140
+ /**
141
+ * Specifies style of an element.
142
+ */
143
+ style?: React.CSSProperties;
144
+ id?: string;
145
+ }
146
+ /**
147
+ * Link, button or custom component for Sidebar, Actions or ActionMenu
148
+ */
149
+ export default function MenuItem(props: MenuItemProps): JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from "react";
2
+ import { ModalType } from "./shared";
3
+ export interface ModalProps {
4
+ modalContent?: string;
5
+ modalTitle?: string;
6
+ modalIcon?: ReactNode;
7
+ unSetModalContent: (modalContent?: string) => void;
8
+ /**
9
+ * Type of `input` depends on `type` prop and which action occured.
10
+ * When it's a string, the user entered something. When it's a boolean, the user clicked "Yes" or "No".
11
+ * When it's `null`, the user cancelled the modal.
12
+ */
13
+ onSubmit?: (input: string | boolean | null) => void;
14
+ defaultInput?: string;
15
+ /**
16
+ * `"ask"` | `"tell"` | `"verify"`
17
+ */
18
+ type: ModalType;
19
+ inputType?: string;
20
+ switchPrimaryBtn?: boolean;
21
+ acceptBtnText?: string;
22
+ cancelBtnText?: string;
23
+ }
24
+ /**
25
+ * Simple modal/dialog. Designed to work as an alternative to JavaScript's native `alert()`, `prompt()` and `confirm()` functions.
26
+ * It uses Bootstrap's Modal components.
27
+ *
28
+ * For easy use, you should use the hook `useModal` together with `ModalProvider`. See the example there.
29
+ */
30
+ export default function Modal({ modalContent, modalTitle, modalIcon, unSetModalContent, onSubmit, defaultInput, type, inputType, switchPrimaryBtn, acceptBtnText, cancelBtnText }: ModalProps): JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from "react";
2
+ interface ModelAlertOptions {
3
+ title?: string;
4
+ icon?: ReactNode;
5
+ switchPrimaryBtn?: boolean;
6
+ acceptBtnText?: string;
7
+ cancelBtnText?: string;
8
+ }
9
+ interface ModelAskOptions extends ModelAlertOptions {
10
+ inputType?: string;
11
+ }
12
+ export interface ModalProviderProps {
13
+ children?: ReactNode;
14
+ }
15
+ declare const ModalProvider: ({ children, ...rest }: ModalProviderProps) => JSX.Element;
16
+ declare const useModal: () => {
17
+ ask: (text: string, options?: ModelAskOptions) => Promise<string | boolean>;
18
+ tell: (text: string, options?: ModelAlertOptions) => Promise<boolean>;
19
+ verify: (text: string, options?: ModelAlertOptions) => Promise<boolean>;
20
+ };
21
+ export { ModalProvider, useModal };
@@ -0,0 +1,17 @@
1
+ import { CSSProperties, MouseEventHandler, MutableRefObject, RefObject } 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
+ onClick?: MouseEventHandler<HTMLDivElement> | undefined;
11
+ style?: CSSProperties;
12
+ wrapperRef?: RefObject<HTMLDivElement>;
13
+ }
14
+ /**
15
+ * Component that fires an event if you click outside of it
16
+ */
17
+ export default function Outside({ children, className, onClickOutside, onClick, style, wrapperRef }: OutsideProps): JSX.Element;
@@ -0,0 +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;
@@ -0,0 +1,36 @@
1
+ import React, { ReactNode, RefObject } from "react";
2
+ export interface SearchProps {
3
+ autoFocus?: boolean;
4
+ /**
5
+ * Is component inside of a page?
6
+ */
7
+ body?: boolean;
8
+ className?: string;
9
+ icon?: any;
10
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
11
+ onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
12
+ placeholder?: string;
13
+ /**
14
+ * Allow reset?
15
+ */
16
+ reset?: boolean;
17
+ /**
18
+ * Define custom icon for the reset button.
19
+ */
20
+ resetIcon?: any;
21
+ /**
22
+ * Is component inside of the sidebar?
23
+ */
24
+ sidebar?: boolean;
25
+ value?: string;
26
+ children?: ReactNode;
27
+ id?: string;
28
+ /**
29
+ * Set `ref` prop of the input element. Let's you take control of it from the outside, e.g. to set focus.
30
+ */
31
+ inputRef?: RefObject<HTMLInputElement>;
32
+ }
33
+ /**
34
+ * A search bar that can be placed to the sidebar or on a page.
35
+ */
36
+ export default function Search(props: SearchProps): JSX.Element;