@cfpb/design-system-react 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,13 @@
1
- import { ButtonHTMLAttributes } from 'react';
1
+ import { ButtonHTMLAttributes, ReactNode } from 'react';
2
2
  interface ButtonProperties extends ButtonHTMLAttributes<HTMLButtonElement> {
3
3
  /**
4
4
  * Button contents
5
5
  */
6
- label: string;
6
+ label?: string;
7
+ /**
8
+ * Any children to render within the button. Allows you to wrap any node with button tag
9
+ */
10
+ children?: ReactNode;
7
11
  /**
8
12
  * What is the button's appearance?
9
13
  */
@@ -19,7 +23,7 @@ interface ButtonProperties extends ButtonHTMLAttributes<HTMLButtonElement> {
19
23
  /**
20
24
  * Button should be styled as a link?
21
25
  */
22
- asLink?: boolean;
26
+ isLink?: boolean;
23
27
  /**
24
28
  * Name of icon to display left of button text
25
29
  */
@@ -6,8 +6,10 @@ export interface CheckboxProperties {
6
6
  label: ReactNode;
7
7
  /** Additional CSS classes applied to the checkbox's wrapper element */
8
8
  className?: string;
9
- /** Is the checkbox checked? */
9
+ /** Is the checkbox checked? (controlled mode). Omit for uncontrolled mode. */
10
10
  checked?: boolean;
11
+ /** Initial checked state (uncontrolled mode only) */
12
+ defaultChecked?: boolean;
11
13
  /** Additional text to further clarify purpose of checkbox */
12
14
  helperText?: ReactNode;
13
15
  /** Additional CSS classes that will be applied to checkbox input element */
@@ -18,9 +20,9 @@ export interface CheckboxProperties {
18
20
  inputRef?: RefObject<HTMLInputElement> | ((instance: HTMLInputElement | null) => void) | null | undefined;
19
21
  /** Apply the "Large" styles for this element? */
20
22
  isLarge?: boolean;
23
+ /** Removes/Adds 'label__heading' class to the Label. When true, uses inline label style. */
24
+ isLabelInline?: boolean;
21
25
  /** A name for this checkbox's value that can be referenced in javascript */
22
- labelInline?: boolean;
23
- /** Removes/Adds 'label__heading' class to the Label * */
24
26
  name?: string;
25
27
  /** Is this checkbox disabled? */
26
28
  disabled?: boolean;
@@ -29,5 +31,5 @@ export interface CheckboxProperties {
29
31
  /** Border status */
30
32
  status?: 'error' | 'success' | 'warning';
31
33
  }
32
- export declare const Checkbox: ({ id, label, className, inputClassName, labelClassName, checked, helperText, inputRef, disabled, isLarge, labelInline, name, onChange, status, ...properties }: CheckboxProperties & JSX.IntrinsicElements["input"]) => ReactElement;
34
+ export declare const Checkbox: ({ id, label, className, inputClassName, labelClassName, checked, defaultChecked, helperText, inputRef, disabled, isLarge, isLabelInline, name, onChange, status, ...properties }: CheckboxProperties & JSX.IntrinsicElements["input"]) => ReactElement;
33
35
  export default Checkbox;
@@ -0,0 +1,20 @@
1
+ import { ReactNode, JSX } from 'react';
2
+ export interface FieldsetProperties {
3
+ /** Legend text displayed at the top of the fieldset */
4
+ legend: ReactNode;
5
+ /** Optional block helper text displayed below the legend (uses a-label__helper--block) */
6
+ legendHelperText?: ReactNode;
7
+ /** Form controls such as Checkbox or RadioButton components */
8
+ children: ReactNode;
9
+ /** Display options inline (same line) instead of stacked vertically */
10
+ isInline?: boolean;
11
+ /** Additional CSS classes applied to the fieldset element */
12
+ className?: string;
13
+ }
14
+ /**
15
+ * A fieldset groups several form controls (checkboxes, radio buttons) with a legend and optional block helper text.
16
+ *
17
+ * Source: https://cfpb.github.io/design-system/components/fieldsets
18
+ */
19
+ export declare const Fieldset: ({ legend, legendHelperText, children, isInline, className, ...properties }: FieldsetProperties & JSX.IntrinsicElements["fieldset"]) => JSX.Element;
20
+ export default Fieldset;
@@ -0,0 +1,13 @@
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Fieldset } from '../../index';
3
+ /**
4
+ *
5
+ * Source: https://cfpb.github.io/design-system/components/fieldsets
6
+ */
7
+ declare const meta: Meta<typeof Fieldset>;
8
+ export default meta;
9
+ type Story = StoryObj<typeof meta>;
10
+ export declare const WithCheckboxes: Story;
11
+ export declare const WithRadioButtons: Story;
12
+ export declare const LargeTargetWithCheckboxes: Story;
13
+ export declare const LargeTargetWithRadioButtons: Story;
@@ -0,0 +1,11 @@
1
+ import { JSX } from 'react';
2
+ export interface HeaderProperties {
3
+ links?: JSX.Element[];
4
+ href?: string;
5
+ withBottomBorder?: boolean;
6
+ }
7
+ /**
8
+ * A header helps users identify where they are and provides a quick, organized way to reach the main sections of a website.
9
+ *
10
+ */
11
+ export declare const Header: ({ links, href, withBottomBorder, }: HeaderProperties) => JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { Meta, StoryObj } from '@storybook/react-vite';
2
- import { PageHeader } from '../../index';
3
- declare const meta: Meta<typeof PageHeader>;
2
+ import { Header } from '../../index';
3
+ declare const meta: Meta<typeof Header>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
File without changes
@@ -1,9 +1,10 @@
1
1
  import { JSX } from 'react';
2
2
  interface LabelProperties {
3
3
  children: React.ReactNode;
4
- inline?: boolean;
4
+ /** When true, uses inline label style instead of heading style */
5
+ isInline?: boolean;
5
6
  htmlFor: string;
6
7
  className?: string;
7
8
  }
8
- export declare const Label: ({ children, inline, htmlFor, className, ...other }: JSX.IntrinsicElements["label"] & LabelProperties) => React.ReactElement | null;
9
+ export declare const Label: ({ children, isInline, htmlFor, className, ...other }: JSX.IntrinsicElements["label"] & LabelProperties) => React.ReactElement | null;
9
10
  export default Label;
@@ -4,7 +4,7 @@ export interface LinkProperties extends HTMLProps<HTMLAnchorElement> {
4
4
  /**
5
5
  * Whether the link should be rendered as a button.
6
6
  */
7
- asButton?: boolean;
7
+ isButton?: boolean;
8
8
  /**
9
9
  * Any children to render within the link. Allows you to wrap any node with anchor tag
10
10
  */
@@ -45,6 +45,6 @@ export interface LinkProperties extends HTMLProps<HTMLAnchorElement> {
45
45
  *
46
46
  * Source: https://cfpb.github.io/design-system/components/links
47
47
  */
48
- export default function Link({ asButton, children, href, iconLeft, iconRight, isJump, isRouterLink, label, type, ...others }: LinkProperties): JSXElement;
48
+ export default function Link({ isButton, children, href, iconLeft, iconRight, isJump, isRouterLink, label, type, ...others }: LinkProperties): JSXElement;
49
49
  export declare const LinkText: ({ children, ...others }: HTMLProps<HTMLSpanElement>) => JSX.Element;
50
50
  export declare const ListLink: (properties: LinkProperties) => JSXElement;
@@ -8,8 +8,9 @@ interface RadioProperties {
8
8
  disabled?: boolean;
9
9
  isLarge?: boolean;
10
10
  name?: string;
11
- labelClassName: string;
12
- labelInline: boolean /** Removes/Adds 'label__heading' class to the Label * */;
11
+ labelClassName?: string;
12
+ /** Removes/Adds 'label__heading' class to the Label. When true, uses inline label style. */
13
+ isLabelInline?: boolean;
13
14
  }
14
- export declare const RadioButton: ({ id, name, helperText, className, disabled, isLarge, labelClassName, labelInline, label, inputRef, ...properties }: JSX.IntrinsicElements["input"] & RadioProperties) => React.ReactElement;
15
+ export declare const RadioButton: ({ id, name, helperText, className, disabled, isLarge, labelClassName, isLabelInline, label, inputRef, ...properties }: JSX.IntrinsicElements["input"] & RadioProperties) => React.ReactElement;
15
16
  export default RadioButton;
@@ -8,6 +8,7 @@ export { ButtonGroup } from './components/Buttons/button-group';
8
8
  export { Checkbox } from './components/Checkbox/checkbox';
9
9
  export { Divider } from './components/Divider/divider';
10
10
  export { Expandable } from './components/Expandable/expandable';
11
+ export { Fieldset } from './components/Fieldset/fieldset';
11
12
  export { ExpandableGroup } from './components/Expandable/expandable-group';
12
13
  export { default as Footer } from './components/Footer/footer';
13
14
  export { FooterCfGov } from './components/Footer/footer-cf-gov';
@@ -21,7 +22,7 @@ export { default as Link, LinkText, ListLink } from './components/Link/link';
21
22
  export type { LinkProperties } from './components/Link/link';
22
23
  export { default as List } from './components/List/list';
23
24
  export { default as ListItem, ListItemBuilder, } from './components/List/list-item';
24
- export { default as PageHeader } from './components/PageHeader/page-header';
25
+ export { Header } from './components/Header/header';
25
26
  export { Pagination } from './components/Pagination/pagination';
26
27
  export { usePagination } from './components/Pagination/use-pagination';
27
28
  export { Paragraph } from './components/Paragraph/paragraph';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cfpb/design-system-react",
3
3
  "license": "MIT",
4
- "version": "0.0.15",
4
+ "version": "0.0.16",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/cfpb/design-system-react.git"
@@ -45,23 +45,25 @@
45
45
  "chromatic": "chromatic --storybook-build-dir dist-storybook --only-changed"
46
46
  },
47
47
  "dependencies": {
48
- "@cfpb/browserslist-config": "^0.0.6",
49
- "@cfpb/cfpb-design-system": "4.4.0",
50
48
  "react-select": "^5.10.2"
51
49
  },
52
50
  "peerDependencies": {
51
+ "@cfpb/cfpb-design-system": "4.4.0",
53
52
  "react": "^18.0.0 || ^19.0.0",
54
53
  "react-dom": "^18.0.0 || ^19.0.0",
55
54
  "react-router": "^7.13.0"
56
55
  },
57
56
  "devDependencies": {
57
+ "@cfpb/browserslist-config": "^0.0.6",
58
+ "@cfpb/cfpb-design-system": "4.4.0",
58
59
  "@chromatic-com/storybook": "^5.0.1",
59
60
  "@eslint/js": "^9.39.3",
60
61
  "@nabla/vite-plugin-eslint": "^2.0.6",
61
- "@storybook/addon-a11y": "^10.2.11",
62
- "@storybook/addon-docs": "^10.2.11",
63
- "@storybook/addon-links": "^10.2.11",
64
- "@storybook/react-vite": "^10.2.11",
62
+ "@storybook/addon-a11y": "^10.2.12",
63
+ "@storybook/addon-docs": "^10.2.12",
64
+ "@storybook/addon-links": "^10.2.12",
65
+ "@storybook/addon-vitest": "^10.2.12",
66
+ "@storybook/react-vite": "^10.2.12",
65
67
  "@testing-library/dom": "^10.4.1",
66
68
  "@testing-library/jest-dom": "^6.9.1",
67
69
  "@testing-library/react": "^16.3.2",
@@ -74,10 +76,11 @@
74
76
  "@typescript-eslint/eslint-plugin": "8.56.1",
75
77
  "@typescript-eslint/parser": "8.56.1",
76
78
  "@vitejs/plugin-react": "^5.1.4",
79
+ "@vitest/browser-playwright": "4.0.18",
77
80
  "@vitest/coverage-istanbul": "^4.0.18",
78
81
  "astring": "^1.9.0",
79
82
  "autoprefixer": "10.4.24",
80
- "chromatic": "^15.1.1",
83
+ "chromatic": "^15.2.0",
81
84
  "classnames": "^2.5.1",
82
85
  "commitizen": "4.3.1",
83
86
  "css-mediaquery": "0.1.2",
@@ -89,7 +92,7 @@
89
92
  "eslint-plugin-jsx-a11y": "^6.10.2",
90
93
  "eslint-plugin-react": "^7.37.5",
91
94
  "eslint-plugin-react-hooks": "^7.0.1",
92
- "eslint-plugin-storybook": "^10.2.11",
95
+ "eslint-plugin-storybook": "^10.2.12",
93
96
  "eslint-plugin-testing-library": "7.16.0",
94
97
  "eslint-plugin-unicorn": "^62.0.0",
95
98
  "globals": "^17.3.0",
@@ -98,6 +101,7 @@
98
101
  "jsdom": "28.1.0",
99
102
  "lint-staged": "16.2.7",
100
103
  "npm-run-all": "4.1.5",
104
+ "playwright": "^1.58.2",
101
105
  "postcss": "8.5.6",
102
106
  "prettier": "3.8.1",
103
107
  "react": "19.2.4",
@@ -105,9 +109,9 @@
105
109
  "react-router": "^7.13.1",
106
110
  "rollup-plugin-jsx-remove-attributes": "^3.1.2",
107
111
  "sass": "^1.97.3",
108
- "start-server-and-test": "2.1.3",
109
- "storybook": "^10.2.11",
110
- "stylelint": "^17.3.0",
112
+ "start-server-and-test": "2.1.5",
113
+ "storybook": "^10.2.12",
114
+ "stylelint": "^17.4.0",
111
115
  "stylelint-config-standard-scss": "^17.0.0",
112
116
  "typescript": "^5.9.3",
113
117
  "typescript-eslint": "^8.56.1",
@@ -1,8 +0,0 @@
1
- import { JSX } from 'react';
2
- interface PageHeaderProperties {
3
- links?: JSX.Element[];
4
- href?: string;
5
- withBottomBorder?: boolean;
6
- }
7
- export default function PageHeader({ links, href, withBottomBorder, }: PageHeaderProperties): JSX.Element;
8
- export {};