Skip to content

Commit

Permalink
Merge branch 'main' into release/9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pwolfert committed Jan 10, 2024
2 parents a6b6892 + 1f82462 commit 4c93c43
Show file tree
Hide file tree
Showing 1,142 changed files with 1,197 additions and 892 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ These scripts can all be run from the root level of the repo:
- **Before** running `start` run the `build` command
- `yarn storybook`
- Starts storybook for easier local development for the core package
- `yarn storybook:healthcare` starts storybook for healthcare stories & styles
- `yarn storybook:medicare` starts storybook for medicare stories & styles
- `yarn storybook:react` starts Storybook with React instead of Preact
- `yarn test`
- Alias of `yarn test:unit`
- `yarn test:unit`
Expand Down
2 changes: 1 addition & 1 deletion examples/create-react-app-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@cmsgov/design-system": "^8.0.0",
"@cmsgov/design-system": "^9.0.0-beta.1",
"@types/jest": "^27.5.2",
"@types/node": "^16.18.0",
"@types/react": "^18.0.22",
Expand Down
8 changes: 5 additions & 3 deletions examples/create-react-app-typescript/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import AutocompleteExample from './Examples/AutocompleteExample';
import BadgeExample from './Examples/BadgeExample';
import ButtonExample from './Examples/ButtonExample';
import ChoiceListExample from './Examples/ChoiceListExample';
import DateFieldExample from './Examples/DateFieldExample';
import SingleInputDateFieldExample from './Examples/SingleInputDateFieldExample';
import MultiInputDateFieldExample from './Examples/MultiInputDateFieldExample';
import DropdownExample from './Examples/DropdownExample';
import FilterChipExample from './Examples/FilterChipExample';
import LabelExample from './Examples/LabelExample';
Expand All @@ -28,7 +29,7 @@ function App() {
return (
<div className="ds-base">
<header className="ds-u-padding--3 ds-u-sm-padding--6 ds-u-display--block ds-u-fill--primary-darkest">
<h1 className="ds-u-margin--0 ds-u-color--white ds-u-font-size--display ds-u-text-align--center">
<h1 className="ds-text-heading--5xl ds-u-margin--0 ds-u-color--white ds-u-text-align--center">
Hello, world!
</h1>
<div className="ds-u-text-align--center">
Expand All @@ -46,7 +47,8 @@ function App() {
<BadgeExample />
<ButtonExample />
<ChoiceListExample />
<DateFieldExample />
<SingleInputDateFieldExample />
<MultiInputDateFieldExample />
<DropdownExample />
<FilterChipExample />
<LabelExample />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { DateField } from '@cmsgov/design-system';
import { MultiInputDateField } from '@cmsgov/design-system';
import React from 'react';

function DateFieldExample() {
function MultiInputDateFieldExample() {
return (
<div>
<h2>DateField Example</h2>
<DateField
<h2>MultiInputDateField Example</h2>
<MultiInputDateField
label="Date of birth"
errorMessage="Please enter a year in the past"
monthDefaultValue="10"
Expand All @@ -17,4 +17,4 @@ function DateFieldExample() {
);
}

export default DateFieldExample;
export default MultiInputDateFieldExample;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React, { useState } from 'react';
import { SingleInputDateField } from '@cmsgov/design-system';

function SingleInputDateFieldExample() {
const [dateString, updateDate] = useState('');
return (
<div>
<h2>SingleInputDateField Example</h2>
<SingleInputDateField
hint="If you were born on a leap day, entering the date will either crash our servers or open a portal to an alternate dimension."
label="Enter your date of birth."
name="single-input-date-field"
fromYear={2023}
toYear={2023}
value={dateString}
onChange={updateDate}
/>
</div>
);
}

export default SingleInputDateFieldExample;
2 changes: 1 addition & 1 deletion packages/design-system-tokens/src/themes/cmsgov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const themeColors: ColorTokens = {
'warn-darker': color['dandelion-700'],
'warn-darkest': color['dandelion-800'],
//
'visited': color['windsor-500'],
'visited': color['orchid-800'],
};

const font: FontTokens = {
Expand Down
1 change: 0 additions & 1 deletion packages/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"@types/react-dom": "^17.0.10",
"@types/react-transition-group": "^4.4.5",
"classnames": "^2.2.5",
"core-js": "^3.6.5",
"date-fns": "^2.28.0",
"ev-emitter": "^1.1.1",
"focus-trap-react": "^10.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function makeItem(name: string, children?: React.ReactNode) {
export const Default: Story = {
render: Template,
args: {
textFieldLabel: 'Enter and select a drug to see its cost under each plan',
textFieldLabel: 'Enter and select a drug to see its cost under each plan.',
textFieldHint:
'Type a letter to see results, then use ARROW keys to change options, ENTER key to make a selection, ESC to dismiss.',
items: [
Expand Down Expand Up @@ -98,7 +98,7 @@ export const Default: Story = {
export const LabeledList: Story = {
render: Template,
args: {
textFieldLabel: 'Search for and select your county',
textFieldLabel: 'Search for and select your county.',
textFieldHint:
'Type "C" then use ARROW keys to change options, ENTER key to make a selection, ESC to dismiss.',
label: 'Select from the options below:',
Expand All @@ -118,7 +118,7 @@ export const LabeledList: Story = {
export const CustomMarkup: Story = {
render: Template,
args: {
textFieldLabel: 'Select a snack that starts with "C"',
textFieldLabel: 'Select a snack that starts with "C".',
textFieldHint:
'Type "C" to start seeing a list of snacks. Clicking the last item should not change the input value to "Search all snacks"',
label: 'Select from the options below:',
Expand Down Expand Up @@ -168,7 +168,7 @@ export const LoadingMessage: Story = {
clearSearchButton: false,
loading: true,
items: [],
textFieldLabel: 'This will only show a loading message',
textFieldLabel: 'This will only show a loading message.',
textFieldHint: 'List should return string Loading to simulate async data call.',
} as any,
};
Expand All @@ -178,7 +178,7 @@ export const NoResults: Story = {
args: {
items: [],
clearSearchButton: false,
textFieldLabel: 'This will show a "no results" message',
textFieldLabel: 'This will show a "no results" message.',
textFieldHint: "Start typing, but you'll only get a loading message.",
} as any,
};
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ type Story = StoryObj<typeof ChoiceList>;

export const DefaultCheckbox: Story = {
args: {
label: 'Checkbox example',
hint: 'Helpful hint text',
name: 'checkbox_choices',
label: 'Check some boxes.',
hint: 'This is some helpful hint text.',
name: 'checkbox-choices',
type: 'checkbox',
},
};

export const DefaultRadio: Story = {
args: {
label: 'Radio example',
name: 'radio_choices',
label: 'Choose an option.',
name: 'radio-choices',
type: 'radio',
},
};

export const SmallOption: Story = {
args: {
label: 'Small size example',
label: 'Choose a small option.',
name: 'size-variants',
type: 'radio',
size: 'small',
Expand All @@ -57,19 +57,18 @@ export const SmallOption: Story = {

export const WithError: Story = {
args: {
errorMessage: 'Example error message',
label: 'Small size example',
name: 'size-variants',
errorMessage: 'This is an example error message.',
label: 'Choose an option.',
name: 'radio-choices',
type: 'radio',
size: 'small',
},
};

export const InverseOption: Story = {
args: {
label: 'Inverse example',
hint: 'Helpful hint text',
name: 'inverse_choices_field',
label: 'Choose an option.',
hint: 'This component is on an inversed background.',
name: 'inverse-choices',
type: 'checkbox',
inversed: true,
},
Expand All @@ -82,8 +81,9 @@ export const InverseOption: Story = {

export const DisabledCheckbox: Story = {
args: {
label: 'Disabled checkbox example',
name: 'checkbox_choices',
label: 'Check some boxes.',
hint: 'These checkboxes are disabled.',
name: 'disabled-checkbox-choices',
type: 'checkbox',
choices: [
{ label: 'Disabled choice A', value: 'A', disabled: true },
Expand All @@ -94,8 +94,9 @@ export const DisabledCheckbox: Story = {

export const DisabledRadio: Story = {
args: {
label: 'Disabled radio example',
name: 'radio_choices',
label: 'Choose an option.',
hint: 'These radio buttons are disabled.',
name: 'disabled-radio-choices',
type: 'radio',
choices: [
{ label: 'Disabled choice A', value: 'A', disabled: true },
Expand All @@ -108,7 +109,12 @@ export const ChoiceChildren: Story = {
args: {
name: 'radio_choices',
type: 'radio',
label: 'Example choices with checked children',
label: 'Choose an option.',
hint: (
<>
This example shows choices with <em>checked children</em>.
</>
),
choices: [
{
label: 'Choice 1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exports[`Choice applies errorMessage to label 1`] = `
>
George Washington
</label>
<span
<p
aria-atomic="true"
aria-live="assertive"
class="ds-c-inline-error"
Expand All @@ -71,7 +71,7 @@ exports[`Choice applies errorMessage to label 1`] = `
Error:
</span>
Hey! You can't do that!
</span>
</p>
</div>
</div>
</DocumentFragment>
Expand All @@ -97,12 +97,12 @@ exports[`Choice has a hint and requirementLabel 1`] = `
>
George Washington
</label>
<div
<p
class="ds-c-hint"
id="static-id__hint"
>
Optional. Hello world
</div>
</p>
</div>
</div>
</DocumentFragment>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ exports[`ChoiceList Radio buttons and Checkboxes is a radio button group 1`] = `
>
Foo
</legend>
<div
<p
class="ds-c-hint"
id="static-id__hint"
>
Psst! I know the answer
</div>
<span
</p>
<p
aria-atomic="true"
aria-live="assertive"
class="ds-c-inline-error"
Expand All @@ -41,7 +41,7 @@ exports[`ChoiceList Radio buttons and Checkboxes is a radio button group 1`] = `
Error:
</span>
Hey, you have to pick an answer
</span>
</p>
<div>
<div
class="ds-c-choice-wrapper"
Expand Down
44 changes: 44 additions & 0 deletions packages/design-system/src/components/CloseButton/CloseButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from 'react';
import classNames from 'classnames';
import useId from '../utilities/useId';
import { CloseIconThin } from '../Icons';

interface BaseCloseButtonProps {
/**
* An aria-label is required since the button content is only an X
*/
'aria-label': string;
/**
* Additional classes to be added to the button element.
*/
className?: string;
/**
* A custom `id` attribute for the dialog element
*/
id?: string;
}

export type CloseButtonProps = Omit<
React.ComponentPropsWithRef<'button'>,
keyof BaseCloseButtonProps
> &
BaseCloseButtonProps;

/**
*
*/
export const CloseButton = ({ className, id: idProp, ...buttonAttributes }: CloseButtonProps) => {
const id = useId('close-button--', idProp);
return (
<button
className={classNames('ds-c-close-button', className)}
type="button"
id={id}
{...buttonAttributes}
>
<CloseIconThin ariaHidden={false} id={`${id}__icon`} />
</button>
);
};

export default CloseButton;
1 change: 1 addition & 0 deletions packages/design-system/src/components/CloseButton/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './CloseButton';
Loading

0 comments on commit 4c93c43

Please sign in to comment.