refactor(content-switcher): use class name directive

This commit is contained in:
Eric Liu 2020-12-05 15:15:12 -08:00
commit 3d5eed849c
5 changed files with 12 additions and 11 deletions

View file

@ -3320,13 +3320,13 @@ None.
### Props
| Prop name | Kind | Reactive | Type | Default value | Description |
| :-------- | :--------------- | :------- | :----------------------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| ref | <code>let</code> | Yes | <code>null &#124; HTMLButtonElement</code> | <code>null</code> | Obtain a reference to the button HTML element |
| selected | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` for the switch to be selected |
| text | <code>let</code> | No | <code>string</code> | <code>"Provide text"</code> | Specify the switch text<br />Alternatively, use the named slot "text" (e.g., &lt;span slot="text"&gt;...&lt;/span&gt;) |
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the switch |
| id | <code>let</code> | No | <code>string</code> | <code>"ccs-" + Math.random().toString(36)</code> | Set an id for the button element |
| Prop name | Kind | Reactive | Type | Default value | Description |
| :-------- | :--------------- | :------- | :----------------------------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| ref | <code>let</code> | Yes | <code>null &#124; HTMLButtonElement</code> | <code>null</code> | Obtain a reference to the button HTML element |
| selected | <code>let</code> | Yes | <code>boolean</code> | <code>false</code> | Set to `true` for the switch to be selected |
| text | <code>let</code> | No | <code>string</code> | <code>"Provide text"</code> | Specify the switch text<br />Alternatively, use the "text" slot (e.g., &lt;span slot="text"&gt;...&lt;/span&gt;) |
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the switch |
| id | <code>let</code> | No | <code>string</code> | <code>"ccs-" + Math.random().toString(36)</code> | Set an id for the button element |
### Slots

View file

@ -911,7 +911,7 @@
{
"name": "text",
"kind": "let",
"description": "Specify the switch text\nAlternatively, use the named slot \"text\" (e.g., <span slot=\"text\">...</span>)",
"description": "Specify the switch text\nAlternatively, use the \"text\" slot (e.g., <span slot=\"text\">...</span>)",
"type": "string",
"value": "\"Provide text\"",
"isFunction": false,

View file

@ -64,8 +64,9 @@
role="tablist"
class:bx--content-switcher="{true}"
class:bx--content-switcher--light="{light}"
class:bx--content-switcher--sm="{size === 'sm'}"
class:bx--content-switcher--xl="{size === 'xl'}"
{...$$restProps}
class="{size && `bx--content-switcher--${size}`} {$$restProps.class}"
on:click
on:mouseover
on:mouseenter

View file

@ -1,7 +1,7 @@
<script>
/**
* Specify the switch text
* Alternatively, use the named slot "text" (e.g., <span slot="text">...</span>)
* Alternatively, use the "text" slot (e.g., <span slot="text">...</span>)
*/
export let text = "Provide text";

View file

@ -3,7 +3,7 @@
export interface SwitchProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["button"]> {
/**
* Specify the switch text
* Alternatively, use the named slot "text" (e.g., <span slot="text">...</span>)
* Alternatively, use the "text" slot (e.g., <span slot="text">...</span>)
* @default "Provide text"
*/
text?: string;