@nationaldesignstudio/react 0.2.0 → 0.5.0
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 +1310 -127
- package/dist/components/atoms/background/background.d.ts +13 -27
- package/dist/components/atoms/button/button.d.ts +64 -72
- package/dist/components/atoms/button/button.figma.d.ts +1 -0
- package/dist/components/atoms/button/icon-button.d.ts +62 -110
- package/dist/components/atoms/input/input-group.d.ts +278 -0
- package/dist/components/atoms/input/input.d.ts +121 -0
- package/dist/components/atoms/popover/popover.d.ts +195 -0
- package/dist/components/atoms/select/select.d.ts +131 -0
- package/dist/components/atoms/tooltip/tooltip.d.ts +161 -0
- package/dist/components/organisms/card/card.d.ts +3 -3
- package/dist/components/sections/hero/hero.d.ts +2 -2
- package/dist/components/sections/prose/prose.d.ts +3 -3
- package/dist/components/sections/river/river.d.ts +1 -1
- package/dist/components/sections/tout/tout.d.ts +4 -4
- package/dist/components/shared/floating-arrow.d.ts +34 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +13935 -7622
- package/dist/index.js.map +1 -1
- package/dist/lib/form-control.d.ts +106 -0
- package/dist/tokens.css +4725 -19065
- package/package.json +2 -1
- package/src/components/atoms/accordion/accordion.stories.tsx +1 -1
- package/src/components/atoms/accordion/accordion.tsx +2 -2
- package/src/components/atoms/background/background.tsx +71 -109
- package/src/components/atoms/button/button.figma.tsx +37 -0
- package/src/components/atoms/button/button.stories.tsx +253 -115
- package/src/components/atoms/button/button.test.tsx +289 -5
- package/src/components/atoms/button/button.tsx +40 -101
- package/src/components/atoms/button/button.visual.test.tsx +28 -32
- package/src/components/atoms/button/icon-button.stories.tsx +44 -101
- package/src/components/atoms/button/icon-button.test.tsx +26 -94
- package/src/components/atoms/button/icon-button.tsx +81 -224
- package/src/components/atoms/input/index.ts +17 -0
- package/src/components/atoms/input/input-group.stories.tsx +646 -0
- package/src/components/atoms/input/input-group.test.tsx +362 -0
- package/src/components/atoms/input/input-group.tsx +409 -0
- package/src/components/atoms/input/input.stories.tsx +228 -0
- package/src/components/atoms/input/input.test.tsx +167 -0
- package/src/components/atoms/input/input.tsx +104 -0
- package/src/components/atoms/pager-control/pager-control.stories.tsx +6 -8
- package/src/components/atoms/pager-control/pager-control.tsx +12 -12
- package/src/components/atoms/popover/index.ts +30 -0
- package/src/components/atoms/popover/popover.stories.tsx +531 -0
- package/src/components/atoms/popover/popover.test.tsx +486 -0
- package/src/components/atoms/popover/popover.tsx +488 -0
- package/src/components/atoms/select/index.ts +18 -0
- package/src/components/atoms/select/select.stories.tsx +455 -0
- package/src/components/atoms/select/select.tsx +324 -0
- package/src/components/atoms/tooltip/index.ts +24 -0
- package/src/components/atoms/tooltip/tooltip.stories.tsx +348 -0
- package/src/components/atoms/tooltip/tooltip.test.tsx +363 -0
- package/src/components/atoms/tooltip/tooltip.tsx +347 -0
- package/src/components/dev-tools/dev-toolbar/dev-toolbar.stories.tsx +8 -17
- package/src/components/dev-tools/dev-toolbar/dev-toolbar.tsx +3 -3
- package/src/components/foundation/typography/typography.stories.tsx +401 -0
- package/src/components/organisms/card/card.stories.tsx +19 -19
- package/src/components/organisms/card/card.test.tsx +1 -1
- package/src/components/organisms/card/card.tsx +3 -3
- package/src/components/organisms/card/card.visual.test.tsx +11 -11
- package/src/components/organisms/navbar/navbar.tsx +2 -2
- package/src/components/organisms/navbar/navbar.visual.test.tsx +2 -2
- package/src/components/organisms/us-gov-banner/us-gov-banner.tsx +2 -2
- package/src/components/sections/banner/banner.stories.tsx +1 -5
- package/src/components/sections/banner/banner.test.tsx +2 -2
- package/src/components/sections/banner/banner.tsx +6 -6
- package/src/components/sections/card-grid/card-grid.tsx +5 -5
- package/src/components/sections/faq-section/faq-section.tsx +2 -2
- package/src/components/sections/hero/hero.stories.tsx +7 -7
- package/src/components/sections/hero/hero.test.tsx +5 -5
- package/src/components/sections/hero/hero.tsx +10 -11
- package/src/components/sections/prose/prose.test.tsx +2 -2
- package/src/components/sections/prose/prose.tsx +6 -7
- package/src/components/sections/river/river.stories.tsx +8 -8
- package/src/components/sections/river/river.test.tsx +4 -4
- package/src/components/sections/river/river.tsx +8 -16
- package/src/components/sections/tout/tout.stories.tsx +7 -31
- package/src/components/sections/tout/tout.test.tsx +1 -1
- package/src/components/sections/tout/tout.tsx +11 -11
- package/src/components/sections/two-column-section/two-column-section.tsx +7 -9
- package/src/components/shared/floating-arrow.tsx +78 -0
- package/src/components/shared/index.ts +5 -0
- package/src/index.ts +98 -0
- package/src/lib/form-control.ts +71 -0
- package/src/stories/grid-system.stories.tsx +309 -0
- package/src/stories/{Introduction.mdx → introduction.mdx} +29 -15
- package/src/stories/{ThemeProvider.stories.tsx → theme-provider.stories.tsx} +8 -22
- package/src/stories/{TokenShowcase.stories.tsx → token-showcase.stories.tsx} +1 -20
- package/src/stories/token-showcase.tsx +777 -0
- package/src/styles.css +3 -0
- package/src/tests/token-resolution.test.tsx +298 -0
- package/src/theme/hooks.ts +1 -1
- package/src/theme/index.ts +1 -1
- package/src/theme/theme-provider.test.tsx +270 -0
- package/src/theme/{ThemeProvider.tsx → theme-provider.tsx} +18 -2
- package/src/stories/GridSystem.stories.tsx +0 -84
- package/src/stories/TokenShowcase.tsx +0 -1429
|
@@ -3,149 +3,287 @@ import { Button } from ".";
|
|
|
3
3
|
|
|
4
4
|
const meta: Meta<typeof Button> = {
|
|
5
5
|
title: "Atoms/Button",
|
|
6
|
-
|
|
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>;
|
|
7
34
|
|
|
8
35
|
export default meta;
|
|
9
36
|
type Story = StoryObj<typeof Button>;
|
|
10
37
|
|
|
38
|
+
// =============================================================================
|
|
39
|
+
// Playground
|
|
40
|
+
// =============================================================================
|
|
41
|
+
|
|
11
42
|
export const Playground: Story = {
|
|
12
43
|
render: (args) => <Button {...args}>Button</Button>,
|
|
13
44
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
Playground.args = {
|
|
40
|
-
size: "default",
|
|
41
|
-
disabled: false,
|
|
42
|
-
variant: "solid",
|
|
43
|
-
colorScheme: "dark",
|
|
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
|
+
),
|
|
44
68
|
};
|
|
45
69
|
|
|
46
70
|
// =============================================================================
|
|
47
|
-
// Variants
|
|
71
|
+
// Individual Variants
|
|
48
72
|
// =============================================================================
|
|
49
73
|
|
|
50
|
-
|
|
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
|
+
};
|
|
51
81
|
|
|
52
|
-
|
|
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
|
+
};
|
|
53
89
|
|
|
54
|
-
|
|
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
|
+
};
|
|
55
97
|
|
|
56
|
-
|
|
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
|
+
};
|
|
57
105
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
+
};
|
|
61
121
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
export const
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
Solid Light
|
|
70
|
-
</Button>
|
|
71
|
-
</DarkBackground>
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
export const OutlineLight = () => (
|
|
75
|
-
<DarkBackground>
|
|
76
|
-
<Button variant="outline" colorScheme="light">
|
|
77
|
-
Outline Light
|
|
78
|
-
</Button>
|
|
79
|
-
</DarkBackground>
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
export const GhostLight = () => (
|
|
83
|
-
<DarkBackground>
|
|
84
|
-
<Button variant="ghost" colorScheme="light">
|
|
85
|
-
Ghost Light
|
|
86
|
-
</Button>
|
|
87
|
-
</DarkBackground>
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
export const SubtleLight = () => (
|
|
91
|
-
<DarkBackground>
|
|
92
|
-
<Button variant="subtle" colorScheme="light">
|
|
93
|
-
Subtle Light
|
|
94
|
-
</Button>
|
|
95
|
-
</DarkBackground>
|
|
96
|
-
);
|
|
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
|
+
};
|
|
97
129
|
|
|
98
130
|
// =============================================================================
|
|
99
|
-
//
|
|
131
|
+
// Sizes
|
|
100
132
|
// =============================================================================
|
|
101
133
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<Button variant="subtle">Subtle</Button>
|
|
113
|
-
</div>
|
|
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>
|
|
114
144
|
</div>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<Button variant="subtle" colorScheme="light">
|
|
130
|
-
Subtle
|
|
131
|
-
</Button>
|
|
132
|
-
</div>
|
|
133
|
-
</DarkBackground>
|
|
134
|
-
</div>
|
|
135
|
-
);
|
|
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
|
+
};
|
|
136
159
|
|
|
137
160
|
// =============================================================================
|
|
138
|
-
//
|
|
161
|
+
// States
|
|
139
162
|
// =============================================================================
|
|
140
163
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Disabled state for all variants.
|
|
166
|
+
*/
|
|
167
|
+
export const Disabled: Story = {
|
|
168
|
+
render: () => <Button disabled>Disabled</Button>,
|
|
169
|
+
};
|
|
144
170
|
|
|
145
|
-
export const
|
|
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
|
+
};
|
|
146
198
|
|
|
147
199
|
// =============================================================================
|
|
148
|
-
//
|
|
200
|
+
// Size Variants Matrix
|
|
149
201
|
// =============================================================================
|
|
150
202
|
|
|
151
|
-
|
|
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
|
+
};
|