Add more documentation

This commit is contained in:
Arnaud 2024-09-13 18:39:30 +02:00
parent fe6990e3eb
commit 17401e5f5e
No known key found for this signature in database
GPG Key ID: 69D6CE281FCAE663
17 changed files with 106 additions and 2 deletions

View File

@ -15,6 +15,9 @@ type Props = {
children: ReactNode; children: ReactNode;
/**
* Apply custom classname.
*/
className?: string; className?: string;
/** /**

View File

@ -3,8 +3,15 @@ import "./appBar.css";
import { ReactNode } from "react"; import { ReactNode } from "react";
type Props = { type Props = {
/**
* Event triggered when the menu is expanding, after a click on the
* menu button.
*/
onExpand: () => void; onExpand: () => void;
/**
* React node to add to the right part of the application bar
*/
Right: ReactNode; Right: ReactNode;
}; };

View File

@ -29,6 +29,9 @@ type Props = {
*/ */
style?: CustomStyleCSS; style?: CustomStyleCSS;
/**
* Apply custom classname.
*/
className?: string; className?: string;
}; };

View File

@ -3,8 +3,19 @@ import "./Collapse.css";
import { attributes } from "../utils/attributes"; import { attributes } from "../utils/attributes";
type Props = { type Props = {
/**
* Summary always displayed
*/
summary: string; summary: string;
/**
* Details to show after the component is collapsed
*/
details: string; details: string;
/**
* Apply custom classname.
*/
className?: string; className?: string;
}; };

View File

@ -39,6 +39,9 @@ type Props = {
*/ */
placeholder: string; placeholder: string;
/**
* List of values to be displayed in the dropdown
*/
options: DropdownOption[]; options: DropdownOption[];
/** /**
@ -77,8 +80,6 @@ type Props = {
label: string; label: string;
id: string; id: string;
Component?: ComponentType<DropdownOption>;
}; };
export function Dropdown({ export function Dropdown({

View File

@ -3,7 +3,14 @@ import { EmptyPlaceholderIcon } from "./EmptyPlaceholderIcon";
type Props = { type Props = {
title: string; title: string;
message: string; message: string;
/**
* If a retry function is passed to the component,
* a button will be displayed and the function will be called when the button
* is clicked.
*/
onRetry?: () => void | Promise<void>; onRetry?: () => void | Promise<void>;
}; };

View File

@ -9,10 +9,25 @@ interface CustomStyleCSS extends CSSProperties {
} }
type Props = { type Props = {
/**
* Error code related to the error, example: 400, 500
*/
code: number; code: number;
message: string; message: string;
title: string; title: string;
/**
* If an action function is passed to the component,
* a button will be displayed and the function will be called when the button
* is clicked.
*/
onClick?: () => void | Promise<void>; onClick?: () => void | Promise<void>;
/**
* The button label
*/
button?: string; button?: string;
/** /**

View File

@ -23,12 +23,18 @@ export type MenuItem =
}; };
type Props = { type Props = {
/**
* If true, the menu will be displayed
*/
expanded: boolean; expanded: boolean;
onClose: () => void; onClose: () => void;
onOpen?: () => void; onOpen?: () => void;
/**
* The menu items to be displayed
*/
items: MenuItem[]; items: MenuItem[];
className?: string; className?: string;

View File

@ -3,6 +3,7 @@ import "./networkIndicator.css";
type Props = { type Props = {
online: boolean; online: boolean;
text: string; text: string;
}; };

View File

@ -4,9 +4,21 @@ import "./placeholder.css";
type Props = { type Props = {
title: string; title: string;
message: string; message: string;
/**
* If a retry function is passed to the component,
* a button will be displayed and the function will be called when the button
* is clicked.
*/
onRetry?: () => void | Promise<void>; onRetry?: () => void | Promise<void>;
/**
* Icon to be displayed on top of the text
*/
Icon: ReactNode; Icon: ReactNode;
className?: string; className?: string;
}; };

View File

@ -11,6 +11,7 @@ interface CustomStyleCSS extends CSSProperties {
type Props = { type Props = {
label: string; label: string;
id: string; id: string;
/** /**

View File

@ -5,7 +5,9 @@ import { attributes } from "../utils/attributes";
type Props = { type Props = {
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;
children: ReactElement; children: ReactElement;
}; };

View File

@ -1,5 +1,6 @@
type Props = { type Props = {
width?: string; width?: string;
className?: string; className?: string;
}; };

View File

@ -4,11 +4,34 @@ import { attributes } from "../utils/attributes";
import { classnames } from "../utils/classnames"; import { classnames } from "../utils/classnames";
type StepProps = { type StepProps = {
/**
* Step title
*/
title: string; title: string;
/**
* Step index
*/
step: number; step: number;
/**
* If true, an active css class will be added
*/
isActive: boolean; isActive: boolean;
/**
* If true, a css class will be added to draw the line between two steps
*/
isLast: boolean; isLast: boolean;
/**
* If true, a done css class will be added to color the step
*/
isDone: boolean; isDone: boolean;
/**
* Event triggered when a step number is clicked on
*/
onClick?: (step: number) => void; onClick?: (step: number) => void;
}; };

View File

@ -2,6 +2,7 @@ import { SimpleText } from "../SimpleText/SimpleText";
type Props = { type Props = {
action: string; action: string;
onClick: (data: unknown) => unknown | Promise<unknown>; onClick: (data: unknown) => unknown | Promise<unknown>;
}; };

View File

@ -7,6 +7,11 @@ type Props = {
*/ */
headers: string[]; headers: string[];
/**
* The ReactNode cells in two dimensions array,
* one for the lines
* one for the data representation
*/
cells: ReactNode[][]; cells: ReactNode[][];
className?: string; className?: string;

View File

@ -7,7 +7,12 @@ type Props = {
label: string; label: string;
Icon?: ComponentType; Icon?: ComponentType;
}[]; }[];
onTabChange: (index: number) => void | Promise<void>; onTabChange: (index: number) => void | Promise<void>;
/**
* Current tab selected index
*/
tabIndex: number; tabIndex: number;
}; };