Make EntitySettingRegistry fully injectable (#6604)

* Make EntitySettingRegistry fully injectable

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Add behavioural tests

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix lint

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Revert tsconfig change

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Fix type errors

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Update snapshot

Signed-off-by: Sebastian Malton <sebastian@malton.name>

* Improve naming

Signed-off-by: Sebastian Malton <sebastian@malton.name>

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton authored and GitHub committed 2022-11-28 12:13:15 -05:00
1 parent 8897bfc26b
commit 9589175604
51 files changed
+2103 -540

No files matched your search

+9 -9
View File
@@ -9,23 +9,23 @@ import React from "react";
import { autoBind, cssNames } from "../../utils";
import { Icon } from "../icon";
const TabsContext = React.createContext<TabsContextValue>({});
const TabsContext = React.createContext<TabsContextValue<unknown>>({});
interface TabsContextValue<D = any> {
interface TabsContextValue<D> {
autoFocus?: boolean;
withBorder?: boolean;
value?: D;
onChange?(value: D): void;
}
export interface TabsProps<D = any> extends TabsContextValue<D>, Omit<DOMAttributes<HTMLElement>, "onChange"> {
export interface TabsProps<D> extends TabsContextValue<D>, Omit<DOMAttributes<HTMLElement>, "onChange"> {
className?: string;
center?: boolean;
wrap?: boolean;
scrollable?: boolean;
}
export class Tabs extends React.PureComponent<TabsProps> {
export class Tabs<D> extends React.PureComponent<TabsProps<D>> {
public elem: HTMLDivElement | null = null;
render() {
@@ -49,22 +49,22 @@ export class Tabs extends React.PureComponent<TabsProps> {
}
}
export interface TabProps<D = any> extends DOMAttributes<HTMLElement> {
export interface TabProps<D> extends DOMAttributes<HTMLElement> {
id?: string;
className?: string;
active?: boolean;
disabled?: boolean;
icon?: React.ReactNode | string; // material-ui name or custom icon
label?: React.ReactNode;
value?: D;
value: D;
}
export class Tab extends React.PureComponent<TabProps> {
export class Tab<D> extends React.PureComponent<TabProps<D>> {
static contextType = TabsContext;
declare context: TabsContextValue;
declare context: TabsContextValue<D>;
public ref = React.createRef<HTMLDivElement>();
constructor(props: TabProps) {
constructor(props: TabProps<D>) {
super(props);
autoBind(this);
}