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(icon-indicator): new component (carbon-design-system#18191)
* feat(icon-indicators): new component * fix(icon-indicator): styles * feat(react): add icon-indicator and more updates * feat(data-table): dyanmic with icon-indicators * fix(icon-indicator): review comment updates * fix(icon-indicator): web-components * chore(update): missing imports and unstable mdx * chore: generated style files * fix(custom-theme): remove for now * fix(snapshot): add styles * chore(update): api * fix(icon-indicator): add wc export * fix(icon-indicator): error to failed and information to informative * fix(icon-indicator): snapshots * fix(data-table): icon-indicator story * fix(data-table): icon-indicator story wc --------- Co-authored-by: Taylor Jones <[email protected]> Co-authored-by: Anna Wen <[email protected]> Co-authored-by: Nikhil Tomar <[email protected]>
- Loading branch information
1 parent
3c6ffa9
commit 03ec6cb
Showing
53 changed files
with
1,633 additions
and
19 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
e2e/components/IconIndicator/IconIndicator-test.avt.e2e.js
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,23 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 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. | ||
*/ | ||
|
||
'use strict'; | ||
import { expect, test } from '@playwright/test'; | ||
import { visitStory } from '../../test-utils/storybook'; | ||
|
||
test.describe('@avt IconIndicator', () => { | ||
test('@avt-default-state', async ({ page }) => { | ||
await visitStory(page, { | ||
component: 'IconIndicator', | ||
id: 'experimental-statusindicators-unstable-iconindicator--default', | ||
globals: { | ||
theme: 'white', | ||
}, | ||
}); | ||
await expect(page).toHaveNoACViolations('IconIndicator'); | ||
}); | ||
}); |
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,25 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 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. | ||
*/ | ||
|
||
'use strict'; | ||
const { test } = require('@playwright/test'); | ||
const { themes } = require('../../test-utils/env'); | ||
const { snapshotStory } = require('../../test-utils/storybook'); | ||
|
||
test.describe('IconIndicator', () => { | ||
themes.forEach((theme) => { | ||
test.describe(theme, () => { | ||
test('icon indicator @vrt', async ({ page }) => { | ||
await snapshotStory(page, { | ||
component: 'IconIndicator', | ||
id: 'experimental-statusindicators-unstable-iconindicator--default', | ||
theme, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
9 changes: 9 additions & 0 deletions
9
packages/carbon-components-react/scss/components/icon-indicator/_icon-indicator.scss
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,9 @@ | ||
// Code generated by carbon-components-react. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 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. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/icon-indicator/icon-indicator'; |
9 changes: 9 additions & 0 deletions
9
packages/carbon-components-react/scss/components/icon-indicator/_index.scss
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,9 @@ | ||
// Code generated by carbon-components-react. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 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. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/icon-indicator'; |
9 changes: 9 additions & 0 deletions
9
packages/carbon-components/scss/components/icon-indicator/_icon-indicator.scss
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,9 @@ | ||
// Code generated by carbon-components. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 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. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/icon-indicator/icon-indicator'; |
9 changes: 9 additions & 0 deletions
9
packages/carbon-components/scss/components/icon-indicator/_index.scss
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,9 @@ | ||
// Code generated by carbon-components. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 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. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/icon-indicator'; |
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
9 changes: 9 additions & 0 deletions
9
packages/react/scss/components/icon-indicator/_icon-indicator.scss
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,9 @@ | ||
// Code generated by @carbon/react. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 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. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/icon-indicator/icon-indicator'; |
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,9 @@ | ||
// Code generated by @carbon/react. DO NOT EDIT. | ||
// | ||
// Copyright IBM Corp. 2018, 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. | ||
// | ||
|
||
@forward '@carbon/styles/scss/components/icon-indicator'; |
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
58 changes: 58 additions & 0 deletions
58
packages/react/src/components/IconIndicator/IconIndicator.mdx
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,58 @@ | ||
import { ArgTypes, Meta } from '@storybook/blocks'; | ||
|
||
<Meta isTemplate /> | ||
|
||
# IconIndicator | ||
|
||
[Source code](https://github.com/carbon-design-system/carbon/tree/main/packages/react/src/components/IconIndicator) | ||
| ||
|
||
{/* <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> */} | ||
|
||
## Table of Contents | ||
|
||
- [Overview](#overview) | ||
- [Component API](#component-api) | ||
- [Feedback](#feedback) | ||
|
||
{/* <!-- END doctoc generated TOC please keep comment here to allow auto update --> */} | ||
|
||
## Overview | ||
|
||
The `IconIndicator` component is useful for communicating severity level | ||
information to users. The shapes and colors, communicate severity that enables | ||
users to quickly assess and identify status and respond accordingly. | ||
|
||
```jsx | ||
import { IconIndicator as unstable__IconIndicator } from '@carbon/react'; | ||
|
||
function ExampleComponent() { | ||
return ( | ||
<IconIndicator kind="failed" label="Failed"> | ||
); | ||
} | ||
``` | ||
|
||
## Kind | ||
|
||
Icon indicators can take the form of failed, caution major, caution minor, | ||
undefined, succeeded, normal, in-progressm incomplete, not started, pending, | ||
unknown, and informative. | ||
|
||
## Size | ||
|
||
Icon indicators have two size options 16 and 20. The default is 16. | ||
|
||
## Customizing the label | ||
|
||
You can set a string to customize the label of the Icon indicator. | ||
|
||
## Component API | ||
|
||
<ArgTypes /> | ||
|
||
## Feedback | ||
|
||
Help us improve this component by providing feedback, asking questions on Slack, | ||
or updating this file on | ||
[GitHub](https://github.com/carbon-design-system/carbon/edit/main/packages/react/src/components/IconIndicator/IconIndicator.mdx). |
73 changes: 73 additions & 0 deletions
73
packages/react/src/components/IconIndicator/IconIndicator.stories.js
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,73 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 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 React from 'react'; | ||
import IconIndicator from '.'; | ||
import { IconIndicatorKinds } from './index'; | ||
import mdx from './IconIndicator.mdx'; | ||
|
||
export default { | ||
title: 'Experimental/StatusIndicators/unstable__IconIndicator', | ||
component: IconIndicator, | ||
parameters: { | ||
docs: { | ||
page: mdx, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Default = () => { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'grid', | ||
gridTemplateColumns: 'auto auto', | ||
columnGap: '1rem', | ||
rowGap: '0.5rem', | ||
width: 'fit-content', | ||
}}> | ||
{IconIndicatorKinds.map((type) => ( | ||
<> | ||
<IconIndicator kind={type} label={type} /> | ||
<IconIndicator kind={type} label={type} size={20} /> | ||
</> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
const PlaygroundStory = (props) => { | ||
return <IconIndicator {...props} />; | ||
}; | ||
|
||
export const Playground = PlaygroundStory.bind({}); | ||
|
||
Playground.args = { | ||
label: 'Custom label', | ||
kind: 'failed', | ||
size: 16, | ||
}; | ||
|
||
Playground.argTypes = { | ||
label: { | ||
control: { | ||
type: 'text', | ||
}, | ||
}, | ||
kind: { | ||
control: { | ||
type: 'select', | ||
}, | ||
options: IconIndicatorKinds, | ||
}, | ||
size: { | ||
control: { | ||
type: 'select', | ||
}, | ||
options: [16, 20], | ||
}, | ||
}; |
Oops, something went wrong.