Add JSDoc comments

Yay
This commit is contained in:
Ryan Gossiaux
2022-03-07 16:34:56 -08:00
parent 5e17e2cb56
commit cc27615e96
17 changed files with 85 additions and 6 deletions

View File

@@ -42,9 +42,13 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "div"> & { > = TPassThroughProps<TSlotProps, TAsProp, "div"> & {
/** Whether the `Dialog` is open */
open?: boolean; open?: boolean;
/** The element that should receive focus when the Dialog is first opened */
initialFocus?: HTMLElement | null; initialFocus?: HTMLElement | null;
/** Whether the element should ignore the internally managed open/closed state */
static?: boolean; static?: boolean;
/** Whether the element should be unmounted, instead of just hidden, based on the open/closed state */
unmount?: boolean; unmount?: boolean;
}; };
</script> </script>

View File

@@ -45,6 +45,7 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "div"> & { > = TPassThroughProps<TSlotProps, TAsProp, "div"> & {
/** Whether the `Disclosure` should be open by default */
defaultOpen?: boolean; defaultOpen?: boolean;
}; };
</script> </script>

View File

@@ -9,8 +9,10 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "div"> & { > = TPassThroughProps<TSlotProps, TAsProp, "div"> & {
unmount?: boolean; /** Whether the element should ignore the internally managed open/closed state */
static?: boolean; static?: boolean;
/** Whether the element should be unmounted, instead of just hidden, based on the open/closed state */
unmount?: boolean;
}; };
</script> </script>

View File

@@ -50,12 +50,16 @@
return context; return context;
} }
type TListboxProps< type TListboxProps<
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "div"> & { > = TPassThroughProps<TSlotProps, TAsProp, "div"> & {
/** Whether the entire `Listbox` and its children should be disabled */
disabled?: boolean; disabled?: boolean;
/** Whether the entire `Listbox` should be oriented horizontally instead of vertically */
horizontal?: boolean; horizontal?: boolean;
/** The selected value */
value?: StateDefinition["value"]; value?: StateDefinition["value"];
}; };
</script> </script>

View File

@@ -3,7 +3,9 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "li"> & { > = TPassThroughProps<TSlotProps, TAsProp, "li"> & {
/** The option value */
value: unknown; value: unknown;
/** Whether the option should be disabled for keyboard navigation and ARIA purposes */
disabled?: boolean; disabled?: boolean;
}; };
</script> </script>

View File

@@ -3,8 +3,10 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "ul"> & { > = TPassThroughProps<TSlotProps, TAsProp, "ul"> & {
unmount?: boolean; /** Whether the element should ignore the internally managed open/closed state */
static?: boolean; static?: boolean;
/** Whether the element should be unmounted, instead of just hidden, based on the open/closed state */
unmount?: boolean;
}; };
</script> </script>

View File

@@ -2,7 +2,10 @@
type TMenuItemProps< type TMenuItemProps<
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "a"> & {}; > = TPassThroughProps<TSlotProps, TAsProp, "a"> & {
/** Whether the item should be disabled for keyboard navigation and ARIA purposes */
disabled?: boolean;
};
</script> </script>
<script lang="ts"> <script lang="ts">

View File

@@ -3,7 +3,9 @@
TSlotProp extends {}, TSlotProp extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProp, TAsProp, "div"> & { > = TPassThroughProps<TSlotProp, TAsProp, "div"> & {
/** Whether the element should ignore the internally managed open/closed state */
static?: boolean; static?: boolean;
/** Whether the element should be unmounted, instead of just hidden, based on the open/closed state */
unmount?: boolean; unmount?: boolean;
}; };
</script> </script>

View File

@@ -12,8 +12,15 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "div"> & { > = TPassThroughProps<TSlotProps, TAsProp, "div"> & {
/**
* Whether the `PopoverPanel` should trap focus.
* If true, focus will move inside the `PopoverPanel` when it is opened,
* and if focus leaves the `PopoverPanel` it will close.
*/
focus?: boolean; focus?: boolean;
/** Whether the element should ignore the internally managed open/closed state */
static?: boolean; static?: boolean;
/** Whether the element should be unmounted, instead of just hidden, based on the open/closed state */
unmount?: boolean; unmount?: boolean;
}; };
</script> </script>

View File

@@ -48,7 +48,9 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "div"> & { > = TPassThroughProps<TSlotProps, TAsProp, "div"> & {
/** The currently selected value in the `RadioGroup` */
value: StateDefinition["value"]; value: StateDefinition["value"];
/** Whether the `RadioGroup` and all of its `RadioGroupOption`s are disabled */
disabled?: boolean; disabled?: boolean;
}; };
</script> </script>

View File

@@ -3,7 +3,12 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "div"> & { > = TPassThroughProps<TSlotProps, TAsProp, "div"> & {
/**
* The value of the `RadioGroupOption`.
* The type should match the type of the value prop in the `RadioGroup`
*/
value: unknown; value: unknown;
/** Whether the `RadioGroupOption` is disabled */
disabled?: boolean; disabled?: boolean;
}; };
</script> </script>

View File

