updated all packages to latest
This commit is contained in:
1 parent
f1b24ec783
commit
e22f64dd51
18 files changed
+3455
-3751
No files matched your search
@@ -1,4 +1,7 @@
|
||||
module.exports = {
|
||||
'core': {
|
||||
builder: 'webpack5'
|
||||
},
|
||||
"stories": [
|
||||
"../src/**/*.stories.mdx",
|
||||
"../src/**/*.stories.@(js|jsx|ts|tsx)"
|
||||
|
||||
+19
-14
@@ -8,24 +8,25 @@
|
||||
"@emotion/styled": "^11.8.1",
|
||||
"@mui/material": "^5.8.0",
|
||||
"@mui/styles": "^5.8.0",
|
||||
"@types/jest": "^26.0.15",
|
||||
"@types/node": "^12.0.0",
|
||||
"@types/react": "^17.0.0",
|
||||
"@types/react-dom": "^17.0.0",
|
||||
"@types/jest": "^27.5.1",
|
||||
"@types/node": "^17.0.36",
|
||||
"@types/react": "^18.0.9",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@uiw/react-codemirror": "^4.7.0",
|
||||
"autosuggest-highlight": "^3.2.1",
|
||||
"home-assistant-js-websocket": "^7.1.0",
|
||||
"jss": "^10.8.2",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"notistack": "^2.0.5",
|
||||
"react": "^18.1.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"react-flow-renderer": "^10.1.2",
|
||||
"react-jss": "^10.8.2",
|
||||
"react-router-dom": "6",
|
||||
"react-scripts": "4.0.3",
|
||||
"react-scripts": "5.0.1",
|
||||
"superstruct": "^0.15.4",
|
||||
"theming": "^3.3.0",
|
||||
"typescript": "^4.1.2",
|
||||
"web-vitals": "^1.0.1",
|
||||
"web-vitals": "^2.1.4",
|
||||
"yarn": "^1.22.17"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -73,20 +74,24 @@
|
||||
"@storybook/addon-essentials": "^6.4.22",
|
||||
"@storybook/addon-links": "^6.4.22",
|
||||
"@storybook/addon-queryparams": "^6.2.9",
|
||||
"@storybook/builder-webpack5": "^6.5.6",
|
||||
"@storybook/manager-webpack5": "^6.5.6",
|
||||
"@storybook/node-logger": "^6.4.22",
|
||||
"@storybook/preset-create-react-app": "^3.2.0",
|
||||
"@storybook/preset-create-react-app": "^4.1.1",
|
||||
"@storybook/react": "^6.4.22",
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^11.1.0",
|
||||
"@testing-library/user-event": "^12.1.10",
|
||||
"@testing-library/react": "^13.3.0",
|
||||
"@testing-library/user-event": "^14.2.0",
|
||||
"@types/autosuggest-highlight": "^3.2.0",
|
||||
"@types/chroma-js": "^2.1.3",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"jest-environment-jsdom": "^27.5.1",
|
||||
"ts-node": "^10.8.0"
|
||||
"jest-environment-jsdom": "^28.1.0",
|
||||
"ts-node": "^10.8.0",
|
||||
"webpack": "^5.72.1",
|
||||
"webpack-dev-server": "^4.9.0"
|
||||
},
|
||||
"moduleDirectories": [
|
||||
"node_modules",
|
||||
"src"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import "./AutoInfoBox.css";
|
||||
import { AutomationMetadata } from "types/automations";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
import InputText from "components/Inputs/InputText";
|
||||
import { FC, useRef, useState } from 'react';
|
||||
import { FC, ReactNode, useRef, useState } from 'react';
|
||||
import { AddIcon, TrashIcon } from "components/Icons";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import InputAutoText from "components/Inputs/InputAutoText";
|
||||
@@ -14,6 +14,7 @@ interface Props {
|
||||
tags: Array<[string, string]>;
|
||||
onUpdate: (m: AutomationMetadata, tags: Array<[string, string]>) => void;
|
||||
tagDB: TagDB;
|
||||
children?: ReactNode;
|
||||
}
|
||||
export const AutoInfoBox: FC<Props> = ({
|
||||
metadata,
|
||||
|
||||
@@ -69,7 +69,8 @@ export const AutomationEditor: FC<Props> = ({
|
||||
className="automation-editor--info-box--icon"
|
||||
onClick={() => setCloseInfo(!closeInfo)}
|
||||
title={closeInfo ? "Show Metadata" : "Hide Metadata"}
|
||||
>{ArrowIcon}</ButtonIcon>
|
||||
Icon={ArrowIcon}
|
||||
/>
|
||||
</AutoInfoBox>
|
||||
|
||||
<div className={["automation-editor--flow-wrapper", state.status].join(" ")}>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "./index.css";
|
||||
import "./index.mobile.css";
|
||||
import { AutomationEditor } from "components/AutomationEditor";
|
||||
import { FC, useState } from "react";
|
||||
import { FC, ReactNode, useState } from "react";
|
||||
import { AutomationData } from "types/automations";
|
||||
import { defaultAutomation } from 'utils/defaults';
|
||||
import { ArrowIcon } from "components/Icons";
|
||||
@@ -21,6 +21,7 @@ interface AutomationListParams {
|
||||
onAdd: (auto: AutomationData) => void;
|
||||
onRemove: (i: number) => void;
|
||||
dims: DAGAutomationFlowDims;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export const AutomationList: FC<AutomationListParams> = ({
|
||||
@@ -59,9 +60,8 @@ export const AutomationList: FC<AutomationListParams> = ({
|
||||
<ButtonIcon
|
||||
onClick={() => setHideList(!hideList)}
|
||||
className="automation-list--list-hide"
|
||||
>
|
||||
{ArrowIcon}
|
||||
</ButtonIcon>
|
||||
Icon={ArrowIcon}
|
||||
/>
|
||||
</div>
|
||||
<div className="automation-list--viewer">
|
||||
{currentAuto ? <AutomationEditor
|
||||
|
||||
@@ -85,47 +85,49 @@ export const ConditionNode: FC<{
|
||||
<button className={p.isRoot ? classes.deleteBtnRoot : classes.deleteBtn} onClick={p?.onClick}>X</button>
|
||||
|
||||
return <div className={classes.root}>
|
||||
{(showDelete && !effectiveDM) && <DeleteButton isRoot onClick={() => onDelete('root')} />}
|
||||
<div className={classes.title}>
|
||||
<InputList
|
||||
label=""
|
||||
className={classes.titleText}
|
||||
current={condition.condition}
|
||||
options={[
|
||||
'or', 'not', 'and',
|
||||
'template',
|
||||
'numeric_state',
|
||||
'state',
|
||||
'time',
|
||||
'trigger',
|
||||
'zone',
|
||||
]}
|
||||
onChange={(n: any) => onUpdate({
|
||||
...getConditionDefaultValues(n),
|
||||
...condition,
|
||||
condition: n,
|
||||
} as any)}
|
||||
/>
|
||||
{effectiveDM && <button className={classes.yamlBtn} onClick={() => setYamlMode(!yamlMode)}>
|
||||
{yamlMode ? 'visual' : 'yaml'}
|
||||
</button>}
|
||||
{!yamlMode && <button className={classes.modifyBtn} onClick={() => setInternalDisplayMode(!effectiveDM)}>
|
||||
{effectiveDM ? <PencilIcon className={classes.icon} /> : <CheckMarkIcon className={classes.icon} />}
|
||||
</button>}
|
||||
</div>
|
||||
<div className={classes.children}>
|
||||
{yamlMode && <InputYaml
|
||||
label=""
|
||||
value={condition}
|
||||
onChange={update => onUpdate(update as any)}
|
||||
/>}
|
||||
<div className={classes.conditionWrap}>
|
||||
{!yamlMode && childrenConditions}
|
||||
<>
|
||||
{(showDelete && !effectiveDM) && <DeleteButton isRoot onClick={() => onDelete('root')} />}
|
||||
<div className={classes.title}>
|
||||
<InputList
|
||||
label=""
|
||||
className={classes.titleText}
|
||||
current={condition.condition}
|
||||
options={[
|
||||
'or', 'not', 'and',
|
||||
'template',
|
||||
'numeric_state',
|
||||
'state',
|
||||
'time',
|
||||
'trigger',
|
||||
'zone',
|
||||
]}
|
||||
onChange={(n: any) => onUpdate({
|
||||
...getConditionDefaultValues(n),
|
||||
...condition,
|
||||
condition: n,
|
||||
} as any)}
|
||||
/>
|
||||
{effectiveDM && <button className={classes.yamlBtn} onClick={() => setYamlMode(!yamlMode)}>
|
||||
{yamlMode ? 'visual' : 'yaml'}
|
||||
</button>}
|
||||
{!yamlMode && <button className={classes.modifyBtn} onClick={() => setInternalDisplayMode(!effectiveDM)}>
|
||||
{effectiveDM ? <PencilIcon className={classes.icon} /> : <CheckMarkIcon className={classes.icon} />}
|
||||
</button>}
|
||||
</div>
|
||||
{!yamlMode && hasChildren && <div className={classes.addBtnContainer}>
|
||||
<button className={classes.addBtn} onClick={() => onAddChild()}>Add</button>
|
||||
</div>}
|
||||
</div>
|
||||
{children({ classes })}
|
||||
<div className={classes.children}>
|
||||
{yamlMode && <InputYaml
|
||||
label=""
|
||||
value={condition}
|
||||
onChange={update => onUpdate(update as any)}
|
||||
/>}
|
||||
<div className={classes.conditionWrap}>
|
||||
{!yamlMode && childrenConditions}
|
||||
</div>
|
||||
{!yamlMode && hasChildren && <div className={classes.addBtnContainer}>
|
||||
<button className={classes.addBtn} onClick={() => onAddChild()}>Add</button>
|
||||
</div>}
|
||||
</div>
|
||||
{children({ classes })}
|
||||
</>
|
||||
</div>
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import "./index.css";
|
||||
import { Component, ErrorInfo } from "react";
|
||||
import { Component, ErrorInfo, ReactNode } from "react";
|
||||
|
||||
type State = {
|
||||
hasError: false;
|
||||
@@ -8,7 +8,9 @@ type State = {
|
||||
error: any,
|
||||
errorInfo?: ErrorInfo,
|
||||
}
|
||||
export class ErrorBoundary extends Component<{}, State> {
|
||||
export class ErrorBoundary extends Component<{
|
||||
children: ReactNode
|
||||
}, State> {
|
||||
|
||||
state: State = {
|
||||
hasError: false
|
||||
|
||||
@@ -5,7 +5,7 @@ import { createAppUseStyles } from 'styles/theme';
|
||||
export interface ButtonIconStyleProps {
|
||||
}
|
||||
export interface ButtonIconProps extends IconBaseProps, ButtonIconStyleProps {
|
||||
children: FC<IconBaseProps>;
|
||||
Icon: FC<IconBaseProps>;
|
||||
}
|
||||
const useButtonIconStyles = createAppUseStyles(theme => ({
|
||||
buttonIcon: {
|
||||
@@ -22,9 +22,9 @@ const useButtonIconStyles = createAppUseStyles(theme => ({
|
||||
|
||||
|
||||
export const ButtonIcon: FC<ButtonIconProps> = ({
|
||||
children: Child,
|
||||
Icon,
|
||||
className,
|
||||
...props
|
||||
}) => <Child
|
||||
}) => <Icon
|
||||
className={`${useButtonIconStyles({}).classes.buttonIcon} ${className}`} {...props}
|
||||
/>
|
||||
@@ -32,7 +32,7 @@ IconList.args = {
|
||||
export const ButtonIconExample: ComponentStory<typeof IconBase> = (args) => {
|
||||
|
||||
return <Page>
|
||||
<ButtonIcon {...args}>{ArrowIcon}</ButtonIcon>
|
||||
<ButtonIcon {...args} Icon={ArrowIcon} />
|
||||
</Page>
|
||||
}
|
||||
ButtonIconExample.args = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import "./InputEntities.css";
|
||||
import { FC } from "react";
|
||||
import { DeviceRegistryOption, useHADeviceRegistry } from 'haService';
|
||||
import { useHADeviceRegistry } from 'haService';
|
||||
import Autocomplete from '@mui/material/Autocomplete';
|
||||
import TextField from '@mui/material/TextField';
|
||||
import Chip from '@mui/material/Chip';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import Chip from "@mui/material/Chip";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Autocomplete from "@mui/material/Autocomplete";
|
||||
import { FC } from "react";
|
||||
|
||||
export interface Props {
|
||||
label: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FC } from "react";
|
||||
import { FC, ReactNode } from "react";
|
||||
import { useInputWrapperStyles } from "./styles";
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ export interface Props {
|
||||
noMargin?: boolean;
|
||||
className?: string;
|
||||
error?: string;
|
||||
children: ReactNode;
|
||||
}
|
||||
const InputWrapper: FC<Props> = ({ error, label, children, labelSize = 'normal', noMargin = false, className = "" }) => {
|
||||
const { classes } = useInputWrapperStyles({ labelSize, noMargin, hasError: !!error })
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { FC } from "react";
|
||||
import { FC, ReactNode } from "react";
|
||||
import { createAppUseStyles } from "styles/theme";
|
||||
|
||||
export interface ModalStyleProps {
|
||||
open: boolean;
|
||||
}
|
||||
export interface Props extends ModalStyleProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
const useModalStyle = createAppUseStyles<ModalStyleProps>(theme => ({
|
||||
root: ({ open }) => ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import "./index.css";
|
||||
|
||||
import { FC } from 'react';
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { AutomationNode, AutomationNodeMapping } from 'types/automations/index';
|
||||
import { useEditorNodeState } from "./OptionManager";
|
||||
import { InputList } from "components/Inputs/InputList";
|
||||
@@ -15,6 +15,7 @@ export interface NodeEditorProps {
|
||||
onFlags?: (isReady: boolean, isModified: boolean) => void;
|
||||
saveBtnCreateText?: boolean;
|
||||
isErrored?: boolean;
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
export const NodeEditor: FC<NodeEditorProps> = ({
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import "./index.css";
|
||||
import { FC } from 'react';
|
||||
import { FC, ReactNode } from 'react';
|
||||
import { createTheme, ThemeProvider } from '@mui/material/styles';
|
||||
import { VersionBox } from "components/VersionBox";
|
||||
import { SnackbarProvider } from 'notistack';
|
||||
|
||||
const theme = createTheme({
|
||||
palette: {
|
||||
@@ -10,14 +11,18 @@ const theme = createTheme({
|
||||
});
|
||||
|
||||
|
||||
export const Page: FC = ({ children }) => {
|
||||
export const Page: FC<{
|
||||
children: ReactNode
|
||||
}> = ({ children }) => {
|
||||
return <ThemeProvider theme={theme}>
|
||||
<main className="page" style={{
|
||||
color: theme.palette.text.primary,
|
||||
background: theme.palette.background.default,
|
||||
}}>
|
||||
<VersionBox />
|
||||
{children}
|
||||
</main>
|
||||
<SnackbarProvider>
|
||||
<main className="page" style={{
|
||||
color: theme.palette.text.primary,
|
||||
background: theme.palette.background.default,
|
||||
}}>
|
||||
<VersionBox />
|
||||
{children}
|
||||
</main>
|
||||
</SnackbarProvider>
|
||||
</ThemeProvider>
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Connection, getCollection } from "home-assistant-js-websocket";
|
||||
import { HassDevices, HassEntitiesRegistry } from './types';
|
||||
import { HassEntitiesRegistry } from './types';
|
||||
|
||||
|
||||
export const fetchEntityRegistry = (conn: Connection) => conn.sendMessagePromise<HassEntitiesRegistry>({
|
||||
|
||||
@@ -123,6 +123,6 @@ export const prettyEntityId = (entityId: string | string[]) => {
|
||||
}
|
||||
|
||||
export const prettyName = (n: string) => {
|
||||
const clean = n.replaceAll(/[\.-_]/g, ' ');
|
||||
const clean = n.replaceAll(/[.-_]/g, ' ');
|
||||
return clean.split(' ').map(x => x.slice(0, 1).toUpperCase() + x.slice(1)).join(' ')
|
||||
}
|
||||
+3351
-3668
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user