forked from carbon-design-system/carbon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tag/tooltip): cwc storybook controls (carbon-design-system#11381)
- Loading branch information
1 parent
46de741
commit 2f4c66d
Showing
9 changed files
with
189 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 0 additions & 94 deletions
94
web-components/packages/carbon-web-components/src/components/tag/tag-story.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
web-components/packages/carbon-web-components/src/components/tag/tag.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright IBM Corp. 2019, 2023 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import { html } from 'lit'; | ||
import { TAG_SIZE } from './tag'; | ||
import './index'; | ||
import storyDocs from './tag.mdx'; | ||
|
||
const sizes = { | ||
[`Medium size (${TAG_SIZE.MEDIUM})`]: TAG_SIZE.MEDIUM, | ||
[`Small size (${TAG_SIZE.SMALL})`]: TAG_SIZE.SMALL, | ||
}; | ||
|
||
const types = [ | ||
'red', | ||
'magenta', | ||
'purple', | ||
'blue', | ||
'cyan', | ||
'teal', | ||
'green', | ||
'gray', | ||
'cool-gray', | ||
'warm-gray', | ||
'high-contrast', | ||
'outline', | ||
]; | ||
|
||
const defaultArgs = { | ||
disabled: false, | ||
filter: false, | ||
title: 'Clear filter', | ||
size: TAG_SIZE.MEDIUM, | ||
}; | ||
|
||
const controls = { | ||
disabled: { | ||
control: 'boolean', | ||
description: 'Specify if the Tag is disabled', | ||
}, | ||
filter: { | ||
control: 'boolean', | ||
description: 'Determine if Tag is a filter/chip', | ||
}, | ||
size: { | ||
control: 'select', | ||
description: | ||
'Specify the size of the Tag. Currently supports either sm or "md" (default) sizes.', | ||
options: sizes, | ||
}, | ||
title: { | ||
control: 'text', | ||
description: 'Text to show on clear filters', | ||
}, | ||
type: { | ||
control: 'select', | ||
description: 'Specify the type of the Tag.', | ||
options: types, | ||
}, | ||
}; | ||
|
||
export const Default = { | ||
render: () => | ||
html`${types.map((e) => html`<cds-tag type="${e}">Tag content</cds-tag>`)}`, | ||
}; | ||
|
||
export const Playground = { | ||
argTypes: controls, | ||
args: defaultArgs, | ||
render: ({ filter, size, type, title, disabled }) => html` | ||
<cds-tag | ||
?filter="${filter}" | ||
size="${size}" | ||
type="${type}" | ||
title="${title}" | ||
?disabled="${disabled}"> | ||
Tag content | ||
</cds-tag> | ||
`, | ||
}; | ||
|
||
const meta = { | ||
title: 'Components/Tag', | ||
parameters: { | ||
docs: { | ||
page: storyDocs, | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.