@nationaldesignstudio/react 0.0.1 → 0.0.3
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.
- package/README.md +54 -4
- package/dist/components/button/button.d.ts +29 -0
- package/dist/components/button/icon-button.d.ts +29 -0
- package/dist/components/card/card.d.ts +69 -0
- package/dist/components/hero/hero.d.ts +17 -0
- package/dist/components/navbar/navbar.d.ts +39 -0
- package/dist/components/prose/prose.d.ts +37 -0
- package/dist/components/us-gov-banner/us-gov-banner.d.ts +19 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.js +925 -576
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/button.d.ts +0 -28
package/README.md
CHANGED
|
@@ -69,11 +69,61 @@ The CSS includes all design tokens as CSS variables. Use them directly or via Ta
|
|
|
69
69
|
<div style={{ color: 'var(--color-blue-500)' }}>
|
|
70
70
|
Content
|
|
71
71
|
</div>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Breakpoints
|
|
75
|
+
|
|
76
|
+
The design system uses three responsive breakpoints:
|
|
77
|
+
|
|
78
|
+
| Breakpoint | Min Width | Tailwind Prefix |
|
|
79
|
+
|:-----------|:----------|:----------------|
|
|
80
|
+
| sm | 320px | (default) |
|
|
81
|
+
| md | 768px | `md:` |
|
|
82
|
+
| lg | 1440px | `lg:` |
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
// Responsive padding
|
|
86
|
+
<div className="p-4 md:p-8 lg:p-12">Content</div>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Typography
|
|
90
|
+
|
|
91
|
+
### Responsive Typography (Recommended)
|
|
92
|
+
|
|
93
|
+
Use responsive typography utilities that automatically scale across breakpoints:
|
|
72
94
|
|
|
73
|
-
|
|
74
|
-
<h1 className="
|
|
75
|
-
|
|
76
|
-
</
|
|
95
|
+
```tsx
|
|
96
|
+
<h1 className="typography-display-large">Responsive Display</h1>
|
|
97
|
+
<h2 className="typography-headline-medium">Responsive Headline</h2>
|
|
98
|
+
<p className="typography-body-medium">Responsive Body Text</p>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
These classes automatically apply:
|
|
102
|
+
- **Mobile (< 768px)**: `brand-small` typography
|
|
103
|
+
- **Tablet (768px+)**: `brand-medium` typography
|
|
104
|
+
- **Desktop (1440px+)**: `brand-large` typography
|
|
105
|
+
|
|
106
|
+
**Available utilities:**
|
|
107
|
+
|
|
108
|
+
| Category | Utilities |
|
|
109
|
+
|:---------|:----------|
|
|
110
|
+
| Display | `typography-display-hero`, `typography-display-xl`, `typography-display-large`, `typography-display-medium`, `typography-display-small` |
|
|
111
|
+
| Headline | `typography-headline-xl`, `typography-headline-large`, `typography-headline-medium`, `typography-headline-small` |
|
|
112
|
+
| Subheading | `typography-subheading-large`, `typography-subheading-medium`, `typography-subheading-small` |
|
|
113
|
+
| Body | `typography-body-large`, `typography-body-medium`, `typography-body-small` |
|
|
114
|
+
| Button | `typography-button-large`, `typography-button-medium`, `typography-button-small` |
|
|
115
|
+
| Label | `typography-label-large`, `typography-label-medium`, `typography-label-small` |
|
|
116
|
+
| Caption | `typography-caption-large`, `typography-caption-small` |
|
|
117
|
+
|
|
118
|
+
Weight variants: `typography-headline-medium-semibold`, `typography-display-hero-regular`, etc.
|
|
119
|
+
|
|
120
|
+
### Static Typography
|
|
121
|
+
|
|
122
|
+
For fixed typography that doesn't change with screen size:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
<h1 className="typography-brand-large-headline-medium">Always Large</h1>
|
|
126
|
+
<p className="typography-brand-small-body-medium">Always Small</p>
|
|
77
127
|
```
|
|
78
128
|
|
|
79
129
|
## Components
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Button component based on Figma BaseKit / Interface / Buttons
|
|
5
|
+
*
|
|
6
|
+
* Variants:
|
|
7
|
+
* - charcoal: Dark filled button (for light backgrounds)
|
|
8
|
+
* - charcoalOutline: Dark outlined button (for light backgrounds)
|
|
9
|
+
* - charcoalOutlineQuiet: Subtle dark outlined button (for light backgrounds)
|
|
10
|
+
* - ivory: Light filled button (for dark backgrounds)
|
|
11
|
+
* - ivoryOutline: Light outlined button (for dark backgrounds)
|
|
12
|
+
* - ivoryOutlineQuiet: Subtle light outlined button (for dark backgrounds)
|
|
13
|
+
*
|
|
14
|
+
* Sizes:
|
|
15
|
+
* - lg: Large buttons (46px height)
|
|
16
|
+
* - default: Medium buttons (38px height)
|
|
17
|
+
* - sm: Small buttons (33px height)
|
|
18
|
+
*
|
|
19
|
+
* For icon-only buttons, use the IconButton component instead.
|
|
20
|
+
*/
|
|
21
|
+
declare const buttonVariants: (props?: ({
|
|
22
|
+
variant?: "charcoal" | "charcoalOutline" | "charcoalOutlineQuiet" | "ivory" | "ivoryOutline" | "ivoryOutlineQuiet" | null | undefined;
|
|
23
|
+
size?: "lg" | "default" | "sm" | null | undefined;
|
|
24
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
25
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* IconButton component based on Figma BaseKit / Interface / Icon Button
|
|
5
|
+
*
|
|
6
|
+
* Variants:
|
|
7
|
+
* - charcoal: Dark filled button (for light backgrounds)
|
|
8
|
+
* - charcoalOutline: Dark outlined button (for light backgrounds)
|
|
9
|
+
* - charcoalOutlineQuiet: Subtle dark outlined button (for light backgrounds)
|
|
10
|
+
* - ghost: No background/border, just icon (for light backgrounds)
|
|
11
|
+
* - ghostDark: No background/border, just icon (for dark backgrounds)
|
|
12
|
+
* - ivory: Light filled button (for dark backgrounds)
|
|
13
|
+
* - ivoryOutline: Light outlined button (for dark backgrounds)
|
|
14
|
+
* - ivoryOutlineQuiet: Subtle light outlined button (for dark backgrounds)
|
|
15
|
+
*
|
|
16
|
+
* Sizes:
|
|
17
|
+
* - lg: Large (46x46)
|
|
18
|
+
* - default: Medium (36x36)
|
|
19
|
+
* - sm: Small (29x29)
|
|
20
|
+
*/
|
|
21
|
+
declare const iconButtonVariants: (props?: ({
|
|
22
|
+
variant?: "charcoal" | "charcoalOutline" | "charcoalOutlineQuiet" | "ivory" | "ivoryOutline" | "ivoryOutlineQuiet" | "ghost" | "ghostDark" | null | undefined;
|
|
23
|
+
size?: "lg" | "default" | "sm" | null | undefined;
|
|
24
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
25
|
+
export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof iconButtonVariants> {
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
29
|
+
export { IconButton, iconButtonVariants };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const cardVariants: (props?: ({
|
|
4
|
+
layout?: "vertical" | "horizontal" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export interface CardProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof cardVariants> {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Card component for displaying content in a contained, scannable format.
|
|
10
|
+
*
|
|
11
|
+
* Layouts:
|
|
12
|
+
* - vertical: Image on top, content below (default)
|
|
13
|
+
* - horizontal: Image on left, content on right
|
|
14
|
+
*
|
|
15
|
+
* Use with CardImage, CardContent, CardEyebrow, CardTitle, CardDescription, and CardActions.
|
|
16
|
+
*/
|
|
17
|
+
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export interface CardImageProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
19
|
+
/**
|
|
20
|
+
* The image source URL
|
|
21
|
+
*/
|
|
22
|
+
src?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Alt text for the image
|
|
25
|
+
*/
|
|
26
|
+
alt?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Card image area. For vertical layout, displays with 16:9 aspect ratio.
|
|
30
|
+
* For horizontal layout, takes up ~40% width and stretches to content height.
|
|
31
|
+
*/
|
|
32
|
+
declare const CardImage: React.ForwardRefExoticComponent<CardImageProps & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
export interface CardContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Card content container with proper padding and spacing.
|
|
37
|
+
*/
|
|
38
|
+
declare const CardContent: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
export interface CardEyebrowProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Optional eyebrow text above the card title.
|
|
43
|
+
*/
|
|
44
|
+
declare const CardEyebrow: React.ForwardRefExoticComponent<CardEyebrowProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
45
|
+
export interface CardTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Card title/heading.
|
|
49
|
+
*/
|
|
50
|
+
declare const CardTitle: React.ForwardRefExoticComponent<CardTitleProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
51
|
+
export interface CardDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Card body/description text.
|
|
55
|
+
*/
|
|
56
|
+
declare const CardDescription: React.ForwardRefExoticComponent<CardDescriptionProps & React.RefAttributes<HTMLParagraphElement>>;
|
|
57
|
+
export interface CardBodyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Container for card text content (eyebrow, title, description).
|
|
61
|
+
*/
|
|
62
|
+
declare const CardBody: React.ForwardRefExoticComponent<CardBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
63
|
+
export interface CardActionsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Container for card action buttons.
|
|
67
|
+
*/
|
|
68
|
+
declare const CardActions: React.ForwardRefExoticComponent<CardActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
69
|
+
export { Card, cardVariants, CardImage, CardContent, CardEyebrow, CardTitle, CardDescription, CardBody, CardActions, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface HeroProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
/**
|
|
4
|
+
* The title text displayed in the hero
|
|
5
|
+
*/
|
|
6
|
+
title: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hero component for page headers with large display typography.
|
|
10
|
+
*
|
|
11
|
+
* Features responsive sizing:
|
|
12
|
+
* - Desktop (1440px+): 850px height, 64px padding, 192px typography
|
|
13
|
+
* - Tablet (768px+): 650px height, 56px padding, 148px typography
|
|
14
|
+
* - Mobile: 500px height, 20px padding, 64px typography
|
|
15
|
+
*/
|
|
16
|
+
declare const Hero: React.ForwardRefExoticComponent<HeroProps & React.RefAttributes<HTMLElement>>;
|
|
17
|
+
export { Hero };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface NavbarProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Main navigation bar container.
|
|
6
|
+
* Provides responsive layout for brand, links, and actions.
|
|
7
|
+
*/
|
|
8
|
+
declare const Navbar: React.ForwardRefExoticComponent<NavbarProps & React.RefAttributes<HTMLElement>>;
|
|
9
|
+
export interface NavbarBrandProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Brand/logo area of the navbar.
|
|
14
|
+
* Use asChild to render as a link.
|
|
15
|
+
*/
|
|
16
|
+
declare const NavbarBrand: React.ForwardRefExoticComponent<NavbarBrandProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export interface NavbarLinksProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Container for navigation links.
|
|
21
|
+
* Centers links on desktop, hidden on mobile (use NavbarMobileMenu instead).
|
|
22
|
+
*/
|
|
23
|
+
declare const NavbarLinks: React.ForwardRefExoticComponent<NavbarLinksProps & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export interface NavbarLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
25
|
+
asChild?: boolean;
|
|
26
|
+
active?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Individual navigation link.
|
|
30
|
+
* Use asChild to render with a router Link component.
|
|
31
|
+
*/
|
|
32
|
+
declare const NavbarLink: React.ForwardRefExoticComponent<NavbarLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
33
|
+
export interface NavbarActionsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Container for navbar action items (search, menu button, etc).
|
|
37
|
+
*/
|
|
38
|
+
declare const NavbarActions: React.ForwardRefExoticComponent<NavbarActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
export { Navbar, NavbarBrand, NavbarLinks, NavbarLink, NavbarActions };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ProseProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Prose container for long-form content with proper typography and spacing.
|
|
7
|
+
*
|
|
8
|
+
* Provides responsive spacing between content blocks:
|
|
9
|
+
* - Desktop (1440px+): 96px gap
|
|
10
|
+
* - Tablet (768px+): 72px gap
|
|
11
|
+
* - Mobile: 56px gap
|
|
12
|
+
*
|
|
13
|
+
* Use with ProseSection components for proper content structure.
|
|
14
|
+
*/
|
|
15
|
+
declare const Prose: React.ForwardRefExoticComponent<ProseProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export interface ProseSectionProps extends React.HTMLAttributes<HTMLElement> {
|
|
17
|
+
/**
|
|
18
|
+
* The heading text for this section
|
|
19
|
+
*/
|
|
20
|
+
heading: string;
|
|
21
|
+
/**
|
|
22
|
+
* The heading level to render (h2 or h3)
|
|
23
|
+
* @default "h2"
|
|
24
|
+
*/
|
|
25
|
+
as?: "h2" | "h3";
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A section within Prose content, containing a heading and body text.
|
|
30
|
+
*
|
|
31
|
+
* Responsive typography:
|
|
32
|
+
* - h2: Uses typography-headline-medium (42px mobile → 56px tablet → 72px desktop)
|
|
33
|
+
* - h3: Uses typography-headline-small (32px mobile → 42px tablet → 56px desktop)
|
|
34
|
+
* - Body: Uses typography-body-medium (16px mobile/tablet → 18px desktop)
|
|
35
|
+
*/
|
|
36
|
+
declare const ProseSection: React.ForwardRefExoticComponent<ProseSectionProps & React.RefAttributes<HTMLElement>>;
|
|
37
|
+
export { Prose, ProseSection };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface USGovBannerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Custom flag icon element. Defaults to a US flag SVG.
|
|
5
|
+
*/
|
|
6
|
+
flagIcon?: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Banner text content
|
|
9
|
+
* @default "An official website of the United States government"
|
|
10
|
+
*/
|
|
11
|
+
text?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* US Government official website banner.
|
|
15
|
+
* Displays the official government website notice with flag icon.
|
|
16
|
+
* Commonly placed at the very top of government websites.
|
|
17
|
+
*/
|
|
18
|
+
declare const USGovBanner: React.ForwardRefExoticComponent<USGovBannerProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export { USGovBanner };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
export type { ButtonProps } from './components/button';
|
|
2
|
-
export { Button, buttonVariants } from './components/button';
|
|
1
|
+
export type { ButtonProps, IconButtonProps } from './components/button';
|
|
2
|
+
export { Button, buttonVariants, IconButton, iconButtonVariants, } from './components/button';
|
|
3
|
+
export type { CardActionsProps, CardBodyProps, CardContentProps, CardDescriptionProps, CardEyebrowProps, CardImageProps, CardProps, CardTitleProps, } from './components/card';
|
|
4
|
+
export { Card, CardActions, CardBody, CardContent, CardDescription, CardEyebrow, CardImage, CardTitle, cardVariants, } from './components/card';
|
|
5
|
+
export type { HeroProps } from './components/hero';
|
|
6
|
+
export { Hero } from './components/hero';
|
|
7
|
+
export type { NavbarActionsProps, NavbarBrandProps, NavbarLinkProps, NavbarLinksProps, NavbarProps, } from './components/navbar';
|
|
8
|
+
export { Navbar, NavbarActions, NavbarBrand, NavbarLink, NavbarLinks, } from './components/navbar';
|
|
9
|
+
export type { ProseProps, ProseSectionProps } from './components/prose';
|
|
10
|
+
export { Prose, ProseSection } from './components/prose';
|
|
11
|
+
export type { USGovBannerProps } from './components/us-gov-banner';
|
|
12
|
+
export { USGovBanner } from './components/us-gov-banner';
|
|
3
13
|
export { cn } from './lib/utils';
|