Giter Club home page Giter Club logo

design-system's Introduction

CMS Design System

The design system is a set of open source design and front-end development resources for creating Section 508 compliant, responsive, and consistent websites. It builds on the U.S. Web Design System and extends it to support additional CSS and React components, utility classes, and a grid framework to allow teams to quickly prototype and build accessible, responsive, production-ready websites.

Contents

Packages

You're currently at the root of a monorepo containing multiple NPM packages located in the packages directory. View the README.md in each of these for additional details.

Name Description
CMS Design System The core CSS, JS, and React components for the design system.
@cmsgov/design-system
Healthcare.gov Design System Design system used by application teams at healthcare.gov
npm
Medicare.gov Design System Design system used by application teams at medicare.gov
npm
CMSDS Documentation Gatsby based CMSDS Documentation site.

Running locally

This project uses Yarn for package management. Yarn helps to ensure everyone is using the same package versions. Install Yarn, if you don't have it yet.

Note: When you create a Git commit, any staged scripts will be automatically ran through ESLint and Prettier. If the linter catches an error, your commit will fail. This is a feature, not a bug :)

Scripts

These scripts can all be run from the root level of the repo:

  • yarn install

    • This will also run Lerna bootstrap which allows us to have multiple packages within the same repo (a monorepo). Lerna installs all our dependencies and symlinks any cross-dependencies.
  • yarn build

    • Compile/transpile/uglify everything and makes things release-ready.
    • yarn build:healthcare to build the Healthcare.gov Design System
    • yarn build:medicare to build the Medicare.gov Design System
  • yarn build:storybook:docs && yarn build:docs

    • Builds the docs site statically
  • yarn start

    • Starts local server running the documentation site
    • Regenerates documentation when files change
    • Before running start run the build command
  • yarn storybook

    • Starts storybook for easier local development for the core package
    • yarn storybook:react starts Storybook with React instead of Preact
  • yarn test

    • Alias of yarn test:unit
  • yarn test:unit

    • Runs JS unit tests for all packages
    • yarn test:unit -u updates Jest snapshots
  • yarn test:browser

    • Runs accessibility and visual-regression tests using Playwright. See Visual regression testing section below for details. This is the base command that defaults to the basic tests that cover Storybook stories, but we have several different kinds of browser tests under different sub-commands.
    • Note that this command will accept any arguments that Playwright accepts.
    • yarn test:browser -u updates reference screenshots used for visual regression testing. Update these only when we expect the visual changes. You can use this argument on any of the browser-test sub-commands to update snapshots for specific kinds of tests.
    • yarn test:browser --no-build will skip building the tests' pre-requisites. This is useful if you've already done it and haven't made any changes to the source.
    • yarn test:browser --grep "Alert" will only run tests with "Alert" in the name.
    • yarn test:browser:interaction runs VRT interaction tests to validate visual state of components after interaction.
    • yarn test:browser:examples runs VRT tests for our example projects.
    • yarn test:browser:storybook-docs checks for regressions in prop tables in storybook docs.
    • yarn test:browser:all runs all of our visual regression tests.
  • yarn lint

    • Runs just the linting portion of the tests, eslint and stylelint
  • yarn deploy-demo

    • Builds the doc site locally and deploys it to a branch-specific path on GitHub Pages. The terminal will display the URL where the demo was deployed to after it is done running.
  • yarn release

    • Interactive script that bumps package versions, tags a release commit, drafts notes, and more. Read our release guide on Confluence for more info.
  • yarn release:notes

    • Interactive script that generates draft release notes and associated ticket information from GitHub Milestones in the CMSDS public repository.
  • yarn release:patch

    • Interactive script that collects the merge commits from pull requests associated with a given milestone and cherry-picks them onto the current branch (use with release branch)

Visual regression testing

We use Playwright to test our components for visual regressions. We have several suites of visual regression tests, but our main suite uses Storybook stories as references. These tests will load a story or other reference material, take a screenshot within a docker container (for consistency), and compare those screenshots with ones previously taken and committed to version control.

Tests can be run in a docker container or out, but we only check in VRT reference images taken inside the docker container, because taking them outside of a container will produce inconsistent results from machine to machine. The reason you might run them outside of docker is if you're working on the tests themselves and want to run in headful mode so you can see what's happening and troubleshoot Note that updating the visual regression test reference images locally requires that you be signed into Docker.

There are a lot of tests, so it can be helpful to constrain the tests you run locally by using Playwright's --grep argument.

