Add types test for HeaderAction

This commit is contained in:
Eric Liu 2025-03-08 11:19:52 -08:00
commit 53a106bc41
4 changed files with 20 additions and 18 deletions

View file

@ -1615,17 +1615,17 @@ None.
### Props
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
| :------------------------- | :------- | :--------------- | :------- | ----------------------------------------------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| ref | No | <code>let</code> | Yes | <code>null &#124; HTMLButtonElement</code> | <code>null</code> | Obtain a reference to the button HTML element |
| isOpen | No | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to open the panel |
| icon | No | <code>let</code> | No | <code>any</code> | <code>undefined</code> | Specify the icon to render when the action panel is closed.<br />Defaults to `&lt;Switcher size={20} /&gt;` |
| closeIcon | No | <code>let</code> | No | <code>any</code> | <code>undefined</code> | Specify the icon to render when the action panel is open.<br />Defaults to `&lt;Close size={20} /&gt;` |
| text | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the text.<br />Alternatively, use the named slot "text" (e.g., `&lt;div slot="text"&gt;...&lt;/div&gt;`) |
| iconDescription | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify an icon tooltip.<br />This only works if `text` or a named slot "text" is not provided. |
| tooltipAlignment | No | <code>let</code> | No | <code>"start" &#124; "center" &#124; "end"</code> | <code>"center"</code> | Set the alignment of the tooltip relative to the icon.<br />This only works if `iconDescription` is provided. |
| transition | No | <code>let</code> | No | <code>false &#124; import("svelte/transition").SlideParams</code> | <code>{ duration: 200 }</code> | Customize the panel transition (i.e., `transition:slide`).<br />Set to `false` to disable the transition |
| preventCloseOnClickOutside | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to prevent the panel from closing when clicking outside |
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
| :------------------------- | :------- | :--------------- | :------- | ----------------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| ref | No | <code>let</code> | Yes | <code>null &#124; HTMLButtonElement</code> | <code>null</code> | Obtain a reference to the button HTML element |
| isOpen | No | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` to open the panel |
| icon | No | <code>let</code> | No | <code>any</code> | <code>undefined</code> | Specify the icon to render when the action panel is closed.<br />Defaults to `&lt;Switcher size={20} /&gt;` |
| closeIcon | No | <code>let</code> | No | <code>any</code> | <code>undefined</code> | Specify the icon to render when the action panel is open.<br />Defaults to `&lt;Close size={20} /&gt;` |
| text | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify the text displayed next to the icon.<br />Alternatively, use the named slot "text" (e.g., `&lt;div slot="text"&gt;...&lt;/div&gt;`) |
| iconDescription | No | <code>let</code> | No | <code>string</code> | <code>undefined</code> | Specify an icon tooltip. The tooltip will not be displayed<br />if either the `text` prop or a named slot="text" is used |
| tooltipAlignment | No | <code>let</code> | No | <code>"start" &#124; "center" &#124; "end"</code> | <code>"center"</code> | Set the alignment of the tooltip relative to the icon.<br />Only applies when `iconDescription` is provided |
| transition | No | <code>let</code> | No | <code>false &#124; import("svelte/transition").SlideParams</code> | <code>{ duration: 200 }</code> | Customize the panel transition (i.e., `transition:slide`).<br />Set to `false` to disable the transition |
| preventCloseOnClickOutside | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to prevent the panel from closing when clicking outside |
### Slots

View file

@ -5870,7 +5870,7 @@
{
"name": "text",
"kind": "let",
"description": "Specify the text.\nAlternatively, use the named slot \"text\" (e.g., `<div slot=\"text\">...</div>`)",
"description": "Specify the text displayed next to the icon.\nAlternatively, use the named slot \"text\" (e.g., `<div slot=\"text\">...</div>`)",
"type": "string",
"isFunction": false,
"isFunctionDeclaration": false,
@ -5881,7 +5881,7 @@
{
"name": "iconDescription",
"kind": "let",
"description": "Specify an icon tooltip.\nThis only works if `text` or a named slot \"text\" is not provided.",
"description": "Specify an icon tooltip. The tooltip will not be displayed\nif either the `text` prop or a named slot=\"text\" is used",
"type": "string",
"isFunction": false,
"isFunctionDeclaration": false,
@ -5892,7 +5892,7 @@
{
"name": "tooltipAlignment",
"kind": "let",
"description": "Set the alignment of the tooltip relative to the icon.\nThis only works if `iconDescription` is provided.",
"description": "Set the alignment of the tooltip relative to the icon.\nOnly applies when `iconDescription` is provided",
"type": "\"start\" | \"center\" | \"end\"",
"value": "\"center\"",
"isFunction": false,

View file

@ -35,6 +35,8 @@
bind:isOpen
on:open
on:close
iconDescription="Switcher"
tooltipAlignment="start"
transition={{ duration: 400, easing: quintOut }}
>
<HeaderPanelLinks>

View file

@ -25,22 +25,22 @@ type $Props = {
closeIcon?: any;
/**
* Specify the text.
* Specify the text displayed next to the icon.
* Alternatively, use the named slot "text" (e.g., `<div slot="text">...</div>`)
* @default undefined
*/
text?: string;
/**
* Specify an icon tooltip.
* This only works if `text` or a named slot "text" is not provided.
* Specify an icon tooltip. The tooltip will not be displayed
* if either the `text` prop or a named slot="text" is used
* @default undefined
*/
iconDescription?: string;
/**
* Set the alignment of the tooltip relative to the icon.
* This only works if `iconDescription` is provided.
* Only applies when `iconDescription` is provided
* @default "center"
*/
tooltipAlignment?: "start" | "center" | "end";