@nationaldesignstudio/react 0.5.2 → 0.5.4
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/package.json +10 -2
- package/src/components/organisms/navbar/navbar.tsx +8 -8
- 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.test.tsx +0 -231
- package/src/components/atoms/accordion/index.ts +0 -6
- package/src/components/atoms/background/background.test.tsx +0 -213
- package/src/components/atoms/background/index.ts +0 -22
- 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 -289
- package/src/components/atoms/button/button.test.tsx +0 -419
- package/src/components/atoms/button/button.visual.test.tsx +0 -98
- package/src/components/atoms/button/icon-button.stories.tsx +0 -260
- package/src/components/atoms/button/icon-button.test.tsx +0 -186
- package/src/components/atoms/button/index.ts +0 -6
- package/src/components/atoms/input/index.ts +0 -17
- package/src/components/atoms/input/input-group.stories.tsx +0 -646
- package/src/components/atoms/input/input-group.test.tsx +0 -362
- package/src/components/atoms/input/input.stories.tsx +0 -228
- package/src/components/atoms/input/input.test.tsx +0 -167
- package/src/components/atoms/ndstudio-footer/index.ts +0 -1
- package/src/components/atoms/pager-control/index.ts +0 -5
- package/src/components/atoms/pager-control/pager-control.stories.tsx +0 -207
- package/src/components/atoms/pager-control/pager-control.test.tsx +0 -130
- package/src/components/atoms/popover/index.ts +0 -30
- package/src/components/atoms/popover/popover.stories.tsx +0 -531
- package/src/components/atoms/popover/popover.test.tsx +0 -486
- package/src/components/atoms/select/index.ts +0 -18
- package/src/components/atoms/select/select.stories.tsx +0 -455
- package/src/components/atoms/tooltip/index.ts +0 -24
- package/src/components/atoms/tooltip/tooltip.stories.tsx +0 -348
- package/src/components/atoms/tooltip/tooltip.test.tsx +0 -363
- package/src/components/dev-tools/dev-toolbar/dev-toolbar.stories.tsx +0 -73
- package/src/components/dev-tools/dev-toolbar/index.ts +0 -1
- package/src/components/dev-tools/grid-overlay/index.ts +0 -1
- package/src/components/dev-tools/index.ts +0 -2
- package/src/components/foundation/typography/typography.stories.tsx +0 -401
- 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 -247
- package/src/components/organisms/card/card.visual.test.tsx +0 -197
- package/src/components/organisms/card/index.ts +0 -26
- 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.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 -5
- 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.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/index.ts +0 -2
- package/src/components/sections/card-grid/card-grid.stories.tsx +0 -351
- package/src/components/sections/card-grid/index.ts +0 -1
- package/src/components/sections/faq-section/faq-section.stories.tsx +0 -453
- 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 -397
- package/src/components/sections/hero/hero.test.tsx +0 -138
- package/src/components/sections/hero/hero.visual.test.tsx +0 -140
- package/src/components/sections/hero/index.ts +0 -23
- 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.visual.test.tsx +0 -105
- package/src/components/sections/quote-block/index.ts +0 -5
- 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/tout/index.ts +0 -1
- package/src/components/sections/tout/tout.stories.tsx +0 -171
- package/src/components/sections/tout/tout.test.tsx +0 -242
- 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/shared/index.ts +0 -5
- package/src/index.ts +0 -293
- package/src/main.tsx +0 -13
- package/src/stories/grid-system.stories.tsx +0 -309
- package/src/stories/introduction.mdx +0 -128
- package/src/stories/theme-provider.stories.tsx +0 -349
- package/src/stories/token-showcase.stories.tsx +0 -73
- package/src/stories/token-showcase.tsx +0 -777
- package/src/styles.css +0 -14
- package/src/tests/token-resolution.test.tsx +0 -298
- package/src/theme/theme-provider.test.tsx +0 -270
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import { page } from "vitest/browser";
|
|
3
|
-
import { render } from "vitest-browser-react";
|
|
4
|
-
import {
|
|
5
|
-
Background,
|
|
6
|
-
BackgroundGradient,
|
|
7
|
-
BackgroundImage,
|
|
8
|
-
BackgroundOverlay,
|
|
9
|
-
BackgroundVideo,
|
|
10
|
-
} from "./background";
|
|
11
|
-
|
|
12
|
-
describe("Background", () => {
|
|
13
|
-
describe("Background Container", () => {
|
|
14
|
-
test("renders as a div with absolute positioning", async () => {
|
|
15
|
-
render(<Background data-testid="bg-container">Content</Background>);
|
|
16
|
-
const container = page.getByTestId("bg-container");
|
|
17
|
-
await expect.element(container).toBeInTheDocument();
|
|
18
|
-
await expect.element(container).toHaveClass(/absolute/);
|
|
19
|
-
await expect.element(container).toHaveClass(/inset-0/);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test("has aria-hidden attribute", async () => {
|
|
23
|
-
render(<Background data-testid="bg-container" />);
|
|
24
|
-
await expect
|
|
25
|
-
.element(page.getByTestId("bg-container"))
|
|
26
|
-
.toHaveAttribute("aria-hidden", "true");
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test("accepts custom className", async () => {
|
|
30
|
-
render(<Background data-testid="bg" className="custom-class" />);
|
|
31
|
-
await expect.element(page.getByTestId("bg")).toHaveClass(/custom-class/);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
describe("BackgroundImage", () => {
|
|
36
|
-
test("renders an img element with src", async () => {
|
|
37
|
-
render(<BackgroundImage src="/test-image.jpg" data-testid="bg-img" />);
|
|
38
|
-
const img = page.getByTestId("bg-img");
|
|
39
|
-
await expect.element(img).toBeInTheDocument();
|
|
40
|
-
await expect.element(img).toHaveAttribute("src", "/test-image.jpg");
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
test("has object-cover class for proper fitting", async () => {
|
|
44
|
-
render(<BackgroundImage src="/test.jpg" data-testid="bg-img" />);
|
|
45
|
-
await expect
|
|
46
|
-
.element(page.getByTestId("bg-img"))
|
|
47
|
-
.toHaveClass(/object-cover/);
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
test("sets default alt to empty string for decorative images", async () => {
|
|
51
|
-
render(<BackgroundImage src="/test.jpg" data-testid="bg-img" />);
|
|
52
|
-
await expect
|
|
53
|
-
.element(page.getByTestId("bg-img"))
|
|
54
|
-
.toHaveAttribute("alt", "");
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test("accepts custom alt text", async () => {
|
|
58
|
-
render(
|
|
59
|
-
<BackgroundImage
|
|
60
|
-
src="/test.jpg"
|
|
61
|
-
alt="Custom alt text"
|
|
62
|
-
data-testid="bg-img"
|
|
63
|
-
/>,
|
|
64
|
-
);
|
|
65
|
-
await expect
|
|
66
|
-
.element(page.getByTestId("bg-img"))
|
|
67
|
-
.toHaveAttribute("alt", "Custom alt text");
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test("applies custom position via style", async () => {
|
|
71
|
-
render(
|
|
72
|
-
<BackgroundImage
|
|
73
|
-
src="/test.jpg"
|
|
74
|
-
position="top left"
|
|
75
|
-
data-testid="bg-img"
|
|
76
|
-
/>,
|
|
77
|
-
);
|
|
78
|
-
const img = page.getByTestId("bg-img");
|
|
79
|
-
// Check the style attribute contains the position
|
|
80
|
-
await expect.element(img).toHaveStyle({ objectPosition: "top left" });
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test("supports render prop for custom element", async () => {
|
|
84
|
-
render(
|
|
85
|
-
<BackgroundImage
|
|
86
|
-
src="/test.jpg"
|
|
87
|
-
// biome-ignore lint/a11y/useAltText: Test case for custom element
|
|
88
|
-
render={<img className="custom-img-class" />}
|
|
89
|
-
data-testid="bg-img"
|
|
90
|
-
/>,
|
|
91
|
-
);
|
|
92
|
-
await expect
|
|
93
|
-
.element(page.getByTestId("bg-img"))
|
|
94
|
-
.toHaveClass(/custom-img-class/);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
describe("BackgroundVideo", () => {
|
|
99
|
-
test("renders a video element", async () => {
|
|
100
|
-
render(<BackgroundVideo src="/test-video.mp4" data-testid="bg-video" />);
|
|
101
|
-
const video = page.getByTestId("bg-video");
|
|
102
|
-
await expect.element(video).toBeInTheDocument();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
test("has autoplay and loop by default", async () => {
|
|
106
|
-
render(<BackgroundVideo src="/test.mp4" data-testid="bg-video" />);
|
|
107
|
-
const video = page.getByTestId("bg-video");
|
|
108
|
-
await expect.element(video).toHaveAttribute("autoplay");
|
|
109
|
-
await expect.element(video).toHaveAttribute("loop");
|
|
110
|
-
// Note: muted is a boolean prop in React that may not render as an HTML attribute
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
test("has object-cover class", async () => {
|
|
114
|
-
render(<BackgroundVideo src="/test.mp4" data-testid="bg-video" />);
|
|
115
|
-
await expect
|
|
116
|
-
.element(page.getByTestId("bg-video"))
|
|
117
|
-
.toHaveClass(/object-cover/);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test("accepts poster prop", async () => {
|
|
121
|
-
render(
|
|
122
|
-
<BackgroundVideo
|
|
123
|
-
src="/test.mp4"
|
|
124
|
-
poster="/poster.jpg"
|
|
125
|
-
data-testid="bg-video"
|
|
126
|
-
/>,
|
|
127
|
-
);
|
|
128
|
-
await expect
|
|
129
|
-
.element(page.getByTestId("bg-video"))
|
|
130
|
-
.toHaveAttribute("poster", "/poster.jpg");
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
describe("BackgroundOverlay", () => {
|
|
135
|
-
test("renders with default opacity", async () => {
|
|
136
|
-
render(<BackgroundOverlay data-testid="bg-overlay" />);
|
|
137
|
-
const overlay = page.getByTestId("bg-overlay");
|
|
138
|
-
await expect.element(overlay).toBeInTheDocument();
|
|
139
|
-
await expect.element(overlay).toHaveStyle({ opacity: "0.4" });
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test("accepts custom opacity", async () => {
|
|
143
|
-
render(<BackgroundOverlay opacity={0.7} data-testid="bg-overlay" />);
|
|
144
|
-
await expect
|
|
145
|
-
.element(page.getByTestId("bg-overlay"))
|
|
146
|
-
.toHaveStyle({ opacity: "0.7" });
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
test("has aria-hidden attribute", async () => {
|
|
150
|
-
render(<BackgroundOverlay data-testid="bg-overlay" />);
|
|
151
|
-
await expect
|
|
152
|
-
.element(page.getByTestId("bg-overlay"))
|
|
153
|
-
.toHaveAttribute("aria-hidden", "true");
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
describe("BackgroundGradient", () => {
|
|
158
|
-
test("renders with default gradient direction", async () => {
|
|
159
|
-
render(<BackgroundGradient data-testid="bg-gradient" />);
|
|
160
|
-
const gradient = page.getByTestId("bg-gradient");
|
|
161
|
-
await expect.element(gradient).toBeInTheDocument();
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test("has aria-hidden attribute", async () => {
|
|
165
|
-
render(<BackgroundGradient data-testid="bg-gradient" />);
|
|
166
|
-
await expect
|
|
167
|
-
.element(page.getByTestId("bg-gradient"))
|
|
168
|
-
.toHaveAttribute("aria-hidden", "true");
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
test("accepts custom gradient via gradient prop", async () => {
|
|
172
|
-
render(
|
|
173
|
-
<BackgroundGradient
|
|
174
|
-
gradient="linear-gradient(45deg, red, blue)"
|
|
175
|
-
data-testid="bg-gradient"
|
|
176
|
-
/>,
|
|
177
|
-
);
|
|
178
|
-
await expect
|
|
179
|
-
.element(page.getByTestId("bg-gradient"))
|
|
180
|
-
.toHaveStyle({ backgroundImage: "linear-gradient(45deg, red, blue)" });
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
describe("Compound Component", () => {
|
|
185
|
-
test("Background.Image is accessible via dot notation", async () => {
|
|
186
|
-
render(
|
|
187
|
-
<Background data-testid="bg-container">
|
|
188
|
-
<Background.Image src="/test.jpg" data-testid="bg-img" />
|
|
189
|
-
</Background>,
|
|
190
|
-
);
|
|
191
|
-
await expect
|
|
192
|
-
.element(page.getByTestId("bg-container"))
|
|
193
|
-
.toBeInTheDocument();
|
|
194
|
-
await expect.element(page.getByTestId("bg-img")).toBeInTheDocument();
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
test("can compose multiple background layers", async () => {
|
|
198
|
-
render(
|
|
199
|
-
<Background data-testid="bg-container">
|
|
200
|
-
<Background.Image src="/test.jpg" data-testid="bg-img" />
|
|
201
|
-
<Background.Overlay data-testid="bg-overlay" />
|
|
202
|
-
<Background.Gradient data-testid="bg-gradient" />
|
|
203
|
-
</Background>,
|
|
204
|
-
);
|
|
205
|
-
await expect
|
|
206
|
-
.element(page.getByTestId("bg-container"))
|
|
207
|
-
.toBeInTheDocument();
|
|
208
|
-
await expect.element(page.getByTestId("bg-img")).toBeInTheDocument();
|
|
209
|
-
await expect.element(page.getByTestId("bg-overlay")).toBeInTheDocument();
|
|
210
|
-
await expect.element(page.getByTestId("bg-gradient")).toBeInTheDocument();
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
BackgroundGradientProps,
|
|
3
|
-
BackgroundImageProps,
|
|
4
|
-
BackgroundOverlayProps,
|
|
5
|
-
BackgroundProps,
|
|
6
|
-
BackgroundStreamProps,
|
|
7
|
-
BackgroundVideoProps,
|
|
8
|
-
} from "./background";
|
|
9
|
-
export {
|
|
10
|
-
Background,
|
|
11
|
-
BackgroundGradient,
|
|
12
|
-
BackgroundImage,
|
|
13
|
-
BackgroundOverlay,
|
|
14
|
-
BackgroundStream,
|
|
15
|
-
BackgroundVideo,
|
|
16
|
-
backgroundGradientVariants,
|
|
17
|
-
backgroundImageVariants,
|
|
18
|
-
backgroundOverlayVariants,
|
|
19
|
-
backgroundStreamVariants,
|
|
20
|
-
backgroundVariants,
|
|
21
|
-
backgroundVideoVariants,
|
|
22
|
-
} from "./background";
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
-
import { Button } from ".";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof Button> = {
|
|
5
|
-
title: "Atoms/Button",
|
|
6
|
-
component: Button,
|
|
7
|
-
argTypes: {
|
|
8
|
-
variant: {
|
|
9
|
-
control: { type: "select" },
|
|
10
|
-
options: [
|
|
11
|
-
"primary",
|
|
12
|
-
"default",
|
|
13
|
-
"secondary",
|
|
14
|
-
"destructive",
|
|
15
|
-
"outline",
|
|
16
|
-
"ghost",
|
|
17
|
-
"link",
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
size: {
|
|
21
|
-
control: { type: "select" },
|
|
22
|
-
options: ["sm", "default", "lg"],
|
|
23
|
-
},
|
|
24
|
-
disabled: {
|
|
25
|
-
control: { type: "boolean" },
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
args: {
|
|
29
|
-
variant: "default",
|
|
30
|
-
size: "default",
|
|
31
|
-
disabled: false,
|
|
32
|
-
},
|
|
33
|
-
} satisfies Meta<typeof Button>;
|
|
34
|
-
|
|
35
|
-
export default meta;
|
|
36
|
-
type Story = StoryObj<typeof Button>;
|
|
37
|
-
|
|
38
|
-
// =============================================================================
|
|
39
|
-
// Playground
|
|
40
|
-
// =============================================================================
|
|
41
|
-
|
|
42
|
-
export const Playground: Story = {
|
|
43
|
-
render: (args) => <Button {...args}>Button</Button>,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// =============================================================================
|
|
47
|
-
// All Variants
|
|
48
|
-
// =============================================================================
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* All button variants in a single view.
|
|
52
|
-
* Matches Figma Button component variants.
|
|
53
|
-
*/
|
|
54
|
-
export const AllVariants: Story = {
|
|
55
|
-
render: () => (
|
|
56
|
-
<div className="flex flex-col gap-24">
|
|
57
|
-
<div className="flex items-center gap-16">
|
|
58
|
-
<Button variant="primary">Primary</Button>
|
|
59
|
-
<Button variant="default">Default</Button>
|
|
60
|
-
<Button variant="secondary">Secondary</Button>
|
|
61
|
-
<Button variant="destructive">Destructive</Button>
|
|
62
|
-
<Button variant="outline">Outline</Button>
|
|
63
|
-
<Button variant="ghost">Ghost</Button>
|
|
64
|
-
<Button variant="link">Link</Button>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
),
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// =============================================================================
|
|
71
|
-
// Individual Variants
|
|
72
|
-
// =============================================================================
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Primary button - Blue filled for primary actions.
|
|
76
|
-
* Use for the main call-to-action.
|
|
77
|
-
*/
|
|
78
|
-
export const Primary: Story = {
|
|
79
|
-
render: () => <Button variant="primary">Primary</Button>,
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Default button - Dark filled for secondary prominence.
|
|
84
|
-
* Use for important but not primary actions.
|
|
85
|
-
*/
|
|
86
|
-
export const Default: Story = {
|
|
87
|
-
render: () => <Button variant="default">Default</Button>,
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Secondary button - Light gray filled with subtle border.
|
|
92
|
-
* Use for less prominent actions.
|
|
93
|
-
*/
|
|
94
|
-
export const Secondary: Story = {
|
|
95
|
-
render: () => <Button variant="secondary">Secondary</Button>,
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Destructive button - Red filled for destructive actions.
|
|
100
|
-
* Use for delete, remove, or other destructive actions.
|
|
101
|
-
*/
|
|
102
|
-
export const Destructive: Story = {
|
|
103
|
-
render: () => <Button variant="destructive">Destructive</Button>,
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Outline button - Bordered with transparent background.
|
|
108
|
-
* Use for secondary actions that need clear boundaries.
|
|
109
|
-
*/
|
|
110
|
-
export const Outline: Story = {
|
|
111
|
-
render: () => <Button variant="outline">Outline</Button>,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Ghost button - Transparent with subtle hover.
|
|
116
|
-
* Use for tertiary actions or in toolbars.
|
|
117
|
-
*/
|
|
118
|
-
export const Ghost: Story = {
|
|
119
|
-
render: () => <Button variant="ghost">Ghost</Button>,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Link button - Text only with underline on hover.
|
|
124
|
-
* Use for navigation or inline actions.
|
|
125
|
-
*/
|
|
126
|
-
export const Link: Story = {
|
|
127
|
-
render: () => <Button variant="link">Link</Button>,
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
// =============================================================================
|
|
131
|
-
// Sizes
|
|
132
|
-
// =============================================================================
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* All button sizes.
|
|
136
|
-
* Matches Figma Button component sizes: sm (32px), default (36px), lg (40px).
|
|
137
|
-
*/
|
|
138
|
-
export const AllSizes: Story = {
|
|
139
|
-
render: () => (
|
|
140
|
-
<div className="flex items-center gap-16">
|
|
141
|
-
<Button size="sm">Small</Button>
|
|
142
|
-
<Button size="default">Default</Button>
|
|
143
|
-
<Button size="lg">Large</Button>
|
|
144
|
-
</div>
|
|
145
|
-
),
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export const Small: Story = {
|
|
149
|
-
render: () => <Button size="sm">Small</Button>,
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
export const Medium: Story = {
|
|
153
|
-
render: () => <Button size="default">Default</Button>,
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export const Large: Story = {
|
|
157
|
-
render: () => <Button size="lg">Large</Button>,
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
// =============================================================================
|
|
161
|
-
// States
|
|
162
|
-
// =============================================================================
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Disabled state for all variants.
|
|
166
|
-
*/
|
|
167
|
-
export const Disabled: Story = {
|
|
168
|
-
render: () => <Button disabled>Disabled</Button>,
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
export const DisabledVariants: Story = {
|
|
172
|
-
render: () => (
|
|
173
|
-
<div className="flex items-center gap-16">
|
|
174
|
-
<Button variant="primary" disabled>
|
|
175
|
-
Primary
|
|
176
|
-
</Button>
|
|
177
|
-
<Button variant="default" disabled>
|
|
178
|
-
Default
|
|
179
|
-
</Button>
|
|
180
|
-
<Button variant="secondary" disabled>
|
|
181
|
-
Secondary
|
|
182
|
-
</Button>
|
|
183
|
-
<Button variant="destructive" disabled>
|
|
184
|
-
Destructive
|
|
185
|
-
</Button>
|
|
186
|
-
<Button variant="outline" disabled>
|
|
187
|
-
Outline
|
|
188
|
-
</Button>
|
|
189
|
-
<Button variant="ghost" disabled>
|
|
190
|
-
Ghost
|
|
191
|
-
</Button>
|
|
192
|
-
<Button variant="link" disabled>
|
|
193
|
-
Link
|
|
194
|
-
</Button>
|
|
195
|
-
</div>
|
|
196
|
-
),
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
// =============================================================================
|
|
200
|
-
// Size Variants Matrix
|
|
201
|
-
// =============================================================================
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Matrix showing all variants at all sizes.
|
|
205
|
-
*/
|
|
206
|
-
export const VariantSizeMatrix: Story = {
|
|
207
|
-
render: () => (
|
|
208
|
-
<div className="flex flex-col gap-24">
|
|
209
|
-
<div>
|
|
210
|
-
<h3 className="mb-12 text-14 font-medium text-gray-600">Small</h3>
|
|
211
|
-
<div className="flex items-center gap-12">
|
|
212
|
-
<Button variant="primary" size="sm">
|
|
213
|
-
Primary
|
|
214
|
-
</Button>
|
|
215
|
-
<Button variant="default" size="sm">
|
|
216
|
-
Default
|
|
217
|
-
</Button>
|
|
218
|
-
<Button variant="secondary" size="sm">
|
|
219
|
-
Secondary
|
|
220
|
-
</Button>
|
|
221
|
-
<Button variant="destructive" size="sm">
|
|
222
|
-
Destructive
|
|
223
|
-
</Button>
|
|
224
|
-
<Button variant="outline" size="sm">
|
|
225
|
-
Outline
|
|
226
|
-
</Button>
|
|
227
|
-
<Button variant="ghost" size="sm">
|
|
228
|
-
Ghost
|
|
229
|
-
</Button>
|
|
230
|
-
<Button variant="link" size="sm">
|
|
231
|
-
Link
|
|
232
|
-
</Button>
|
|
233
|
-
</div>
|
|
234
|
-
</div>
|
|
235
|
-
<div>
|
|
236
|
-
<h3 className="mb-12 text-14 font-medium text-gray-600">Default</h3>
|
|
237
|
-
<div className="flex items-center gap-12">
|
|
238
|
-
<Button variant="primary" size="default">
|
|
239
|
-
Primary
|
|
240
|
-
</Button>
|
|
241
|
-
<Button variant="default" size="default">
|
|
242
|
-
Default
|
|
243
|
-
</Button>
|
|
244
|
-
<Button variant="secondary" size="default">
|
|
245
|
-
Secondary
|
|
246
|
-
</Button>
|
|
247
|
-
<Button variant="destructive" size="default">
|
|
248
|
-
Destructive
|
|
249
|
-
</Button>
|
|
250
|
-
<Button variant="outline" size="default">
|
|
251
|
-
Outline
|
|
252
|
-
</Button>
|
|
253
|
-
<Button variant="ghost" size="default">
|
|
254
|
-
Ghost
|
|
255
|
-
</Button>
|
|
256
|
-
<Button variant="link" size="default">
|
|
257
|
-
Link
|
|
258
|
-
</Button>
|
|
259
|
-
</div>
|
|
260
|
-
</div>
|
|
261
|
-
<div>
|
|
262
|
-
<h3 className="mb-12 text-14 font-medium text-gray-600">Large</h3>
|
|
263
|
-
<div className="flex items-center gap-12">
|
|
264
|
-
<Button variant="primary" size="lg">
|
|
265
|
-
Primary
|
|
266
|
-
</Button>
|
|
267
|
-
<Button variant="default" size="lg">
|
|
268
|
-
Default
|
|
269
|
-
</Button>
|
|
270
|
-
<Button variant="secondary" size="lg">
|
|
271
|
-
Secondary
|
|
272
|
-
</Button>
|
|
273
|
-
<Button variant="destructive" size="lg">
|
|
274
|
-
Destructive
|
|
275
|
-
</Button>
|
|
276
|
-
<Button variant="outline" size="lg">
|
|
277
|
-
Outline
|
|
278
|
-
</Button>
|
|
279
|
-
<Button variant="ghost" size="lg">
|
|
280
|
-
Ghost
|
|
281
|
-
</Button>
|
|
282
|
-
<Button variant="link" size="lg">
|
|
283
|
-
Link
|
|
284
|
-
</Button>
|
|
285
|
-
</div>
|
|
286
|
-
</div>
|
|
287
|
-
</div>
|
|
288
|
-
),
|
|
289
|
-
};
|