add missing @since annotations to ui-forms & ui-buttons

This commit is contained in:
Konstantin Schaper
2023-01-16 13:56:36 +01:00
parent d5e5490b53
commit 7d2f9b7fe1
4 changed files with 33 additions and 9 deletions

View File

@@ -27,7 +27,10 @@ import { Link as ReactRouterLink, LinkProps as ReactRouterLinkProps } from "reac
import classNames from "classnames"; import classNames from "classnames";
import { createAttributesForTesting } from "@scm-manager/ui-components"; import { createAttributesForTesting } from "@scm-manager/ui-components";
/** @Beta */ /**
* @beta
* @since 2.41.0
*/
export const ButtonVariants = { export const ButtonVariants = {
PRIMARY: "primary", PRIMARY: "primary",
SECONDARY: "secondary", SECONDARY: "secondary",
@@ -58,7 +61,9 @@ type ButtonProps = BaseButtonProps & ButtonHTMLAttributes<HTMLButtonElement>;
/** /**
* Styled html button * Styled html button
* @Beta *
* @beta
* @since 2.41.0
*/ */
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ className, variant, isLoading, testId, children, ...props }, ref) => ( ({ className, variant, isLoading, testId, children, ...props }, ref) => (
@@ -77,7 +82,9 @@ type LinkButtonProps = BaseButtonProps & ReactRouterLinkProps;
/** /**
* Styled react router link * Styled react router link
* @Beta *
* @beta
* @since 2.41.0
*/ */
export const LinkButton = React.forwardRef<HTMLAnchorElement, LinkButtonProps>( export const LinkButton = React.forwardRef<HTMLAnchorElement, LinkButtonProps>(
({ className, variant, isLoading, testId, children, ...props }, ref) => ( ({ className, variant, isLoading, testId, children, ...props }, ref) => (
@@ -96,7 +103,9 @@ type ExternalLinkButtonProps = BaseButtonProps & AnchorHTMLAttributes<HTMLAnchor
/** /**
* Styled html anchor * Styled html anchor
* @Beta *
* @beta
* @since 2.41.0
*/ */
export const ExternalLinkButton = React.forwardRef<HTMLAnchorElement, ExternalLinkButtonProps>( export const ExternalLinkButton = React.forwardRef<HTMLAnchorElement, ExternalLinkButtonProps>(
({ className, variant, isLoading, testId, children, ...props }, ref) => ( ({ className, variant, isLoading, testId, children, ...props }, ref) => (

View File

@@ -31,7 +31,10 @@ type Props<T extends HalRepresentation> = Pick<ComponentProps<typeof Form<T, T>>
link: string; link: string;
}; };
/** @Beta */ /**
* @beta
* @since 2.41.0
*/
export function ConfigurationForm<T extends HalRepresentation>({link, translationPath, children}: Props<T>) { export function ConfigurationForm<T extends HalRepresentation>({link, translationPath, children}: Props<T>) {
const {initialConfiguration, isReadOnly, update, isLoading} = useConfigLink<T>(link); const {initialConfiguration, isReadOnly, update, isLoading} = useConfigLink<T>(link);

View File

@@ -62,7 +62,10 @@ type Props<FormType extends Record<string, unknown>, DefaultValues extends FormT
submitButtonTestId?: string; submitButtonTestId?: string;
}; };
/** @Beta */ /**
* @beta
* @since 2.41.0
*/
function Form<FormType extends Record<string, unknown>, DefaultValues extends FormType>({ function Form<FormType extends Record<string, unknown>, DefaultValues extends FormType>({
children, children,
onSubmit, onSubmit,

View File

@@ -66,7 +66,10 @@ const createResource = <I, O = never>(link: string, contentType: string) => {
type CreateResourceOptions = MutatingResourceOptions; type CreateResourceOptions = MutatingResourceOptions;
/** @Beta */ /**
* @beta
* @since 2.41.0
*/
export const useCreateResource = <I, O>( export const useCreateResource = <I, O>(
link: string, link: string,
[entityKey, collectionName]: QueryKeyPair, [entityKey, collectionName]: QueryKeyPair,
@@ -92,7 +95,10 @@ type UpdateResourceOptions = MutatingResourceOptions & {
collectionName?: QueryKeyPair; collectionName?: QueryKeyPair;
}; };
/** @Beta */ /**
* @beta
* @since 2.41.0
*/
export const useUpdateResource = <T>( export const useUpdateResource = <T>(
link: LinkOrHalLink, link: LinkOrHalLink,
idFactory: (createdResource: T) => string, idFactory: (createdResource: T) => string,
@@ -125,7 +131,10 @@ type DeleteResourceOptions = {
collectionName?: QueryKeyPair; collectionName?: QueryKeyPair;
}; };
/** @Beta */ /**
* @beta
* @since 2.41.0
*/
export const useDeleteResource = <T extends HalRepresentation>( export const useDeleteResource = <T extends HalRepresentation>(
idFactory: (createdResource: T) => string, idFactory: (createdResource: T) => string,
{ collectionName: [entityQueryKey, collectionName] = ["", ""] }: DeleteResourceOptions = {} { collectionName: [entityQueryKey, collectionName] = ["", ""] }: DeleteResourceOptions = {}