Skip to content

Commit bf7a6e3

Browse files
committed
chore: dist folder
1 parent d6a078f commit bf7a6e3

File tree

213 files changed

+4453
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

213 files changed

+4453
-4
lines changed

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
dist/
21
build/
32
node_modules/
43
.eslintcache
54
.nyc_output/
65
.idea/
7-
6+
**/.DS_Store

.husky/pre-commit

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx lint-staged
4+
npm run lint:fix
5+
npm run transpile
6+
git add dist

dist/hooks/useCopyToClipboard.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export declare const useCopyToClipboard: (alertProps?: {}) => (textToCopy: string, content: string) => void;

dist/hooks/useCopyToClipboard.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { useCallback } from "react";
2+
import { useAlert } from "../mui/components/custom/alert/hooks/useAlert";
3+
import { copyToClipboard } from "../utils/clipboard";
4+
export const useCopyToClipboard = (alertProps = {}) => {
5+
const alert = useAlert();
6+
return useCallback((textToCopy, content) => {
7+
copyToClipboard(textToCopy, () => {
8+
alert === null || alert === void 0 ? void 0 : alert.show({
9+
content,
10+
...alertProps,
11+
});
12+
});
13+
}, []);
14+
};

dist/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

dist/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { hello_python } from "./other/fullscreen/test";
2+
console.log(hello_python());

dist/mixins/statefulEntityMixin.d.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { InMemoryEntity } from "@exabyte-io/code.js/dist/entity";
2+
export declare const StatefulEntityMixin: (superclass: any) => {
3+
new (props: any): {
4+
[x: string]: any;
5+
_resetStateEntityAndUpdateParents(entity: InMemoryEntity, callback: never): void;
6+
onEntityUpdate: (entity: never) => void;
7+
_propagateChangesToParents(): void;
8+
_resetStateEntity(entity: InMemoryEntity, callback: never): void;
9+
};
10+
[x: string]: any;
11+
};

