generated from Exabyte-io/template-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
274 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import { hello_python } from "./other/fullscreen/test"; | ||
console.log(hello_python()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import React from "react"; | ||
export interface AccordionProps { | ||
hideExpandIcon?: boolean; | ||
children?: React.ReactNode; | ||
hideExpandIcon: boolean; | ||
children: React.ReactNode; | ||
isExpanded: boolean; | ||
header?: React.ReactNode; | ||
renderSummary?: React.ReactNode; | ||
header: React.ReactNode; | ||
alternativeComponent: React.ReactNode; | ||
} | ||
export default function Accordion({ hideExpandIcon, children, isExpanded, header, renderSummary, ...restProps }: AccordionProps): React.JSX.Element; | ||
export default function Accordion({ hideExpandIcon, children, isExpanded, header, alternativeComponent, ...restProps }: AccordionProps): React.JSX.Element; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
dist/mui/components/custom/alert/AlertContextProvider.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { AlertProps } from "@mui/material/Alert"; | ||
import { SnackbarProps } from "@mui/material/Snackbar"; | ||
import React from "react"; | ||
export type ExtendedAlertProps = AlertProps & { | ||
content: string; | ||
}; | ||
export declare const AlertContext: React.Context<{ | ||
show: (alertProps: ExtendedAlertProps, snackbarProps?: SnackbarProps) => void; | ||
} | null>; | ||
export interface AlertProvider { | ||
children: React.ReactNode; | ||
} | ||
declare function AlertProvider({ children }: AlertProvider): React.JSX.Element; | ||
export declare const AlertContextProvider: React.MemoExoticComponent<typeof AlertProvider>; | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* eslint-disable no-shadow */ | ||
/* eslint-disable react/jsx-props-no-spreading */ | ||
import Alert from "@mui/material/Alert"; | ||
import AlertTitle from "@mui/material/AlertTitle"; | ||
import Snackbar from "@mui/material/Snackbar"; | ||
import React, { createContext, memo, useCallback, useState } from "react"; | ||
export const AlertContext = createContext(null); | ||
const defaultSnackbarProps = { | ||
anchorOrigin: { | ||
vertical: "bottom", | ||
horizontal: "right", | ||
}, | ||
autoHideDuration: 3000, | ||
}; | ||
const defaultAlertProps = { | ||
content: "Success Alert", | ||
severity: "success", | ||
variant: "filled", | ||
}; | ||
// eslint-disable-next-line react/prop-types | ||
function AlertProvider({ children }) { | ||
const [isAlertShown, setShownAlert] = useState(false); | ||
const [snackbarProps, setSnackbarProps] = useState(defaultSnackbarProps); | ||
const [alertProps, setAlertProps] = useState(defaultAlertProps); | ||
const showAlert = useCallback((alertProps, snackbarProps) => { | ||
if (alertProps) | ||
setAlertProps((prev) => ({ ...prev, ...alertProps })); | ||
if (snackbarProps) | ||
setSnackbarProps((prev) => ({ ...prev, ...snackbarProps })); | ||
setShownAlert(true); | ||
}, []); | ||
const closeAlert = useCallback(() => { | ||
setShownAlert(false); | ||
}, []); | ||
const { content, severity, variant, ...restAlertProps } = alertProps; | ||
/* eslint-disable react/jsx-no-constructed-context-values */ | ||
return (React.createElement(AlertContext.Provider, { value: { show: showAlert } }, | ||
children, | ||
React.createElement(Snackbar, { ...snackbarProps, open: isAlertShown, onClose: closeAlert }, | ||
React.createElement(Alert, { onClose: closeAlert, variant: variant, severity: severity, ...restAlertProps }, | ||
React.createElement(AlertTitle, null, severity), | ||
content)))); | ||
/* eslint-enable react/jsx-no-constructed-context-values */ | ||
} | ||
export const AlertContextProvider = memo(AlertProvider); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export declare const useAlert: () => { | ||
show: (alertProps: import("../AlertContextProvider").ExtendedAlertProps, snackbarProps?: import("@mui/material").SnackbarProps | undefined) => void; | ||
} | null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { useContext } from "react"; | ||
import { AlertContext } from "../AlertContextProvider"; | ||
export const useAlert = () => { | ||
return useContext(AlertContext); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./hooks/useAlert"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./hooks/useAlert"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from "react"; | ||
export interface StepIconProps { | ||
active: boolean; | ||
icon: React.ReactNode; | ||
} | ||
declare function StepIcon(props: StepIconProps): React.JSX.Element; | ||
export default StepIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { styled } from "@mui/material/styles"; | ||
import classNames from "classnames"; | ||
import React from "react"; | ||
const StyledStepIcon = styled("div")(({ theme }) => ({ | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
width: 50, | ||
height: 50, | ||
border: `1px solid ${theme.palette.primary.dark}`, | ||
borderRadius: "50%", | ||
color: theme.palette.common.white, | ||
".internal-circle": { | ||
display: "flex", | ||
flexDirection: "column", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
width: 44, | ||
height: 44, | ||
background: "transparent", | ||
borderRadius: "50%", | ||
border: `1px solid ${theme.palette.primary.dark}`, | ||
lineHeight: 1.2, | ||
".step-number": { | ||
fontSize: 13, | ||
color: theme.palette.primary.dark, | ||
}, | ||
".step-label": { | ||
fontSize: 10, | ||
color: theme.palette.primary.dark, | ||
}, | ||
}, | ||
"&.active": { | ||
border: `1px solid ${theme.palette.primary.dark}`, | ||
color: theme.palette.common.white, | ||
".internal-circle": { | ||
background: theme.palette.primary.dark, | ||
".step-number": { | ||
fontSize: 13, | ||
color: theme.palette.common.white, | ||
}, | ||
".step-label": { | ||
fontSize: 10, | ||
color: theme.palette.common.white, | ||
}, | ||
}, | ||
}, | ||
})); | ||
function StepIcon(props) { | ||
const { active, icon } = props; | ||
return (React.createElement(StyledStepIcon, { className: classNames({ active }) }, | ||
React.createElement("div", { className: "internal-circle" }, | ||
React.createElement("span", { className: "step-number" }, icon), | ||
React.createElement("span", { className: "step-label" }, "STEP")))); | ||
} | ||
export default StepIcon; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export declare const StyledConnector: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>; | ||
export declare const StepMsg: StyledComponent<ComponentProps, SpecificComponentProps, JSXProps>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import StepConnector, { stepConnectorClasses } from "@mui/material/StepConnector"; | ||
import { styled } from "@mui/material/styles"; | ||
import Typography from "@mui/material/Typography"; | ||
export const StyledConnector = styled(StepConnector)(({ theme }) => ({ | ||
[`&.${stepConnectorClasses.alternativeLabel}`]: { | ||
top: 24, | ||
left: "calc(-50% + 25px)", | ||
right: "calc(50% + 25px)", | ||
}, | ||
[`&.${stepConnectorClasses.active}`]: { | ||
[`& .${stepConnectorClasses.line}`]: { | ||
backgroundColor: theme.palette.primary.dark, | ||
"&::after": { | ||
backgroundColor: theme.palette.primary.dark, | ||
}, | ||
}, | ||
}, | ||
[`&.${stepConnectorClasses.completed}`]: { | ||
[`& .${stepConnectorClasses.line}`]: { | ||
backgroundColor: theme.palette.primary.dark, | ||
"&::after": { | ||
backgroundColor: theme.palette.primary.dark, | ||
}, | ||
}, | ||
}, | ||
[`& .${stepConnectorClasses.line}`]: { | ||
height: 2, | ||
border: 0, | ||
backgroundColor: theme.palette.border.dark, | ||
"&::after": { | ||
position: "absolute", | ||
right: "-3px", | ||
top: "-2px", | ||
display: "block", | ||
content: '""', | ||
width: "6px", | ||
height: "6px", | ||
backgroundColor: theme.palette.border.dark, | ||
borderRadius: "50%", | ||
}, | ||
}, | ||
})); | ||
export const StepMsg = styled(Typography)(() => ({ | ||
marginTop: "15px", | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { SxProps } from "@mui/material"; | ||
import React, { HTMLInputTypeAttribute } from "react"; | ||
type BasicTextFieldProps = { | ||
label: string; | ||
value?: string | number; | ||
defaultValue?: string | number; | ||
onChange?: (newValue: string | number) => void; | ||
disabled?: boolean; | ||
fullWidth?: boolean; | ||
size?: "small" | "medium"; | ||
labelAsPlaceholder?: boolean; | ||
sx?: SxProps; | ||
type?: HTMLInputTypeAttribute; | ||
variant?: "standard" | "filled" | "outlined"; | ||
required?: boolean; | ||
}; | ||
declare function BasicTextField({ label, value, defaultValue, onChange, // eslint-disable-line @typescript-eslint/no-empty-function | ||
disabled, fullWidth, size, labelAsPlaceholder, sx, type, variant, required, }: BasicTextFieldProps): React.JSX.Element; | ||
export default BasicTextField; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import TextField from "@mui/material/TextField"; | ||
import React from "react"; | ||
function BasicTextField({ label, value, defaultValue, onChange = () => { }, // eslint-disable-line @typescript-eslint/no-empty-function | ||
disabled = false, fullWidth = true, size = "medium", labelAsPlaceholder = true, sx = {}, type = "text", variant = "outlined", required = false, }) { | ||
const inputLabelProps = labelAsPlaceholder ? {} : { shrink: true }; | ||
return (React.createElement(TextField, { type: type, sx: sx, label: label, value: value, defaultValue: defaultValue, fullWidth: fullWidth, disabled: disabled, variant: variant, size: size, required: required, InputLabelProps: inputLabelProps, onChange: (e) => onChange(e.target.value) })); | ||
} | ||
export default BasicTextField; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import BasicTextField from "./BasicTextField"; | ||
export { BasicTextField }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import BasicTextField from "./BasicTextField"; | ||
export { BasicTextField }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export declare function hello_python(): Promise<void>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// import { loadPyodide } from "pyodide"; | ||
// const { loadPyodide } = require("pyodide"); | ||
export async function hello_python() { | ||
// const pyodide = await loadPyodide({ | ||
// indexURL: "<pyodide artifacts folder>", | ||
// }); | ||
// return pyodide.runPythonAsync("1+1"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { FormContextType, ObjectFieldTemplateProps, RJSFSchema, StrictRJSFSchema } from "@rjsf/utils"; | ||
import React from "react"; | ||
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the | ||
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all | ||
* the properties. | ||
* | ||
* @param props - The `ObjectFieldTemplateProps` for this component | ||
*/ | ||
declare function ObjectFieldTemplate<T = any, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = any>({ description, title, properties, required, disabled, readonly, uiSchema, idSchema, schema, formData, onAddClick, registry, }: ObjectFieldTemplateProps<T, S, F>): React.JSX.Element; | ||
export default ObjectFieldTemplate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* eslint-disable react/no-array-index-key */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import Grid from "@mui/material/Grid"; | ||
import { useTheme } from "@mui/material/styles"; | ||
import { canExpand, descriptionId, getTemplate, getUiOptions, titleId, } from "@rjsf/utils"; | ||
import React from "react"; | ||
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the | ||
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all | ||
* the properties. | ||
* | ||
* @param props - The `ObjectFieldTemplateProps` for this component | ||
*/ | ||
function ObjectFieldTemplate({ description, title, properties, required, disabled, readonly, uiSchema, idSchema, schema, formData, onAddClick, registry, }) { | ||
const theme = useTheme(); | ||
const uiOptions = getUiOptions(uiSchema); | ||
const TitleFieldTemplate = getTemplate("TitleFieldTemplate", registry, uiOptions); | ||
const DescriptionFieldTemplate = getTemplate("DescriptionFieldTemplate", registry, uiOptions); | ||
// Button templates are not overridden in the uiSchema | ||
const { ButtonTemplates: { AddButton }, } = registry.templates; | ||
return (React.createElement(React.Fragment, null, | ||
title && (React.createElement(TitleFieldTemplate, { id: titleId(idSchema), title: title, required: required, schema: schema, uiSchema: uiSchema, registry: registry })), | ||
description && (React.createElement(DescriptionFieldTemplate, { id: descriptionId(idSchema), description: description, schema: schema, uiSchema: uiSchema, registry: registry })), | ||
React.createElement(Grid, { container: true, spacing: 2 }, | ||
properties.map((element, index) => | ||
// Remove the <Grid> if the inner element is hidden as the <Grid> | ||
// itself would otherwise still take up space. | ||
element.hidden ? (element.content) : (React.createElement(Grid, { item: true, xs: 12, sm: 6, md: 4, lg: 3, xl: 2, key: index, rowSpacing: theme.spacing(1.25) }, element.content))), | ||
canExpand(schema, uiSchema, formData) && (React.createElement(Grid, { container: true, justifyContent: "flex-end" }, | ||
React.createElement(Grid, { item: true }, | ||
React.createElement(AddButton, { className: "object-property-expand", onClick: onAddClick(schema), disabled: disabled || readonly, uiSchema: uiSchema, registry: registry }))))))); | ||
} | ||
export default ObjectFieldTemplate; |