Skip to content

Commit

Permalink
fix(types): extend icon prop type to support Component
Browse files Browse the repository at this point in the history
  • Loading branch information
metonym committed Feb 3, 2025
1 parent ece9e03 commit e07c74d
Show file tree
Hide file tree
Showing 39 changed files with 264 additions and 226 deletions.
330 changes: 165 additions & 165 deletions COMPONENT_INDEX.md

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render\nAlternatively, use the named slot \"icon\" (e.g., `<Icon slot=\"icon\" size=\"{20}\" />`)",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -2570,7 +2570,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render\nIcon is rendered to the left of the label text",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -5771,7 +5771,7 @@
"name": "iconMenu",
"kind": "let",
"description": "Specify the icon to render for the closed state.\nDefaults to `<Menu size={20} />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand All @@ -5782,7 +5782,7 @@
"name": "iconClose",
"kind": "let",
"description": "Specify the icon to render for the opened state.\nDefaults to `<Close size={20} />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -5849,7 +5849,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render when the action panel is closed.\nDefaults to `<Switcher size={20} />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand All @@ -5860,7 +5860,7 @@
"name": "closeIcon",
"kind": "let",
"description": "Specify the icon to render when the action panel is open.\nDefaults to `<Close size={20} />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -5996,7 +5996,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -6059,7 +6059,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -7007,7 +7007,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render\n`inline` must be `false`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -7987,7 +7987,7 @@
"name": "primaryButtonIcon",
"kind": "let",
"description": "Specify the primary button icon",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -8228,7 +8228,7 @@
"name": "primaryButtonIcon",
"kind": "let",
"description": "Specify the primary button icon",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -9000,7 +9000,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -9712,7 +9712,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render.\nDefaults to `<OverflowMenuVertical />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -12032,7 +12032,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render.\nDefaults to `<Search />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -12974,7 +12974,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -13054,7 +13054,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -15061,7 +15061,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -17297,7 +17297,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render for the tooltip button.\nDefault to `<Information />`",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down Expand Up @@ -17646,7 +17646,7 @@
"name": "icon",
"kind": "let",
"description": "Specify the icon to render",
"type": "typeof import(\"svelte\").SvelteComponent<any>",
"type": "typeof import(\"svelte\").SvelteComponent<any> | import(\"svelte\").Component",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
Expand Down
2 changes: 1 addition & 1 deletion src/Button/Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Specify the icon to render
* Alternatively, use the named slot "icon" (e.g., `<Icon slot="icon" size="{20}" />`)
*
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/ComposedModal/ModalFooter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Specify the primary button icon
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let primaryButtonIcon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/ContextMenu/ContextMenuOption.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Specify the icon to render
* Icon is rendered to the left of the label text
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/Link/Link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* Specify the icon to render
* `inline` must be `false`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/Modal/Modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
/**
* Specify the primary button icon
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let primaryButtonIcon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/Notification/NotificationButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = Close;
Expand Down
2 changes: 1 addition & 1 deletion src/OverflowMenu/OverflowMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
/**
* Specify the icon to render.
* Defaults to `<OverflowMenuVertical />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = OverflowMenuVertical;
Expand Down
2 changes: 1 addition & 1 deletion src/Search/Search.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/**
* Specify the icon to render.
* Defaults to `<Search />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = IconSearch;
Expand Down
2 changes: 1 addition & 1 deletion src/Tag/Tag.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/Tooltip/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Specify the icon to render for the tooltip button.
* Default to `<Information />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = Information;
Expand Down
2 changes: 1 addition & 1 deletion src/TooltipIcon/TooltipIcon.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/TreeView/TreeViewNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/TreeView/TreeViewNodeList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/UIShell/HamburgerMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
/**
* Specify the icon to render for the closed state.
* Defaults to `<Menu size={20} />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let iconMenu = Menu;
/**
* Specify the icon to render for the opened state.
* Defaults to `<Close size={20} />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let iconClose = Close;
Expand Down
4 changes: 2 additions & 2 deletions src/UIShell/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@
/**
* Specify the icon to render for the closed state.
* Defaults to `<Menu size={20} />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let iconMenu = Menu;
/**
* Specify the icon to render for the opened state.
* Defaults to `<Close size={20} />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let iconClose = Close;
Expand Down
4 changes: 2 additions & 2 deletions src/UIShell/HeaderAction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
/**
* Specify the icon to render when the action panel is closed.
* Defaults to `<Switcher size={20} />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = Switcher;
/**
* Specify the icon to render when the action panel is open.
* Defaults to `<Close size={20} />`
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let closeIcon = Close;
Expand Down
2 changes: 1 addition & 1 deletion src/UIShell/HeaderActionLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/UIShell/HeaderGlobalAction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/UIShell/SideNavLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/UIShell/SideNavMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Specify the icon to render
* @type {typeof import("svelte").SvelteComponent<any>}
* @type {typeof import("svelte").SvelteComponent<any> | import("svelte").Component}
*/
export let icon = undefined;
Expand Down
4 changes: 3 additions & 1 deletion types/Button/Button.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ type $Props = {
* Alternatively, use the named slot "icon" (e.g., `<Icon slot="icon" size="{20}" />`)
* @default undefined
*/
icon?: typeof import("svelte").SvelteComponent<any>;
icon?:
| typeof import("svelte").SvelteComponent<any>
| import("svelte").Component;

/**
* Specify the ARIA label for the button icon
Expand Down
4 changes: 3 additions & 1 deletion types/ComposedModal/ModalFooter.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ type $Props = {
* Specify the primary button icon
* @default undefined
*/
primaryButtonIcon?: typeof import("svelte").SvelteComponent<any>;
primaryButtonIcon?:
| typeof import("svelte").SvelteComponent<any>
| import("svelte").Component;

/**
* Set to `true` to disable the primary button
Expand Down
Loading

0 comments on commit e07c74d

Please sign in to comment.