+
+
Enter the name of the team you wish to create. Team names can contain
the characters a-z A-Z 0-9 _ and must not start or end with an _
@@ -111,7 +104,7 @@ export function CreateTeamForm() {
)}
-
+
);
}
diff --git a/packages/cyberstorm/src/components/TextInput/TextInput.tsx b/packages/cyberstorm/src/components/TextInput/TextInput.tsx
index 4c62c89d4..aa0cb7fa5 100644
--- a/packages/cyberstorm/src/components/TextInput/TextInput.tsx
+++ b/packages/cyberstorm/src/components/TextInput/TextInput.tsx
@@ -1,11 +1,12 @@
"use client";
-import React, { ReactNode } from "react";
+import React from "react";
import styles from "./TextInput.module.css";
import { Icon } from "../Icon/Icon";
import { classnames } from "../../utils/utils";
-export interface TextInputProps {
- children?: ReactNode;
+export interface TextInputProps
+ extends React.ComponentPropsWithRef<"input">,
+ React.PropsWithChildren {
placeHolder?: string;
leftIcon?: JSX.Element;
id?: string;
@@ -14,9 +15,8 @@ export interface TextInputProps {
value?: string;
name?: string;
color?: string;
- ref?: (instance: any) => void;
- onBlur?: (val: any) => void;
- onChange?: (val: any) => void;
+ onBlur?: React.FocusEventHandler
;
+ onChange?: React.ChangeEventHandler;
enterHook?: (value: string) => string | void;
}
diff --git a/packages/cyberstorm/src/components/Toast/Provider.tsx b/packages/cyberstorm/src/components/Toast/Provider.tsx
index 1f10b8b5b..ac0a8a6c3 100644
--- a/packages/cyberstorm/src/components/Toast/Provider.tsx
+++ b/packages/cyberstorm/src/components/Toast/Provider.tsx
@@ -1,6 +1,11 @@
-import { createContext, PropsWithChildren, useReducer } from "react";
-import { v4 as uuid } from "uuid";
import * as RadixToast from "@radix-ui/react-toast";
+import {
+ createContext,
+ PropsWithChildren,
+ useContext,
+ useReducer,
+} from "react";
+import { v4 as uuid } from "uuid";
import Toast from ".";
import { ToastProps } from "./Toast";
@@ -37,16 +42,16 @@ const toastReducer = (
};
interface ContextInterface {
- addToast: (props: Omit) => void;
+ addToast: ({ ...props }: Omit) => void;
remove: (id: string) => void;
}
-const ToastContext = createContext(null);
+export const ToastContext = createContext(null);
export function Provider(props: { toastDuration: number } & PropsWithChildren) {
const [state, dispatch] = useReducer(toastReducer, initState);
- const addToast = (props: Omit) => {
+ const addToast = ({ ...props }: Omit) => {
const id = uuid();
dispatch({ type: "add", toast: { id, ...props } });
};
@@ -69,3 +74,13 @@ export function Provider(props: { toastDuration: number } & PropsWithChildren) {
);
}
+
+export const useToast = (): ContextInterface => {
+ const contextState = useContext(ToastContext);
+
+ if (contextState === null) {
+ throw new Error("useToast must be used within a Toast.Provider tag");
+ }
+
+ return contextState;
+};
diff --git a/yarn.lock b/yarn.lock
index 39c1087d1..872fe68da 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2588,6 +2588,11 @@
dependencies:
prop-types "^15.8.1"
+"@hookform/resolvers@^3.3.2":
+ version "3.3.2"
+ resolved "https://registry.yarnpkg.com/@hookform/resolvers/-/resolvers-3.3.2.tgz#5c40f06fe8137390b071d961c66d27ee8f76f3bc"
+ integrity sha512-Tw+GGPnBp+5DOsSg4ek3LCPgkBOuOgS5DsDV7qsWNH9LZc433kgsWICjlsh2J9p04H2K66hsXPPb9qn9ILdUtA==
+
"@humanwhocodes/config-array@^0.11.8":
version "0.11.8"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz#03595ac2075a4dc0f191cc2131de14fbd7d410b9"