Updating the visual regression tests with Docker:

  1. Open the Docker app, and make sure you're signed in (Docker Desktop requires a license now).
  2. Run yarn test:browser to begin comparing component images
    1. If differences are detected and unexpected, evaluate your changes - we only want to update and commit references when we expect the visual changes detected.
    2. If differences are detected and expected, run yarn test:browser -u, verify the changes, and then commit them.

Development outside of Docker:

  • Run any of the browser-test sub-commands with the --no-docker flag, like yarn test:browser:examples --no-docker.
  • If you've never installed Playwright, running the yarn test:browser command will prompt you to install it, which you will want to do. The reason we don't need it installed when running it in Docker is because the Docker image contains all of its own dependencies.
  • Because snapshots will probably fail outside of the Docker container, pass --ignore-snapshots if you want to just see that the tests execute properly.
  • You can turn off headless mode by using Playwright's --headed flag.
  • Playwright's --debug flag is another helpful argument because it will pause and allow you to step through the tests.
  • Don't forget that you can run a subset of tests by using Playwright's --grep argument.
  • Remember that passing --no-build will skip re-building the source material like Storybook stories if you haven't made any changes to them and are only changing the tests themselves.
  • Here's an example of a command you might run to debug the dropdown tests: yarn test:browser:interaction --no-docker --no-build --headed --debug --ignore-snapshots --grep "Dropdown"

Design Assets

The CMS Design System provides a Sketch file and Sketch Library containing components, styles, and symbols. These are regularly updated alongside our code, and updates are automatically synced for designers using the Sketch Library.

Read more on using Sketch with the CMS Design System

Examples

Examples of the design system in use can be found in the examples directory.

Contributing

Please read the CONTRIBUTING.md document to learn about contributing to the design system, and our coding guidelines.

Contact

To get in touch with the CMS Design System team, please visit design.cms.gov/contact for a list of ways to contact us.

One of our goals is to ensure a welcoming environment for all contributors. Please take a look at our Code of Conduct to learn more.

design-system's People

Contributors

1copenut avatar amistein avatar babsdenney avatar bernardwang avatar brentschneider avatar davidakennedy avatar dependabot[bot] avatar dmethvin-gov avatar ericwbailey avatar erinrep avatar forrestbaer avatar hannaliebl avatar joefarhaven avatar josh68 avatar kaipokent avatar kencheeto avatar kimieann avatar line47 avatar louisfettet avatar nichia avatar niralkunadia12 avatar phiden avatar pwolfert avatar sawyerh avatar scheul93 avatar scitech avatar seesleestak avatar sethetter avatar somepedro avatar zarahzachz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

design-system's Issues

Add a text-underline to the transparent button SCSS class

Description

The ds-c-button--transparent SCSS class is designed to remove button backgrounds, and have them appear closer to links. These buttons are relying on color as the only cue they are actionable, and would benefit from a text underline. Screenshot attached below.


screen shot 2019-02-13 at 12 22 50 pm

webfonts, css assets fail to load on sandbox.bluebutton.cms.gov/v1/o/applications/register

Description

webfonts, css assets fail to load on sandbox.bluebutton.cms.gov/v1/o/applications/register issues with s3 asset object/bucket key, and deployment URIs for sandbox.bluebutton.cms.gov

update:

I'm also seeing this on https://sandbox.bluebutton.cms.gov/

S3 related:

NoSuchKeyThe specified key does not exist.static/bootstrap/css/dist/css/bootstrap.cssCC87AC85E992EC19GgeYLw8li/9KxuL2gClSGzKOffHFZcCJOOY9bUTyy099HRaWz3E6uFfi03Hd7x1qkXMiOVXnUSI=

deployment URI related:

Doesn't break functionality, but UX/UI is funky without the CSS.

Steps to reproduce the issue

Navigation:

  1. sign in
  2. https://sandbox.bluebutton.cms.gov/v1/o/applications/
  3. https://sandbox.bluebutton.cms.gov/v1/o/applications/register/

Additional information

  • I wasn't sure where to open this issue.

screen shot 2018-09-28 at 1 11 20 pm

Browser Version : Firefox 62.0.2 (64-bit)

list of what looked like related repos, info:

Tabs does not detect TabPanels in React

Attempts to use the example for Tabs results in a seemingly empty div.

