mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
feat(tag): support outline type
This commit is contained in:
parent
012d206e31
commit
7cc95e452b
6 changed files with 21 additions and 3 deletions
|
@ -4041,6 +4041,17 @@ None.
|
||||||
| title | <code>let</code> | No | <code>string</code> | <code>"Clear filter"</code> | Set the title for the close button in a filterable tag |
|
| title | <code>let</code> | No | <code>string</code> | <code>"Clear filter"</code> | Set the title for the close button in a filterable tag |
|
||||||
| icon | <code>let</code> | No | <code>typeof import("svelte").SvelteComponent</code> | -- | Specify the icon from `carbon-icons-svelte` to render |
|
| icon | <code>let</code> | No | <code>typeof import("svelte").SvelteComponent</code> | -- | Specify the icon from `carbon-icons-svelte` to render |
|
||||||
| id | <code>let</code> | No | <code>string</code> | <code>"ccs-" + Math.random().toString(36)</code> | Set an id for the filterable tag |
|
| id | <code>let</code> | No | <code>string</code> | <code>"ccs-" + Math.random().toString(36)</code> | Set an id for the filterable tag |
|
||||||
|
| Prop name | Kind | Reactive | Type | Default value | Description |
|
||||||
|
| :---------- | :--------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------- |
|
||||||
|
| type | <code>let</code> | No | <code>"red" | "magenta" | "purple" | "blue" | "cyan" | "teal" | "green" | "gray" | "cool-gray" | "warm-gray" | "high-contrast" | "outline"</code> | -- | Specify the type of tag |
|
||||||
|
| size | <code>let</code> | No | <code>"sm" | "default"</code> | <code>"default"</code> | -- |
|
||||||
|
| filter | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to use filterable variant |
|
||||||
|
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable a filterable tag |
|
||||||
|
| interactive | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to render a `button` element instead of a `div` |
|
||||||
|
| skeleton | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to display the skeleton state |
|
||||||
|
| title | <code>let</code> | No | <code>string</code> | <code>"Clear filter"</code> | Set the title for the close button in a filterable tag |
|
||||||
|
| icon | <code>let</code> | No | <code>typeof import("carbon-icons-svelte").CarbonIcon</code> | -- | Specify the icon from `carbon-icons-svelte` to render |
|
||||||
|
| id | <code>let</code> | No | <code>string</code> | <code>"ccs-" + Math.random().toString(36)</code> | Set an id for the filterable tag |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
|
|
@ -11037,7 +11037,7 @@
|
||||||
"name": "type",
|
"name": "type",
|
||||||
"kind": "let",
|
"kind": "let",
|
||||||
"description": "Specify the type of tag",
|
"description": "Specify the type of tag",
|
||||||
"type": "\"red\" | \"magenta\" | \"purple\" | \"blue\" | \"cyan\" | \"teal\" | \"green\" | \"gray\" | \"cool-gray\" | \"warm-gray\" | \"high-contrast\"",
|
"type": "\"red\" | \"magenta\" | \"purple\" | \"blue\" | \"cyan\" | \"teal\" | \"green\" | \"gray\" | \"cool-gray\" | \"warm-gray\" | \"high-contrast\" | \"outline\"",
|
||||||
"isFunction": false,
|
"isFunction": false,
|
||||||
"isFunctionDeclaration": false,
|
"isFunctionDeclaration": false,
|
||||||
"constant": false,
|
"constant": false,
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<Tag type="cool-gray">cool-gray</Tag>
|
<Tag type="cool-gray">cool-gray</Tag>
|
||||||
<Tag type="warm-gray">warm-gray</Tag>
|
<Tag type="warm-gray">warm-gray</Tag>
|
||||||
<Tag type="high-contrast">high-contrast</Tag>
|
<Tag type="high-contrast">high-contrast</Tag>
|
||||||
|
<Tag type="outline">outline</Tag>
|
||||||
|
|
||||||
### Filterable
|
### Filterable
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the type of tag
|
* Specify the type of tag
|
||||||
* @type {"red" | "magenta" | "purple" | "blue" | "cyan" | "teal" | "green" | "gray" | "cool-gray" | "warm-gray" | "high-contrast"}
|
* @type {"red" | "magenta" | "purple" | "blue" | "cyan" | "teal" | "green" | "gray" | "cool-gray" | "warm-gray" | "high-contrast" | "outline"}
|
||||||
*/
|
*/
|
||||||
export let type = undefined;
|
export let type = undefined;
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@
|
||||||
class:bx--tag--cool-gray="{type === 'cool-gray'}"
|
class:bx--tag--cool-gray="{type === 'cool-gray'}"
|
||||||
class:bx--tag--warm-gray="{type === 'warm-gray'}"
|
class:bx--tag--warm-gray="{type === 'warm-gray'}"
|
||||||
class:bx--tag--high-contrast="{type === 'high-contrast'}"
|
class:bx--tag--high-contrast="{type === 'high-contrast'}"
|
||||||
|
class:bx--tag--outline="{type === 'outline'}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
>
|
>
|
||||||
<slot props="{{ class: 'bx--tag__label' }}">
|
<slot props="{{ class: 'bx--tag__label' }}">
|
||||||
|
@ -112,6 +113,7 @@
|
||||||
class:bx--tag--cool-gray="{type === 'cool-gray'}"
|
class:bx--tag--cool-gray="{type === 'cool-gray'}"
|
||||||
class:bx--tag--warm-gray="{type === 'warm-gray'}"
|
class:bx--tag--warm-gray="{type === 'warm-gray'}"
|
||||||
class:bx--tag--high-contrast="{type === 'high-contrast'}"
|
class:bx--tag--high-contrast="{type === 'high-contrast'}"
|
||||||
|
class:bx--tag--outline="{type === 'outline'}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
|
@ -144,6 +146,7 @@
|
||||||
class:bx--tag--cool-gray="{type === 'cool-gray'}"
|
class:bx--tag--cool-gray="{type === 'cool-gray'}"
|
||||||
class:bx--tag--warm-gray="{type === 'warm-gray'}"
|
class:bx--tag--warm-gray="{type === 'warm-gray'}"
|
||||||
class:bx--tag--high-contrast="{type === 'high-contrast'}"
|
class:bx--tag--high-contrast="{type === 'high-contrast'}"
|
||||||
|
class:bx--tag--outline="{type === 'outline'}"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
on:click
|
on:click
|
||||||
on:mouseover
|
on:mouseover
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
<Tag type="high-contrast">high-contrast</Tag>
|
<Tag type="high-contrast">high-contrast</Tag>
|
||||||
|
|
||||||
|
<Tag type="outline">outline</Tag>
|
||||||
|
|
||||||
<Tag filter on:click on:close>Filterable</Tag>
|
<Tag filter on:click on:close>Filterable</Tag>
|
||||||
|
|
||||||
<Tag icon="{Add16}">Custom icon</Tag>
|
<Tag icon="{Add16}">Custom icon</Tag>
|
||||||
|
|
3
types/Tag/Tag.d.ts
vendored
3
types/Tag/Tag.d.ts
vendored
|
@ -18,7 +18,8 @@ export interface TagProps
|
||||||
| "gray"
|
| "gray"
|
||||||
| "cool-gray"
|
| "cool-gray"
|
||||||
| "warm-gray"
|
| "warm-gray"
|
||||||
| "high-contrast";
|
| "high-contrast"
|
||||||
|
| "outline";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @default "default"
|
* @default "default"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue