@superdispatch/ui 0.15.0 → 0.18.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.
- package/dist-node/index.js +387 -152
- package/dist-node/index.js.map +1 -1
- package/dist-src/adaptive-toolbar/AdaptiveToolbar.js +38 -33
- package/dist-src/adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js +115 -0
- package/dist-src/dropdown-button/DropdownButton.js +114 -0
- package/dist-src/index.js +3 -0
- package/dist-src/utils/ResizeObserver.js +20 -0
- package/dist-types/index.d.ts +37 -3
- package/dist-web/index.js +335 -103
- package/dist-web/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["items"];
|
|
4
|
-
import {
|
|
5
|
-
import { Grid, Menu, MenuItem, Toolbar, Typography } from '@material-ui/core';
|
|
4
|
+
import { Divider, Grid, Menu, MenuItem, Toolbar, Typography } from '@material-ui/core';
|
|
6
5
|
import { MoreHoriz } from '@material-ui/icons';
|
|
7
6
|
import { makeStyles } from '@material-ui/styles';
|
|
8
|
-
import {
|
|
9
|
-
import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
|
7
|
+
import { forwardRef, useRef, useState } from 'react';
|
|
10
8
|
import { Button } from "../button/Button.js";
|
|
9
|
+
import { DropdownButton } from "../dropdown-button/DropdownButton.js";
|
|
10
|
+
import { useResizeObserver } from "../utils/ResizeObserver.js";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
|
|
14
|
-
function useResizeObserver(node, observer) {
|
|
15
|
-
var handler = useEventHandler(observer);
|
|
16
|
-
useLayoutEffect(() => {
|
|
17
|
-
if (!node) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var resizeObserver = new ResizeObserver(() => {
|
|
22
|
-
handler(node);
|
|
23
|
-
});
|
|
24
|
-
resizeObserver.observe(node);
|
|
25
|
-
handler(node);
|
|
26
|
-
return () => {
|
|
27
|
-
resizeObserver.disconnect();
|
|
28
|
-
};
|
|
29
|
-
}, [node, handler]);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
14
|
var useStyles = /*#__PURE__*/makeStyles({
|
|
33
15
|
actions: {
|
|
34
16
|
overflow: 'hidden'
|
|
@@ -83,7 +65,6 @@ export var AdaptiveToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
83
65
|
children: /*#__PURE__*/_jsxs(Grid, {
|
|
84
66
|
container: true,
|
|
85
67
|
spacing: 1,
|
|
86
|
-
wrap: "nowrap",
|
|
87
68
|
ref: setRootNode,
|
|
88
69
|
children: [/*#__PURE__*/_jsx(Grid, {
|
|
89
70
|
item: true,
|
|
@@ -98,7 +79,16 @@ export var AdaptiveToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
98
79
|
ref: node => {
|
|
99
80
|
itemNodes.current[idx] = node;
|
|
100
81
|
},
|
|
101
|
-
children: /*#__PURE__*/_jsx(
|
|
82
|
+
children: item.dropdown ? /*#__PURE__*/_jsx(DropdownButton, _objectSpread(_objectSpread({
|
|
83
|
+
type: "button",
|
|
84
|
+
onClick: item.onClick,
|
|
85
|
+
label: item.label
|
|
86
|
+
}, item.ButtonProps), {}, {
|
|
87
|
+
children: item.dropdown.map(dropdownItem => /*#__PURE__*/_jsx(MenuItem, {
|
|
88
|
+
onClick: dropdownItem.onClick,
|
|
89
|
+
children: dropdownItem.label
|
|
90
|
+
}, dropdownItem.key))
|
|
91
|
+
})) : /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
102
92
|
type: "button",
|
|
103
93
|
onClick: item.onClick
|
|
104
94
|
}, item.ButtonProps), {}, {
|
|
@@ -129,15 +119,30 @@ export var AdaptiveToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
129
119
|
onClose: () => {
|
|
130
120
|
setMenuButtonRef(undefined);
|
|
131
121
|
},
|
|
132
|
-
children: menuItems.map(item =>
|
|
133
|
-
|
|
134
|
-
var _item$onClick;
|
|
122
|
+
children: menuItems.map((item, index, arr) => {
|
|
123
|
+
var _item$dropdown;
|
|
135
124
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
125
|
+
var next = arr[index + 1];
|
|
126
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
127
|
+
children: [/*#__PURE__*/_jsx(MenuItem, {
|
|
128
|
+
onClick: event => {
|
|
129
|
+
var _item$onClick;
|
|
130
|
+
|
|
131
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
|
|
132
|
+
setMenuButtonRef(undefined);
|
|
133
|
+
},
|
|
134
|
+
children: item.label
|
|
135
|
+
}, item.key), (_item$dropdown = item.dropdown) === null || _item$dropdown === void 0 ? void 0 : _item$dropdown.map(dropdownItem => /*#__PURE__*/_jsx(MenuItem, {
|
|
136
|
+
onClick: event => {
|
|
137
|
+
var _dropdownItem$onClick;
|
|
138
|
+
|
|
139
|
+
(_dropdownItem$onClick = dropdownItem.onClick) === null || _dropdownItem$onClick === void 0 ? void 0 : _dropdownItem$onClick.call(dropdownItem, event);
|
|
140
|
+
setMenuButtonRef(undefined);
|
|
141
|
+
},
|
|
142
|
+
children: dropdownItem.label
|
|
143
|
+
}, dropdownItem.key)), next && item.groupKey !== next.groupKey && /*#__PURE__*/_jsx(Divider, {})]
|
|
144
|
+
});
|
|
145
|
+
})
|
|
141
146
|
})]
|
|
142
147
|
})]
|
|
143
148
|
})
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Divider, Grid, Menu, MenuItem } from '@material-ui/core';
|
|
2
|
+
import { MoreHoriz } from '@material-ui/icons';
|
|
3
|
+
import { makeStyles } from '@material-ui/styles';
|
|
4
|
+
import { cloneElement, forwardRef, useRef, useState } from 'react';
|
|
5
|
+
import { Button } from "../button/Button.js";
|
|
6
|
+
import { mergeRefs } from "../utils/mergeRefs.js";
|
|
7
|
+
import { useResizeObserver } from "../utils/ResizeObserver.js";
|
|
8
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
var useStyles = /*#__PURE__*/makeStyles({
|
|
11
|
+
root: {
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
height: '100%'
|
|
14
|
+
}
|
|
15
|
+
}, {
|
|
16
|
+
name: 'SD-AdaptiveVerticalToolbar'
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var defaultMoreElement = /*#__PURE__*/_jsx(Button, {
|
|
20
|
+
type: "button",
|
|
21
|
+
children: /*#__PURE__*/_jsx(MoreHoriz, {})
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export var AdaptiveVerticalToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
25
|
+
var {
|
|
26
|
+
items,
|
|
27
|
+
disableGutters,
|
|
28
|
+
moreElement = defaultMoreElement,
|
|
29
|
+
renderItem = item => item.label,
|
|
30
|
+
renderMenuItem = item => item.label
|
|
31
|
+
} = _ref;
|
|
32
|
+
var styles = useStyles();
|
|
33
|
+
var itemNodes = useRef([]);
|
|
34
|
+
var optionsButtonRef = useRef(null);
|
|
35
|
+
var [firstHiddenIdx, setFirstHiddenIdx] = useState(-1);
|
|
36
|
+
var menuItems = firstHiddenIdx === -1 ? [] : items.slice(firstHiddenIdx);
|
|
37
|
+
var [menuButtonNode, setMenuButtonRef] = useState();
|
|
38
|
+
var [rootNode, setRootNode] = useState(null);
|
|
39
|
+
useResizeObserver(rootNode, node => {
|
|
40
|
+
var _optionsButtonRef$cur;
|
|
41
|
+
|
|
42
|
+
var rootRect = node.getBoundingClientRect();
|
|
43
|
+
var rootHeight = rootRect.bottom;
|
|
44
|
+
var optionsButtonRect = (_optionsButtonRef$cur = optionsButtonRef.current) === null || _optionsButtonRef$cur === void 0 ? void 0 : _optionsButtonRef$cur.getBoundingClientRect();
|
|
45
|
+
var optionsButtonWidth = (optionsButtonRect === null || optionsButtonRect === void 0 ? void 0 : optionsButtonRect.height) || 0;
|
|
46
|
+
var maxBottomPosition = rootHeight - optionsButtonWidth;
|
|
47
|
+
var mountedNodes = itemNodes.current.filter(x => x != null);
|
|
48
|
+
var hiddenIdx = mountedNodes.findIndex((itemNode, idx) => {
|
|
49
|
+
itemNode.removeAttribute('hidden');
|
|
50
|
+
var itemRect = itemNode.getBoundingClientRect(); // Ignore options button height when checking last item.
|
|
51
|
+
|
|
52
|
+
if (idx === mountedNodes.length - 1) {
|
|
53
|
+
return itemRect.bottom > rootHeight;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return itemRect.bottom > maxBottomPosition;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (hiddenIdx !== -1) {
|
|
60
|
+
mountedNodes.slice(hiddenIdx).forEach(itemNode => {
|
|
61
|
+
itemNode.setAttribute('hidden', 'true');
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
setFirstHiddenIdx(hiddenIdx);
|
|
66
|
+
});
|
|
67
|
+
return /*#__PURE__*/_jsxs(Grid, {
|
|
68
|
+
direction: "column",
|
|
69
|
+
container: true,
|
|
70
|
+
wrap: "nowrap",
|
|
71
|
+
className: styles.root,
|
|
72
|
+
spacing: disableGutters ? undefined : 1,
|
|
73
|
+
ref: mergeRefs(ref, node => {
|
|
74
|
+
setRootNode(node);
|
|
75
|
+
}),
|
|
76
|
+
children: [items.map((item, idx) => /*#__PURE__*/_jsx(Grid, {
|
|
77
|
+
item: true,
|
|
78
|
+
ref: node => {
|
|
79
|
+
itemNodes.current[idx] = node;
|
|
80
|
+
},
|
|
81
|
+
children: renderItem(item)
|
|
82
|
+
}, item.key)), menuItems.length > 0 && /*#__PURE__*/_jsxs(Grid, {
|
|
83
|
+
item: true,
|
|
84
|
+
ref: optionsButtonRef,
|
|
85
|
+
component: "div",
|
|
86
|
+
children: [/*#__PURE__*/cloneElement(moreElement, {
|
|
87
|
+
onClick: _ref2 => {
|
|
88
|
+
var {
|
|
89
|
+
currentTarget
|
|
90
|
+
} = _ref2;
|
|
91
|
+
setMenuButtonRef(currentTarget);
|
|
92
|
+
}
|
|
93
|
+
}), /*#__PURE__*/_jsx(Menu, {
|
|
94
|
+
open: !!menuButtonNode,
|
|
95
|
+
anchorEl: menuButtonNode,
|
|
96
|
+
onClose: () => {
|
|
97
|
+
setMenuButtonRef(undefined);
|
|
98
|
+
},
|
|
99
|
+
children: menuItems.flatMap((item, index, arr) => {
|
|
100
|
+
var next = arr[index + 1];
|
|
101
|
+
return [/*#__PURE__*/_jsx(MenuItem, {
|
|
102
|
+
onClick: event => {
|
|
103
|
+
var _item$onClick;
|
|
104
|
+
|
|
105
|
+
(_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, event);
|
|
106
|
+
setMenuButtonRef(undefined);
|
|
107
|
+
},
|
|
108
|
+
children: renderMenuItem(item)
|
|
109
|
+
}, item.key), next && next.menuGroupKey !== item.menuGroupKey && /*#__PURE__*/_jsx(Divider, {}, "".concat(item.key, "-divider"))];
|
|
110
|
+
})
|
|
111
|
+
})]
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
if (process.env.NODE_ENV !== "production") AdaptiveVerticalToolbar.displayName = "AdaptiveVerticalToolbar";
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["MenuListProps", "ButtonGroupProps", "children", "isLoading", "onClick", "label"];
|
|
4
|
+
import { ButtonGroup, MenuList, Popover } from '@material-ui/core';
|
|
5
|
+
import * as React from 'react';
|
|
6
|
+
import { forwardRef } from 'react';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { Color, mergeRefs, useUID } from "../index.js";
|
|
9
|
+
import { Button } from "../button/Button.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
|
|
14
|
+
function CaretDownIcon() {
|
|
15
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
16
|
+
viewBox: "0 0 8 4",
|
|
17
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
18
|
+
fill: "currentColor",
|
|
19
|
+
d: "M0.666687 0.666656L4.00002 3.99999L7.33335 0.666656H0.666687Z"
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var CaretButton = /*#__PURE__*/styled(Button).withConfig({
|
|
25
|
+
displayName: "DropdownButton__CaretButton",
|
|
26
|
+
componentId: "SD__sc-8l84jm-0"
|
|
27
|
+
})(["width:auto;", ";"], _ref => {
|
|
28
|
+
var {
|
|
29
|
+
variant
|
|
30
|
+
} = _ref;
|
|
31
|
+
return variant === 'contained' && "border-left: 1px solid ".concat(Color.Blue500);
|
|
32
|
+
});
|
|
33
|
+
export var DropdownButton = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
34
|
+
var _anchorRef$current2;
|
|
35
|
+
|
|
36
|
+
var {
|
|
37
|
+
MenuListProps,
|
|
38
|
+
ButtonGroupProps,
|
|
39
|
+
children,
|
|
40
|
+
isLoading,
|
|
41
|
+
onClick,
|
|
42
|
+
label
|
|
43
|
+
} = _ref2,
|
|
44
|
+
buttonProps = _objectWithoutProperties(_ref2, _excluded);
|
|
45
|
+
|
|
46
|
+
var uid = useUID();
|
|
47
|
+
var [open, setOpen] = React.useState(false);
|
|
48
|
+
var anchorRef = React.useRef(null);
|
|
49
|
+
|
|
50
|
+
function handleClick(event) {
|
|
51
|
+
setOpen(false);
|
|
52
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function handleToggle() {
|
|
56
|
+
setOpen(prevOpen => !prevOpen);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleClose(event) {
|
|
60
|
+
var _anchorRef$current;
|
|
61
|
+
|
|
62
|
+
if ((_anchorRef$current = anchorRef.current) !== null && _anchorRef$current !== void 0 && _anchorRef$current.contains(event.currentTarget)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
setOpen(false);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
70
|
+
children: [/*#__PURE__*/_jsxs(ButtonGroup, _objectSpread(_objectSpread({}, ButtonGroupProps), {}, {
|
|
71
|
+
ref: mergeRefs(ButtonGroupProps === null || ButtonGroupProps === void 0 ? void 0 : ButtonGroupProps.ref, anchorRef),
|
|
72
|
+
fullWidth: (ButtonGroupProps === null || ButtonGroupProps === void 0 ? void 0 : ButtonGroupProps.fullWidth) || buttonProps.fullWidth,
|
|
73
|
+
children: [/*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
|
|
74
|
+
ref: ref,
|
|
75
|
+
onClick: handleClick,
|
|
76
|
+
disabled: isLoading,
|
|
77
|
+
isLoading: isLoading
|
|
78
|
+
}, buttonProps), {}, {
|
|
79
|
+
children: label
|
|
80
|
+
})), /*#__PURE__*/_jsx(CaretButton, {
|
|
81
|
+
onClick: handleToggle,
|
|
82
|
+
disabled: isLoading,
|
|
83
|
+
color: buttonProps.color,
|
|
84
|
+
variant: buttonProps.variant,
|
|
85
|
+
"aria-haspopup": "menu",
|
|
86
|
+
"aria-controls": open ? uid : undefined,
|
|
87
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
88
|
+
children: /*#__PURE__*/_jsx(CaretDownIcon, {})
|
|
89
|
+
})]
|
|
90
|
+
})), /*#__PURE__*/_jsx(Popover, {
|
|
91
|
+
open: open,
|
|
92
|
+
onClose: handleClose,
|
|
93
|
+
anchorEl: anchorRef.current,
|
|
94
|
+
anchorOrigin: {
|
|
95
|
+
vertical: 'bottom',
|
|
96
|
+
horizontal: 'left'
|
|
97
|
+
},
|
|
98
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
99
|
+
style: {
|
|
100
|
+
minWidth: (_anchorRef$current2 = anchorRef.current) === null || _anchorRef$current2 === void 0 ? void 0 : _anchorRef$current2.clientWidth
|
|
101
|
+
},
|
|
102
|
+
children: /*#__PURE__*/_jsx(MenuList, _objectSpread(_objectSpread({}, MenuListProps), {}, {
|
|
103
|
+
id: uid,
|
|
104
|
+
onClick: () => {
|
|
105
|
+
setOpen(false);
|
|
106
|
+
},
|
|
107
|
+
children: children
|
|
108
|
+
}))
|
|
109
|
+
})
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
if (process.env.NODE_ENV !== "production") DropdownButton.displayName = "DropdownButton";
|
|
114
|
+
export default DropdownButton;
|
package/dist-src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./adaptive-toolbar/AdaptiveToolbar.js";
|
|
2
|
+
export * from "./adaptive-vertical-toolbar/AdaptiveVerticalToolbar.js";
|
|
2
3
|
export * from "./avatar-button/AvatarButton.js";
|
|
3
4
|
export * from "./button/Button.js";
|
|
4
5
|
export * from "./card-button/CardButton.js";
|
|
@@ -11,6 +12,7 @@ export * from "./drawer/DrawerActions.js";
|
|
|
11
12
|
export * from "./drawer/DrawerContent.js";
|
|
12
13
|
export * from "./drawer/DrawerList.js";
|
|
13
14
|
export * from "./drawer/DrawerTitle.js";
|
|
15
|
+
export * from "./dropdown-button/DropdownButton.js";
|
|
14
16
|
export * from "./grid/GridStack.js";
|
|
15
17
|
export * from "./grid/InlineGrid.js";
|
|
16
18
|
export * from "./info-card/InfoCard.js";
|
|
@@ -36,5 +38,6 @@ export * from "./tiles/Tiles.js";
|
|
|
36
38
|
export * from "./utils/isEmptyReactNode.js";
|
|
37
39
|
export * from "./utils/mergeRefs.js";
|
|
38
40
|
export * from "./utils/renderChildren.js";
|
|
41
|
+
export * from "./utils/ResizeObserver.js";
|
|
39
42
|
export * from "./utils/useUID.js";
|
|
40
43
|
export * from "./utils/VisibilityObserver.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ResizeObserver } from '@juggle/resize-observer';
|
|
2
|
+
import { useEventHandler } from '@superdispatch/hooks';
|
|
3
|
+
import { useLayoutEffect } from 'react';
|
|
4
|
+
export function useResizeObserver(node, observer) {
|
|
5
|
+
var handler = useEventHandler(observer);
|
|
6
|
+
useLayoutEffect(() => {
|
|
7
|
+
if (!node) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var resizeObserver = new ResizeObserver(() => {
|
|
12
|
+
handler(node);
|
|
13
|
+
});
|
|
14
|
+
resizeObserver.observe(node);
|
|
15
|
+
handler(node);
|
|
16
|
+
return () => {
|
|
17
|
+
resizeObserver.disconnect();
|
|
18
|
+
};
|
|
19
|
+
}, [node, handler]);
|
|
20
|
+
}
|
package/dist-types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps as ButtonProps$1, ToolbarProps, AvatarClassKey, AvatarTypeMap, ButtonBaseProps, CheckboxProps, FormControlLabelProps, FormControlProps, FormGroupProps, FormLabelProps, FormHelperTextProps, TypographyProps, TooltipProps, ListProps, ListTypeMap, GridProps, CardClassKey, CardProps, CardContentProps, RadioProps, RadioGroupProps, SnackbarContentProps as SnackbarContentProps$1, SnackbarContentClassKey as SnackbarContentClassKey$1, SnackbarProps as SnackbarProps$1, Theme } from '@material-ui/core';
|
|
3
|
-
import { RefAttributes, ForwardRefExoticComponent, Key, ReactNode, MouseEvent, ButtonHTMLAttributes, Ref, ElementType, HTMLAttributes,
|
|
2
|
+
import { ButtonProps as ButtonProps$1, ToolbarProps, AvatarClassKey, AvatarTypeMap, ButtonBaseProps, CheckboxProps, FormControlLabelProps, FormControlProps, FormGroupProps, FormLabelProps, FormHelperTextProps, TypographyProps, TooltipProps, ListProps, ListTypeMap, MenuListProps, ButtonGroupProps, GridProps, CardClassKey, CardProps, CardContentProps, RadioProps, RadioGroupProps, SnackbarContentProps as SnackbarContentProps$1, SnackbarContentClassKey as SnackbarContentClassKey$1, SnackbarProps as SnackbarProps$1, Theme } from '@material-ui/core';
|
|
3
|
+
import { RefAttributes, ForwardRefExoticComponent, Key, ReactNode, MouseEvent, ReactElement, EventHandler, ButtonHTMLAttributes, Ref, ElementType, HTMLAttributes, ConsumerProps } from 'react';
|
|
4
4
|
import { ClassNameMap } from '@material-ui/styles';
|
|
5
5
|
import { Property } from 'csstype';
|
|
6
6
|
import { CommonProps } from '@material-ui/core/OverridableComponent';
|
|
@@ -15,9 +15,16 @@ interface ButtonProps extends RefAttributes<HTMLButtonElement>, Omit<ButtonProps
|
|
|
15
15
|
}
|
|
16
16
|
declare const Button: ForwardRefExoticComponent<ButtonProps>;
|
|
17
17
|
|
|
18
|
+
interface AdaptiveToolbarDropdownItem {
|
|
19
|
+
key: Key;
|
|
20
|
+
label: ReactNode;
|
|
21
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
22
|
+
}
|
|
18
23
|
interface AdaptiveToolbarItem {
|
|
19
24
|
key: Key;
|
|
25
|
+
groupKey?: Key;
|
|
20
26
|
label: ReactNode;
|
|
27
|
+
dropdown?: AdaptiveToolbarDropdownItem[];
|
|
21
28
|
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
22
29
|
ButtonProps?: Omit<ButtonProps, 'type' | 'onClick'>;
|
|
23
30
|
}
|
|
@@ -26,6 +33,23 @@ interface AdaptiveToolbarProps extends RefAttributes<HTMLDivElement>, Omit<Toolb
|
|
|
26
33
|
}
|
|
27
34
|
declare const AdaptiveToolbar: ForwardRefExoticComponent<AdaptiveToolbarProps>;
|
|
28
35
|
|
|
36
|
+
interface AdaptiveVerticalToolbarItem {
|
|
37
|
+
key: Key;
|
|
38
|
+
label: ReactNode;
|
|
39
|
+
menuGroupKey?: Key;
|
|
40
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
41
|
+
}
|
|
42
|
+
interface AdaptiveVerticalToolbarProps extends RefAttributes<HTMLDivElement> {
|
|
43
|
+
disableGutters?: boolean;
|
|
44
|
+
items: AdaptiveVerticalToolbarItem[];
|
|
45
|
+
renderItem?: (item: AdaptiveVerticalToolbarItem) => ReactNode;
|
|
46
|
+
renderMenuItem?: (item: AdaptiveVerticalToolbarItem) => ReactNode;
|
|
47
|
+
moreElement?: ReactElement<{
|
|
48
|
+
onClick: EventHandler<MouseEvent<HTMLElement>>;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
declare const AdaptiveVerticalToolbar: ForwardRefExoticComponent<AdaptiveVerticalToolbarProps>;
|
|
52
|
+
|
|
29
53
|
declare type AvatarButtonClassKey = 'button' | 'overlay' | 'progress' | 'withIcon' | 'sizeLarge' | Exclude<AvatarClassKey, 'circle'>;
|
|
30
54
|
interface AvatarButtonProps extends RefAttributes<HTMLButtonElement>, ButtonHTMLAttributes<HTMLButtonElement> {
|
|
31
55
|
size?: 'small' | 'large';
|
|
@@ -168,6 +192,14 @@ interface DrawerTitleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'
|
|
|
168
192
|
}
|
|
169
193
|
declare const DrawerTitle: ForwardRefExoticComponent<DrawerTitleProps & RefAttributes<HTMLDivElement>>;
|
|
170
194
|
|
|
195
|
+
interface DropdownButtonProps extends Omit<ButtonProps, 'children'> {
|
|
196
|
+
label?: ReactNode;
|
|
197
|
+
children: ReactNode;
|
|
198
|
+
MenuListProps?: Omit<MenuListProps, 'id'>;
|
|
199
|
+
ButtonGroupProps?: ButtonGroupProps;
|
|
200
|
+
}
|
|
201
|
+
declare const DropdownButton: ForwardRefExoticComponent<Pick<DropdownButtonProps, "className" | "style" | "classes" | "innerRef" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "form" | "label" | "key" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "disableElevation" | "fullWidth" | "startIcon" | "endIcon" | "disableFocusRipple" | "href" | "size" | "variant" | "action" | "buttonRef" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "rel" | "target" | "isActive" | "isLoading" | "MenuListProps" | "ButtonGroupProps"> & RefAttributes<HTMLButtonElement>>;
|
|
202
|
+
|
|
171
203
|
interface GridStackProps extends RefAttributes<HTMLDivElement>, Pick<GridProps, 'style' | 'className' | 'children' | 'spacing' | 'alignItems'> {
|
|
172
204
|
}
|
|
173
205
|
/**
|
|
@@ -387,6 +419,8 @@ declare function assignRef<T>(ref: Ref<T> | undefined, value: T): void;
|
|
|
387
419
|
|
|
388
420
|
declare function renderChildren(node: ReactNode): null | ReactElement;
|
|
389
421
|
|
|
422
|
+
declare function useResizeObserver<T extends HTMLElement>(node: null | undefined | T, observer: (node: T) => void): void;
|
|
423
|
+
|
|
390
424
|
declare function useUID(defaultID?: string): string;
|
|
391
425
|
|
|
392
426
|
declare type ElementVisibility = 'undetermined' | 'visible' | 'invisible';
|
|
@@ -408,4 +442,4 @@ interface VisibilityObserverProps extends VisibilityObserverOptions {
|
|
|
408
442
|
}
|
|
409
443
|
declare function VisibilityObserver({ render, onChange, ...options }: VisibilityObserverProps): null | ReactElement;
|
|
410
444
|
|
|
411
|
-
export { AdaptiveToolbar, AdaptiveToolbarItem, AdaptiveToolbarProps, AvatarButton, AvatarButtonClassKey, AvatarButtonProps, Button, ButtonProps, CardButton, CardButtonClassKey, CardButtonProps, CheckboxField, CheckboxFieldProps, CheckboxGroupField, CheckboxGroupFieldProps, CollapseBreakpoint, CollapseProp, Color, ColorProp, ColorVariant, Column, ColumnProps, ColumnWidth, Columns, ColumnsProps, DescriptionList, DescriptionListItem, DescriptionListItemProps, DescriptionListProps, DrawerActions, DrawerActionsProps, DrawerContent, DrawerContentProps, DrawerList, DrawerListProps, DrawerTitle, DrawerTitleProps, ElementVisibility, GridStack, GridStackProps, HorizontalAlign, InfoCard, InfoCardClassKey, InfoCardProps, Inline, InlineGrid, InlineGridProps, InlineProps, NegativeSpaceProp, OverflowText, OverflowTextProps, PartialResponsivePropRecord, RadioField, RadioFieldProps, RadioGroupField, RadioGroupFieldProps, ResponsiveContext, ResponsiveContextProvider, ResponsiveContextProviderProps, ResponsiveProp, ResponsivePropPrimitive, ResponsivePropRecord, ResponsivePropTuple, ResponsivePropTupleInit, Snackbar, SnackbarCloseReason, SnackbarContent, SnackbarContentProps, SnackbarProps, SnackbarStack, SnackbarStackConsumer, SnackbarStackOptions, SnackbarStackProvider, SnackbarStackProviderProps, SnackbarVariant, SpaceProp, Stack, StackProps, SuperDispatchTheme, Tag, TagClassKey, TagProps, ThemeProvider, ThemeProviderProps, Tiles, TilesColumns, TilesProps, TilesSpace, VerticalAlign, VisibilityObserver, VisibilityObserverOptions, VisibilityObserverProps, VisibilityObserverRenderProps, assignRef, isColorProp, isEmptyReactNode, mergeRefs, parseAlignProp, parseCollapsedBelow, parseResponsiveProp, parseSpaceProp, renderChildren, useCollapseBreakpoint, useResponsiveContext, useResponsiveProp, useResponsivePropRecord, useResponsiveValue, useSnackbarStack, useUID, useVisibilityObserver };
|
|
445
|
+
export { AdaptiveToolbar, AdaptiveToolbarDropdownItem, AdaptiveToolbarItem, AdaptiveToolbarProps, AdaptiveVerticalToolbar, AdaptiveVerticalToolbarItem, AdaptiveVerticalToolbarProps, AvatarButton, AvatarButtonClassKey, AvatarButtonProps, Button, ButtonProps, CardButton, CardButtonClassKey, CardButtonProps, CheckboxField, CheckboxFieldProps, CheckboxGroupField, CheckboxGroupFieldProps, CollapseBreakpoint, CollapseProp, Color, ColorProp, ColorVariant, Column, ColumnProps, ColumnWidth, Columns, ColumnsProps, DescriptionList, DescriptionListItem, DescriptionListItemProps, DescriptionListProps, DrawerActions, DrawerActionsProps, DrawerContent, DrawerContentProps, DrawerList, DrawerListProps, DrawerTitle, DrawerTitleProps, DropdownButton, ElementVisibility, GridStack, GridStackProps, HorizontalAlign, InfoCard, InfoCardClassKey, InfoCardProps, Inline, InlineGrid, InlineGridProps, InlineProps, NegativeSpaceProp, OverflowText, OverflowTextProps, PartialResponsivePropRecord, RadioField, RadioFieldProps, RadioGroupField, RadioGroupFieldProps, ResponsiveContext, ResponsiveContextProvider, ResponsiveContextProviderProps, ResponsiveProp, ResponsivePropPrimitive, ResponsivePropRecord, ResponsivePropTuple, ResponsivePropTupleInit, Snackbar, SnackbarCloseReason, SnackbarContent, SnackbarContentProps, SnackbarProps, SnackbarStack, SnackbarStackConsumer, SnackbarStackOptions, SnackbarStackProvider, SnackbarStackProviderProps, SnackbarVariant, SpaceProp, Stack, StackProps, SuperDispatchTheme, Tag, TagClassKey, TagProps, ThemeProvider, ThemeProviderProps, Tiles, TilesColumns, TilesProps, TilesSpace, VerticalAlign, VisibilityObserver, VisibilityObserverOptions, VisibilityObserverProps, VisibilityObserverRenderProps, assignRef, isColorProp, isEmptyReactNode, mergeRefs, parseAlignProp, parseCollapsedBelow, parseResponsiveProp, parseSpaceProp, renderChildren, useCollapseBreakpoint, useResizeObserver, useResponsiveContext, useResponsiveProp, useResponsivePropRecord, useResponsiveValue, useSnackbarStack, useUID, useVisibilityObserver };
|