JSX

                <Tabs>
                    <TabPanel id="interventions" tab="Interventions">
                        someother stuff here
                    </TabPanel>
                    <TabPanel id="implementation" tab="Implementation Costs">
                        some stuffh ere
                    </TabPanel>
                </Tabs>

html

<div>
    <div class="ds-c-tabs" role="tablist"></div>
    <div aria-hidden="true" aria-disabled="false" class="ds-c-tabs__panel" id="interventions" role="tabpanel">someother stuff here</div>
    <div aria-hidden="true" aria-disabled="false" class="ds-c-tabs__panel" id="implementation" role="tabpanel">some stuffh ere</div>
</div>

Traced it to the line that detects TabPanels (child.type === TabPanel); see screenshot

screen shot 2018-07-16 at 2 57 38 pm

Inquiring to change to child.props && child.props.tab.

Environment:

"@cmsgov/design-system-core": "^1.23.0",
"react": "16.3.0",

Components retrieved via individual exports, i.e.

import { TabPanel } from '@cmsgov/design-system-core/dist/components/Tabs/TabPanel';
import { Tabs } from '@cmsgov/design-system-core/dist/components/Tabs/Tabs'; 

Consider adding component maturity page

Description

I was looking for information on component maturity states on https://design.cms.gov/ and could not find an explanation. I'd like to recommend creating a page somewhere on the site (maybe under guidelines) that defines the component states.

In addition, I think it would be nice to update the component states to use plain language

  • Draft (What used to be alpha)
  • Work in progress (What used to be beta)
  • Ready (Ready to implement)

These components are in either alpha or beta and I'm not sure what that means
https://design.cms.gov/components/dialog/
https://design.cms.gov/components/spinner/
https://design.cms.gov/components/tabs/
https://design.cms.gov/patterns/step-list/
https://design.cms.gov/components/autocomplete/

Export maskValue method

Description

As a Developer, I would like to submit form data to my server as an unmasked value to make validation easier, but when I re-display the value in a read-only state (i.e. in <p> tag), I would like to display the masked version.

Currently, I can do the first part, unmasking the value using the design system's exported unmaskValue method. However, there isn't an exported method to mask the value, though it exists.

TLDR: Export maskValue along with the already exported unmaskValue

Update aria-controls and autocomplete attributes on Autocomplete component

Description

The <Autocomplete /> component shows 2 axe-core errors. The first is related to the input aria-controls attribute looking for an ID that is not always present. The second is related to the input autocomplete attribute using an invalid value of "nope" to prevent Chrome from using its own auto-suggest box.

Suggested Fixes

  1. Have the aria-controls attribute appear only when the listbox of suggestions is on screen. Otherwise set it to a null (non-rendering) value.
  2. Update the autoCompleteLabel to "off" from "nope" and retest with Chrome

Propose moving a few components to patterns

Description

If we are going to keep the distinction between components and patterns we need to define when something is a component VS pattern.

Proposing to move the following components under patterns as they are more complex and involve multiple components.

  • Date Field
  • Help drawer
  • Modal dialog
  • Month picker
  • Tabs
  • Vertical navigation

CC @melwoodard @phiden @1Copenut thoughts?

Instructions for site packages and themes should be updated

Description

Instructions for site packages and themes should be updated.

Added medicare.gov site package to the design system and followed the directions for site packages and themes. This yielded no discernible results when running a quick test with a test-theme.

In order to view the test-theme successfully in the design system documentation site, the following steps were taken:

  1. Added a 'settings' folder inside test-theme's src folder
  2. Within the 'settings' folder, added an_override.color.scss file with the following style: $color-primary: #ff0000;
  3. Included the following cms imports inside the index.scss file:
// Design system overrides
@import 'settings/override.color';
// @import 'settings/override.forms';

// Design system core and grid styles
@import '@cmsgov/design-system-core/src/index';
@import '@cmsgov/design-system-layout/src/index';
  1. After running yarn start:theme, test-theme rendered as expected

Update Sketch file

Currently, the sketch file has items that are not in the design system and the design system has code components that are not in the Sketch file.

Fonts missing

Maybe we need to tell folks to make sure they have the following installed? Follow on work #334

screen shot 2019-02-18 at 10 11 00 am

Colors

Sketch file has special state colors defined but they are not in the code. - Follow on work #352

Components

Buttons

  • Sketch file is missing inverse buttons
  • Sketch file is missing buttons with icons - Follow on work #354

Badge

  • Sketch file is missing large text version

