chore: v11 ContentSwitcher

For better compatibility with existing code bases size `xl` is still supported.
This commit is contained in:
Gregor Wassmann 2023-03-27 14:40:54 +02:00 committed by Enrico Sacchetti
commit ee32859ba2
No known key found for this signature in database
GPG key ID: 3374B89ECA60D796
6 changed files with 11 additions and 11 deletions

View file

@ -757,9 +757,9 @@ None.
### Props ### Props
| Prop name | Required | Kind | Reactive | Type | Default value | Description | | Prop name | Required | Kind | Reactive | Type | Default value | Description |
| :------------ | :------- | :--------------- | :------- | ----------------------------- | ---------------------- | ----------------------------------------- | | :------------ | :------- | :--------------- | :------- | ------------------------------ | ---------------------- | ----------------------------------------- |
| selectedIndex | No | <code>let</code> | Yes | <code>number</code> | <code>0</code> | Set the selected index of the switch item | | selectedIndex | No | <code>let</code> | Yes | <code>number</code> | <code>0</code> | Set the selected index of the switch item |
| size | No | <code>let</code> | No | <code>"sm" &#124; "xl"</code> | <code>undefined</code> | Specify the size of the content switcher | | size | No | <code>let</code> | No | <code>"sm" &#124; "lg" </code> | <code>undefined</code> | Specify the size of the content switcher |
### Slots ### Slots

View file

@ -1935,7 +1935,7 @@
"name": "size", "name": "size",
"kind": "let", "kind": "let",
"description": "Specify the size of the content switcher", "description": "Specify the size of the content switcher",
"type": "\"sm\" | \"xl\"", "type": "\"sm\" | \"lg\" ",
"isFunction": false, "isFunction": false,
"isFunctionDeclaration": false, "isFunctionDeclaration": false,
"isRequired": false, "isRequired": false,

View file

@ -43,9 +43,9 @@ components: ["ContentSwitcher", "Switch"]
</Switch> </Switch>
</ContentSwitcher> </ContentSwitcher>
## Extra-large size ## Large size
<ContentSwitcher size="xl"> <ContentSwitcher size="lg">
<Switch text="All" /> <Switch text="All" />
<Switch text="Archived" /> <Switch text="Archived" />
</ContentSwitcher> </ContentSwitcher>

View file

@ -8,7 +8,7 @@
/** /**
* Specify the size of the content switcher * Specify the size of the content switcher
* @type {"sm" | "xl"} * @type {"sm" | "lg" }
*/ */
export let size = undefined; export let size = undefined;
@ -63,7 +63,7 @@
role="tablist" role="tablist"
class:bx--content-switcher="{true}" class:bx--content-switcher="{true}"
class:bx--content-switcher--sm="{size === 'sm'}" class:bx--content-switcher--sm="{size === 'sm'}"
class:bx--content-switcher--xl="{size === 'xl'}" class:bx--content-switcher--lg="{size === 'lg' || size === 'xl'}"
{...$$restProps} {...$$restProps}
on:click on:click
on:mouseover on:mouseover

View file

@ -3,7 +3,7 @@
import Analytics from "carbon-icons-svelte/lib/Analytics.svelte"; import Analytics from "carbon-icons-svelte/lib/Analytics.svelte";
</script> </script>
<ContentSwitcher size="xl" selectedIndex="{1}"> <ContentSwitcher size="lg" selectedIndex="{1}">
<Switch disabled text="Latest news" /> <Switch disabled text="Latest news" />
<Switch text="Trending" /> <Switch text="Trending" />
<Switch> <Switch>

View file

@ -14,7 +14,7 @@ export interface ContentSwitcherProps extends RestProps {
* Specify the size of the content switcher * Specify the size of the content switcher
* @default undefined * @default undefined
*/ */
size?: "sm" | "xl"; size?: "sm" | "lg";
[key: `data-${string}`]: any; [key: `data-${string}`]: any;
} }