@nationaldesignstudio/react 0.5.2 → 0.5.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.
Files changed (160) hide show
  1. package/package.json +10 -2
  2. package/src/App.css +0 -0
  3. package/src/App.tsx +0 -7
  4. package/src/assets/fonts/PPNeueMontreal-Variable.woff2 +0 -0
  5. package/src/assets/react.svg +0 -1
  6. package/src/components/atoms/accordion/accordion.stories.tsx +0 -228
  7. package/src/components/atoms/accordion/accordion.test.tsx +0 -231
  8. package/src/components/atoms/accordion/index.ts +0 -6
  9. package/src/components/atoms/background/background.test.tsx +0 -213
  10. package/src/components/atoms/background/index.ts +0 -22
  11. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-darwin.png +0 -0
  12. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-linux.png +0 -0
  13. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-darwin.png +0 -0
  14. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-linux.png +0 -0
  15. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-darwin.png +0 -0
  16. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-linux.png +0 -0
  17. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-darwin.png +0 -0
  18. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-linux.png +0 -0
  19. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-darwin.png +0 -0
  20. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-linux.png +0 -0
  21. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-darwin.png +0 -0
  22. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-linux.png +0 -0
  23. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-darwin.png +0 -0
  24. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-linux.png +0 -0
  25. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-darwin.png +0 -0
  26. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-linux.png +0 -0
  27. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-darwin.png +0 -0
  28. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-linux.png +0 -0
  29. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-darwin.png +0 -0
  30. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-linux.png +0 -0
  31. package/src/components/atoms/button/button.stories.tsx +0 -289
  32. package/src/components/atoms/button/button.test.tsx +0 -419
  33. package/src/components/atoms/button/button.visual.test.tsx +0 -98
  34. package/src/components/atoms/button/icon-button.stories.tsx +0 -260
  35. package/src/components/atoms/button/icon-button.test.tsx +0 -186
  36. package/src/components/atoms/button/index.ts +0 -6
  37. package/src/components/atoms/input/index.ts +0 -17
  38. package/src/components/atoms/input/input-group.stories.tsx +0 -646
  39. package/src/components/atoms/input/input-group.test.tsx +0 -362
  40. package/src/components/atoms/input/input.stories.tsx +0 -228
  41. package/src/components/atoms/input/input.test.tsx +0 -167
  42. package/src/components/atoms/ndstudio-footer/index.ts +0 -1
  43. package/src/components/atoms/pager-control/index.ts +0 -5
  44. package/src/components/atoms/pager-control/pager-control.stories.tsx +0 -207
  45. package/src/components/atoms/pager-control/pager-control.test.tsx +0 -130
  46. package/src/components/atoms/popover/index.ts +0 -30
  47. package/src/components/atoms/popover/popover.stories.tsx +0 -531
  48. package/src/components/atoms/popover/popover.test.tsx +0 -486
  49. package/src/components/atoms/select/index.ts +0 -18
  50. package/src/components/atoms/select/select.stories.tsx +0 -455
  51. package/src/components/atoms/tooltip/index.ts +0 -24
  52. package/src/components/atoms/tooltip/tooltip.stories.tsx +0 -348
  53. package/src/components/atoms/tooltip/tooltip.test.tsx +0 -363
  54. package/src/components/dev-tools/dev-toolbar/dev-toolbar.stories.tsx +0 -73
  55. package/src/components/dev-tools/dev-toolbar/index.ts +0 -1
  56. package/src/components/dev-tools/grid-overlay/index.ts +0 -1
  57. package/src/components/dev-tools/index.ts +0 -2
  58. package/src/components/foundation/typography/typography.stories.tsx +0 -401
  59. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-darwin.png +0 -0
  60. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-linux.png +0 -0
  61. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-darwin.png +0 -0
  62. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-linux.png +0 -0
  63. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-darwin.png +0 -0
  64. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-linux.png +0 -0
  65. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-darwin.png +0 -0
  66. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-linux.png +0 -0
  67. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-darwin.png +0 -0
  68. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-linux.png +0 -0
  69. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-darwin.png +0 -0
  70. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-linux.png +0 -0
  71. package/src/components/organisms/card/card.stories.tsx +0 -293
  72. package/src/components/organisms/card/card.test.tsx +0 -247
  73. package/src/components/organisms/card/card.visual.test.tsx +0 -197
  74. package/src/components/organisms/card/index.ts +0 -26
  75. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-darwin.png +0 -0
  76. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-linux.png +0 -0
  77. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-darwin.png +0 -0
  78. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-linux.png +0 -0
  79. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-darwin.png +0 -0
  80. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-linux.png +0 -0
  81. package/src/components/organisms/navbar/index.ts +0 -18
  82. package/src/components/organisms/navbar/navbar.stories.tsx +0 -313
  83. package/src/components/organisms/navbar/navbar.test.tsx +0 -190
  84. package/src/components/organisms/navbar/navbar.visual.test.tsx +0 -85
  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
  86. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-linux.png +0 -0
  87. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-darwin.png +0 -0
  88. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-linux.png +0 -0
  89. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-darwin.png +0 -0
  90. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-linux.png +0 -0
  91. package/src/components/organisms/us-gov-banner/index.ts +0 -5
  92. package/src/components/organisms/us-gov-banner/us-gov-banner.stories.tsx +0 -35
  93. package/src/components/organisms/us-gov-banner/us-gov-banner.test.tsx +0 -107
  94. package/src/components/organisms/us-gov-banner/us-gov-banner.visual.test.tsx +0 -46
  95. package/src/components/sections/banner/banner.stories.tsx +0 -150
  96. package/src/components/sections/banner/banner.test.tsx +0 -185
  97. package/src/components/sections/banner/index.ts +0 -2
  98. package/src/components/sections/card-grid/card-grid.stories.tsx +0 -351
  99. package/src/components/sections/card-grid/index.ts +0 -1
  100. package/src/components/sections/faq-section/faq-section.stories.tsx +0 -453
  101. package/src/components/sections/faq-section/index.ts +0 -2
  102. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-darwin.png +0 -0
  103. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-linux.png +0 -0
  104. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-darwin.png +0 -0
  105. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-linux.png +0 -0
  106. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-darwin.png +0 -0
  107. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-linux.png +0 -0
  108. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-darwin.png +0 -0
  109. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-linux.png +0 -0
  110. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-darwin.png +0 -0
  111. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-linux.png +0 -0
  112. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-darwin.png +0 -0
  113. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-linux.png +0 -0
  114. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-darwin.png +0 -0
  115. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-linux.png +0 -0
  116. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-darwin.png +0 -0
  117. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-linux.png +0 -0
  118. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-darwin.png +0 -0
  119. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-linux.png +0 -0
  120. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-darwin.png +0 -0
  121. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-linux.png +0 -0
  122. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-default-chromium-linux.png +0 -0
  123. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-darwin.png +0 -0
  124. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-linux.png +0 -0
  125. package/src/components/sections/hero/hero.stories.tsx +0 -397
  126. package/src/components/sections/hero/hero.test.tsx +0 -138
  127. package/src/components/sections/hero/hero.visual.test.tsx +0 -140
  128. package/src/components/sections/hero/index.ts +0 -23
  129. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-darwin.png +0 -0
  130. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-linux.png +0 -0
  131. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-darwin.png +0 -0
  132. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-linux.png +0 -0
  133. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-darwin.png +0 -0
  134. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-linux.png +0 -0
  135. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-darwin.png +0 -0
  136. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-linux.png +0 -0
  137. package/src/components/sections/prose/index.ts +0 -6
  138. package/src/components/sections/prose/prose.stories.tsx +0 -144
  139. package/src/components/sections/prose/prose.test.tsx +0 -178
  140. package/src/components/sections/prose/prose.visual.test.tsx +0 -105
  141. package/src/components/sections/quote-block/index.ts +0 -5
  142. package/src/components/sections/river/index.ts +0 -1
  143. package/src/components/sections/river/river.stories.tsx +0 -237
  144. package/src/components/sections/river/river.test.tsx +0 -268
  145. package/src/components/sections/tout/index.ts +0 -1
  146. package/src/components/sections/tout/tout.stories.tsx +0 -171
  147. package/src/components/sections/tout/tout.test.tsx +0 -242
  148. package/src/components/sections/two-column-section/index.ts +0 -5
  149. package/src/components/sections/two-column-section/two-column-section.stories.tsx +0 -285
  150. package/src/components/shared/index.ts +0 -5
  151. package/src/index.ts +0 -293
  152. package/src/main.tsx +0 -13
  153. package/src/stories/grid-system.stories.tsx +0 -309
  154. package/src/stories/introduction.mdx +0 -128
  155. package/src/stories/theme-provider.stories.tsx +0 -349
  156. package/src/stories/token-showcase.stories.tsx +0 -73
  157. package/src/stories/token-showcase.tsx +0 -777
  158. package/src/styles.css +0 -14
  159. package/src/tests/token-resolution.test.tsx +0 -298
  160. package/src/theme/theme-provider.test.tsx +0 -270