Checkbox and radio

  • Sketch file is missing inverse versions
  • Sketch file is missing right to left version
  • Sketch file is missing hint text and errors

Select

  • Sketch file is missing different sizes
  • Sketch file is missing inverse versions

Date field

  • Sketch file is different than code (which is the source fo truth?)
  • Sketch file is missing error example

Table

  • Sketch file is different than code (which is the source fo truth?)

Tabs

Sketch file is different than code (which is the source fo truth?) Follow on work - #353

Text field

  • Sketch file is different than code (which is the source fo truth?). Sketch file is missing labels and hint text.
  • Sketch file is missing disabled text field
  • Sketch file is missing inverse versions

Vertical navigation

  • Sketch file is different than code (which is the source fo truth?)

Missing components from Sketch file

Follow on work #355

Missing patterns from Sketch file

  • Documentation page
  • Review
  • Step List

Advanced table behaviors: Sorting, Paging

Description

We have some advanced table features in our backlog. Does the core team have either of the following in your roadmap for table or list features?

  1. Paging (classic style)
  2. Sorting (by column header)

Proper directory setup for using SASS

I am trying to use your framework, and am having trouble getting it initially setup. I would like to use the SASS version and have followed your documentation, with no luck. I am well versed in SASS and should not be an issue once the directory is setup correctly.

Currently I have the following directory setup

Main Directory

  • index.html
  • node_modules
  • fonts
  • images
  • css

which other files and setup should I include? From there which files do I create or add to import the rest of the Sass and override?

I would like to replicate your KSS setup

Hi,

not really an issue, more a question. I read the article on Medium about this design system and was very impressed and as such I would like to replicate it so I can use it myself.

Is the purpose of this repo sharing the design system itself or the functionality of how it was made? I get the impression it's more the former than the latter, and as such I was wondering if it would be possible of maybe creating a guide on how you did the setup?

kind regards,

Nathan

Add an optional prop for a dismiss / close button on the Alert component

Description

Alerts serve many purposes, mostly to inform users of time-sensitive or in-passing information. Sometimes this information needs to persist, other times it is simply a confirmation, and users should be able to dismiss it.

Additional information [optional]

Per the 18F WDS recommendation on alerts, I propose we add an optional prop to the Alert.jsx component for a dismiss UI mechanism. A button seems a good candidate.

Sketch file: Clarify grid layout on desktop

Related to a comment originally posted in #331

Description

In the Responsive page templates page of the Sketch file, the artboards for Desktop and Mobile don't use measurements that conform with spacing or responsive layout guidance on the site.

Desktop artboard size

  • In the Sketch file, the artboard width for standard desktop is set to 1104px, which seemed non-standard and confusing.
  • Based on the breakpoints and variables in the responsive design page, I would expect it to be set to 1024px, or to provide an annotation about why 1104px was chosen.

Current:
screen shot 2019-02-19 at 8 39 41 pm

Desktop grid layout

  • In the Sketch file, the grid on the Desktop-sized artboard is set to take up 1040px wide (including outside gutters). In the current settings, the gutter width is set to 29px, which does not conform to the 8-pixel grid defined in the spacing page documentation
  • Based on the breakpoints and variables in the responsive design page, I would expect it to be set to 1024px (or smaller) but definitely not larger. I would also expect that the gutters measure even increments of 8px. Otherwise, I expect to find an annotation telling how these settings are derived.

Current:
screen shot 2019-02-19 at 8 06 53 pm

Additional comments

I haven't gone into the Mobile or Tablet layout yet, but the quirks in the desktop template make me really unsure if I should trust them.

Add a one-line start to the package.json scripts section

Description

It would be helpful and a bit of a shortcut to add a one-line start command that allows users to install dependencies and start the development server.

The design system is predicated on Yarn so any script solutions should use it as the task runner as opposed to NPM.

Advertise WCAG 2.0 AA compatibility?

Description

This is not an issue but moreso a question/consideration. It seems that Section 508 is compliant with WCAG 2.0 levels A and AA as of January 18, 2017, per https://www.section508.gov/manage/laws-and-policies and https://www.access-board.gov/attachments/article/1877/ict-final-rule.pdf:

The Revised 508 Standards and 255 Guidelines incorporate by reference the Web Content Accessibility Guidelines (WCAG) 2.0, a globally-recognized and technologically-neutral set of accessibility guidelines for Web content. For Section 508-covered ICT, all covered Web and non-Web content and software—including, for example, Web sites, intranets, word processing documents, portable document format documents, and project management software—is required, with a few specific exceptions, to conform to WCAG 2.0’s Level A and Level AA Success Criteria and Conformance Requirements