@@ -3,6 +3,7 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "button"> & { > = TPassThroughProps<TSlotProps, TAsProp, "button"> & {
/** Whether the switch is checked */
checked: boolean; checked: boolean;
}; };
</script> </script>

View File

@@ -3,6 +3,7 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "button"> & { > = TPassThroughProps<TSlotProps, TAsProp, "button"> & {
/** Whether the `Tab` is currently disabled */
disabled?: boolean; disabled?: boolean;
}; };
</script> </script>

View File

@@ -41,8 +41,15 @@
TSlotProps extends {}, TSlotProps extends {},
TAsProp extends SupportedAs TAsProp extends SupportedAs
> = TPassThroughProps<TSlotProps, TAsProp, "div"> & { > = TPassThroughProps<TSlotProps, TAsProp, "div"> & {
/** The index of the default selected tab */
defaultIndex?: number; defaultIndex?: number;
/** Whether the orientation of the `TabList` is vertical instead of horizontal */
vertical?: boolean; vertical?: boolean;
/**
* Whether, in keyboard navigation, the Enter or Space key is necessary to change tabs.
* By default, the arrow keys will change tabs automatically without hitting Enter/Space.
* This has no impact on mouse behavior
*/
manual?: boolean; manual?: boolean;
}; };
</script> </script>

View File

@@ -2,15 +2,27 @@
export type TTransitionChildProps< export type TTransitionChildProps<
TAsProp extends SupportedAs, TAsProp extends SupportedAs,
TDefaultAs TDefaultAs
> = TPassThroughProps<{}, TAsProp, TDefaultAs> & { > = Omit<TPassThroughProps<{}, TAsProp, TDefaultAs>, "class"> & {
/** Classes to add to the transitioning element during the entire enter phase */
enter?: string; enter?: string;
/** Classes to add to the transitioning element before the enter phase starts */
enterFrom?: string; enterFrom?: string;
/** Classes to add to the transitioning element immediately after the enter phase starts */
enterTo?: string; enterTo?: string;
/**
* Classes to add to the transitioning element once the transition is done.
* These classes will persist after that until the leave phase
*/
entered?: string; entered?: string;
/** Classes to add to the transitioning element during the entire leave phase */
leave?: string; leave?: string;
/** Classes to add to the transitioning element before the leave phase starts */
leaveFrom?: string; leaveFrom?: string;
/** Classes to add to the transitioning element immediately after the leave phase starts */
leaveTo?: string; leaveTo?: string;
/** Whether the element should be unmounted, instead of just hidden, based on the open/closed state */
unmount?: boolean; unmount?: boolean;
/** The class attribute for the transition element. These classes will always be present. */
class?: string; class?: string;
}; };
</script> </script>

View File

@@ -3,7 +3,9 @@
TAsProp extends SupportedAs, TAsProp extends SupportedAs,
TDefaultAs TDefaultAs
> = TTransitionChildProps<TAsProp, TDefaultAs> & { > = TTransitionChildProps<TAsProp, TDefaultAs> & {
/** Whether the children should be shown */
show?: boolean; show?: boolean;
/** Whether the transition should run on initial mount */
appear?: boolean; appear?: boolean;
}; };
</script> </script>

View File

@@ -44,15 +44,36 @@
TDefaultAs TDefaultAs
> = TRestProps<TResolveAs<TAsProp, TDefaultAs>> & { > = TRestProps<TResolveAs<TAsProp, TDefaultAs>> & {
name: string; name: string;
as: TAsProp;
slotProps: TSlotProps; slotProps: TSlotProps;
el?: HTMLElement | null; el?: HTMLElement | null;
use?: HTMLActionArray;
visible?: boolean; visible?: boolean;
features?: Features; features?: Features;
as: TAsProp;
static?: boolean; static?: boolean;
unmount?: boolean; unmount?: boolean;
/**
* A list of actions to apply to the component's HTML element.
*
* Each action must take the form `[action]` or `[action, options]`:
*
* use={[[action1], [action2, action2Options], [action3]]}
*/
use?: HTMLActionArray;
/**
* The class attribute for this component.
*
* In addition to a regular string, this may be a function that returns a string.
* In that case, the function will be passed this component's slot props as an argument,
* allowing you to conditionally apply classes. See the component's documentation for more.
*/
class?: ((props: TSlotProps) => string) | string; class?: ((props: TSlotProps) => string) | string;
/**
* The style attribute for this component.
*
* In addition to a regular string, this may be a function that returns a string.
* In that case, the function will be passed this component's slot props as an argument,
* allowing you to conditionally apply styles. See the component's documentation for more.
*/
style?: ((props: TSlotProps) => string) | string; style?: ((props: TSlotProps) => string) | string;
}; };
@@ -66,6 +87,7 @@
TRenderProps<TSlotProps, TAsProp, TDefaultAs>, TRenderProps<TSlotProps, TAsProp, TDefaultAs>,
TInternalProps | "as" | "static" | "unmount" TInternalProps | "as" | "static" | "unmount"
> & { > & {
/** The HTML element the component should render as */
as?: TAsProp; as?: TAsProp;
}; };
</script> </script>