@@ -1,397 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react-vite";
2
- import { Hero, HeroBackground, HeroContent, HeroHeader } from ".";
3
-
4
- const meta: Meta<typeof Hero> = {
5
- title: "Sections/Hero",
6
- component: Hero,
7
- parameters: {
8
- layout: "fullscreen",
9
- },
10
- argTypes: {
11
- variant: {
12
- control: "select",
13
- options: ["A1", "A2", "A3"],
14
- description: "Hero variant controlling content alignment",
15
- },
16
- title: {
17
- control: "text",
18
- description: "The title text displayed in the hero",
19
- },
20
- background: {
21
- control: "text",
22
- description:
23
- "Background color (hex/rgb) or use HeroBackground components",
24
- },
25
- overlayOpacity: {
26
- control: { type: "range", min: 0, max: 1, step: 0.1 },
27
- description: "Opacity of the overlay (0-1)",
28
- },
29
- overlayColor: {
30
- control: "color",
31
- description: "Color of the overlay",
32
- },
33
- borderRadius: {
34
- control: "text",
35
- description:
36
- "Border radius for the hero container (e.g., '0 0 20px 20px')",
37
- },
38
- },
39
- } as Meta<typeof Hero>;
40
-
41
- export default meta;
42
- type Story = StoryObj<typeof Hero>;
43
-
44
- export const Playground: Story = {
45
- render: (args) => <Hero {...args} />,
46
- };
47
- Playground.args = {
48
- title: "Hero Title",
49
- variant: "A1",
50
- background: "#1a1a1a",
51
- };
52
-
53
- // =============================================================================
54
- // Variants
55
- // =============================================================================
56
-
57
- /**
58
- * A1 variant: Content aligned at the bottom of the hero.
59
- * This is the default variant.
60
- */
61
- export const A1: Story = {
62
- render: () => <Hero variant="A1" title="Hero A1" />,
63
- };
64
-
65
- /**
66
- * A2 variant: Content aligned at the top of the hero.
67
- */
68
- export const A2: Story = {
69
- render: () => <Hero variant="A2" title="Hero A2" />,
70
- };
71
-
72
- /**
73
- * A3 variant: Content centered vertically in the hero.
74
- */
75
- export const A3: Story = {
76
- render: () => <Hero variant="A3" title="Hero A3" />,
77
- };
78
-
79
- // =============================================================================
80
- // Background Types
81
- // =============================================================================
82
-
83
- /**
84
- * Hero with solid color background using hex code
85
- */
86
- export const WithColorBackground: Story = {
87
- render: () => (
88
- <Hero variant="A1" title="Color Background" background="#2563eb" />
89
- ),
90
- };
91
-
92
- /**
93
- * Hero with background image using HeroBackground.Image
94
- */
95
- export const WithImageBackground: Story = {
96
- render: () => (
97
- <Hero
98
- variant="A1"
99
- title="Image Background"
100
- background={
101
- <HeroBackground.Image
102
- src="https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=1920&q=80"
103
- position="center"
104
- alt="Earth from space"
105
- />
106
- }
107
- overlayOpacity={0.4}
108
- />
109
- ),
110
- };
111
-
112
- /**
113
- * Hero with HTML5 video background using HeroBackground.Video
114
- */
115
- export const WithVideoBackground: Story = {
116
- render: () => (
117
- <Hero
118
- variant="A1"
119
- title="Video Background"
120
- background={
121
- <HeroBackground.Video
122
- src="https://storage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4"
123
- poster="https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=1920&q=80"
124
- />
125
- }
126
- overlayOpacity={0.3}
127
- />
128
- ),
129
- };
130
-
131
- /**
132
- * Hero with Cloudflare Stream video background
133
- *
134
- * Note: Replace with a valid Cloudflare Stream video ID for actual use
135
- */
136
- export const WithCloudflareStream: Story = {
137
- render: () => (
138
- <Hero
139
- variant="A1"
140
- title="Stream Background"
141
- background={
142
- <HeroBackground.Stream
143
- videoId="5d5bc37ffcf54c9b82e996823bffbb81"
144
- muted
145
- autoplay
146
- loop
147
- />
148
- }
149
- overlayOpacity={0.4}
150
- />
151
- ),
152
- };
153
-
154
- // =============================================================================
155
- // Composition - Top Slot & Border Radius
156
- // =============================================================================
157
-
158
- /**
159
- * Mock banner component for story demonstration
160
- */
161
- const MockBanner = () => (
162
- <div className="bg-gray-1200 px-16 py-8 text-center text-14 text-text-inverted">
163
- An official website of the United States government
164
- </div>
165
- );
166
-
167
- /**
168
- * Mock navigation component for story demonstration
169
- */
170
- const MockNavigation = () => (
171
- <nav className="flex items-center justify-between px-56 py-16">
172
- <div className="flex items-center gap-24">
173
- <div className="size-48 rounded-full bg-gray-50" />
174
- <div className="flex gap-24 text-14 text-text-inverted">
175
- <span className="cursor-pointer hover:opacity-80">Link 1</span>
176
- <span className="cursor-pointer hover:opacity-80">Link 2</span>
177
- </div>
178
- </div>
179
- <div className="text-14 text-text-inverted">Actions</div>
180
- </nav>
181
- );
182
-
183
- /**
184
- * Hero with top slot containing a banner
185
- */
186
- export const WithTopSlot: Story = {
187
- render: () => (
188
- <Hero
189
- variant="A1"
190
- title="Hero with Top Slot"
191
- background="#1a1a1a"
192
- top={<MockBanner />}
193
- />
194
- ),
195
- };
196
-
197
- /**
198
- * Hero with rounded bottom corners
199
- */
200
- export const WithRoundedCorners: Story = {
201
- render: () => (
202
- <div className="bg-bg-page p-32">
203
- <Hero
204
- variant="A1"
205
- title="Rounded Corners"
206
- background="#1a1a1a"
207
- borderRadius="0 0 20px 20px"
208
- />
209
- </div>
210
- ),
211
- };
212
-
213
- /**
214
- * Hero with both top slot and rounded corners
215
- */
216
- export const WithTopAndRoundedCorners: Story = {
217
- render: () => (
218
- <div className="bg-bg-page">
219
- <Hero
220
- variant="A1"
221
- title="Full Composition"
222
- background={
223
- <HeroBackground.Image
224
- src="https://images.unsplash.com/photo-1451187580459-43490279c0fa?w=1920&q=80"
225
- position="center"
226
- />
227
- }
228
- overlayOpacity={0.5}
229
- borderRadius="0 0 20px 20px"
230
- top={
231
- <>
232
- <MockBanner />
233
- <MockNavigation />
234
- </>
235
- }
236
- >
237
- <p className="mt-16 max-w-[560px] text-20 text-text-inverted">
238
- A subtitle or description can be added as children
239
- </p>
240
- </Hero>
241
- </div>
242
- ),
243
- };
244
-
245
- // =============================================================================
246
- // Sub-components
247
- // =============================================================================
248
-
249
- /**
250
- * Using Hero.Header and Hero.Content sub-components directly
251
- * for more control over the layout
252
- */
253
- export const UsingSubComponents: Story = {
254
- render: () => (
255
- <section className="relative flex min-h-[80vh] flex-col bg-gray-1200">
256
- <HeroHeader>
257
- <MockBanner />
258
- <MockNavigation />
259
- </HeroHeader>
260
- <HeroContent className="flex-1 justify-end">
261
- <h1 className="text-64 font-medium text-text-inverted lg:text-128">
262
- Custom Layout
263
- </h1>
264
- <p className="mt-16 text-20 text-text-inverted">
265
- Using HeroHeader and HeroContent sub-components
266
- </p>
267
- </HeroContent>
268
- </section>
269
- ),
270
- };
271
-
272
- // =============================================================================
273
- // Responsive Variants - A1 (Content at bottom)
274
- // =============================================================================
275
-
276
- export const A1Desktop: Story = {
277
- render: () => <Hero variant="A1" title="Hero A1" />,
278
- globals: {
279
- viewport: { value: "lg", isRotated: false },
280
- },
281
- };
282
-
283
- export const A1Tablet: Story = {
284
- render: () => <Hero variant="A1" title="Hero A1" />,
285
- globals: {
286
- viewport: { value: "md", isRotated: false },
287
- },
288
- };
289
-
290
- export const A1Mobile: Story = {
291
- render: () => <Hero variant="A1" title="Hero A1" />,
292
- globals: {
293
- viewport: { value: "sm", isRotated: false },
294
- },
295
- };
296
-
297
- // =============================================================================
298
- // Responsive Variants - A2 (Content at top)
299
- // =============================================================================
300
-
301
- export const A2Desktop: Story = {
302
- render: () => <Hero variant="A2" title="Hero A2" />,
303
- globals: {
304
- viewport: { value: "lg", isRotated: false },
305
- },
306
- };
307
-
308
- export const A2Tablet: Story = {
309
- render: () => <Hero variant="A2" title="Hero A2" />,
310
- globals: {
311
- viewport: { value: "md", isRotated: false },
312
- },
313
- };
314
-
315
- export const A2Mobile: Story = {
316
- render: () => <Hero variant="A2" title="Hero A2" />,
317
- globals: {
318
- viewport: { value: "sm", isRotated: false },
319
- },
320
- };
321
-
322
- // =============================================================================
323
- // Responsive Variants - A3 (Content centered)
324
- // =============================================================================
325
-
326
- export const A3Desktop: Story = {
327
- render: () => <Hero variant="A3" title="Hero A3" />,
328
- globals: {
329
- viewport: { value: "lg", isRotated: false },
330
- },
331
- };
332
-
333
- export const A3Tablet: Story = {
334
- render: () => <Hero variant="A3" title="Hero A3" />,
335
- globals: {
336
- viewport: { value: "md", isRotated: false },
337
- },
338
- };
339
-
340
- export const A3Mobile: Story = {
341
- render: () => <Hero variant="A3" title="Hero A3" />,
342
- globals: {
343
- viewport: { value: "sm", isRotated: false },
344
- },
345
- };
346
-
347
- // =============================================================================
348
- // Examples
349
- // =============================================================================
350
-
351
- export const WithLongTitle: Story = {
352
- render: () => <Hero title="A Much Longer Hero Title That Wraps" />,
353
- };
354
-
355
- export const WithCustomClassName: Story = {
356
- render: () => <Hero title="Custom Background" className="bg-blue-600" />,
357
- };
358
-
359
- /**
360
- * Hero with image and high overlay for better text contrast
361
- */
362
- export const WithHighOverlay: Story = {
363
- render: () => (
364
- <Hero
365
- variant="A3"
366
- title="High Contrast"
367
- background={
368
- <HeroBackground.Image
369
- src="https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1920&q=80"
370
- position="center bottom"
371
- />
372
- }
373
- overlayOpacity={0.7}
374
- overlayColor="#000000"
375
- />
376
- ),
377
- };
378
-
379
- /**
380
- * Hero with gradient-style overlay color
381
- */
382
- export const WithColoredOverlay: Story = {
383
- render: () => (
384
- <Hero
385
- variant="A1"
386
- title="Tinted Overlay"
387
- background={
388
- <HeroBackground.Image
389
- src="https://images.unsplash.com/photo-1557682250-33bd709cbe85?w=1920&q=80"
390
- position="center"
391
- />
392
- }
393
- overlayOpacity={0.5}
394
- overlayColor="#1e3a5f"
395
- />
396
- ),
397
- };
@@ -1,138 +0,0 @@
1
- import { describe, expect, test } from "vitest";
2
- import { page } from "vitest/browser";
3
- import { render } from "vitest-browser-react";
4
- import { Hero } from "./hero";
5
-
6
- describe("Hero", () => {
7
- describe("Accessibility", () => {
8
- test("renders as section landmark", async () => {
9
- render(<Hero title="Test Hero" data-testid="hero" />);
10
-
11
- // Section is a region landmark when it has an accessible name
12
- const hero = page.getByTestId("hero");
13
- await expect.element(hero).toBeInTheDocument();
14
- });
15
-
16
- test("title renders as h1 heading", async () => {
17
- render(<Hero title="Hero Title" />);
18
-
19
- await expect
20
- .element(page.getByRole("heading", { level: 1, name: "Hero Title" }))
21
- .toBeInTheDocument();
22
- });
23
-
24
- test("title is accessible to screen readers", async () => {
25
- render(<Hero title="Accessible Title" />);
26
-
27
- await expect
28
- .element(page.getByText("Accessible Title"))
29
- .toBeInTheDocument();
30
- });
31
- });
32
-
33
- describe("Props", () => {
34
- test("renders with required title prop", async () => {
35
- render(<Hero title="Required Title" />);
36
-
37
- await expect
38
- .element(page.getByText("Required Title"))
39
- .toBeInTheDocument();
40
- });
41
-
42
- test("supports custom className", async () => {
43
- render(
44
- <Hero title="Custom" className="custom-class" data-testid="hero" />,
45
- );
46
-
47
- const hero = page.getByTestId("hero");
48
- await expect.element(hero).toHaveClass(/custom-class/);
49
- });
50
-
51
- test("spreads additional props to section element", async () => {
52
- render(
53
- <Hero
54
- title="Props Test"
55
- data-testid="hero"
56
- aria-label="Hero section"
57
- />,
58
- );
59
-
60
- const hero = page.getByTestId("hero");
61
- await expect.element(hero).toHaveAttribute("aria-label", "Hero section");
62
- });
63
- });
64
-
65
- describe("Styling", () => {
66
- test("applies default background color when no background provided", async () => {
67
- render(<Hero title="Default" data-testid="hero" />);
68
-
69
- const hero = page.getByTestId("hero");
70
- // Uses semantic token bg-bg-page for default dark colorScheme
71
- await expect.element(hero).toHaveClass(/bg-bg-page/);
72
- });
73
-
74
- test("applies minimum height for viewport coverage", async () => {
75
- render(<Hero title="Responsive" data-testid="hero" />);
76
-
77
- const hero = page.getByTestId("hero");
78
- // Uses min-h-[80vh] for all variants
79
- await expect.element(hero).toHaveClass(/min-h-\[80vh\]/);
80
- });
81
- });
82
-
83
- describe("Variants", () => {
84
- test("A1 variant applies flex column layout", async () => {
85
- render(<Hero title="A1 Hero" variant="A1" data-testid="hero" />);
86
-
87
- const hero = page.getByTestId("hero");
88
- await expect.element(hero).toHaveClass(/flex-col/);
89
- });
90
-
91
- test("A1 variant is default when no variant specified", async () => {
92
- render(<Hero title="Default Hero" data-testid="hero" />);
93
-
94
- const hero = page.getByTestId("hero");
95
- // Default variant still applies min-height and flex layout
96
- await expect.element(hero).toHaveClass(/min-h-\[80vh\]/);
97
- await expect.element(hero).toHaveClass(/flex-col/);
98
- });
99
-
100
- test("A2 variant applies flex column layout", async () => {
101
- render(<Hero title="A2 Hero" variant="A2" data-testid="hero" />);
102
-
103
- const hero = page.getByTestId("hero");
104
- await expect.element(hero).toHaveClass(/flex-col/);
105
- });
106
-
107
- test("A3 variant applies flex column layout", async () => {
108
- render(<Hero title="A3 Hero" variant="A3" data-testid="hero" />);
109
-
110
- const hero = page.getByTestId("hero");
111
- await expect.element(hero).toHaveClass(/flex-col/);
112
- });
113
-
114
- test("A1 variant maintains common styles", async () => {
115
- render(<Hero title="A1 Hero" variant="A1" data-testid="hero" />);
116
-
117
- const hero = page.getByTestId("hero");
118
- await expect.element(hero).toHaveClass(/bg-bg-page/);
119
- await expect.element(hero).toHaveClass(/min-h-\[80vh\]/);
120
- });
121
-
122
- test("A2 variant maintains common styles", async () => {
123
- render(<Hero title="A2 Hero" variant="A2" data-testid="hero" />);
124
-
125
- const hero = page.getByTestId("hero");
126
- await expect.element(hero).toHaveClass(/bg-bg-page/);
127
- await expect.element(hero).toHaveClass(/min-h-\[80vh\]/);
128
- });
129
-
130
- test("A3 variant maintains common styles", async () => {
131
- render(<Hero title="A3 Hero" variant="A3" data-testid="hero" />);
132
-
133
- const hero = page.getByTestId("hero");
134
- await expect.element(hero).toHaveClass(/bg-bg-page/);
135
- await expect.element(hero).toHaveClass(/min-h-\[80vh\]/);
136
- });
137
- });
138
- });
@@ -1,140 +0,0 @@
1
- import { describe, expect, test } from "vitest";
2
- import { page } from "vitest/browser";
3
- import { render } from "vitest-browser-react";
4
- import { Hero } from "./hero";
5
-
6
- describe("Hero Visual Regression", () => {
7
- // =========================================================================
8
- // Variant A1 (Content at bottom) - Default
9
- // =========================================================================
10
- describe("Variant A1", () => {
11
- test("A1 desktop renders correctly", async () => {
12
- await page.viewport(1440, 900);
13
-
14
- render(<Hero data-testid="hero" variant="A1" title="Hero A1" />);
15
-
16
- await expect(page.getByTestId("hero")).toMatchScreenshot(
17
- "hero-a1-desktop",
18
- );
19
- });
20
-
21
- test("A1 tablet renders correctly", async () => {
22
- await page.viewport(834, 700);
23
-
24
- render(<Hero data-testid="hero" variant="A1" title="Hero A1" />);
25
-
26
- await expect(page.getByTestId("hero")).toMatchScreenshot(
27
- "hero-a1-tablet",
28
- );
29
- });
30
-
31
- test("A1 mobile renders correctly", async () => {
32
- await page.viewport(393, 600);
33
-
34
- render(<Hero data-testid="hero" variant="A1" title="Hero A1" />);
35
-
36
- await expect(page.getByTestId("hero")).toMatchScreenshot(
37
- "hero-a1-mobile",
38
- );
39
- });
40
- });
41
-
42
- // =========================================================================
43
- // Variant A2 (Content at top)
44
- // =========================================================================
45
- describe("Variant A2", () => {
46
- test("A2 desktop renders correctly", async () => {
47
- await page.viewport(1440, 900);
48
-
49
- render(<Hero data-testid="hero" variant="A2" title="Hero A2" />);
50
-
51
- await expect(page.getByTestId("hero")).toMatchScreenshot(
52
- "hero-a2-desktop",
53
- );
54
- });
55
-
56
- test("A2 tablet renders correctly", async () => {
57
- await page.viewport(834, 700);
58
-
59
- render(<Hero data-testid="hero" variant="A2" title="Hero A2" />);
60
-
61
- await expect(page.getByTestId("hero")).toMatchScreenshot(
62
- "hero-a2-tablet",
63
- );
64
- });
65
-
66
- test("A2 mobile renders correctly", async () => {
67
- await page.viewport(393, 600);
68
-
69
- render(<Hero data-testid="hero" variant="A2" title="Hero A2" />);
70
-
71
- await expect(page.getByTestId("hero")).toMatchScreenshot(
72
- "hero-a2-mobile",
73
- );
74
- });
75
- });
76
-
77
- // =========================================================================
78
- // Variant A3 (Content centered)
79
- // =========================================================================
80
- describe("Variant A3", () => {
81
- test("A3 desktop renders correctly", async () => {
82
- await page.viewport(1440, 900);
83
-
84
- render(<Hero data-testid="hero" variant="A3" title="Hero A3" />);
85
-
86
- await expect(page.getByTestId("hero")).toMatchScreenshot(
87
- "hero-a3-desktop",
88
- );
89
- });
90
-
91
- test("A3 tablet renders correctly", async () => {
92
- await page.viewport(834, 700);
93
-
94
- render(<Hero data-testid="hero" variant="A3" title="Hero A3" />);
95
-
96
- await expect(page.getByTestId("hero")).toMatchScreenshot(
97
- "hero-a3-tablet",
98
- );
99
- });
100
-
101
- test("A3 mobile renders correctly", async () => {
102
- await page.viewport(393, 600);
103
-
104
- render(<Hero data-testid="hero" variant="A3" title="Hero A3" />);
105
-
106
- await expect(page.getByTestId("hero")).toMatchScreenshot(
107
- "hero-a3-mobile",
108
- );
109
- });
110
- });
111
-
112
- // =========================================================================
113
- // Additional tests
114
- // =========================================================================
115
- test("hero with long title renders correctly", async () => {
116
- await page.viewport(1280, 800);
117
-
118
- render(
119
- <Hero data-testid="hero" title="A Much Longer Hero Title That Wraps" />,
120
- );
121
-
122
- await expect(page.getByTestId("hero")).toMatchScreenshot("hero-long-title");
123
- });
124
-
125
- test("hero with custom className renders correctly", async () => {
126
- await page.viewport(1280, 800);
127
-
128
- render(
129
- <Hero
130
- data-testid="hero"
131
- title="Custom Background"
132
- className="bg-blue-600"
133
- />,
134
- );
135
-
136
- await expect(page.getByTestId("hero")).toMatchScreenshot(
137
- "hero-custom-class",
138
- );
139
- });
140
- });
@@ -1,23 +0,0 @@
1
- export {
2
- DEFAULT_TITLE_TYPOGRAPHY,
3
- Hero,
4
- HeroBackground,
5
- HeroBackgroundImage,
6
- type HeroBackgroundImageProps,
7
- HeroBackgroundStream,
8
- type HeroBackgroundStreamProps,
9
- HeroBackgroundVideo,
10
- type HeroBackgroundVideoProps,
11
- HeroContent,
12
- type HeroContentProps,
13
- HeroGradient,
14
- type HeroGradientProps,
15
- HeroHeader,
16
- type HeroHeaderProps,
17
- HeroOverlay,
18
- type HeroOverlayProps,
19
- type HeroProps,
20
- heroContentVariants,
21
- heroHeaderVariants,
22
- heroVariants,
23
- } from "./hero";