├── lib ├── components │ ├── Form.jsx │ ├── Button.jsx │ ├── DateField.jsx │ ├── Footer.jsx │ ├── Image.jsx │ ├── Legend.jsx │ ├── NameForm.jsx │ ├── TextField.jsx │ ├── ToolTip.jsx │ ├── AddressForm.jsx │ ├── PasswordField.jsx │ ├── SignInForm.jsx │ ├── PasswordResetForm.jsx │ ├── SecondaryButton.jsx │ ├── InputLabel.jsx │ ├── Link.jsx │ ├── Label.jsx │ ├── FieldSet.jsx │ ├── NavigationBar.jsx │ ├── Alert.jsx │ ├── Header.jsx │ ├── Radio.jsx │ ├── Checkbox.jsx │ ├── SearchField.jsx │ ├── PrimaryButton.jsx │ ├── Grid.jsx │ ├── Sidebar.jsx │ ├── Dropdown.jsx │ ├── OfficialSiteBanner.jsx │ ├── Tables.jsx │ └── TextArea.jsx ├── styles │ ├── core │ │ ├── _fonts.scss │ │ ├── _base.scss │ │ ├── _grid.scss │ │ └── _utilities.scss │ ├── components │ │ ├── Sidebar.scss │ │ ├── Alerts.scss │ │ ├── SearchField.scss │ │ ├── Accordion.scss │ │ └── OfficialSiteBanner.scss │ ├── elements │ │ ├── _labels.scss │ │ ├── _list.scss │ │ ├── _tables.scss │ │ └── _buttons.scss │ ├── fonts │ │ ├── _merriweather.scss │ │ └── _source-sans-pro.scss │ ├── uswds.scss │ └── fixes │ │ └── fixes.scss ├── helpers │ └── utilities.js └── utils │ └── validators.js ├── .eslintignore ├── .gitignore ├── .env ├── .babelrc ├── assets ├── images │ ├── close.png │ ├── hero.png │ ├── minus.png │ ├── plus.png │ ├── correct8.png │ ├── correct9.png │ ├── logo-img.png │ ├── plus-alt.png │ ├── search.png │ ├── arrow-down.png │ ├── circle-124.png │ ├── minus-alt.png │ ├── search-alt.png │ ├── alerts │ │ ├── error.png │ │ ├── info.png │ │ ├── success.png │ │ ├── warning.png │ │ ├── success.svg │ │ ├── warning.svg │ │ ├── error.svg │ │ └── info.svg │ ├── arrow-right.png │ ├── external-link.png │ ├── us_flag_small.png │ ├── angle-arrow-down.png │ ├── external-link-alt.png │ ├── favicons │ │ ├── favicon.ico │ │ ├── favicon.png │ │ ├── favicon-114.png │ │ ├── favicon-144.png │ │ ├── favicon-16.png │ │ ├── favicon-192.png │ │ ├── favicon-40.png │ │ ├── favicon-57.png │ │ └── favicon-72.png │ ├── external-link-hover.png │ ├── angle-arrow-down-hover.png │ ├── angle-arrow-up-primary.png │ ├── external-link-alt-hover.png │ ├── social-icons │ │ ├── png │ │ │ ├── rss25.png │ │ │ ├── facebook25.png │ │ │ ├── twitter16.png │ │ │ └── youtube15.png │ │ └── svg │ │ │ ├── facebook25.svg │ │ │ ├── twitter16.svg │ │ │ ├── rss25.svg │ │ │ └── youtube15.svg │ ├── angle-arrow-down-primary.png │ ├── angle-arrow-up-primary-hover.png │ ├── angle-arrow-down-primary-hover.png │ ├── arrow-down.svg │ ├── minus.svg │ ├── minus-alt.svg │ ├── icon-https.svg │ ├── correct8.svg │ ├── correct9.svg │ ├── angle-arrow-down.svg │ ├── angle-arrow-down-hover.svg │ ├── angle-arrow-down-primary.svg │ ├── angle-arrow-up-primary.svg │ ├── angle-arrow-down-primary-hover.svg │ ├── angle-arrow-up-primary-hover.svg │ ├── arrow-right.svg │ ├── icon-dot-gov.svg │ ├── plus.svg │ ├── plus-alt.svg │ ├── close.svg │ ├── search.svg │ ├── search-alt.svg │ ├── external-link.svg │ ├── external-link-alt.svg │ ├── external-link-hover.svg │ └── external-link-alt-hover.svg └── fonts │ ├── merriweather-bold-webfont.eot │ ├── merriweather-bold-webfont.ttf │ ├── merriweather-bold-webfont.woff │ ├── merriweather-light-webfont.eot │ ├── merriweather-light-webfont.ttf │ ├── sourcesanspro-bold-webfont.eot │ ├── sourcesanspro-bold-webfont.ttf │ ├── merriweather-bold-webfont.woff2 │ ├── merriweather-italic-webfont.eot │ ├── merriweather-italic-webfont.ttf │ ├── merriweather-italic-webfont.woff │ ├── merriweather-italic-webfont.woff2 │ ├── merriweather-light-webfont.woff │ ├── merriweather-light-webfont.woff2 │ ├── merriweather-regular-webfont.eot │ ├── merriweather-regular-webfont.ttf │ ├── merriweather-regular-webfont.woff │ ├── sourcesanspro-bold-webfont.woff │ ├── sourcesanspro-bold-webfont.woff2 │ ├── sourcesanspro-italic-webfont.eot │ ├── sourcesanspro-italic-webfont.ttf │ ├── sourcesanspro-italic-webfont.woff │ ├── sourcesanspro-light-webfont.eot │ ├── sourcesanspro-light-webfont.ttf │ ├── sourcesanspro-light-webfont.woff │ ├── sourcesanspro-light-webfont.woff2 │ ├── sourcesanspro-regular-webfont.eot │ ├── sourcesanspro-regular-webfont.ttf │ ├── merriweather-regular-webfont.woff2 │ ├── sourcesanspro-italic-webfont.woff2 │ ├── sourcesanspro-regular-webfont.woff │ └── sourcesanspro-regular-webfont.woff2 ├── server ├── index.js └── views │ └── index.ejs ├── styleguide ├── reducers │ └── root.js ├── app.jsx ├── store │ └── configureStore.js ├── containers │ ├── LabelsContainer.jsx │ ├── ColorsContainer.jsx │ ├── FootersContainer.jsx │ ├── HeadersContainer.jsx │ ├── OverviewContainer.jsx │ ├── TypographyContainer.jsx │ ├── SidebarContainer.jsx │ ├── FormTemplatesContainer.jsx │ ├── AccessibilityContainer.jsx │ ├── Docs.jsx │ ├── SearchBarContainer.jsx │ ├── App.jsx │ └── ButtonsContainer.jsx └── routes │ └── routes.jsx ├── .editorconfig ├── styles ├── main.scss ├── _github-gist.scss └── _docs.scss ├── support ├── webpack.server.js └── webpack.config.js ├── LICENSE ├── __tests__ └── lib │ └── components │ ├── FieldSet-test.js │ ├── InputLabel-test.js │ ├── Label-test.js │ ├── TextArea-test.js │ ├── TextInput-test.js │ ├── PrimaryButton-test.js │ ├── Alert-test.js │ ├── Grid-test.js │ ├── Tabels-test.js │ ├── Radio-test.js │ ├── Checkbox-test.js │ └── Dropdown-test.js ├── .eslintrc ├── gulpfile.js ├── README.md └── package.json /lib/components/Form.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/Button.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/DateField.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/Footer.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/Image.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/Legend.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/NameForm.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/TextField.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/ToolTip.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/AddressForm.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/PasswordField.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/SignInForm.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/PasswordResetForm.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/SecondaryButton.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | dist/* 2 | gulpfile.js 3 | coverage 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | *.log 4 | coverage/ 5 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | NODE_ENV=development 2 | API_BASE_URL=http://localhost:3000 3 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "es2015", 4 | "react", 5 | "stage-0" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /assets/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/close.png -------------------------------------------------------------------------------- /assets/images/hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/hero.png -------------------------------------------------------------------------------- /assets/images/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/minus.png -------------------------------------------------------------------------------- /assets/images/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/plus.png -------------------------------------------------------------------------------- /assets/images/correct8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/correct8.png -------------------------------------------------------------------------------- /assets/images/correct9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/correct9.png -------------------------------------------------------------------------------- /assets/images/logo-img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/logo-img.png -------------------------------------------------------------------------------- /assets/images/plus-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/plus-alt.png -------------------------------------------------------------------------------- /assets/images/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/search.png -------------------------------------------------------------------------------- /lib/styles/core/_fonts.scss: -------------------------------------------------------------------------------- 1 | @import "../fonts/merriweather"; 2 | @import "../fonts/source-sans-pro"; 3 | -------------------------------------------------------------------------------- /assets/images/arrow-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/arrow-down.png -------------------------------------------------------------------------------- /assets/images/circle-124.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/circle-124.png -------------------------------------------------------------------------------- /assets/images/minus-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/minus-alt.png -------------------------------------------------------------------------------- /assets/images/search-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/search-alt.png -------------------------------------------------------------------------------- /assets/images/alerts/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/alerts/error.png -------------------------------------------------------------------------------- /assets/images/alerts/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/alerts/info.png -------------------------------------------------------------------------------- /assets/images/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/arrow-right.png -------------------------------------------------------------------------------- /assets/images/external-link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/external-link.png -------------------------------------------------------------------------------- /assets/images/us_flag_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/us_flag_small.png -------------------------------------------------------------------------------- /assets/images/alerts/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/alerts/success.png -------------------------------------------------------------------------------- /assets/images/alerts/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/alerts/warning.png -------------------------------------------------------------------------------- /assets/images/angle-arrow-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/angle-arrow-down.png -------------------------------------------------------------------------------- /assets/images/external-link-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/external-link-alt.png -------------------------------------------------------------------------------- /assets/images/favicons/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon.ico -------------------------------------------------------------------------------- /assets/images/favicons/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon.png -------------------------------------------------------------------------------- /assets/images/external-link-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/external-link-hover.png -------------------------------------------------------------------------------- /assets/images/favicons/favicon-114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon-114.png -------------------------------------------------------------------------------- /assets/images/favicons/favicon-144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon-144.png -------------------------------------------------------------------------------- /assets/images/favicons/favicon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon-16.png -------------------------------------------------------------------------------- /assets/images/favicons/favicon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon-192.png -------------------------------------------------------------------------------- /assets/images/favicons/favicon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon-40.png -------------------------------------------------------------------------------- /assets/images/favicons/favicon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon-57.png -------------------------------------------------------------------------------- /assets/images/favicons/favicon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/favicons/favicon-72.png -------------------------------------------------------------------------------- /assets/images/angle-arrow-down-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/angle-arrow-down-hover.png -------------------------------------------------------------------------------- /assets/images/angle-arrow-up-primary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/angle-arrow-up-primary.png -------------------------------------------------------------------------------- /assets/images/external-link-alt-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/external-link-alt-hover.png -------------------------------------------------------------------------------- /assets/images/social-icons/png/rss25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/social-icons/png/rss25.png -------------------------------------------------------------------------------- /assets/fonts/merriweather-bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-bold-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/merriweather-bold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-bold-webfont.ttf -------------------------------------------------------------------------------- /assets/fonts/merriweather-bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-bold-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/merriweather-light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-light-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/merriweather-light-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-light-webfont.ttf -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-bold-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-bold-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-bold-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-bold-webfont.ttf -------------------------------------------------------------------------------- /assets/images/angle-arrow-down-primary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/angle-arrow-down-primary.png -------------------------------------------------------------------------------- /assets/fonts/merriweather-bold-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-bold-webfont.woff2 -------------------------------------------------------------------------------- /assets/fonts/merriweather-italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-italic-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/merriweather-italic-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-italic-webfont.ttf -------------------------------------------------------------------------------- /assets/fonts/merriweather-italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-italic-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/merriweather-italic-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-italic-webfont.woff2 -------------------------------------------------------------------------------- /assets/fonts/merriweather-light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-light-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/merriweather-light-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-light-webfont.woff2 -------------------------------------------------------------------------------- /assets/fonts/merriweather-regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-regular-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/merriweather-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-regular-webfont.ttf -------------------------------------------------------------------------------- /assets/fonts/merriweather-regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-regular-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-bold-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-bold-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-bold-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-bold-webfont.woff2 -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-italic-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-italic-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-italic-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-italic-webfont.ttf -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-italic-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-italic-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-light-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-light-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-light-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-light-webfont.ttf -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-light-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-light-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-light-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-light-webfont.woff2 -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-regular-webfont.eot -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-regular-webfont.ttf -------------------------------------------------------------------------------- /assets/images/angle-arrow-up-primary-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/angle-arrow-up-primary-hover.png -------------------------------------------------------------------------------- /assets/images/social-icons/png/facebook25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/social-icons/png/facebook25.png -------------------------------------------------------------------------------- /assets/images/social-icons/png/twitter16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/social-icons/png/twitter16.png -------------------------------------------------------------------------------- /assets/images/social-icons/png/youtube15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/social-icons/png/youtube15.png -------------------------------------------------------------------------------- /assets/fonts/merriweather-regular-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/merriweather-regular-webfont.woff2 -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-italic-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-italic-webfont.woff2 -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-regular-webfont.woff -------------------------------------------------------------------------------- /assets/fonts/sourcesanspro-regular-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/fonts/sourcesanspro-regular-webfont.woff2 -------------------------------------------------------------------------------- /assets/images/angle-arrow-down-primary-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/n8mellis/uswds-react/HEAD/assets/images/angle-arrow-down-primary-hover.png -------------------------------------------------------------------------------- /server/index.js: -------------------------------------------------------------------------------- 1 | if (process.env.NODE_ENV !== "production") { 2 | require("dotenv").config(); 3 | } 4 | require("babel-register"); 5 | require("./server.jsx"); 6 | -------------------------------------------------------------------------------- /lib/styles/components/Sidebar.scss: -------------------------------------------------------------------------------- 1 | 2 | .usa-sidenav-list { 3 | @include usa-sidenav-list; 4 | } 5 | 6 | .usa-sidenav-sub_list { 7 | @include usa-sidenav-sublist; 8 | display: none; 9 | } 10 | 11 | .usa-current ~ .usa-sidenav-sub_list { 12 | display: block; 13 | } 14 | -------------------------------------------------------------------------------- /styleguide/reducers/root.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from 'redux'; 2 | 3 | // eslint-disable-next-line no-unused-vars 4 | let tmpReducer = function(state={}, action) { return state; }; 5 | 6 | const rootReducer = combineReducers({ 7 | tmpReducer 8 | }); 9 | 10 | export default rootReducer; 11 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # js, jsx, json 12 | [*.{js,jsx,json}] 13 | charset = utf-8 14 | indent_style = space 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /styles/main.scss: -------------------------------------------------------------------------------- 1 | @import "../lib/styles/uswds"; 2 | @import "styleguide"; 3 | @import "docs"; 4 | @import "github-gist"; 5 | 6 | // ----------------------------------------------------------------------------- 7 | 8 | .usa-header { 9 | background-color: #112e51; 10 | 11 | .usa-logo a { 12 | color: white; 13 | } 14 | } 15 | 16 | .sub-header { 17 | position: relative; 18 | } 19 | -------------------------------------------------------------------------------- /assets/images/arrow-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/minus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/social-icons/svg/facebook25.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /assets/images/minus-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/styles/elements/_labels.scss: -------------------------------------------------------------------------------- 1 | .usa-label { 2 | background-color: $color-primary; 3 | border-radius: $border-radius; 4 | color: $color-white; 5 | font-size: $h5-font-size; 6 | margin-right: 0.5rem; 7 | padding: 0.1rem 0.7rem; 8 | text-transform: uppercase; 9 | 10 | &:only-of-type { 11 | margin-right: 0; 12 | } 13 | } 14 | 15 | .usa-label-big { 16 | @extend .usa-label; 17 | font-size: $base-font-size; 18 | padding-left: 0.9rem; 19 | padding-right: 0.9rem; 20 | } 21 | -------------------------------------------------------------------------------- /assets/images/icon-https.svg: -------------------------------------------------------------------------------- 1 | https icon -------------------------------------------------------------------------------- /lib/styles/elements/_list.scss: -------------------------------------------------------------------------------- 1 | ul, 2 | ol { 3 | @include margin(1em null); 4 | padding-left: 1.94em; // Approximately 15px left padding at default font size 5 | } 6 | 7 | li { 8 | line-height: $base-line-height; 9 | margin-bottom: 0.5em; 10 | 11 | &:last-child { 12 | margin-bottom: 0; 13 | } 14 | } 15 | 16 | h1, 17 | h2, 18 | h3, 19 | h4, 20 | h5, 21 | h6, 22 | p { 23 | + ul, 24 | + ol { 25 | margin-top: 0; 26 | } 27 | } 28 | 29 | // Unstyled lists 30 | .usa-unstyled-list { 31 | @include unstyled-list; 32 | } 33 | -------------------------------------------------------------------------------- /assets/images/correct8.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/correct9.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/angle-arrow-down.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/angle-arrow-down-hover.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/angle-arrow-down-primary.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/angle-arrow-up-primary.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/angle-arrow-down-primary-hover.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/angle-arrow-up-primary-hover.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/arrow-right.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/icon-dot-gov.svg: -------------------------------------------------------------------------------- 1 | dot gov icon -------------------------------------------------------------------------------- /lib/styles/core/_base.scss: -------------------------------------------------------------------------------- 1 | // Apply a natural box layout model to all elements, but allowing components to 2 | // change 3 | 4 | html { 5 | box-sizing: border-box; 6 | } 7 | 8 | *, 9 | *::before, 10 | *::after { 11 | box-sizing: inherit; 12 | } 13 | 14 | body { 15 | background-color: $color-white; 16 | overflow-x: hidden; 17 | } 18 | 19 | // Hack for clearfixes 20 | .lt-ie9 { 21 | * { 22 | filter: none !important; /* stylelint-disable-line declaration-no-important */ 23 | } 24 | } 25 | 26 | // for IE < 11, see: 27 | // 28 | [hidden] { 29 | display: none !important; /* stylelint-disable-line declaration-no-important */ 30 | } 31 | -------------------------------------------------------------------------------- /support/webpack.server.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var WebpackDevServer = require('webpack-dev-server'); 3 | var config = require('./webpack.config'); 4 | var port = 3001; 5 | 6 | /* eslint-disable no-console */ 7 | 8 | new WebpackDevServer(webpack(config), { 9 | publicPath: config.output.publicPath, 10 | hot: true, 11 | historyApiFallback: true, 12 | compress: true, 13 | stats: { 14 | colors: true, 15 | hash: true, 16 | timings: true, 17 | chunks: false 18 | } 19 | }).listen(port, 'localhost', function (err) { 20 | if (err) { 21 | console.log(err); 22 | } 23 | 24 | console.log('Webpack dev server is listening at localhost:' + port); 25 | }); 26 | -------------------------------------------------------------------------------- /lib/styles/fonts/_merriweather.scss: -------------------------------------------------------------------------------- 1 | @include font-face( 2 | 'Merriweather', 3 | '#{$font-path}/merriweather-light-webfont', 4 | 300, 5 | normal, 6 | $file-formats: eot woff2 woff ttf 7 | ); 8 | 9 | @include font-face( 10 | 'Merriweather', 11 | '#{$font-path}/merriweather-regular-webfont', 12 | 400, 13 | normal, 14 | $file-formats: eot woff2 woff ttf 15 | ); 16 | 17 | @include font-face( 18 | 'Merriweather', 19 | '#{$font-path}/merriweather-italic-webfont', 20 | 400, 21 | italic, 22 | $file-formats: eot woff2 woff ttf 23 | ); 24 | 25 | @include font-face( 26 | 'Merriweather', 27 | '#{$font-path}/merriweather-bold-webfont', 28 | 700, 29 | normal, 30 | $file-formats: eot woff2 woff ttf 31 | ); 32 | -------------------------------------------------------------------------------- /lib/styles/fonts/_source-sans-pro.scss: -------------------------------------------------------------------------------- 1 | @include font-face( 2 | 'Source Sans Pro', 3 | '#{$font-path}/sourcesanspro-light-webfont', 4 | 300, 5 | normal, 6 | $file-formats: eot woff2 woff ttf 7 | ); 8 | 9 | @include font-face( 10 | 'Source Sans Pro', 11 | '#{$font-path}/sourcesanspro-regular-webfont', 12 | 400, 13 | normal, 14 | $file-formats: eot woff2 woff ttf 15 | ); 16 | 17 | @include font-face( 18 | 'Source Sans Pro', 19 | '#{$font-path}/sourcesanspro-italic-webfont', 20 | 400, 21 | italic, 22 | $file-formats: eot woff2 woff ttf 23 | ); 24 | 25 | @include font-face( 26 | 'Source Sans Pro', 27 | '#{$font-path}/sourcesanspro-bold-webfont', 28 | 700, 29 | normal, 30 | $file-formats: eot woff2 woff ttf 31 | ); 32 | -------------------------------------------------------------------------------- /assets/images/plus.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/plus-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | > 3 | 4 | 5 | <%- header.title.toString() %> 6 | <%- header.base.toString() %> 7 | <%- header.meta.toString() %> 8 | <%- header.link.toString() %> 9 | <%- header.script.toString() %> 10 | <%- header.style.toString() %> 11 | 12 | 13 |
<%- html %>
14 | 15 | 18 | <% scripts.forEach(function(src){ %> 19 | 20 | <% }) %> 21 | 22 | 23 | -------------------------------------------------------------------------------- /lib/styles/elements/_tables.scss: -------------------------------------------------------------------------------- 1 | table { 2 | border-spacing: 0; 3 | margin: 2em 0; 4 | min-width: 100%; 5 | 6 | thead { 7 | th, 8 | td { 9 | background-color: $color-gray-lightest; 10 | } 11 | } 12 | 13 | th { 14 | text-align: left; 15 | } 16 | 17 | tbody { 18 | th { 19 | font-weight: $font-normal; 20 | } 21 | } 22 | 23 | th, 24 | td { 25 | background-color: $color-white; 26 | border: 1px solid $color-gray; 27 | padding: 1.5rem; 28 | } 29 | } 30 | 31 | .usa-table-borderless { 32 | thead { 33 | tr { 34 | background-color: transparent; 35 | } 36 | 37 | th { 38 | border-top: 0; 39 | } 40 | } 41 | 42 | th, 43 | td { 44 | border-left: 0; 45 | border-right: 0; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/components/InputLabel.jsx: -------------------------------------------------------------------------------- 1 | import React, { PropTypes } from 'react'; 2 | 3 | /** 4 | * Label for form fields 5 | * @returns {node} the rendered DOM node 6 | * @param {string} label required - text for the input's label 7 | * @param {string} htmlFor required - sets the 18 | ); 19 | } 20 | 21 | InputLabel.propTypes = { 22 | label: PropTypes.string.isRequired, 23 | htmlFor: PropTypes.string.isRequired, 24 | required: PropTypes.bool 25 | }; 26 | -------------------------------------------------------------------------------- /assets/images/close.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/components/Link.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Link as RRLink } from "react-router"; 3 | 4 | /** 5 | * Represents a generic link element. 6 | * 7 | * This class is a wrapper around the React Router Link class and accepts any 8 | * props supported by that class. 9 | * 10 | * If no `activeClassName` is defined, this class will set it to the default 11 | * value of "usa-current" per the U.S. Web Design Standards. 12 | */ 13 | export default class Link extends React.Component 14 | { 15 | /** 16 | * Renders the component. 17 | * 18 | * @returns {Node|null} The rendered DOM node. 19 | */ 20 | render() 21 | { 22 | let props = Object.assign({}, this.props); 23 | if (!props.activeClassName) { 24 | props.activeClassName = "usa-current"; 25 | } 26 | return ( 27 | 28 | ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /styleguide/app.jsx: -------------------------------------------------------------------------------- 1 | import 'babel-polyfill'; 2 | 3 | import React from 'react'; 4 | import ReactDOM from 'react-dom'; 5 | import { browserHistory } from 'react-router'; 6 | 7 | import configureStore from 'store/configureStore'; 8 | import createRoutes from 'routes/routes'; 9 | import { Provider } from 'react-redux'; 10 | import Immutable from 'immutable'; 11 | import _ from 'lodash'; 12 | 13 | let reduxState = {}; 14 | if (window.__REDUX_STATE__) { 15 | try { 16 | let plain = JSON.parse(unescape(window.__REDUX_STATE__)); 17 | _.each(plain, (val, key)=> { 18 | reduxState[key] = Immutable.fromJS(val); 19 | }); 20 | } catch (e) { 21 | // TODO: Handle the error. 22 | } 23 | } 24 | 25 | const store = configureStore(reduxState); 26 | 27 | ReactDOM.render(( 28 | 29 | { createRoutes(browserHistory) } 30 | 31 | ), document.getElementById('root')); 32 | -------------------------------------------------------------------------------- /lib/components/Label.jsx: -------------------------------------------------------------------------------- 1 | import React, { PropTypes } from 'react'; 2 | 3 | /** 4 | * The Label component shows a colored pill of text. 5 | * Comes in two sizes: regular and big. Specify big by passing a 'big' attribute. 6 | * @returns {node} The rendered DOM node 7 | * @param {string} size If 'big', makes the font size larger 8 | * @param {node} children required. Expected to be the text to display inside the pill 9 | */ 10 | export default function Label ({size, children}) { 11 | let style = size === 'big' ? 'usa-label-big' : 'usa-label'; 12 | 13 | return ( 14 | {children} 15 | ); 16 | } 17 | 18 | const SIZE_BIG = 'big'; 19 | const SIZE_NORMAL = 'normal'; 20 | 21 | Label.propTypes = { 22 | size: PropTypes.oneOf([ 23 | SIZE_BIG, 24 | SIZE_NORMAL 25 | ]), 26 | children: PropTypes.node.isRequired 27 | }; 28 | 29 | Label.defaultProps = { 30 | size: SIZE_NORMAL 31 | }; 32 | -------------------------------------------------------------------------------- /lib/styles/uswds.scss: -------------------------------------------------------------------------------- 1 | 2 | // Vendor 3 | $output-bourbon-deprecation-warnings: false; 4 | @import "../../node_modules/bourbon/app/assets/stylesheets/bourbon"; 5 | @import "../../node_modules/bourbon-neat/app/assets/stylesheets/neat"; 6 | @import "../../node_modules/normalize.css/normalize"; 7 | 8 | // Core 9 | @import "core/variables"; 10 | @import "core/fonts"; 11 | @import "core/base"; 12 | @import "core/grid"; 13 | @import "core/utilities"; 14 | @import "core/typography"; 15 | 16 | // To replace... 17 | @import "elements/buttons"; 18 | @import "elements/inputs"; 19 | @import "elements/labels"; 20 | @import "elements/list"; 21 | @import "elements/tables"; 22 | 23 | // Components 24 | @import "components/Accordion"; 25 | @import "components/OfficialSiteBanner"; 26 | @import "components/Header"; 27 | @import "components/SearchField"; 28 | @import "components/Sidebar"; 29 | @import "components/Alerts"; 30 | 31 | //Fixes 32 | @import "fixes/fixes"; 33 | -------------------------------------------------------------------------------- /assets/images/search.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright 2017-present, Nathan Mellis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /assets/images/search-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /__tests__/lib/components/FieldSet-test.js: -------------------------------------------------------------------------------- 1 | jest.unmock('../../../lib/components/FieldSet.jsx'); 2 | 3 | import React from 'react'; 4 | import { mount } from 'enzyme'; 5 | 6 | import FieldSet from '../../../lib/components/FieldSet.jsx'; 7 | import Checkbox from '../../../lib/components/Checkbox.jsx'; 8 | 9 | describe('FieldSet', () => { 10 | 11 | let wrapper = null; 12 | const legend = 'Legend test'; 13 | const name = 'Name test'; 14 | 15 | beforeEach(function() { 16 | wrapper = mount( 17 |
18 | 19 | 20 |
21 | ); 22 | }); 23 | 24 | it('is defined', () => { 25 | expect(wrapper).toBeDefined(); 26 | }); 27 | 28 | it('renders the legend', () => { 29 | expect(wrapper.find('legend').text()).toBe(legend); 30 | }); 31 | 32 | it('changes the name attribute of all its children', () => { 33 | let children = wrapper.find('input'); 34 | children.forEach((child) => { 35 | expect(child.props().name).toBe(name); 36 | }); 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /assets/images/social-icons/svg/twitter16.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/styles/fixes/fixes.scss: -------------------------------------------------------------------------------- 1 | // When there's multiple paragraphs in the alert body, 2 | // remove top and bottom margins to preserve spacing 3 | .usa-alert-text p:first-child { 4 | margin-top: 0; 5 | } 6 | 7 | .usa-alert-text p:last-child { 8 | margin-bottom: 0; 9 | } 10 | 11 | // Make labels and inputs have pointer cursor. 12 | [type="checkbox"] { 13 | cursor: pointer; 14 | } 15 | 16 | // Make labels and inputs have pointer cursor 17 | [type="radio"] { 18 | cursor: pointer; 19 | } 20 | 21 | // Adjust checkbox label lineheight because they are not inside
  • 's 22 | [type="checkbox"]+label { 23 | line-height: 1.5; 24 | } 25 | 26 | 27 | // Adjust radio button label lineheight because they are not inside
  • 's 28 | [type="radio"]+label { 29 | line-height: 1.5; 30 | } 31 | 32 | // Made disabled radio button labels gray 33 | [type="radio"]:disabled+label { 34 | color: #5b616b; 35 | } 36 | 37 | // no borders on fieldsets 38 | .usa-fieldset-inputs { 39 | border: none; 40 | margin: 0; 41 | padding: 0; 42 | } 43 | 44 | // fix label text being cropped at the bottom 45 | .usa-input-error select { 46 | line-height: 1.1; 47 | } 48 | -------------------------------------------------------------------------------- /__tests__/lib/components/InputLabel-test.js: -------------------------------------------------------------------------------- 1 | jest.unmock('../../../lib/components/InputLabel.jsx'); 2 | 3 | import React from 'react'; 4 | import { shallow } from 'enzyme'; 5 | 6 | import InputLabel from '../../../lib/components/InputLabel.jsx'; 7 | 8 | describe('InputLabel', () => { 9 | 10 | let wrapper = null; 11 | const label = 'Label test'; 12 | const htmlFor = 'htmlForTest'; 13 | 14 | beforeEach(function() { 15 | wrapper = shallow( 16 | 17 | ); 18 | }); 19 | 20 | it('is defined', () => { 21 | expect(wrapper).toBeDefined(); 22 | }); 23 | 24 | it('renders the label text', () => { 25 | expect(wrapper.text()).toBe(label); 26 | }); 27 | 28 | it('has an htmlFor attribute', () => { 29 | expect(wrapper.props().htmlFor).toBe(htmlFor); 30 | }); 31 | 32 | it('has an id', () => { 33 | expect(wrapper.props().id).toBe(`${htmlFor}-label`); 34 | }); 35 | 36 | it('accepts the required attribute', () => { 37 | wrapper = shallow(); 38 | expect(wrapper.hasClass('usa-input-required')).toBe(true); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /__tests__/lib/components/Label-test.js: -------------------------------------------------------------------------------- 1 | jest.unmock('../../../lib/components/Label.jsx'); 2 | 3 | import React from 'react'; 4 | import {shallow} from 'enzyme'; 5 | 6 | import Label from '../../../lib/components/Label.jsx'; 7 | 8 | describe('Label', () => { 9 | 10 | let wrapper = null; 11 | 12 | const text = 'Test'; 13 | 14 | beforeEach(function() { 15 | wrapper = shallow(); 16 | }); 17 | 18 | it('is defined', () => { 19 | expect(wrapper).toBeDefined(); 20 | }); 21 | 22 | it('renders without throwing an error', () => { 23 | expect(wrapper.contains({text})).toBe(true); 24 | }); 25 | 26 | it('is a span element', () => { 27 | expect(wrapper.type()).toEqual('span'); 28 | }); 29 | 30 | it('has specified text', () => { 31 | expect(wrapper.text()).toEqual(text); 32 | }); 33 | 34 | it('has the correct class', () => { 35 | expect(wrapper.hasClass('usa-label')).toBe(true); 36 | }); 37 | 38 | it('has the correct class when size="big"', () => { 39 | wrapper = shallow(); 40 | expect(wrapper.hasClass('usa-label-big')).toBe(true); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /assets/images/alerts/success.svg: -------------------------------------------------------------------------------- 1 | 3 | 12 | 13 | -------------------------------------------------------------------------------- /styles/_github-gist.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * GitHub Gist Theme 3 | * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro 4 | */ 5 | 6 | .hljs { 7 | display: block; 8 | background: white; 9 | padding: 0.5em; 10 | color: #333333; 11 | overflow-x: auto; 12 | } 13 | 14 | .hljs-comment, 15 | .hljs-meta { 16 | color: #969896; 17 | } 18 | 19 | .hljs-string, 20 | .hljs-variable, 21 | .hljs-template-variable, 22 | .hljs-strong, 23 | .hljs-emphasis, 24 | .hljs-quote { 25 | color: #df5000; 26 | } 27 | 28 | .hljs-keyword, 29 | .hljs-selector-tag, 30 | .hljs-type { 31 | color: #a71d5d; 32 | } 33 | 34 | .hljs-literal, 35 | .hljs-symbol, 36 | .hljs-bullet, 37 | .hljs-attribute { 38 | color: #0086b3; 39 | } 40 | 41 | .hljs-section, 42 | .hljs-name { 43 | color: #63a35c; 44 | } 45 | 46 | .hljs-tag { 47 | color: #333333; 48 | } 49 | 50 | .hljs-title, 51 | .hljs-attr, 52 | .hljs-selector-id, 53 | .hljs-selector-class, 54 | .hljs-selector-attr, 55 | .hljs-selector-pseudo { 56 | color: #795da3; 57 | } 58 | 59 | .hljs-addition { 60 | color: #55a532; 61 | background-color: #eaffea; 62 | } 63 | 64 | .hljs-deletion { 65 | color: #bd2c00; 66 | background-color: #ffecec; 67 | } 68 | 69 | .hljs-link { 70 | text-decoration: underline; 71 | } 72 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": [ 4 | "react" 5 | ], 6 | "parserOptions": { 7 | "ecmaVersion": 6, 8 | "sourceType": "module", 9 | "ecmaFeatures": { 10 | "jsx": true 11 | } 12 | }, 13 | "env": { 14 | "browser": true, 15 | "amd": true, 16 | "es6": true, 17 | "node": true, 18 | "mocha": true, 19 | "commonjs": true, 20 | "jest": true 21 | }, 22 | "extends": [ 23 | "eslint:recommended", 24 | "plugin:react/recommended" 25 | ], 26 | "rules": { 27 | "semi": [ "error" ], 28 | "comma-dangle": [ "error", "never" ], 29 | "comma-style": [ "error", "last" ], 30 | "func-call-spacing": [ "error", "never" ], 31 | "indent": [ "error", 2 ], 32 | "linebreak-style": [ "error", "unix" ], 33 | "spaced-comment": [ "error", "always" ], 34 | "valid-jsdoc": [ "error" , { 35 | "prefer": { "return": "returns" }, 36 | "requireReturn": false, 37 | "requireReturnDescription": false 38 | }], 39 | "require-jsdoc": [ "warn", { 40 | "require": { 41 | "FunctionDeclaration": true, 42 | "MethodDefinition": true, 43 | "ClassDeclaration": true, 44 | "ArrowFunctionExpression": false 45 | } 46 | }] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/components/FieldSet.jsx: -------------------------------------------------------------------------------- 1 | import React, { PropTypes } from 'react'; 2 | 3 | /** 4 | * The Field set is used to group two or more checkboxes or radio buttons together. 5 | * 6 | * This component returns a
    with a legend, which is necessary for screen readers. 7 | * Many screen readers will read the legend for each control, so it shoud be 8 | * brief and descriptive. 9 | * 10 | * As a convenience, passing a name property will give that name to each 11 | * Checkbox or radio button child so they will all be the same. 12 | * @returns {node} The rendered DOM node 13 | * @param {object} props The props 14 | */ 15 | export default function FieldSet(props) { 16 | let {name, children, onChange, legend, ...otherProps} = props; 17 | if (name) { 18 | children = React.Children.map(children, child => React.cloneElement(child, {name, onChange: onChange})); 19 | } 20 | 21 | return ( 22 |
    23 | 24 | {legend} 25 | 26 | 27 | {children} 28 | 29 |
    30 | ); 31 | } 32 | 33 | FieldSet.propTypes = { 34 | legend: PropTypes.string.isRequired, 35 | children: PropTypes.node.isRequired, 36 | name: PropTypes.string, 37 | onChange: PropTypes.func 38 | }; 39 | -------------------------------------------------------------------------------- /styleguide/store/configureStore.js: -------------------------------------------------------------------------------- 1 | import { createStore, applyMiddleware } from 'redux'; 2 | import thunkMiddleware from 'redux-thunk'; 3 | // import apiMiddleware from '../middleware/api'; 4 | import createLogger from 'redux-logger'; 5 | import rootReducer from '../reducers/root'; 6 | 7 | 8 | const logger = createLogger({ 9 | level: 'info', 10 | collapsed: false, 11 | logger: console, 12 | predicate: (getState, action) => true // eslint-disable-line no-unused-vars 13 | }); 14 | 15 | let middlewares = [ 16 | thunkMiddleware // , 17 | // apiMiddleware 18 | ]; 19 | 20 | if (process.env.NODE_ENV !== 'production') { 21 | middlewares = [...middlewares, logger]; 22 | } 23 | 24 | const createStoreWithMiddleware = applyMiddleware( 25 | ...middlewares 26 | )(createStore); 27 | 28 | /** 29 | * [configureStore description] 30 | * @param {object} initialState the initial state 31 | * @returns {object} the store 32 | */ 33 | export default function configureStore(initialState) { 34 | const store = createStoreWithMiddleware(rootReducer, initialState); 35 | 36 | if (module.hot) { 37 | // Enable Webpack hot module replacement for reducers 38 | module.hot.accept('../reducers/root', () => { 39 | const nextRootReducer = require('../reducers/root'); 40 | store.replaceReducer(nextRootReducer); 41 | }); 42 | } 43 | 44 | return store; 45 | } 46 | -------------------------------------------------------------------------------- /assets/images/external-link.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/external-link-alt.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/external-link-hover.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/external-link-alt-hover.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/images/social-icons/svg/rss25.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /lib/helpers/utilities.js: -------------------------------------------------------------------------------- 1 | import ReactDOM from "react-dom"; 2 | 3 | let index = 0; 4 | 5 | /** 6 | * Provides utility functions for components in this library. 7 | * 8 | * All the functions on this class should be defined as static functions so this 9 | * class acts more like a namespace than a class that you create instances of. 10 | * 11 | * See each method's documentation for more infomation about what this class 12 | * provides. 13 | */ 14 | export default class Utilities 15 | { 16 | 17 | /** 18 | * Returns a unique identifier for the supplied component instance. 19 | * 20 | * This method should only be called from `componentDidMount`. 21 | * 22 | * This method attempts to re-use an existing unique ID (e.g. `data-reactid`) 23 | * as much as possible. If no such unique ID exists, it will generate a 24 | * UUID to use for the component instance. 25 | * 26 | * @param {React.Component} component The React component to compute a unique 27 | * identifier for. 28 | * @returns {String} A unique identifier for the supplied component. 29 | */ 30 | static uniqueIdForComponent(component) 31 | { 32 | let node = ReactDOM.findDOMNode(component); // eslint-disable-line react/no-find-dom-node 33 | if (node) { 34 | if (node.hasAttribute("data-reactid")) { 35 | return "data-reactid-" + node.getAttribute("data-reactid"); 36 | } 37 | } 38 | return `component-unique-id-${index++}`; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /lib/components/NavigationBar.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | /** 4 | * Provides a standard Navigation Bar. 5 | * 6 | * Children of the Navigation Bar can be one of the following: 7 | * 8 | * - MenuItem 9 | * - Link 10 | * - SearchField 11 | * 12 | * For more information on when to use each of the different sizes, please 13 | * consult the US Web Design Standards (https://standards.usa.gov/search-bar/). 14 | */ 15 | export default class NavigationBar extends React.Component 16 | { 17 | /** 18 | * Constructor. 19 | * 20 | * @param {Object} props The props that will be applied to this component. 21 | */ 22 | constructor(props) 23 | { 24 | super(props); 25 | } 26 | 27 | /** 28 | * Renders the component. 29 | * 30 | * @returns {Node|null} The rendered DOM node. 31 | */ 32 | render() 33 | { 34 | return ( 35 | 43 | ); 44 | } 45 | } 46 | 47 | NavigationBar.LAYOUT_BASIC = "usa-search-big"; 48 | NavigationBar.LAYOUT_EXTENDED = "usa-search-medium"; 49 | 50 | NavigationBar.propTypes = { 51 | layout: React.PropTypes.oneOf([ 52 | NavigationBar.LAYOUT_BASIC, 53 | NavigationBar.LAYOUT_EXTENDED ]), 54 | children: React.PropTypes.node 55 | }; 56 | 57 | NavigationBar.defaultProps = { 58 | layout: NavigationBar.LAYOUT_BASIC 59 | }; 60 | -------------------------------------------------------------------------------- /__tests__/lib/components/TextArea-test.js: -------------------------------------------------------------------------------- 1 | jest.unmock('../../../lib/components/TextArea.jsx'); 2 | 3 | import React from 'react'; 4 | import { mount } from 'enzyme'; 5 | 6 | import TextArea from '../../../lib/components/TextArea.jsx'; 7 | 8 | describe('TextArea', () => { 9 | 10 | let wrapper = null; 11 | const label = 'label goes here'; 12 | 13 | 14 | beforeEach(function() { 15 | wrapper = mount( 95 | 96 | ); 97 | } 98 | 99 | /** 100 | * Checks textarea value against required status 101 | */ 102 | _validate() { 103 | // Check if field is required and empty 104 | if (this.props.required && !this.state.value) { 105 | this.setState({ 106 | hasError: true, 107 | isValid: false, 108 | errorMessageBody: 'This field is required' 109 | }); 110 | } 111 | // Field must not have an error 112 | else { 113 | this.setState({ 114 | hasError: false, 115 | errorMessageBody: null 116 | }); 117 | } 118 | } 119 | 120 | /** 121 | * Actions when user moves focus away from the field 122 | */ 123 | _handleBlur() { 124 | if (this.props.required && !this.state.isPristine) { 125 | this._validate(); 126 | } 127 | } 128 | 129 | /** 130 | * This function runs every time the user changes the contents of the input. 131 | * @param {event} event The event 132 | */ 133 | _handleChange(event) { 134 | this.setState({value: event.target.value}, () => { 135 | // React docs suggest this callback should generally go in ComponentDidUpdate, 136 | // however since both this callback actions update the state, they must 137 | // go here because changing state in ComponentDidUpdate would cause a 138 | // recursive loop and blow up the call stack 139 | if (this.state.value && this.state.isPristine) { 140 | this.setState({isPristine: false}); 141 | } 142 | if (this.state.hasError) { 143 | this._validate(); 144 | } 145 | }); 146 | } 147 | } 148 | 149 | TextArea.propTypes = { 150 | id: PropTypes.string, 151 | label: PropTypes.string.isRequired, 152 | required: PropTypes.bool, 153 | errorMessage: PropTypes.string, 154 | value: PropTypes.string 155 | }; 156 | --------------------------------------------------------------------------------