Is the CMS Design System supposed to be compliant with this latest version of Section 508? If so, I think it'd be good to advertise on the website and documentation that the framework is compliant with WCAG 2.0 AA (perhaps, if necessary, with a footnote that said "few specific exceptions" may apply). I think this would help prospective users of the framework realize that this is the case.

Proposal: Add "Exposed Within" pattern (and "Inset" component)

Following the pattern proposal guidelines, I'd like to suggest that we add the "Exposed Within" form pattern to the design system. Also included in this pattern is a new component, which for lack of a better name, I'm calling "Inset". Both of these are detailed below.

Proposal Part 1: Exposed Within

The "Exposed Within" pattern is a way to progressively reveal an additional question only when it is relevant to the user. This takes the form of a question that is visually nested below a checked radio/checkbox field.

Example
exposed-within

What user need this pattern solves

There may be times when a service needs to ask the user for more information based on how they answered a previous question. This pattern allows the form to be as minimal as possible, and only surfaces questions that are relevant to the user's circumstances.

Supporting evidence

  1. Some research on this pattern was mentioned in Web Form Design, by Luke Wroblewski. In their research they asked users to use 9 different form patterns and used eye tracking software to measure the number and duration of their fixations. The average number of eye fixations indicates the level of effort required to parse a form. And the length of fixation indicates the time spent looking at each element.

    The “expose within radio buttons” method also hid irrelevant form inputs from people until they needed them. This meant it was easy on the eyes and completed quite quickly. In fact, this was the fastest solution we tested and had the lowest number of average fixations.

  2. This is pattern is recommended by GOV.uk

  3. and recommended in the Co-op Design Manual

Alternative patterns

This pattern doesn't solve for all use cases, but is a good solution for situations when you need to progressively reveal one piece of information. If you need to ask for more than one thing, an alternative pattern may be better, like revealing the information below the original question's fieldset or on a separate screen.


Proposal Part 2: Inset component

While prototyping the Exposed Within pattern above, I ran into the need for a new component that visually looks like the content is nested, while having a border that leads the user's eye to the element that it is nested within.

What user need this pattern solves

The Inset component is meant to draw attention to important content, or to associate a block of content with another element. It can be used as part of the Exposed Within pattern, in a progressive disclosure accordion (ie. for help text), or on its own as a way to distinguish a block of text from its surrounding content.

Example
Progressively disclosed text inset-disclosure
Important content image

Alternative components

This component is somewhat similar to the Alert component, in that it can be used to draw attention to important content. However, the Inset component is also used to visually associate its content with neighboring elements, and can be used to indicate a nested relationship.

The Alert component also has a similar left border, but that visual styling could change, as it has in the past.

Supporting evidence

  1. This is a pattern recommended by GOV.uk. In their CSS, they named it panel, however I find that confusing and not very accurate.

Clarify styling inconsistency in React/non-React versions of vertical nav component

Description

When designing a layout that will use the vertical nav component, I expected each version in the design system site to be consistently styled. Instead I spotted a small variation between them.

It would be helpful for all three of these examples to be consistent — I'm not sure which is the canonical UI style.

Steps to reproduce the issue

  1. Visit the Vertical Nav Component page: https://design.cms.gov/components/vertical-nav/
  2. Look at the styles of all three examples on that page
  • The nav as used in the site's own navigation uses carets to show sections that expand with sub-sections

    • screen shot 2019-02-07 at 2 16 45 pm
  • The regular HTML component does not use carets to show sections that expand with sub-sections

    • screen shot 2019-02-07 at 2 17 12 pm
  • The react component uses carets

    • screen shot 2019-02-07 at 2 17 22 pm

Consider deprecating the inputs to right of label pattern on Choice component

Description

The Choice component allows for inputs to be placed to the right of labels, which can create ragged spacing and readability issues. We should discuss if this is a pattern we want to maintain going forward, or if it would be better deprecated. This discussion will include identifying any uses in the wild, and ways to notify and remediate any breaking changes.

This came about as part of a discussion on #341, specifically @melwoodard comment #341 (comment)

Including screen shot from that PR showing an example right to left layout with checkedChildren

Additional information [optional]

screen shot 2019-02-20 at 7 24 45 am

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.