Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(website): Add text color token accessibility rating to the token…
… page (#28) * feat(website): add accessibility rating for text color tokens * feat(website): fix up the color rating test * fix(website): color combos test prettier * feat(screen-reader-only): create a SRO component * fix: update the component category in package.json * fix: \correct the tokens that are being displayed * fix: remove importants and update license field * fix: eslint of jest test promises
- Loading branch information
Showing
21 changed files
with
3,405 additions
and
59 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
packages/paste-core/utilities/screen-reader-only/package.json
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,41 @@ | ||
{ | ||
"name": "@twilio-paste/screen-reader-only", | ||
"version": "0.0.0", | ||
"category": "typography", | ||
"status": "alpha", | ||
"description": "", | ||
"author": "Twilio Inc.", | ||
"license": "MIT", | ||
"main:dev": "src/index.tsx", | ||
"main": "dist/index.js", | ||
"module": "dist/index.es.js", | ||
"types": "dist/index.d.ts", | ||
"sideEffects": false, | ||
"files": [ | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "yarn clean && yarn compile", | ||
"build:dev": "yarn clean && yarn compile:dev", | ||
"clean": "rm -rf ./dist && rm -rf tsconfig.build.tsbuildinfo && rm -rf .rpt2_cache", | ||
"compile": "rollup -c --environment NODE_ENV:production", | ||
"compile:dev": "rollup -c --environment NODE_ENV:development", | ||
"prepublishOnly": "yarn build", | ||
"type-check": "tsc --noEmit" | ||
}, | ||
"peerDependencies": { | ||
"@emotion/styled": "^10.0.10", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
"styled-system": "^4.1.0" | ||
}, | ||
"devDependencies": { | ||
"rollup": "^1.16.2", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.0.1", | ||
"rollup-plugin-node-resolve": "^5.1.0", | ||
"rollup-plugin-terser": "^5.0.0", | ||
"rollup-plugin-typescript2": "^0.21.2", | ||
"typescript": "^3.5.2" | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/paste-core/utilities/screen-reader-only/rollup.config.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,34 @@ | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import babel from 'rollup-plugin-babel'; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
import {terser} from 'rollup-plugin-terser'; | ||
import pkg from './package.json'; | ||
|
||
export default { | ||
input: pkg['main:dev'], | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
format: 'cjs', | ||
}, | ||
{ | ||
file: pkg.module, | ||
format: 'es', | ||
}, | ||
], | ||
external: [...Object.keys(pkg.peerDependencies || {})], | ||
plugins: [ | ||
resolve(), | ||
commonjs(), | ||
typescript({ | ||
clean: true, | ||
typescript: require('typescript'), | ||
tsconfig: './tsconfig.build.json', | ||
}), | ||
babel({ | ||
exclude: 'node_modules/**', | ||
}), | ||
process.env.NODE_ENV === 'production' ? terser() : null, | ||
], | ||
}; |
14 changes: 14 additions & 0 deletions
14
packages/paste-core/utilities/screen-reader-only/src/index.tsx
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,14 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
export const ScreenReaderOnly = styled.span<{}>` | ||
position: absolute; | ||
margin: -1px; | ||
border: 0; | ||
padding: 0; | ||
width: 1px; | ||
height: 1px; | ||
overflow: hidden; | ||
clip: rect(0 0 0 0); | ||
text-transform: none; | ||
white-space: nowrap; | ||
`; |
15 changes: 15 additions & 0 deletions
15
packages/paste-core/utilities/screen-reader-only/stories/index.stories.tsx
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,15 @@ | ||
import * as React from 'react'; | ||
import {storiesOf} from '@storybook/react'; | ||
import {withKnobs} from '@storybook/addon-knobs'; | ||
import {Text} from '@twilio-paste/text'; | ||
import {ScreenReaderOnly} from '../src'; | ||
|
||
storiesOf('Utilities|Screen reader only', module) | ||
.addDecorator(withKnobs) | ||
.add('Default', () => { | ||
return ( | ||
<Text> | ||
Some visible text <ScreenReaderOnly>some not visible text</ScreenReaderOnly> | ||
</Text> | ||
); | ||
}); |
15 changes: 15 additions & 0 deletions
15
packages/paste-core/utilities/screen-reader-only/tsconfig.build.json
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,15 @@ | ||
{ | ||
"extends": "../../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"rootDir": "./src" | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
], | ||
"references": [ | ||
{ | ||
"path": "../../../paste-theme-tokens" | ||
} | ||
] | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/paste-core/utilities/screen-reader-only/tsconfig.json
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,4 @@ | ||
{ | ||
"extends": "../../../../tsconfig.json", | ||
"include": ["src/**/*"] | ||
} |
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,3 +1,2 @@ | ||
declare module 'gulp-theo'; | ||
declare module 'gulp-restart'; | ||
declare module 'color'; |
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
Oops, something went wrong.