@nationaldesignstudio/react 0.0.10 → 0.0.11
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/dist/component-registry.md +2405 -0
- package/dist/components/atoms/accordion/accordion.d.ts +44 -3
- package/dist/components/atoms/button/button.d.ts +155 -11
- package/dist/components/atoms/button/icon-button.d.ts +114 -5
- package/dist/components/atoms/ndstudio-footer/ndstudio-footer.d.ts +30 -0
- package/dist/components/atoms/pager-control/pager-control.d.ts +116 -9
- package/dist/components/dev-tools/dev-toolbar/dev-toolbar.d.ts +4 -0
- package/dist/components/dev-tools/grid-overlay/grid-overlay.d.ts +6 -0
- package/dist/components/organisms/card/card.d.ts +40 -4
- package/dist/components/sections/banner/banner.d.ts +39 -6
- package/dist/components/sections/card-grid/card-grid.d.ts +37 -4
- package/dist/components/sections/faq-section/faq-section.d.ts +2 -2
- package/dist/components/sections/hero/hero.d.ts +167 -16
- package/dist/components/sections/river/river.d.ts +37 -4
- package/dist/components/sections/tout/tout.d.ts +86 -6
- package/dist/components/sections/two-column-section/two-column-section.d.ts +80 -6
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-event-listener.d.ts +24 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +12034 -5934
- package/dist/index.js.map +1 -1
- package/dist/lib/theme.d.ts +330 -0
- package/dist/tokens.css +13650 -6129
- package/package.json +11 -21
- package/src/App.css +0 -0
- package/src/App.tsx +0 -7
- package/src/assets/fonts/PPNeueMontreal-Variable.woff2 +0 -0
- package/src/assets/react.svg +0 -1
- package/src/components/atoms/accordion/accordion.stories.tsx +0 -228
- package/src/components/atoms/accordion/accordion.tsx +0 -137
- package/src/components/atoms/accordion/index.ts +0 -6
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-linux.png +0 -0
- package/src/components/atoms/button/button.stories.tsx +0 -84
- package/src/components/atoms/button/button.test.tsx +0 -141
- package/src/components/atoms/button/button.tsx +0 -95
- package/src/components/atoms/button/button.visual.test.tsx +0 -102
- package/src/components/atoms/button/icon-button.stories.tsx +0 -166
- package/src/components/atoms/button/icon-button.tsx +0 -125
- package/src/components/atoms/button/index.ts +0 -6
- package/src/components/atoms/pager-control/index.ts +0 -5
- package/src/components/atoms/pager-control/pager-control.stories.tsx +0 -209
- package/src/components/atoms/pager-control/pager-control.test.tsx +0 -149
- package/src/components/atoms/pager-control/pager-control.tsx +0 -328
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-linux.png +0 -0
- package/src/components/organisms/card/card.stories.tsx +0 -293
- package/src/components/organisms/card/card.test.tsx +0 -245
- package/src/components/organisms/card/card.tsx +0 -227
- package/src/components/organisms/card/card.visual.test.tsx +0 -197
- package/src/components/organisms/card/index.ts +0 -19
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/index.ts +0 -18
- package/src/components/organisms/navbar/navbar.stories.tsx +0 -313
- package/src/components/organisms/navbar/navbar.test.tsx +0 -190
- package/src/components/organisms/navbar/navbar.tsx +0 -317
- package/src/components/organisms/navbar/navbar.visual.test.tsx +0 -85
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/index.ts +0 -1
- package/src/components/organisms/us-gov-banner/us-gov-banner.stories.tsx +0 -35
- package/src/components/organisms/us-gov-banner/us-gov-banner.test.tsx +0 -107
- package/src/components/organisms/us-gov-banner/us-gov-banner.tsx +0 -73
- package/src/components/organisms/us-gov-banner/us-gov-banner.visual.test.tsx +0 -46
- package/src/components/sections/banner/banner.stories.tsx +0 -150
- package/src/components/sections/banner/banner.test.tsx +0 -185
- package/src/components/sections/banner/banner.tsx +0 -130
- package/src/components/sections/banner/index.ts +0 -2
- package/src/components/sections/card-grid/card-grid.stories.tsx +0 -351
- package/src/components/sections/card-grid/card-grid.tsx +0 -118
- package/src/components/sections/card-grid/index.ts +0 -1
- package/src/components/sections/faq-section/faq-section.tsx +0 -77
- package/src/components/sections/faq-section/index.ts +0 -2
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-default-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-linux.png +0 -0
- package/src/components/sections/hero/hero.stories.tsx +0 -145
- package/src/components/sections/hero/hero.test.tsx +0 -135
- package/src/components/sections/hero/hero.tsx +0 -191
- package/src/components/sections/hero/hero.visual.test.tsx +0 -140
- package/src/components/sections/hero/index.ts +0 -1
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-linux.png +0 -0
- package/src/components/sections/prose/index.ts +0 -6
- package/src/components/sections/prose/prose.stories.tsx +0 -144
- package/src/components/sections/prose/prose.test.tsx +0 -178
- package/src/components/sections/prose/prose.tsx +0 -88
- package/src/components/sections/prose/prose.visual.test.tsx +0 -105
- package/src/components/sections/river/index.ts +0 -1
- package/src/components/sections/river/river.stories.tsx +0 -237
- package/src/components/sections/river/river.test.tsx +0 -268
- package/src/components/sections/river/river.tsx +0 -175
- package/src/components/sections/tout/index.ts +0 -1
- package/src/components/sections/tout/tout.stories.tsx +0 -154
- package/src/components/sections/tout/tout.test.tsx +0 -242
- package/src/components/sections/tout/tout.tsx +0 -206
- package/src/components/sections/two-column-section/index.ts +0 -5
- package/src/components/sections/two-column-section/two-column-section.stories.tsx +0 -285
- package/src/components/sections/two-column-section/two-column-section.tsx +0 -152
- package/src/index.ts +0 -98
- package/src/lib/utils.ts +0 -6
- package/src/main.tsx +0 -13
- package/src/stories/Introduction.mdx +0 -114
- package/src/stories/TokenShowcase.stories.tsx +0 -92
- package/src/stories/TokenShowcase.tsx +0 -1352
- package/src/styles.css +0 -11
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { IconButton } from "../../atoms/button/icon-button";
|
|
3
|
-
import { USGovBanner } from "../us-gov-banner";
|
|
4
|
-
import {
|
|
5
|
-
Navbar,
|
|
6
|
-
NavbarActions,
|
|
7
|
-
NavbarBrand,
|
|
8
|
-
NavbarLink,
|
|
9
|
-
NavbarLinks,
|
|
10
|
-
NavbarMobileMenu,
|
|
11
|
-
NavbarMobileMenuButton,
|
|
12
|
-
NavbarMobileMenuLink,
|
|
13
|
-
} from ".";
|
|
14
|
-
|
|
15
|
-
const meta: Meta<typeof Navbar> = {
|
|
16
|
-
title: "Organisms/Navbar",
|
|
17
|
-
component: Navbar,
|
|
18
|
-
parameters: {
|
|
19
|
-
layout: "fullscreen",
|
|
20
|
-
},
|
|
21
|
-
} as Meta<typeof Navbar>;
|
|
22
|
-
|
|
23
|
-
export default meta;
|
|
24
|
-
type Story = StoryObj<typeof Navbar>;
|
|
25
|
-
|
|
26
|
-
const SearchIcon = () => (
|
|
27
|
-
<svg
|
|
28
|
-
width="17"
|
|
29
|
-
height="17"
|
|
30
|
-
viewBox="0 0 17 17"
|
|
31
|
-
fill="none"
|
|
32
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
33
|
-
aria-hidden="true"
|
|
34
|
-
>
|
|
35
|
-
<circle cx="7" cy="7" r="5.5" stroke="currentColor" strokeWidth="1.5" />
|
|
36
|
-
<path
|
|
37
|
-
d="M11 11L15 15"
|
|
38
|
-
stroke="currentColor"
|
|
39
|
-
strokeWidth="1.5"
|
|
40
|
-
strokeLinecap="round"
|
|
41
|
-
/>
|
|
42
|
-
</svg>
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const MenuIcon = () => (
|
|
46
|
-
<svg
|
|
47
|
-
width="20"
|
|
48
|
-
height="20"
|
|
49
|
-
viewBox="0 0 20 20"
|
|
50
|
-
fill="none"
|
|
51
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
52
|
-
aria-hidden="true"
|
|
53
|
-
>
|
|
54
|
-
<path
|
|
55
|
-
d="M3 5H17M3 10H17M3 15H17"
|
|
56
|
-
stroke="currentColor"
|
|
57
|
-
strokeWidth="1.5"
|
|
58
|
-
strokeLinecap="round"
|
|
59
|
-
/>
|
|
60
|
-
</svg>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const BrandPlaceholder = () => (
|
|
64
|
-
<div className="size-[46px] rounded-[8px] bg-gray-300" />
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
// =============================================================================
|
|
68
|
-
// Default
|
|
69
|
-
// =============================================================================
|
|
70
|
-
|
|
71
|
-
export const Default: Story = {
|
|
72
|
-
render: () => (
|
|
73
|
-
<Navbar>
|
|
74
|
-
<NavbarBrand>
|
|
75
|
-
<BrandPlaceholder />
|
|
76
|
-
</NavbarBrand>
|
|
77
|
-
<NavbarLinks>
|
|
78
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
79
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
80
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
81
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
82
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
83
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
84
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
85
|
-
</NavbarLinks>
|
|
86
|
-
<NavbarActions>
|
|
87
|
-
<IconButton variant="ghost" size="lg" aria-label="Search">
|
|
88
|
-
<SearchIcon />
|
|
89
|
-
</IconButton>
|
|
90
|
-
</NavbarActions>
|
|
91
|
-
</Navbar>
|
|
92
|
-
),
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
// =============================================================================
|
|
96
|
-
// With US Gov Banner
|
|
97
|
-
// =============================================================================
|
|
98
|
-
|
|
99
|
-
export const WithUSGovBanner: Story = {
|
|
100
|
-
render: () => (
|
|
101
|
-
<div className="flex w-full flex-col">
|
|
102
|
-
<USGovBanner />
|
|
103
|
-
<Navbar>
|
|
104
|
-
<NavbarBrand>
|
|
105
|
-
<BrandPlaceholder />
|
|
106
|
-
</NavbarBrand>
|
|
107
|
-
<NavbarLinks>
|
|
108
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
109
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
110
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
111
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
112
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
113
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
114
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
115
|
-
</NavbarLinks>
|
|
116
|
-
<NavbarActions>
|
|
117
|
-
<IconButton variant="ivoryOutlineQuiet" size="lg" aria-label="Search">
|
|
118
|
-
<SearchIcon />
|
|
119
|
-
</IconButton>
|
|
120
|
-
</NavbarActions>
|
|
121
|
-
</Navbar>
|
|
122
|
-
</div>
|
|
123
|
-
),
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// =============================================================================
|
|
127
|
-
// Responsive Variants
|
|
128
|
-
// =============================================================================
|
|
129
|
-
|
|
130
|
-
export const Desktop: Story = {
|
|
131
|
-
render: () => (
|
|
132
|
-
<div className="flex w-full flex-col">
|
|
133
|
-
<USGovBanner />
|
|
134
|
-
<Navbar>
|
|
135
|
-
<NavbarBrand>
|
|
136
|
-
<BrandPlaceholder />
|
|
137
|
-
</NavbarBrand>
|
|
138
|
-
<NavbarLinks>
|
|
139
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
140
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
141
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
142
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
143
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
144
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
145
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
146
|
-
</NavbarLinks>
|
|
147
|
-
<NavbarActions>
|
|
148
|
-
<IconButton variant="ivoryOutlineQuiet" size="lg" aria-label="Search">
|
|
149
|
-
<SearchIcon />
|
|
150
|
-
</IconButton>
|
|
151
|
-
</NavbarActions>
|
|
152
|
-
</Navbar>
|
|
153
|
-
</div>
|
|
154
|
-
),
|
|
155
|
-
globals: {
|
|
156
|
-
viewport: { value: "lg", isRotated: false },
|
|
157
|
-
},
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export const Tablet: Story = {
|
|
161
|
-
render: () => (
|
|
162
|
-
<div className="flex w-full flex-col">
|
|
163
|
-
<USGovBanner />
|
|
164
|
-
<Navbar>
|
|
165
|
-
<NavbarBrand>
|
|
166
|
-
<BrandPlaceholder />
|
|
167
|
-
</NavbarBrand>
|
|
168
|
-
<NavbarLinks>
|
|
169
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
170
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
171
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
172
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
173
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
174
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
175
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
176
|
-
</NavbarLinks>
|
|
177
|
-
<NavbarActions>
|
|
178
|
-
<IconButton variant="ghost" size="default" aria-label="Search">
|
|
179
|
-
<SearchIcon />
|
|
180
|
-
</IconButton>
|
|
181
|
-
</NavbarActions>
|
|
182
|
-
</Navbar>
|
|
183
|
-
</div>
|
|
184
|
-
),
|
|
185
|
-
globals: {
|
|
186
|
-
viewport: { value: "md", isRotated: false },
|
|
187
|
-
},
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export const Mobile: Story = {
|
|
191
|
-
render: () => (
|
|
192
|
-
<div className="flex w-full flex-col">
|
|
193
|
-
<USGovBanner />
|
|
194
|
-
<Navbar>
|
|
195
|
-
<NavbarBrand>
|
|
196
|
-
<div className="size-[26px] rounded-[8px] bg-gray-300" />
|
|
197
|
-
</NavbarBrand>
|
|
198
|
-
<NavbarLinks>
|
|
199
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
200
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
201
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
202
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
203
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
204
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
205
|
-
<NavbarLink href="#">Link</NavbarLink>
|
|
206
|
-
</NavbarLinks>
|
|
207
|
-
<NavbarActions>
|
|
208
|
-
<NavbarMobileMenuButton asChild>
|
|
209
|
-
<IconButton variant="ghost" size="default" aria-label="Menu">
|
|
210
|
-
<MenuIcon />
|
|
211
|
-
</IconButton>
|
|
212
|
-
</NavbarMobileMenuButton>
|
|
213
|
-
</NavbarActions>
|
|
214
|
-
<NavbarMobileMenu>
|
|
215
|
-
<NavbarMobileMenuLink href="#">Home</NavbarMobileMenuLink>
|
|
216
|
-
<NavbarMobileMenuLink href="#">About</NavbarMobileMenuLink>
|
|
217
|
-
<NavbarMobileMenuLink href="#">Services</NavbarMobileMenuLink>
|
|
218
|
-
<NavbarMobileMenuLink href="#">Resources</NavbarMobileMenuLink>
|
|
219
|
-
<NavbarMobileMenuLink href="#">News</NavbarMobileMenuLink>
|
|
220
|
-
<NavbarMobileMenuLink href="#">Careers</NavbarMobileMenuLink>
|
|
221
|
-
<NavbarMobileMenuLink href="#">Contact</NavbarMobileMenuLink>
|
|
222
|
-
</NavbarMobileMenu>
|
|
223
|
-
</Navbar>
|
|
224
|
-
</div>
|
|
225
|
-
),
|
|
226
|
-
globals: {
|
|
227
|
-
viewport: { value: "sm", isRotated: false },
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
// =============================================================================
|
|
232
|
-
// With Active Link
|
|
233
|
-
// =============================================================================
|
|
234
|
-
|
|
235
|
-
export const WithActiveLink: Story = {
|
|
236
|
-
render: () => (
|
|
237
|
-
<Navbar>
|
|
238
|
-
<NavbarBrand>
|
|
239
|
-
<BrandPlaceholder />
|
|
240
|
-
</NavbarBrand>
|
|
241
|
-
<NavbarLinks>
|
|
242
|
-
<NavbarLink href="#" active>
|
|
243
|
-
Home
|
|
244
|
-
</NavbarLink>
|
|
245
|
-
<NavbarLink href="#">About</NavbarLink>
|
|
246
|
-
<NavbarLink href="#">Services</NavbarLink>
|
|
247
|
-
<NavbarLink href="#">Contact</NavbarLink>
|
|
248
|
-
</NavbarLinks>
|
|
249
|
-
<NavbarActions>
|
|
250
|
-
<IconButton variant="ghost" size="lg" aria-label="Search">
|
|
251
|
-
<SearchIcon />
|
|
252
|
-
</IconButton>
|
|
253
|
-
</NavbarActions>
|
|
254
|
-
</Navbar>
|
|
255
|
-
),
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
// =============================================================================
|
|
259
|
-
// Responsive with Mobile Menu
|
|
260
|
-
// =============================================================================
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Complete responsive navbar example.
|
|
264
|
-
* - Desktop: Shows inline links
|
|
265
|
-
* - Mobile: Shows hamburger menu that opens a full-screen navigation
|
|
266
|
-
*
|
|
267
|
-
* Resize the viewport or view in different viewport sizes to see the responsive behavior.
|
|
268
|
-
*/
|
|
269
|
-
export const ResponsiveWithMobileMenu: Story = {
|
|
270
|
-
render: () => (
|
|
271
|
-
<div className="flex w-full flex-col">
|
|
272
|
-
<USGovBanner />
|
|
273
|
-
<Navbar>
|
|
274
|
-
<NavbarBrand>
|
|
275
|
-
<BrandPlaceholder />
|
|
276
|
-
</NavbarBrand>
|
|
277
|
-
<NavbarLinks>
|
|
278
|
-
<NavbarLink href="#" active>
|
|
279
|
-
Home
|
|
280
|
-
</NavbarLink>
|
|
281
|
-
<NavbarLink href="#">About</NavbarLink>
|
|
282
|
-
<NavbarLink href="#">Services</NavbarLink>
|
|
283
|
-
<NavbarLink href="#">Resources</NavbarLink>
|
|
284
|
-
<NavbarLink href="#">Contact</NavbarLink>
|
|
285
|
-
</NavbarLinks>
|
|
286
|
-
<NavbarActions>
|
|
287
|
-
<IconButton
|
|
288
|
-
variant="ghost"
|
|
289
|
-
size="lg"
|
|
290
|
-
aria-label="Search"
|
|
291
|
-
className="hidden md:flex"
|
|
292
|
-
>
|
|
293
|
-
<SearchIcon />
|
|
294
|
-
</IconButton>
|
|
295
|
-
<NavbarMobileMenuButton asChild>
|
|
296
|
-
<IconButton variant="ghost" size="default" aria-label="Menu">
|
|
297
|
-
<MenuIcon />
|
|
298
|
-
</IconButton>
|
|
299
|
-
</NavbarMobileMenuButton>
|
|
300
|
-
</NavbarActions>
|
|
301
|
-
<NavbarMobileMenu>
|
|
302
|
-
<NavbarMobileMenuLink href="#" active>
|
|
303
|
-
Home
|
|
304
|
-
</NavbarMobileMenuLink>
|
|
305
|
-
<NavbarMobileMenuLink href="#">About</NavbarMobileMenuLink>
|
|
306
|
-
<NavbarMobileMenuLink href="#">Services</NavbarMobileMenuLink>
|
|
307
|
-
<NavbarMobileMenuLink href="#">Resources</NavbarMobileMenuLink>
|
|
308
|
-
<NavbarMobileMenuLink href="#">Contact</NavbarMobileMenuLink>
|
|
309
|
-
</NavbarMobileMenu>
|
|
310
|
-
</Navbar>
|
|
311
|
-
</div>
|
|
312
|
-
),
|
|
313
|
-
};
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import { page } from "vitest/browser";
|
|
3
|
-
import { render } from "vitest-browser-react";
|
|
4
|
-
import { Button } from "../../atoms/button";
|
|
5
|
-
import {
|
|
6
|
-
Navbar,
|
|
7
|
-
NavbarActions,
|
|
8
|
-
NavbarBrand,
|
|
9
|
-
NavbarLink,
|
|
10
|
-
NavbarLinks,
|
|
11
|
-
} from "./navbar";
|
|
12
|
-
|
|
13
|
-
describe("Navbar", () => {
|
|
14
|
-
describe("Accessibility", () => {
|
|
15
|
-
test("renders as nav landmark", async () => {
|
|
16
|
-
render(
|
|
17
|
-
<Navbar>
|
|
18
|
-
<NavbarBrand>Logo</NavbarBrand>
|
|
19
|
-
</Navbar>,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
await expect.element(page.getByRole("navigation")).toBeInTheDocument();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
test("links are accessible", async () => {
|
|
26
|
-
// NavbarLinks is hidden at mobile viewport, set to desktop
|
|
27
|
-
await page.viewport(1280, 800);
|
|
28
|
-
|
|
29
|
-
render(
|
|
30
|
-
<Navbar>
|
|
31
|
-
<NavbarLinks>
|
|
32
|
-
<NavbarLink href="/home">Home</NavbarLink>
|
|
33
|
-
<NavbarLink href="/about">About</NavbarLink>
|
|
34
|
-
</NavbarLinks>
|
|
35
|
-
</Navbar>,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
await expect
|
|
39
|
-
.element(page.getByRole("link", { name: "Home" }))
|
|
40
|
-
.toBeInTheDocument();
|
|
41
|
-
await expect
|
|
42
|
-
.element(page.getByRole("link", { name: "About" }))
|
|
43
|
-
.toBeInTheDocument();
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test("links have correct href attributes", async () => {
|
|
47
|
-
// NavbarLinks is hidden at mobile viewport, set to desktop
|
|
48
|
-
await page.viewport(1280, 800);
|
|
49
|
-
|
|
50
|
-
render(
|
|
51
|
-
<Navbar>
|
|
52
|
-
<NavbarLinks>
|
|
53
|
-
<NavbarLink href="/test-page">Test Link</NavbarLink>
|
|
54
|
-
</NavbarLinks>
|
|
55
|
-
</Navbar>,
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
await expect
|
|
59
|
-
.element(page.getByRole("link", { name: "Test Link" }))
|
|
60
|
-
.toHaveAttribute("href", "/test-page");
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test("buttons in actions are accessible", async () => {
|
|
64
|
-
render(
|
|
65
|
-
<Navbar>
|
|
66
|
-
<NavbarActions>
|
|
67
|
-
<Button>Sign In</Button>
|
|
68
|
-
</NavbarActions>
|
|
69
|
-
</Navbar>,
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
await expect
|
|
73
|
-
.element(page.getByRole("button", { name: "Sign In" }))
|
|
74
|
-
.toBeInTheDocument();
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
describe("NavbarLink", () => {
|
|
79
|
-
test("active link has different styling", async () => {
|
|
80
|
-
// NavbarLinks is hidden at mobile viewport, set to desktop
|
|
81
|
-
await page.viewport(1280, 800);
|
|
82
|
-
|
|
83
|
-
render(
|
|
84
|
-
<Navbar>
|
|
85
|
-
<NavbarLinks>
|
|
86
|
-
<NavbarLink href="#" active data-testid="active-link">
|
|
87
|
-
Active
|
|
88
|
-
</NavbarLink>
|
|
89
|
-
<NavbarLink href="#" data-testid="inactive-link">
|
|
90
|
-
Inactive
|
|
91
|
-
</NavbarLink>
|
|
92
|
-
</NavbarLinks>
|
|
93
|
-
</Navbar>,
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
const activeLink = page.getByTestId("active-link");
|
|
97
|
-
await expect.element(activeLink).toHaveClass(/text-gray-1100/);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
test("supports asChild prop for router links", async () => {
|
|
101
|
-
// NavbarLinks is hidden at mobile viewport, set to desktop
|
|
102
|
-
await page.viewport(1280, 800);
|
|
103
|
-
|
|
104
|
-
render(
|
|
105
|
-
<Navbar>
|
|
106
|
-
<NavbarLinks>
|
|
107
|
-
<NavbarLink asChild>
|
|
108
|
-
<a href="/custom">Custom Link</a>
|
|
109
|
-
</NavbarLink>
|
|
110
|
-
</NavbarLinks>
|
|
111
|
-
</Navbar>,
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
await expect
|
|
115
|
-
.element(page.getByRole("link", { name: "Custom Link" }))
|
|
116
|
-
.toHaveAttribute("href", "/custom");
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
describe("NavbarBrand", () => {
|
|
121
|
-
test("renders brand content", async () => {
|
|
122
|
-
render(
|
|
123
|
-
<Navbar>
|
|
124
|
-
<NavbarBrand>
|
|
125
|
-
<span>My Brand</span>
|
|
126
|
-
</NavbarBrand>
|
|
127
|
-
</Navbar>,
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
await expect.element(page.getByText("My Brand")).toBeInTheDocument();
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
test("supports asChild for link brands", async () => {
|
|
134
|
-
render(
|
|
135
|
-
<Navbar>
|
|
136
|
-
<NavbarBrand asChild>
|
|
137
|
-
<a href="/">Home Brand</a>
|
|
138
|
-
</NavbarBrand>
|
|
139
|
-
</Navbar>,
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
await expect
|
|
143
|
-
.element(page.getByRole("link", { name: "Home Brand" }))
|
|
144
|
-
.toHaveAttribute("href", "/");
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
describe("Composition", () => {
|
|
149
|
-
test("renders complete navbar with all components", async () => {
|
|
150
|
-
// NavbarLinks is hidden at mobile viewport, set to desktop
|
|
151
|
-
await page.viewport(1280, 800);
|
|
152
|
-
|
|
153
|
-
render(
|
|
154
|
-
<Navbar>
|
|
155
|
-
<NavbarBrand>Logo</NavbarBrand>
|
|
156
|
-
<NavbarLinks>
|
|
157
|
-
<NavbarLink href="#">Link 1</NavbarLink>
|
|
158
|
-
<NavbarLink href="#">Link 2</NavbarLink>
|
|
159
|
-
</NavbarLinks>
|
|
160
|
-
<NavbarActions>
|
|
161
|
-
<Button>Action</Button>
|
|
162
|
-
</NavbarActions>
|
|
163
|
-
</Navbar>,
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
await expect.element(page.getByRole("navigation")).toBeInTheDocument();
|
|
167
|
-
await expect.element(page.getByText("Logo")).toBeInTheDocument();
|
|
168
|
-
await expect
|
|
169
|
-
.element(page.getByRole("link", { name: "Link 1" }))
|
|
170
|
-
.toBeInTheDocument();
|
|
171
|
-
await expect
|
|
172
|
-
.element(page.getByRole("link", { name: "Link 2" }))
|
|
173
|
-
.toBeInTheDocument();
|
|
174
|
-
await expect
|
|
175
|
-
.element(page.getByRole("button", { name: "Action" }))
|
|
176
|
-
.toBeInTheDocument();
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
test("supports custom className on Navbar", async () => {
|
|
180
|
-
render(
|
|
181
|
-
<Navbar className="custom-navbar" data-testid="navbar">
|
|
182
|
-
<NavbarBrand>Logo</NavbarBrand>
|
|
183
|
-
</Navbar>,
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
const navbar = page.getByTestId("navbar");
|
|
187
|
-
await expect.element(navbar).toHaveClass(/custom-navbar/);
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
});
|