This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[terra-icon] accessibility upgrade (#3598)
- Loading branch information
Showing
557 changed files
with
7,714 additions
and
866 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: 47 additions & 47 deletions
94
packages/terra-core-docs/src/terra-dev-site/doc/icon/example/IconStatic.jsx
Large diffs are not rendered by default.
Oops, something went wrong.
455 changes: 228 additions & 227 deletions
455
packages/terra-core-docs/src/terra-dev-site/doc/icon/example/IconThemeable.jsx
Large diffs are not rendered by default.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
packages/terra-core-docs/src/terra-dev-site/test/icon/IconAccessibleLabel.test.jsx
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,19 @@ | ||
import React from 'react'; | ||
import IconAlert from 'terra-icon/lib/icon/IconAlert'; | ||
import IconAlertDecorative from 'terra-icon/lib/icon/decorative/IconAlert'; | ||
|
||
const IconAccessibleLabel = () => ( | ||
<div> | ||
<h3>Meaningful icon</h3> | ||
<div> | ||
<IconAlert a11yLabel="alert icon"/> | ||
</div> | ||
|
||
<h3>Decorative icon</h3> | ||
<div> | ||
<IconAlertDecorative a11yLabel="alert icon"/> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default IconAccessibleLabel; |
2 changes: 1 addition & 1 deletion
2
packages/terra-core-docs/src/terra-dev-site/test/icon/IconAll.module.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
:local { | ||
.icon { | ||
height: 40px; | ||
margin: 5px; | ||
width: 40px; | ||
margin: 5px; | ||
} | ||
|
||
.icon-inverse { | ||
|
627 changes: 310 additions & 317 deletions
627
packages/terra-core-docs/src/terra-dev-site/test/icon/IconAll.test.jsx
Large diffs are not rendered by default.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
packages/terra-core-docs/src/terra-dev-site/test/icon/IconAriaLabel.test.jsx
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
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
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
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 |
---|---|---|
@@ -1 +1,26 @@ | ||
Each script has its own readme. Instructions on when and how to use these scripts are in the [terra-icons readme](../../README.md). | ||
# Update all SVG icons | ||
|
||
### Step 1. Initate scripts | ||
|
||
npm run compilescripts | ||
|
||
### Step 2. (Optional) Migrate icons from a csv file | ||
You can skip this step if you're not updating the svg files in `packages/terra-icon/src/svg`. | ||
|
||
npm run migrate-csv | ||
npm run migrate-svg | ||
|
||
### Step 3. Generate icons based | ||
This will generate icons based on the files in `packages/terra-icon/src/svg`, whether they are newly migrated or pre-existing. | ||
|
||
npm run generate-all-icons | ||
|
||
Meaningful icons will be generated in `packages/terra-icon/src/icon`, directly in the folder. | ||
Decorative icons will be generated in `packages/terra-icon/src/icon/decorative`. | ||
|
||
|
||
### Alternative run all steps command | ||
|
||
Alternatively, if you need to run steps 1, 2 and 3, then you can execute them all with a single command: | ||
|
||
npm run migrate-cerner-one-icons |
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
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
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,81 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import classNamesBind from 'classnames/bind'; | ||
|
||
// eslint-disable-next-line import/no-unresolved, import/no-webpack-loader-syntax | ||
import styles from './Icon.module.scss'; | ||
|
||
const cx = classNamesBind.bind(styles); | ||
|
||
const propTypes = { | ||
/** | ||
* Should the svg mirror when dir="rtl". | ||
*/ | ||
isBidi: PropTypes.bool, | ||
/** | ||
* Should the SVG rotate. | ||
*/ | ||
isSpin: PropTypes.bool, | ||
/** | ||
* Child nodes. | ||
*/ | ||
children: PropTypes.node, | ||
/** | ||
* Height of SVG. | ||
*/ | ||
height: PropTypes.string, | ||
/** | ||
* Width of SVG. | ||
*/ | ||
width: PropTypes.string, | ||
/** | ||
* Focusable attribute. IE 10/11 are focusable without this attribute. | ||
*/ | ||
focusable: PropTypes.string, | ||
}; | ||
|
||
const defaultProps = { | ||
isBidi: false, | ||
isSpin: false, | ||
children: null, | ||
height: '1em', | ||
width: '1em', | ||
focusable: 'false', | ||
}; | ||
|
||
const IconBase = ({ | ||
isBidi, | ||
isSpin, | ||
children, | ||
height, | ||
width, | ||
title, | ||
focusable, | ||
...customProps | ||
}) => { | ||
const attributes = { ...customProps }; | ||
|
||
// append to existing classNames | ||
const classes = classNames( | ||
cx( | ||
'tui-Icon', | ||
'icon', | ||
{ 'is-bidi': isBidi }, | ||
{ 'is-spin': isSpin }, | ||
), | ||
attributes.className, | ||
); | ||
|
||
attributes.height = height; | ||
attributes.width = width; | ||
attributes.focusable = focusable; | ||
attributes.role = 'presentation'; | ||
|
||
return <svg {...attributes} className={classes}>{children}</svg>; | ||
}; | ||
|
||
IconBase.propTypes = propTypes; | ||
IconBase.defaultProps = defaultProps; | ||
|
||
export default IconBase; |
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.