@superdispatch/ui-lab 0.16.0-alpha.0 → 0.16.0-alpha.1
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 +107 -1464
- package/dist-node/index.js.map +1 -1
- package/dist-src/alert/Alert.js +2 -2
- package/dist-src/button/Button.js +1 -1
- package/dist-src/button-area/ButtonArea.js +1 -1
- package/dist-src/file-drop-zone/FileDropZone.js +2 -2
- package/dist-src/file-list-item/FileListItem.js +2 -2
- package/dist-src/index.js +1 -3
- package/dist-src/sidebar/SidebarDivider.js +1 -1
- package/dist-src/sidebar/SidebarMenuItem.js +2 -2
- package/dist-src/sidebar/SidebarMenuItemAction.js +1 -1
- package/dist-src/sidebar/SidebarMenuItemAvatar.js +1 -1
- package/dist-types/index.d.ts +7 -327
- package/dist-web/index.js +128 -1485
- package/dist-web/index.js.map +1 -1
- package/package.json +2 -2
- package/dist-src/v5/alert/Alert.js +0 -43
- package/dist-src/v5/banner/Banner.js +0 -61
- package/dist-src/v5/box/Box.js +0 -153
- package/dist-src/v5/button/Button.js +0 -227
- package/dist-src/v5/button-area/ButtonArea.js +0 -48
- package/dist-src/v5/description-item/DescriptionItem.js +0 -75
- package/dist-src/v5/file-drop-zone/FileDropZone.js +0 -132
- package/dist-src/v5/file-list-item/FileListItem.js +0 -136
- package/dist-src/v5/index.js +0 -16
- package/dist-src/v5/sidebar/Sidebar.js +0 -66
- package/dist-src/v5/sidebar/SidebarContainer.js +0 -25
- package/dist-src/v5/sidebar/SidebarDivider.js +0 -15
- package/dist-src/v5/sidebar/SidebarMenuItem.js +0 -124
- package/dist-src/v5/sidebar/SidebarMenuItemAction.js +0 -26
- package/dist-src/v5/sidebar/SidebarMenuItemAvatar.js +0 -53
- package/dist-src/v5/sidebar/SidebarMenuItemContext.js +0 -21
- package/dist-src/v5/sidebar/SidebarSubheader.js +0 -41
- package/dist-src/v5/text-box/TextBox.js +0 -133
- package/dist-src/v5/utils/RuleNormalizer.js +0 -17
- package/dist-src/v5/utils/mergeStyles.js +0 -24
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["disabled", "children", "hintText", "startIcon", "fallback", "accept", "maxSize", "maxFiles", "onDropRejected", "onDropAccepted"];
|
|
4
|
-
import { mdiUpload } from '@mdi/js';
|
|
5
|
-
import { Error } from '@mui/icons-material';
|
|
6
|
-
import { CircularProgress, SvgIcon } from '@mui/material';
|
|
7
|
-
import { v5 } from '@superdispatch/ui';
|
|
8
|
-
import { forwardRef, Suspense } from 'react';
|
|
9
|
-
import Dropzone from 'react-dropzone';
|
|
10
|
-
import styled from 'styled-components';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
var {
|
|
15
|
-
CardButton,
|
|
16
|
-
Color,
|
|
17
|
-
Column,
|
|
18
|
-
Columns
|
|
19
|
-
} = v5;
|
|
20
|
-
export function toBytes(input, unit) {
|
|
21
|
-
if (unit === 'gb') return input * (1 << 30);
|
|
22
|
-
if (unit === 'mb') return input * (1 << 20);
|
|
23
|
-
return input * (1 << 10);
|
|
24
|
-
}
|
|
25
|
-
var KILOBYTE = 1024;
|
|
26
|
-
var BYTE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
27
|
-
export function formatBytes(bytes) {
|
|
28
|
-
if (bytes === 0) return '0 Bytes';
|
|
29
|
-
var unitIndex = Math.floor(Math.log(bytes) / Math.log(KILOBYTE));
|
|
30
|
-
var unit = BYTE_UNITS[unitIndex];
|
|
31
|
-
return "".concat((bytes / Math.pow(KILOBYTE, unitIndex)).toFixed(2), " ").concat(unit);
|
|
32
|
-
}
|
|
33
|
-
var StyledCardButton = /*#__PURE__*/styled(CardButton).withConfig({
|
|
34
|
-
displayName: "FileDropZone__StyledCardButton",
|
|
35
|
-
componentId: "SD__sc-neqvyq-0"
|
|
36
|
-
})(_ref => {
|
|
37
|
-
var {
|
|
38
|
-
status
|
|
39
|
-
} = _ref;
|
|
40
|
-
return {
|
|
41
|
-
backgroundColor: status === 'active' ? Color.Blue50 : undefined
|
|
42
|
-
};
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
function UploadRejection(_ref2) {
|
|
46
|
-
var {
|
|
47
|
-
maxSize,
|
|
48
|
-
rejection
|
|
49
|
-
} = _ref2;
|
|
50
|
-
var [error] = rejection.errors;
|
|
51
|
-
if (!error) return null;
|
|
52
|
-
return /*#__PURE__*/_jsxs(Columns, {
|
|
53
|
-
align: "center",
|
|
54
|
-
children: [/*#__PURE__*/_jsx(Column, {
|
|
55
|
-
width: "content",
|
|
56
|
-
children: /*#__PURE__*/_jsx(Error, {})
|
|
57
|
-
}), /*#__PURE__*/_jsx(Column, {
|
|
58
|
-
children: error.code === 'file-too-large' ? maxSize == null ? 'Attachment size is too large' : "Attachment size should be less than ".concat(formatBytes(maxSize)) : error.message
|
|
59
|
-
})]
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export var FileDropZone = /*#__PURE__*/forwardRef((props, ref) => {
|
|
64
|
-
var {
|
|
65
|
-
// CardButton
|
|
66
|
-
disabled = false,
|
|
67
|
-
children: _children = 'Upload Attachments',
|
|
68
|
-
hintText = 'or Drag & Drop files',
|
|
69
|
-
startIcon = /*#__PURE__*/_jsx(SvgIcon, {
|
|
70
|
-
children: /*#__PURE__*/_jsx("path", {
|
|
71
|
-
d: mdiUpload
|
|
72
|
-
})
|
|
73
|
-
}),
|
|
74
|
-
fallback = /*#__PURE__*/_jsx(CardButton, {
|
|
75
|
-
ref: ref,
|
|
76
|
-
disabled: true,
|
|
77
|
-
startIcon: /*#__PURE__*/_jsx(CircularProgress, {
|
|
78
|
-
size: "1em",
|
|
79
|
-
color: "inherit"
|
|
80
|
-
}),
|
|
81
|
-
children: "Loading dependencies\u2026"
|
|
82
|
-
}),
|
|
83
|
-
// Dropzone
|
|
84
|
-
accept,
|
|
85
|
-
maxSize = Infinity,
|
|
86
|
-
maxFiles = Infinity,
|
|
87
|
-
onDropRejected: _onDropRejected,
|
|
88
|
-
onDropAccepted: _onDropAccepted
|
|
89
|
-
} = props,
|
|
90
|
-
dropzoneProps = _objectWithoutProperties(props, _excluded);
|
|
91
|
-
|
|
92
|
-
return /*#__PURE__*/_jsx(Suspense, {
|
|
93
|
-
fallback: fallback,
|
|
94
|
-
children: /*#__PURE__*/_jsx(Dropzone, _objectSpread(_objectSpread({}, dropzoneProps), {}, {
|
|
95
|
-
accept: accept,
|
|
96
|
-
maxSize: maxSize,
|
|
97
|
-
maxFiles: maxFiles,
|
|
98
|
-
disabled: disabled,
|
|
99
|
-
onDropAccepted: files => {
|
|
100
|
-
_onDropAccepted === null || _onDropAccepted === void 0 ? void 0 : _onDropAccepted(files);
|
|
101
|
-
},
|
|
102
|
-
onDropRejected: fileRejections => {
|
|
103
|
-
_onDropRejected === null || _onDropRejected === void 0 ? void 0 : _onDropRejected(fileRejections);
|
|
104
|
-
},
|
|
105
|
-
children: _ref3 => {
|
|
106
|
-
var {
|
|
107
|
-
isDragActive,
|
|
108
|
-
isDragReject,
|
|
109
|
-
getRootProps,
|
|
110
|
-
getInputProps,
|
|
111
|
-
fileRejections: [fileRejection]
|
|
112
|
-
} = _ref3;
|
|
113
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
114
|
-
children: [/*#__PURE__*/_jsx("input", _objectSpread({}, getInputProps())), /*#__PURE__*/_jsx(StyledCardButton, _objectSpread(_objectSpread({}, getRootProps()), {}, {
|
|
115
|
-
ref: ref,
|
|
116
|
-
hint: hintText,
|
|
117
|
-
disabled: disabled,
|
|
118
|
-
startIcon: startIcon,
|
|
119
|
-
status: isDragActive ? 'active' : isDragReject ? 'error' : 'idle',
|
|
120
|
-
error: !!fileRejection && /*#__PURE__*/_jsx(UploadRejection, {
|
|
121
|
-
accept: accept,
|
|
122
|
-
maxSize: maxSize,
|
|
123
|
-
rejection: fileRejection
|
|
124
|
-
}),
|
|
125
|
-
children: _children
|
|
126
|
-
}))]
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}))
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
if (process.env.NODE_ENV !== "production") FileDropZone.displayName = "FileDropZone";
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import { mdiFilePdfBox, mdiTextBox } from '@mdi/js';
|
|
3
|
-
import { CheckCircle, Delete, Error, Image, Refresh } from '@mui/icons-material';
|
|
4
|
-
import { CircularProgress, IconButton, Link, SvgIcon, Tooltip } from '@mui/material';
|
|
5
|
-
import { v5 } from '@superdispatch/ui';
|
|
6
|
-
import { forwardRef, memo, useState } from 'react';
|
|
7
|
-
import styled from 'styled-components';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
var {
|
|
11
|
-
Color,
|
|
12
|
-
Column,
|
|
13
|
-
Columns,
|
|
14
|
-
useResponsiveValue,
|
|
15
|
-
useUID
|
|
16
|
-
} = v5;
|
|
17
|
-
var FileListItemName = /*#__PURE__*/styled.div.withConfig({
|
|
18
|
-
displayName: "FileListItem__FileListItemName",
|
|
19
|
-
componentId: "SD__sc-1pro30e-0"
|
|
20
|
-
})(["overflow:hidden;line-height:22px;white-space:nowrap;text-overflow:ellipsis;"]);
|
|
21
|
-
var FileListItemProgress = /*#__PURE__*/styled(CircularProgress).withConfig({
|
|
22
|
-
displayName: "FileListItem__FileListItemProgress",
|
|
23
|
-
componentId: "SD__sc-1pro30e-1"
|
|
24
|
-
})(["font-size:24px;", "{font-size:14px;}"], _ref => {
|
|
25
|
-
var {
|
|
26
|
-
theme
|
|
27
|
-
} = _ref;
|
|
28
|
-
return theme.breakpoints.up('sm');
|
|
29
|
-
});
|
|
30
|
-
var PdfIcon = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(SvgIcon, _objectSpread(_objectSpread({}, props), {}, {
|
|
31
|
-
children: /*#__PURE__*/_jsx("path", {
|
|
32
|
-
d: mdiFilePdfBox
|
|
33
|
-
})
|
|
34
|
-
})));
|
|
35
|
-
var TextBoxIcon = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(SvgIcon, _objectSpread(_objectSpread({}, props), {}, {
|
|
36
|
-
children: /*#__PURE__*/_jsx("path", {
|
|
37
|
-
d: mdiTextBox
|
|
38
|
-
})
|
|
39
|
-
})));
|
|
40
|
-
var PDF_FILE_PATTERN = /\.pdf$/;
|
|
41
|
-
var IMAGE_FILE_PATTERN = /\.(gif|png|jpg|jpeg)$/;
|
|
42
|
-
|
|
43
|
-
function getFileType(name) {
|
|
44
|
-
if (PDF_FILE_PATTERN.exec(name)) return 'pdf';
|
|
45
|
-
if (IMAGE_FILE_PATTERN.exec(name)) return 'image';
|
|
46
|
-
return 'unknown';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export var FileListItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
50
|
-
var {
|
|
51
|
-
url,
|
|
52
|
-
name,
|
|
53
|
-
status,
|
|
54
|
-
onRetry,
|
|
55
|
-
onDelete
|
|
56
|
-
} = _ref2;
|
|
57
|
-
var uid = useUID();
|
|
58
|
-
var fileType = getFileType(name);
|
|
59
|
-
var [isHoveredState, setIsHovered] = useState(false);
|
|
60
|
-
var isHovered = useResponsiveValue(true, isHoveredState);
|
|
61
|
-
return /*#__PURE__*/_jsx("div", {
|
|
62
|
-
ref: ref,
|
|
63
|
-
onMouseOver: () => {
|
|
64
|
-
setIsHovered(true);
|
|
65
|
-
},
|
|
66
|
-
onMouseLeave: () => {
|
|
67
|
-
setIsHovered(false);
|
|
68
|
-
},
|
|
69
|
-
children: /*#__PURE__*/_jsxs(Columns, {
|
|
70
|
-
align: "center",
|
|
71
|
-
space: "xsmall",
|
|
72
|
-
children: [/*#__PURE__*/_jsx(Column, {
|
|
73
|
-
width: "content",
|
|
74
|
-
children: status === 'error' ? /*#__PURE__*/_jsx(Error, {
|
|
75
|
-
color: "error",
|
|
76
|
-
fontSize: "small"
|
|
77
|
-
}) : fileType === 'pdf' ? /*#__PURE__*/_jsx(PdfIcon, {
|
|
78
|
-
color: "action",
|
|
79
|
-
fontSize: "small"
|
|
80
|
-
}) : fileType === 'image' ? /*#__PURE__*/_jsx(Image, {
|
|
81
|
-
color: "action",
|
|
82
|
-
fontSize: "small"
|
|
83
|
-
}) : /*#__PURE__*/_jsx(TextBoxIcon, {
|
|
84
|
-
color: "action",
|
|
85
|
-
fontSize: "small"
|
|
86
|
-
})
|
|
87
|
-
}), /*#__PURE__*/_jsx(Column, {
|
|
88
|
-
width: "fluid",
|
|
89
|
-
children: /*#__PURE__*/_jsx(FileListItemName, {
|
|
90
|
-
id: uid,
|
|
91
|
-
children: !url ? name : /*#__PURE__*/_jsx(Link, {
|
|
92
|
-
href: url,
|
|
93
|
-
noWrap: true,
|
|
94
|
-
target: "_blank",
|
|
95
|
-
rel: "noopener noreferrer",
|
|
96
|
-
children: name
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
}), status === 'error' && /*#__PURE__*/_jsx(Column, {
|
|
100
|
-
width: "content",
|
|
101
|
-
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
102
|
-
title: "Retry",
|
|
103
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
104
|
-
size: "small",
|
|
105
|
-
onClick: onRetry,
|
|
106
|
-
children: /*#__PURE__*/_jsx(Refresh, {
|
|
107
|
-
fontSize: "small"
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
}), /*#__PURE__*/_jsx(Column, {
|
|
112
|
-
width: "content",
|
|
113
|
-
children: status === 'loading' ? /*#__PURE__*/_jsx(IconButton, {
|
|
114
|
-
size: "small",
|
|
115
|
-
disabled: true,
|
|
116
|
-
children: /*#__PURE__*/_jsx(FileListItemProgress, {
|
|
117
|
-
size: "1em"
|
|
118
|
-
})
|
|
119
|
-
}) : /*#__PURE__*/_jsx(Tooltip, {
|
|
120
|
-
title: "Delete",
|
|
121
|
-
children: /*#__PURE__*/_jsx(IconButton, {
|
|
122
|
-
size: "small",
|
|
123
|
-
onClick: onDelete,
|
|
124
|
-
children: !isHovered && status === 'success' ? /*#__PURE__*/_jsx(CheckCircle, {
|
|
125
|
-
fontSize: "small",
|
|
126
|
-
htmlColor: Color.Green300
|
|
127
|
-
}) : /*#__PURE__*/_jsx(Delete, {
|
|
128
|
-
fontSize: "small"
|
|
129
|
-
})
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
})]
|
|
133
|
-
})
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
if (process.env.NODE_ENV !== "production") FileListItem.displayName = "FileListItem";
|
package/dist-src/v5/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export * from "./alert/Alert.js";
|
|
2
|
-
export * from "./banner/Banner.js";
|
|
3
|
-
export * from "./box/Box.js";
|
|
4
|
-
export * from "./button-area/ButtonArea.js";
|
|
5
|
-
export * from "./button/Button.js";
|
|
6
|
-
export * from "./description-item/DescriptionItem.js";
|
|
7
|
-
export * from "./file-drop-zone/FileDropZone.js";
|
|
8
|
-
export * from "./file-list-item/FileListItem.js";
|
|
9
|
-
export * from "./sidebar/Sidebar.js";
|
|
10
|
-
export * from "./sidebar/SidebarContainer.js";
|
|
11
|
-
export * from "./sidebar/SidebarDivider.js";
|
|
12
|
-
export * from "./sidebar/SidebarMenuItem.js";
|
|
13
|
-
export * from "./sidebar/SidebarMenuItemAction.js";
|
|
14
|
-
export * from "./sidebar/SidebarMenuItemAvatar.js";
|
|
15
|
-
export * from "./sidebar/SidebarSubheader.js";
|
|
16
|
-
export * from "./text-box/TextBox.js";
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { v5 } from '@superdispatch/ui';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { TextBox } from "../text-box/TextBox.js";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
var {
|
|
8
|
-
Color,
|
|
9
|
-
Column,
|
|
10
|
-
Columns,
|
|
11
|
-
useUID
|
|
12
|
-
} = v5;
|
|
13
|
-
var SidebarRoot = /*#__PURE__*/styled.aside.withConfig({
|
|
14
|
-
displayName: "Sidebar__SidebarRoot",
|
|
15
|
-
componentId: "SD__sc-14hfb05-0"
|
|
16
|
-
})(["top:0;position:sticky;overflow-y:auto;overflow-x:hidden;width:240px;height:100vh;background-color:", ";border-right:1px solid ", ";"], Color.White, Color.Silver400);
|
|
17
|
-
var SidebarHeader = /*#__PURE__*/styled.div.withConfig({
|
|
18
|
-
displayName: "Sidebar__SidebarHeader",
|
|
19
|
-
componentId: "SD__sc-14hfb05-1"
|
|
20
|
-
})(["top:0;z-index:1;position:sticky;padding-left:24px;padding-right:24px;padding-bottom:8px;background-color:", ";"], Color.White);
|
|
21
|
-
var SidebarTitle = /*#__PURE__*/styled.div.withConfig({
|
|
22
|
-
displayName: "Sidebar__SidebarTitle",
|
|
23
|
-
componentId: "SD__sc-14hfb05-2"
|
|
24
|
-
})(["height:64px;max-height:64px;display:flex;align-items:center;"]);
|
|
25
|
-
export var Sidebar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
26
|
-
var {
|
|
27
|
-
title,
|
|
28
|
-
count,
|
|
29
|
-
header,
|
|
30
|
-
children,
|
|
31
|
-
id: idProp
|
|
32
|
-
} = _ref;
|
|
33
|
-
var id = useUID(idProp);
|
|
34
|
-
var titleID = "".concat(id, "-title");
|
|
35
|
-
return /*#__PURE__*/_jsxs(SidebarRoot, {
|
|
36
|
-
id: id,
|
|
37
|
-
ref: ref,
|
|
38
|
-
children: [/*#__PURE__*/_jsxs(SidebarHeader, {
|
|
39
|
-
children: [/*#__PURE__*/_jsx(SidebarTitle, {
|
|
40
|
-
children: /*#__PURE__*/_jsxs(Columns, {
|
|
41
|
-
space: "xsmall",
|
|
42
|
-
align: "center",
|
|
43
|
-
children: [/*#__PURE__*/_jsx(Column, {
|
|
44
|
-
width: "fluid",
|
|
45
|
-
children: /*#__PURE__*/_jsx(TextBox, {
|
|
46
|
-
variant: "heading-2",
|
|
47
|
-
noWrap: true,
|
|
48
|
-
id: titleID,
|
|
49
|
-
children: title
|
|
50
|
-
})
|
|
51
|
-
}), !!count && /*#__PURE__*/_jsx(Column, {
|
|
52
|
-
width: "content",
|
|
53
|
-
children: /*#__PURE__*/_jsx(TextBox, {
|
|
54
|
-
color: "secondary",
|
|
55
|
-
children: count
|
|
56
|
-
})
|
|
57
|
-
})]
|
|
58
|
-
})
|
|
59
|
-
}), header]
|
|
60
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
61
|
-
"aria-labelledby": titleID,
|
|
62
|
-
children: children
|
|
63
|
-
})]
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
if (process.env.NODE_ENV !== "production") Sidebar.displayName = "Sidebar";
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
import styled from 'styled-components';
|
|
3
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
var SidebarContainerRoot = /*#__PURE__*/styled.div.withConfig({
|
|
6
|
-
displayName: "SidebarContainer__SidebarContainerRoot",
|
|
7
|
-
componentId: "SD__sc-6u6mqe-0"
|
|
8
|
-
})(["display:flex;height:inherit;max-height:inherit;min-height:inherit;"]);
|
|
9
|
-
var SidebarContainerContent = /*#__PURE__*/styled.div.withConfig({
|
|
10
|
-
displayName: "SidebarContainer__SidebarContainerContent",
|
|
11
|
-
componentId: "SD__sc-6u6mqe-1"
|
|
12
|
-
})(["height:inherit;max-height:inherit;min-height:inherit;width:calc(100% - 240px);min-width:calc(100% - 240px);max-width:calc(100% - 240px);"]);
|
|
13
|
-
export var SidebarContainer = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
14
|
-
var {
|
|
15
|
-
sidebar,
|
|
16
|
-
children
|
|
17
|
-
} = _ref;
|
|
18
|
-
return /*#__PURE__*/_jsxs(SidebarContainerRoot, {
|
|
19
|
-
ref: ref,
|
|
20
|
-
children: [sidebar, /*#__PURE__*/_jsx(SidebarContainerContent, {
|
|
21
|
-
children: children
|
|
22
|
-
})]
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
if (process.env.NODE_ENV !== "production") SidebarContainer.displayName = "SidebarContainer";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Divider } from '@mui/material';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
var SidebarDividerRoot = /*#__PURE__*/styled.div.withConfig({
|
|
6
|
-
displayName: "SidebarDivider__SidebarDividerRoot",
|
|
7
|
-
componentId: "SD__sc-182lunj-0"
|
|
8
|
-
})(["padding:20px 24px;"]);
|
|
9
|
-
export var SidebarDivider = /*#__PURE__*/forwardRef((_, ref) => {
|
|
10
|
-
return /*#__PURE__*/_jsx(SidebarDividerRoot, {
|
|
11
|
-
ref: ref,
|
|
12
|
-
children: /*#__PURE__*/_jsx(Divider, {})
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
if (process.env.NODE_ENV !== "production") SidebarDivider.displayName = "SidebarDivider";
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { OpenInNew } from '@mui/icons-material';
|
|
2
|
-
import { ButtonBase } from '@mui/material';
|
|
3
|
-
import { v5 } from '@superdispatch/ui';
|
|
4
|
-
import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
|
5
|
-
import styled, { css } from 'styled-components';
|
|
6
|
-
import { TextBox } from "../text-box/TextBox.js";
|
|
7
|
-
import { SidebarMenuItemContextProvider } from "./SidebarMenuItemContext.js";
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
var {
|
|
11
|
-
Color,
|
|
12
|
-
Column,
|
|
13
|
-
Columns,
|
|
14
|
-
Inline
|
|
15
|
-
} = v5;
|
|
16
|
-
var SidebarMenuItemRoot = /*#__PURE__*/styled.div.withConfig({
|
|
17
|
-
displayName: "SidebarMenuItem__SidebarMenuItemRoot",
|
|
18
|
-
componentId: "SD__sc-1srwx2n-0"
|
|
19
|
-
})(_ref => {
|
|
20
|
-
var {
|
|
21
|
-
hasAvatar
|
|
22
|
-
} = _ref;
|
|
23
|
-
var height = hasAvatar ? 48 : 40;
|
|
24
|
-
return css(["position:relative;& > .MuiButtonBase-root{width:100%;display:flex;justify-content:flex-start;padding-left:24px;padding-right:24px;height:", "px;max-height:", "px;&[aria-current='true']{background-color:", ";box-shadow:inset 4px 0 0 ", ";}}"], height, height, Color.Silver200, Color.Blue300);
|
|
25
|
-
});
|
|
26
|
-
var SidebarMenuItemBadge = /*#__PURE__*/styled.div.withConfig({
|
|
27
|
-
displayName: "SidebarMenuItem__SidebarMenuItemBadge",
|
|
28
|
-
componentId: "SD__sc-1srwx2n-1"
|
|
29
|
-
})(["font-size:12px;line-height:16px;padding-left:4px;padding-right:4px;border-radius:100px;color:", ";background-color:", ";.MuiButtonBase-root[aria-current='true'] &{color:", ";background-color:", ";}"], Color.Dark500, Color.Silver300, Color.White, Color.Dark450);
|
|
30
|
-
var SidebarMenuItemSecondaryAction = /*#__PURE__*/styled.div.withConfig({
|
|
31
|
-
displayName: "SidebarMenuItem__SidebarMenuItemSecondaryAction",
|
|
32
|
-
componentId: "SD__sc-1srwx2n-2"
|
|
33
|
-
})(["top:50%;right:24px;position:absolute;transform:translate3d(0,-50%,0);"]);
|
|
34
|
-
export var SidebarMenuItem = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
35
|
-
var {
|
|
36
|
-
action,
|
|
37
|
-
avatar,
|
|
38
|
-
onClick,
|
|
39
|
-
external,
|
|
40
|
-
children,
|
|
41
|
-
disabled,
|
|
42
|
-
selected,
|
|
43
|
-
secondaryActions,
|
|
44
|
-
badge: badgeProp
|
|
45
|
-
} = _ref2;
|
|
46
|
-
var [hovered, setHovered] = useState(false);
|
|
47
|
-
var actionsRef = useRef(null);
|
|
48
|
-
var actionsPlaceholderRef = useRef(null);
|
|
49
|
-
useLayoutEffect(() => {
|
|
50
|
-
if (actionsRef.current && actionsPlaceholderRef.current) {
|
|
51
|
-
actionsPlaceholderRef.current.style.width = "".concat(Math.max(0, actionsRef.current.offsetWidth - 8), "px");
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
var badge = !badgeProp || !Number.isFinite(badgeProp) ? null : badgeProp > 999 ? '999+' : badgeProp;
|
|
55
|
-
return /*#__PURE__*/_jsxs(SidebarMenuItemRoot, {
|
|
56
|
-
ref: ref,
|
|
57
|
-
hasAvatar: !!avatar,
|
|
58
|
-
onMouseEnter: () => {
|
|
59
|
-
setHovered(true);
|
|
60
|
-
},
|
|
61
|
-
onMouseLeave: () => {
|
|
62
|
-
setHovered(false);
|
|
63
|
-
},
|
|
64
|
-
children: [/*#__PURE__*/_jsx(ButtonBase, {
|
|
65
|
-
onClick: onClick,
|
|
66
|
-
disabled: disabled,
|
|
67
|
-
"aria-current": selected,
|
|
68
|
-
children: /*#__PURE__*/_jsxs(Columns, {
|
|
69
|
-
align: "center",
|
|
70
|
-
space: "xsmall",
|
|
71
|
-
children: [/*#__PURE__*/_jsx(Column, {
|
|
72
|
-
children: /*#__PURE__*/_jsx(Columns, {
|
|
73
|
-
align: "center",
|
|
74
|
-
space: "xsmall",
|
|
75
|
-
children: /*#__PURE__*/_jsx(Column, {
|
|
76
|
-
width: "fluid",
|
|
77
|
-
children: /*#__PURE__*/_jsxs(Columns, {
|
|
78
|
-
align: "center",
|
|
79
|
-
space: "xsmall",
|
|
80
|
-
children: [!!avatar && /*#__PURE__*/_jsx(SidebarMenuItemContextProvider, {
|
|
81
|
-
hovered: hovered,
|
|
82
|
-
disabled: disabled,
|
|
83
|
-
children: /*#__PURE__*/_jsx(Column, {
|
|
84
|
-
width: "content",
|
|
85
|
-
children: avatar
|
|
86
|
-
})
|
|
87
|
-
}), /*#__PURE__*/_jsx(Column, {
|
|
88
|
-
width: "adaptive",
|
|
89
|
-
children: /*#__PURE__*/_jsx(TextBox, {
|
|
90
|
-
variant: selected ? 'body-semibold' : 'body',
|
|
91
|
-
noWrap: true,
|
|
92
|
-
children: children
|
|
93
|
-
})
|
|
94
|
-
}), external && /*#__PURE__*/_jsx(Column, {
|
|
95
|
-
width: "content",
|
|
96
|
-
children: /*#__PURE__*/_jsx(OpenInNew, {
|
|
97
|
-
color: "action",
|
|
98
|
-
fontSize: "small"
|
|
99
|
-
})
|
|
100
|
-
})]
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
}), !!badge && /*#__PURE__*/_jsx(Column, {
|
|
105
|
-
width: "content",
|
|
106
|
-
children: /*#__PURE__*/_jsx(SidebarMenuItemBadge, {
|
|
107
|
-
children: badge
|
|
108
|
-
})
|
|
109
|
-
}), (!!action || !!secondaryActions) && /*#__PURE__*/_jsx(Column, {
|
|
110
|
-
width: "content",
|
|
111
|
-
children: /*#__PURE__*/_jsx("div", {
|
|
112
|
-
ref: actionsPlaceholderRef
|
|
113
|
-
})
|
|
114
|
-
})]
|
|
115
|
-
})
|
|
116
|
-
}), (!!action || !!secondaryActions) && /*#__PURE__*/_jsx(SidebarMenuItemSecondaryAction, {
|
|
117
|
-
ref: actionsRef,
|
|
118
|
-
children: /*#__PURE__*/_jsxs(Inline, {
|
|
119
|
-
children: [hovered && secondaryActions, action]
|
|
120
|
-
})
|
|
121
|
-
})]
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
if (process.env.NODE_ENV !== "production") SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { IconButton, Tooltip } from '@mui/material';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
var SidebarMenuItemActionRoot = /*#__PURE__*/styled(IconButton).withConfig({
|
|
6
|
-
displayName: "SidebarMenuItemAction__SidebarMenuItemActionRoot",
|
|
7
|
-
componentId: "SD__sc-4la7tu-0"
|
|
8
|
-
})(["& .MuiSvgIcon-root{font-size:16px;}"]);
|
|
9
|
-
export var SidebarMenuItemAction = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
10
|
-
var {
|
|
11
|
-
title,
|
|
12
|
-
placement,
|
|
13
|
-
children
|
|
14
|
-
} = _ref;
|
|
15
|
-
return /*#__PURE__*/_jsx(Tooltip, {
|
|
16
|
-
title: title,
|
|
17
|
-
placement: placement,
|
|
18
|
-
children: /*#__PURE__*/_jsx(SidebarMenuItemActionRoot, {
|
|
19
|
-
ref: ref,
|
|
20
|
-
size: "small",
|
|
21
|
-
edge: "end",
|
|
22
|
-
children: children
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
if (process.env.NODE_ENV !== "production") SidebarMenuItemAction.displayName = "SidebarMenuItemAction";
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Avatar, Checkbox } from '@mui/material';
|
|
2
|
-
import { forwardRef, useMemo } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { useSidebarMenuItemContext } from "./SidebarMenuItemContext.js";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
function stopPropagation(event) {
|
|
8
|
-
event.stopPropagation();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
var SidebarMenuItemAvatarCheckbox = /*#__PURE__*/styled.div.withConfig({
|
|
12
|
-
displayName: "SidebarMenuItemAvatar__SidebarMenuItemAvatarCheckbox",
|
|
13
|
-
componentId: "SD__sc-bfi0pv-0"
|
|
14
|
-
})(["margin:-5px;"]);
|
|
15
|
-
export var SidebarMenuItemAvatar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
|
-
var {
|
|
17
|
-
children,
|
|
18
|
-
value,
|
|
19
|
-
onChange: _onChange
|
|
20
|
-
} = _ref;
|
|
21
|
-
var {
|
|
22
|
-
hovered,
|
|
23
|
-
disabled
|
|
24
|
-
} = useSidebarMenuItemContext();
|
|
25
|
-
var initials = useMemo(() => {
|
|
26
|
-
var matches = children.match(/\b\w/g) || [];
|
|
27
|
-
var first = matches.shift() || '';
|
|
28
|
-
var last = matches.pop() || '';
|
|
29
|
-
return (first + last).toUpperCase();
|
|
30
|
-
}, [children]);
|
|
31
|
-
|
|
32
|
-
if (value === true || hovered && value != null) {
|
|
33
|
-
return /*#__PURE__*/_jsx(SidebarMenuItemAvatarCheckbox, {
|
|
34
|
-
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
35
|
-
color: "primary",
|
|
36
|
-
checked: value,
|
|
37
|
-
disabled: disabled,
|
|
38
|
-
onMouseDown: stopPropagation,
|
|
39
|
-
onTouchStart: stopPropagation,
|
|
40
|
-
onChange: (_, checked) => {
|
|
41
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(checked);
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return /*#__PURE__*/_jsx(Avatar, {
|
|
48
|
-
ref: ref,
|
|
49
|
-
"aria-hidden": true,
|
|
50
|
-
children: initials
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
if (process.env.NODE_ENV !== "production") SidebarMenuItemAvatar.displayName = "SidebarMenuItemAvatar";
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext, useMemo } from 'react';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
var context = /*#__PURE__*/createContext({});
|
|
4
|
-
export function useSidebarMenuItemContext() {
|
|
5
|
-
return useContext(context);
|
|
6
|
-
}
|
|
7
|
-
export function SidebarMenuItemContextProvider(_ref) {
|
|
8
|
-
var {
|
|
9
|
-
children,
|
|
10
|
-
hovered = false,
|
|
11
|
-
disabled = false
|
|
12
|
-
} = _ref;
|
|
13
|
-
var ctx = useMemo(() => ({
|
|
14
|
-
hovered,
|
|
15
|
-
disabled
|
|
16
|
-
}), [hovered, disabled]);
|
|
17
|
-
return /*#__PURE__*/_jsx(context.Provider, {
|
|
18
|
-
value: ctx,
|
|
19
|
-
children: children
|
|
20
|
-
});
|
|
21
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { v5 } from '@superdispatch/ui';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { TextBox } from "../text-box/TextBox.js";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
var {
|
|
8
|
-
Column,
|
|
9
|
-
Columns
|
|
10
|
-
} = v5;
|
|
11
|
-
var SidebarSubheaderRoot = /*#__PURE__*/styled.div.withConfig({
|
|
12
|
-
displayName: "SidebarSubheader__SidebarSubheaderRoot",
|
|
13
|
-
componentId: "SD__sc-7njpmq-0"
|
|
14
|
-
})(["display:flex;align-items:center;height:40px;max-height:40px;padding-left:24px;padding-right:24px;"]);
|
|
15
|
-
export var SidebarSubheader = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
16
|
-
var {
|
|
17
|
-
id,
|
|
18
|
-
action,
|
|
19
|
-
children
|
|
20
|
-
} = _ref;
|
|
21
|
-
return /*#__PURE__*/_jsx(SidebarSubheaderRoot, {
|
|
22
|
-
ref: ref,
|
|
23
|
-
children: /*#__PURE__*/_jsxs(Columns, {
|
|
24
|
-
space: "xsmall",
|
|
25
|
-
align: "center",
|
|
26
|
-
children: [/*#__PURE__*/_jsx(Column, {
|
|
27
|
-
children: /*#__PURE__*/_jsx(TextBox, {
|
|
28
|
-
id: id,
|
|
29
|
-
variant: "heading-6",
|
|
30
|
-
color: "secondary",
|
|
31
|
-
noWrap: true,
|
|
32
|
-
children: children
|
|
33
|
-
})
|
|
34
|
-
}), !!action && /*#__PURE__*/_jsx(Column, {
|
|
35
|
-
width: "content",
|
|
36
|
-
children: action
|
|
37
|
-
})]
|
|
38
|
-
})
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
if (process.env.NODE_ENV !== "production") SidebarSubheader.displayName = "SidebarSubheader";
|