From 63ef51209d5902ef7d55ad3c14b3070693098669 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Wed, 27 Jan 2021 14:16:07 -0800 Subject: [PATCH] feat: make renderIcon/icon prop consistent (#496) --- COMPONENT_INDEX.md | 54 +++++++++---------- docs/src/COMPONENT_API.json | 18 +++---- docs/src/pages/_layout.svelte | 2 +- src/Notification/NotificationButton.svelte | 4 +- src/UIShell/GlobalHeader/HeaderAction.svelte | 12 ++--- .../GlobalHeader/HeaderActionLink.svelte | 8 +-- src/UIShell/SideNav/SideNavLink.svelte | 8 +-- src/UIShell/SideNav/SideNavMenu.svelte | 10 ++-- types/Notification/NotificationButton.d.ts | 2 +- types/UIShell/GlobalHeader/HeaderAction.d.ts | 4 +- .../GlobalHeader/HeaderActionLink.d.ts | 4 +- types/UIShell/SideNav/SideNavLink.d.ts | 4 +- types/UIShell/SideNav/SideNavMenu.d.ts | 4 +- 13 files changed, 67 insertions(+), 67 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 07454755..13881a05 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1400,13 +1400,13 @@ export interface HeaderActionSlideTransition { ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :--------- | :--------------- | :------- | :------------------------------------------------------------------------------------ | ------------------------------ | ------------------------------------------------------------------------------------------------------------- | -| ref | let | Yes | null | HTMLButtonElement | null | Obtain a reference to the button HTML element | -| isOpen | let | Yes | boolean | false | Set to `true` to open the panel | -| icon | let | No | { render: import("carbon-icons-svelte").CarbonIcon; skeleton: boolean; } | -- | Specify the icon props | -| text | let | No | string | -- | Specify the text
Alternatively, use the named slot "text" (e.g., <div slot="text">...</div>) | -| transition | let | No | false | HeaderActionSlideTransition | { duration: 200 } | Customize the panel transition (i.e., `transition:slide`)
Set to `false` to disable the transition | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :--------- | :--------------- | :------- | :----------------------------------------------------------- | ------------------------------ | ------------------------------------------------------------------------------------------------------------- | +| ref | let | Yes | null | HTMLButtonElement | null | Obtain a reference to the button HTML element | +| isOpen | let | Yes | boolean | false | Set to `true` to open the panel | +| icon | let | No | typeof import("carbon-icons-svelte").CarbonIcon | -- | Specify the icon from `carbon-icons-svelte` to render | +| text | let | No | string | -- | Specify the text
Alternatively, use the named slot "text" (e.g., <div slot="text">...</div>) | +| transition | let | No | false | HeaderActionSlideTransition | { duration: 200 } | Customize the panel transition (i.e., `transition:slide`)
Set to `false` to disable the transition | ### Slots @@ -1426,12 +1426,12 @@ export interface HeaderActionSlideTransition { ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :----------- | :--------------- | :------- | :------------------------------------------------------------------------------------ | ------------------ | --------------------------------------------- | -| ref | let | Yes | null | HTMLAnchorElement | null | Obtain a reference to the HTML anchor element | -| linkIsActive | let | No | boolean | false | Set to `true` to use the active state | -| href | let | No | string | -- | Specify the `href` attribute | -| icon | let | No | { render: import("carbon-icons-svelte").CarbonIcon; skeleton: boolean; } | -- | Specify the icon props | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :----------- | :--------------- | :------- | :----------------------------------------------------------- | ------------------ | ----------------------------------------------------- | +| ref | let | Yes | null | HTMLAnchorElement | null | Obtain a reference to the HTML anchor element | +| linkIsActive | let | No | boolean | false | Set to `true` to use the active state | +| href | let | No | string | -- | Specify the `href` attribute | +| icon | let | No | typeof import("carbon-icons-svelte").CarbonIcon | -- | Specify the icon from `carbon-icons-svelte` to render | ### Slots @@ -2207,7 +2207,7 @@ None. | Prop name | Kind | Reactive | Type | Default value | Description | | :--------------- | :--------------- | :------- | :----------------------------------------------------------- | ------------------------- | ----------------------------------------------------- | | notificationType | let | No | "toast" | "inline" | "toast" | Set the type of notification | -| renderIcon | let | No | typeof import("carbon-icons-svelte").CarbonIcon | -- | Specify the icon from `carbon-icons-svelte` to render | +| icon | let | No | typeof import("carbon-icons-svelte").CarbonIcon | -- | Specify the icon from `carbon-icons-svelte` to render | | title | let | No | string | -- | Specify the title of the icon | | iconDescription | let | No | string | "Close icon" | Specify the ARIA label for the icon | @@ -2982,13 +2982,13 @@ None. ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :--------- | :--------------- | :------- | :------------------------------------------------------------------------------------ | ------------------ | --------------------------------------------- | -| ref | let | Yes | null | HTMLAnchorElement | null | Obtain a reference to the HTML anchor element | -| isSelected | let | No | boolean | false | Set to `true` to select the current link | -| href | let | No | string | -- | Specify the `href` attribute | -| text | let | No | string | -- | Specify the text | -| icon | let | No | { render: import("carbon-icons-svelte").CarbonIcon; skeleton: boolean; } | -- | Specify the icon props | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :--------- | :--------------- | :------- | :----------------------------------------------------------- | ------------------ | ----------------------------------------------------- | +| ref | let | Yes | null | HTMLAnchorElement | null | Obtain a reference to the HTML anchor element | +| isSelected | let | No | boolean | false | Set to `true` to select the current link | +| href | let | No | string | -- | Specify the `href` attribute | +| text | let | No | string | -- | Specify the text | +| icon | let | No | typeof import("carbon-icons-svelte").CarbonIcon | -- | Specify the icon from `carbon-icons-svelte` to render | ### Slots @@ -3004,12 +3004,12 @@ None. ### Props -| Prop name | Kind | Reactive | Type | Default value | Description | -| :-------- | :--------------- | :------- | :------------------------------------------------------------------------------------ | ------------------ | --------------------------------------------- | -| ref | let | Yes | null | HTMLButtonElement | null | Obtain a reference to the HTML button element | -| expanded | let | Yes | boolean | false | Set to `true` to toggle the expanded state | -| text | let | No | string | -- | Specify the text | -| icon | let | No | { render: import("carbon-icons-svelte").CarbonIcon; skeleton: boolean; } | -- | Specify the icon props | +| Prop name | Kind | Reactive | Type | Default value | Description | +| :-------- | :--------------- | :------- | :----------------------------------------------------------- | ------------------ | ----------------------------------------------------- | +| ref | let | Yes | null | HTMLButtonElement | null | Obtain a reference to the HTML button element | +| expanded | let | Yes | boolean | false | Set to `true` to toggle the expanded state | +| text | let | No | string | -- | Specify the text | +| icon | let | No | typeof import("carbon-icons-svelte").CarbonIcon | -- | Specify the icon from `carbon-icons-svelte` to render | ### Slots diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index ab8ee008..641e5d13 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -5621,7 +5621,7 @@ "reactive": false }, { - "name": "renderIcon", + "name": "icon", "kind": "let", "description": "Specify the icon from `carbon-icons-svelte` to render", "type": "typeof import(\"carbon-icons-svelte\").CarbonIcon", @@ -9828,8 +9828,8 @@ { "name": "icon", "kind": "let", - "description": "Specify the icon props", - "type": "{ render: import(\"carbon-icons-svelte\").CarbonIcon; skeleton: boolean; }", + "description": "Specify the icon from `carbon-icons-svelte` to render", + "type": "typeof import(\"carbon-icons-svelte\").CarbonIcon", "isFunction": false, "constant": false, "reactive": false @@ -9912,8 +9912,8 @@ { "name": "icon", "kind": "let", - "description": "Specify the icon props", - "type": "{ render: import(\"carbon-icons-svelte\").CarbonIcon; skeleton: boolean; }", + "description": "Specify the icon from `carbon-icons-svelte` to render", + "type": "typeof import(\"carbon-icons-svelte\").CarbonIcon", "isFunction": false, "constant": false, "reactive": false @@ -10230,8 +10230,8 @@ { "name": "icon", "kind": "let", - "description": "Specify the icon props", - "type": "{ render: import(\"carbon-icons-svelte\").CarbonIcon; skeleton: boolean; }", + "description": "Specify the icon from `carbon-icons-svelte` to render", + "type": "typeof import(\"carbon-icons-svelte\").CarbonIcon", "isFunction": false, "constant": false, "reactive": false @@ -10278,8 +10278,8 @@ { "name": "icon", "kind": "let", - "description": "Specify the icon props", - "type": "{ render: import(\"carbon-icons-svelte\").CarbonIcon; skeleton: boolean; }", + "description": "Specify the icon from `carbon-icons-svelte` to render", + "type": "typeof import(\"carbon-icons-svelte\").CarbonIcon", "isFunction": false, "constant": false, "reactive": false diff --git a/docs/src/pages/_layout.svelte b/docs/src/pages/_layout.svelte index 2726efa3..e2131aee 100644 --- a/docs/src/pages/_layout.svelte +++ b/docs/src/pages/_layout.svelte @@ -182,7 +182,7 @@ diff --git a/src/Notification/NotificationButton.svelte b/src/Notification/NotificationButton.svelte index 9c5983b6..cccd78a3 100644 --- a/src/Notification/NotificationButton.svelte +++ b/src/Notification/NotificationButton.svelte @@ -9,7 +9,7 @@ * Specify the icon from `carbon-icons-svelte` to render * @type {typeof import("carbon-icons-svelte").CarbonIcon} */ - export let renderIcon = Close20; + export let icon = Close20; /** * Specify the title of the icon @@ -36,7 +36,7 @@ on:mouseleave > diff --git a/src/UIShell/GlobalHeader/HeaderAction.svelte b/src/UIShell/GlobalHeader/HeaderAction.svelte index 37e6b2d7..34473322 100644 --- a/src/UIShell/GlobalHeader/HeaderAction.svelte +++ b/src/UIShell/GlobalHeader/HeaderAction.svelte @@ -7,8 +7,8 @@ export let isOpen = false; /** - * Specify the icon props - * @type {{ render: import("carbon-icons-svelte").CarbonIcon; skeleton: boolean; }} + * Specify the icon from `carbon-icons-svelte` to render + * @type {typeof import("carbon-icons-svelte").CarbonIcon} */ export let icon = undefined; @@ -31,9 +31,9 @@ import { createEventDispatcher } from "svelte"; import { slide } from "svelte/transition"; - import Close20 from "carbon-icons-svelte/lib/Close20"; - import AppSwitcher20 from "carbon-icons-svelte/lib/AppSwitcher20"; - import { Icon } from "../../Icon"; + import Close20 from "carbon-icons-svelte/lib/Close20/Close20.svelte"; + import AppSwitcher20 from "carbon-icons-svelte/lib/AppSwitcher20/AppSwitcher20.svelte"; + import Icon from "../../Icon/Icon.svelte"; const dispatch = createEventDispatcher(); @@ -79,7 +79,7 @@ dispatch(isOpen ? 'open' : 'close'); }}" > - + {#if text}{text}{/if} diff --git a/src/UIShell/GlobalHeader/HeaderActionLink.svelte b/src/UIShell/GlobalHeader/HeaderActionLink.svelte index 8c80210e..01cedbea 100644 --- a/src/UIShell/GlobalHeader/HeaderActionLink.svelte +++ b/src/UIShell/GlobalHeader/HeaderActionLink.svelte @@ -9,15 +9,15 @@ export let href = undefined; /** - * Specify the icon props - * @type {{ render: import("carbon-icons-svelte").CarbonIcon; skeleton: boolean; }} + * Specify the icon from `carbon-icons-svelte` to render + * @type {typeof import("carbon-icons-svelte").CarbonIcon} */ export let icon = undefined; /** Obtain a reference to the HTML anchor element */ export let ref = null; - import { Icon } from "../../Icon"; + import Icon from "../../Icon/Icon.svelte";