dist/mixins/statefulEntityMixin.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// TODO: figure out correct types for this mixin
2+
// @ts-ignore
3+
export const StatefulEntityMixin = (superclass) => class extends superclass {
4+
// @ts-ignore
5+
constructor(props) {
6+
super(props);
7+
this._resetStateEntity = this._resetStateEntity.bind(this);
8+
this._propagateChangesToParents = this._propagateChangesToParents.bind(this);
9+
this._resetStateEntityAndUpdateParents =
10+
this._resetStateEntityAndUpdateParents.bind(this);
11+
}
12+
_resetStateEntityAndUpdateParents(entity, callback) {
13+
this._resetStateEntity(entity, callback);
14+
this._propagateChangesToParents();
15+
}
16+
_propagateChangesToParents() {
17+
// @ts-ignore
18+
this.onEntityUpdate(this.state.entity);
19+
}
20+
// helper to trigger re-render on in-place updates
21+
_resetStateEntity(entity, callback) {
22+
// @ts-ignore
23+
this.setState({ entity: entity || this.state.entity }, callback);
24+
}
25+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from "react";
2+
interface Props {
3+
draggableId: string;
4+
index: number;
5+
children?: React.ReactNode | React.ReactNode[];
6+
xs?: number;
7+
md?: number;
8+
xl?: number;
9+
}
10+
export default function DraggableGrid({ draggableId, index, xs, md, xl, children }: Props): React.JSX.Element;
11+
export {};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* eslint-disable react/jsx-props-no-spreading */
2+
import Grid from "@mui/material/Unstable_Grid2";
3+
import React from "react";
4+
import { Draggable } from "react-beautiful-dnd";
5+
export default function DraggableGrid({ draggableId, index, xs, md, xl, children }) {
6+
return (React.createElement(Draggable, { draggableId: draggableId, index: index }, (provided) => {
7+
return (React.createElement(Grid, { xs: xs, md: md, xl: xl, ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps }, children));
8+
}));
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from "react";
2+
import { OnDragEndResponder } from "react-beautiful-dnd";
3+
interface Props {
4+
droppableId: string;
5+
onDragEnd: OnDragEndResponder;
6+
spacing: number;
7+
children: React.ReactNode | React.ReactNode[];
8+
}
9+
export default function DroppableGrid({ droppableId, onDragEnd, spacing, children }: Props): React.JSX.Element;
10+
export {};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Grid from "@mui/material/Unstable_Grid2";
2+
import React from "react";
3+
import { DragDropContext, Droppable } from "react-beautiful-dnd";
4+
export default function DroppableGrid({ droppableId, onDragEnd, spacing, children }) {
5+
return (React.createElement(DragDropContext, { onDragEnd: onDragEnd },
6+
React.createElement(Droppable, { droppableId: droppableId }, (provided) => {
7+
return (React.createElement(Grid, { container: true, spacing: spacing, ref: provided.innerRef, ...provided.droppableProps },
8+
children,
9+
provided.placeholder));
10+
})));
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import DraggableGrid from "./DraggableGrid";
2+
import DroppableGrid from "./DroppableGrid";
3+
import useDndOrderState from "./useDndOrderState";
4+
export { DraggableGrid, DroppableGrid, useDndOrderState };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import DraggableGrid from "./DraggableGrid";
2+
import DroppableGrid from "./DroppableGrid";
3+
import useDndOrderState from "./useDndOrderState";
4+
export { DraggableGrid, DroppableGrid, useDndOrderState };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { DropResult } from "react-beautiful-dnd";
2+
export default function useDndOrderState(initialOrder: string[]): [string[], (order: DropResult) => void];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { useState } from "react";
2+
const reorder = (list, startIndex, endIndex) => {
3+
const result = Array.from(list);
4+
const [removed] = result.splice(startIndex, 1);
5+
result.splice(endIndex, 0, removed);
6+
return result;
7+
};
8+
export default function useDndOrderState(initialOrder) {
9+
const [order, setState] = useState(initialOrder);
10+
const onDragEnd = (result) => {
11+
if (!result.destination) {
12+
return;
13+
}
14+
if (result.destination.index === result.source.index) {
15+
return;
16+
}
17+
const newSortOrder = reorder(order, result.source.index, result.destination.index);
18+
setState(newSortOrder);
19+
};
20+
return [order, onDragEnd];
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react";
2+
export interface AccordionProps {
3+
hideExpandIcon: boolean;
4+
children: React.ReactNode;
5+
isExpanded: boolean;
6+
header: React.ReactNode;
7+
alternativeComponent: React.ReactNode;
8+
}
9+
export default function Accordion({ hideExpandIcon, children, isExpanded, header, alternativeComponent, ...restProps }: AccordionProps): React.JSX.Element;
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* eslint-disable react/jsx-props-no-spreading */
2+
/* eslint-disable react/prop-types */
3+
import MuiAccordion from "@mui/material/Accordion";
4+
import AccordionDetails from "@mui/material/AccordionDetails";
5+
import MuiAccordionSummary from "@mui/material/AccordionSummary";
6+
import Divider from "@mui/material/Divider";
7+
import Typography from "@mui/material/Typography";
8+
import { withStyles } from "@mui/styles";
9+
import React, { useEffect, useState } from "react";
10+
import IconByName from "../icon/IconByName";
11+
// deletes header animation in accordion
12+
const StyledAccordion = withStyles({
13+
root: {
14+
margin: "0",
15+
"&$expanded": {
16+
margin: "0",
17+
},
18+
},
19+
expanded: {},
20+
})(MuiAccordion);
21+
// deletes header animation in accordion
22+
const AccordionSummary = withStyles({
23+
root: {
24+
minHeight: "48px",
25+
margin: "0",
26+
"&$expanded": {
27+
minHeight: "48px",
28+
margin: "0",
29+
},
30+
},
31+
content: {
32+
display: "flex",
33+
justifyContent: "space-between",
34+
alignItems: "center",
35+
margin: "0",
36+
"&$expanded": {
37+
margin: "0",
38+
},
39+
},
40+
expanded: {},
41+
})(MuiAccordionSummary);
42+
export default function Accordion({ hideExpandIcon, children, isExpanded, header, alternativeComponent, ...restProps }) {
43+
const [isExpanded_, setIsExpanded] = useState(isExpanded);
44+
useEffect(() => {
45+
setIsExpanded(isExpanded);
46+
}, [isExpanded]);
47+
const handleToggleExpanded = (e) => {
48+
if (!e.defaultPrevented) {
49+
e.preventDefault();
50+
setIsExpanded((prev) => !prev);
51+
}
52+
};
53+
return (React.createElement(StyledAccordion, { defaultExpanded: isExpanded, expanded: isExpanded_, ...restProps },
54+
React.createElement(AccordionSummary, { onClick: handleToggleExpanded, "aria-controls": "panel2a-content", expandIcon: !hideExpandIcon && React.createElement(IconByName, { name: "actions.expand" }) },
55+
React.createElement(Typography, { variant: "overline" }, header),
56+
alternativeComponent),
57+
React.createElement(Divider, null),
58+
React.createElement(AccordionDetails, null, children)));
59+
}
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default } from "./Accordion";
2+
export * from "./Accordion";
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default } from "./Accordion";
2+
export * from "./Accordion";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* ButtonMultiSelect Component
3+
*
4+
* Overview:
5+
* The ButtonMultiSelect component is a reusable, configurable button group component.
6+
* It allows the creation of a configurable buttons which allows for selecting from multiple possible actions.
7+
* The state of the selected button is saved in localStorage.
8+
*
9+
* Usage:
10+
* To use this component, define an array of ButtonConfig objects, each representing a button's configuration.
11+
* Pass this array along with a localStorage key (for saving the selected button's state) to the component.
12+
*
13+
* Example:
14+
* ```
15+
* <ButtonMultiSelect
16+
* buttonConfigs={[
17+
* { id: 'save', iconName: 'save_icon', label: 'Save', onClick: handleSave },
18+
* { id: 'cancel', iconName: 'cancel_icon', label: 'Cancel', onClick: handleCancel }
19+
* ]}
20+
* localStorageKey="myButtonSelectKey"
21+
* size="medium"
22+
* isLoading={false}
23+
* isCompact={true}
24+
* />
25+
* ```
26+
*/
27+
import React from "react";
28+
export type ButtonConfig = {
29+
id: string;
30+
iconName: string;
31+
label: string;
32+
onClick: () => void;
33+
};
34+
type ButtonMultiSelectProps = {
35+
id?: string;
36+
buttonConfigs: ButtonConfig[];
37+
size?: "small" | "medium" | "large";
38+
localStorageKey: string;
39+
isLoading?: boolean;
40+
isCompact?: boolean;
41+
};
42+
declare function ButtonMultiSelect({ id, buttonConfigs, size, localStorageKey, isLoading, isCompact, }: ButtonMultiSelectProps): React.JSX.Element;
43+
export default ButtonMultiSelect;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* ButtonMultiSelect Component
3+
*
4+
* Overview:
5+
* The ButtonMultiSelect component is a reusable, configurable button group component.
6+
* It allows the creation of a configurable buttons which allows for selecting from multiple possible actions.
7+
* The state of the selected button is saved in localStorage.
8+
*
9+
* Usage:
10+
* To use this component, define an array of ButtonConfig objects, each representing a button's configuration.
11+
* Pass this array along with a localStorage key (for saving the selected button's state) to the component.
12+
*
13+
* Example:
14+
* ```
15+
* <ButtonMultiSelect
16+
* buttonConfigs={[
17+
* { id: 'save', iconName: 'save_icon', label: 'Save', onClick: handleSave },
18+
* { id: 'cancel', iconName: 'cancel_icon', label: 'Cancel', onClick: handleCancel }
19+
* ]}
20+
* localStorageKey="myButtonSelectKey"
21+
* size="medium"
22+
* isLoading={false}
23+
* isCompact={true}
24+
* />
25+
* ```
26+
*/
27+
import LoadingButton from "@mui/lab/LoadingButton";
28+
import Button from "@mui/material/Button";
29+
import ButtonGroup from "@mui/material/ButtonGroup";
30+
import Menu from "@mui/material/Menu";
31+
import MenuItem from "@mui/material/MenuItem";
32+
import React, { useCallback, useEffect, useState } from "react";
33+
import IconByName from "../icon/IconByName";
34+
function ButtonMultiSelect({ id, buttonConfigs, size = "small", localStorageKey, isLoading = false, isCompact = false, }) {
35+
const [anchorEl, setAnchorEl] = useState(null);
36+
const [selectedOption, setSelectedOption] = useState(buttonConfigs[0]);
37+
const mainButtonRef = React.useRef(null);
38+
const open = Boolean(anchorEl);
39+
// load saved option from local storage
40+
useEffect(() => {
41+
const savedOptionKey = localStorage.getItem(localStorageKey);
42+
const savedOption = buttonConfigs.find((config) => config.id === savedOptionKey);
43+
// check if value matches one of the button configs
44+
if (savedOption) {
45+
setSelectedOption(savedOption);
46+
}
47+
}, []);
48+
const handleExpandClick = useCallback(() => {
49+
setAnchorEl(mainButtonRef.current);
50+
}, []);
51+
const handleClose = useCallback(() => {
52+
setAnchorEl(null);
53+
}, []);
54+
const handleMenuClick = useCallback((config) => {
55+
localStorage.setItem("selectedSaveOption", config.id);
56+
setSelectedOption(config);
57+
handleClose();
58+
}, []);
59+
return (React.createElement(React.Fragment, null,
60+
React.createElement(ButtonGroup, { variant: "contained", size: size, sx: { height: "fit-content" } },
61+
React.createElement(LoadingButton, { id: id, ref: mainButtonRef, size: size, onClick: selectedOption.onClick, variant: "contained", loading: isLoading, startIcon: !isCompact && React.createElement(IconByName, { name: selectedOption.iconName, fontSize: size }) }, isCompact ? (React.createElement(IconByName, { name: selectedOption.iconName, fontSize: size })) : (selectedOption.label)),
62+
React.createElement(Button, { onClick: handleExpandClick, size: size },
63+
React.createElement(IconByName, { name: "shapes.arrow.dropdown", fontSize: size }))),
64+
React.createElement(Menu, { anchorEl: anchorEl, keepMounted: true, open: open, onClose: handleClose }, buttonConfigs.map((config) => (React.createElement(MenuItem, { key: config.id, onClick: () => handleMenuClick(config) }, config.label))))));
65+
}
66+
export default ButtonMultiSelect;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import React from "react";
2+
export default function UploadButton({ id, label, file, accept, onFileUpload, buttonProps, }: {
3+
id: string;
4+
label: string | React.ReactNode;
5+
file: File | null;
6+
accept?: string;
7+
onFileUpload: (event: React.ChangeEvent<HTMLInputElement>) => void;
8+
buttonProps?: object;
9+
}): React.JSX.Element;
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* eslint-disable react/jsx-props-no-spreading */
2+
import Box from "@mui/material/Box";
3+
import Button from "@mui/material/Button";
4+
import React from "react";
5+
import IconByName from "../icon/IconByName";
6+
export default function UploadButton({ id, label, file, accept = "*", onFileUpload, buttonProps, }) {
7+
return (React.createElement(React.Fragment, null,
8+
React.createElement(Button, { id: `${id}-button`, component: "label", variant: "outlined", startIcon: React.createElement(IconByName, { name: "actions.uploadFile" }), ...buttonProps },
9+
label,
10+
React.createElement("input", { id: id, type: "file", accept: accept, style: { display: "none" }, onChange: onFileUpload })),
11+
file ? React.createElement(Box, null, file.name) : null));
12+
}
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { FormControlLabelProps } from "@mui/material/FormControlLabel";
2+
import { SxProps } from "@mui/material/styles";
3+
import { TypographyProps } from "@mui/material/Typography";
4+
import React from "react";
5+
export interface CheckboxComponentProps {
6+
id: string;
7+
value: string;
8+
checked: boolean;
9+
required: boolean;
10+
disabled: boolean;
11+
label: React.ReactNode;
12+
onChange: (checked: boolean) => void;
13+
className: string;
14+
slotProps: {
15+
typography: TypographyProps;
16+
};
17+
labelPlacement: FormControlLabelProps["labelPlacement"];
18+
formControlLabelSx: SxProps;
19+
checkboxSx: SxProps;
20+
}
21+
declare function CheckboxComponent({ id, value, checked, required, disabled, label, onChange, className, slotProps, labelPlacement, formControlLabelSx, checkboxSx, }: CheckboxComponentProps): React.JSX.Element;
22+
export default CheckboxComponent;

0 commit comments

Comments
 (0)