@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.
Files changed (97) hide show
  1. package/dist/component-registry.md +1310 -127
  2. package/dist/components/atoms/background/background.d.ts +13 -27
  3. package/dist/components/atoms/button/button.d.ts +64 -72
  4. package/dist/components/atoms/button/button.figma.d.ts +1 -0
  5. package/dist/components/atoms/button/icon-button.d.ts +62 -110
  6. package/dist/components/atoms/input/input-group.d.ts +278 -0
  7. package/dist/components/atoms/input/input.d.ts +121 -0
  8. package/dist/components/atoms/popover/popover.d.ts +195 -0
  9. package/dist/components/atoms/select/select.d.ts +131 -0
  10. package/dist/components/atoms/tooltip/tooltip.d.ts +161 -0
  11. package/dist/components/organisms/card/card.d.ts +3 -3
  12. package/dist/components/sections/hero/hero.d.ts +2 -2
  13. package/dist/components/sections/prose/prose.d.ts +3 -3
  14. package/dist/components/sections/river/river.d.ts +1 -1
  15. package/dist/components/sections/tout/tout.d.ts +4 -4
  16. package/dist/components/shared/floating-arrow.d.ts +34 -0
  17. package/dist/index.d.ts +12 -0
  18. package/dist/index.js +13935 -7622
  19. package/dist/index.js.map +1 -1
  20. package/dist/lib/form-control.d.ts +106 -0
  21. package/dist/tokens.css +4725 -19065
  22. package/package.json +2 -1
  23. package/src/components/atoms/accordion/accordion.stories.tsx +1 -1
  24. package/src/components/atoms/accordion/accordion.tsx +2 -2
  25. package/src/components/atoms/background/background.tsx +71 -109
  26. package/src/components/atoms/button/button.figma.tsx +37 -0
  27. package/src/components/atoms/button/button.stories.tsx +253 -115
  28. package/src/components/atoms/button/button.test.tsx +289 -5
  29. package/src/components/atoms/button/button.tsx +40 -101
  30. package/src/components/atoms/button/button.visual.test.tsx +28 -32
  31. package/src/components/atoms/button/icon-button.stories.tsx +44 -101
  32. package/src/components/atoms/button/icon-button.test.tsx +26 -94
  33. package/src/components/atoms/button/icon-button.tsx +81 -224
  34. package/src/components/atoms/input/index.ts +17 -0
  35. package/src/components/atoms/input/input-group.stories.tsx +646 -0
  36. package/src/components/atoms/input/input-group.test.tsx +362 -0
  37. package/src/components/atoms/input/input-group.tsx +409 -0
  38. package/src/components/atoms/input/input.stories.tsx +228 -0
  39. package/src/components/atoms/input/input.test.tsx +167 -0
  40. package/src/components/atoms/input/input.tsx +104 -0
  41. package/src/components/atoms/pager-control/pager-control.stories.tsx +6 -8
  42. package/src/components/atoms/pager-control/pager-control.tsx +12 -12
  43. package/src/components/atoms/popover/index.ts +30 -0
  44. package/src/components/atoms/popover/popover.stories.tsx +531 -0
  45. package/src/components/atoms/popover/popover.test.tsx +486 -0
  46. package/src/components/atoms/popover/popover.tsx +488 -0
  47. package/src/components/atoms/select/index.ts +18 -0
  48. package/src/components/atoms/select/select.stories.tsx +455 -0
  49. package/src/components/atoms/select/select.tsx +324 -0
  50. package/src/components/atoms/tooltip/index.ts +24 -0
  51. package/src/components/atoms/tooltip/tooltip.stories.tsx +348 -0
  52. package/src/components/atoms/tooltip/tooltip.test.tsx +363 -0
  53. package/src/components/atoms/tooltip/tooltip.tsx +347 -0
  54. package/src/components/dev-tools/dev-toolbar/dev-toolbar.stories.tsx +8 -17
  55. package/src/components/dev-tools/dev-toolbar/dev-toolbar.tsx +3 -3
  56. package/src/components/foundation/typography/typography.stories.tsx +401 -0
  57. package/src/components/organisms/card/card.stories.tsx +19 -19
  58. package/src/components/organisms/card/card.test.tsx +1 -1
  59. package/src/components/organisms/card/card.tsx +3 -3
  60. package/src/components/organisms/card/card.visual.test.tsx +11 -11
  61. package/src/components/organisms/navbar/navbar.tsx +2 -2
  62. package/src/components/organisms/navbar/navbar.visual.test.tsx +2 -2
  63. package/src/components/organisms/us-gov-banner/us-gov-banner.tsx +2 -2
  64. package/src/components/sections/banner/banner.stories.tsx +1 -5
  65. package/src/components/sections/banner/banner.test.tsx +2 -2
  66. package/src/components/sections/banner/banner.tsx +6 -6
  67. package/src/components/sections/card-grid/card-grid.tsx +5 -5
  68. package/src/components/sections/faq-section/faq-section.tsx +2 -2
  69. package/src/components/sections/hero/hero.stories.tsx +7 -7
  70. package/src/components/sections/hero/hero.test.tsx +5 -5
  71. package/src/components/sections/hero/hero.tsx +10 -11
  72. package/src/components/sections/prose/prose.test.tsx +2 -2
  73. package/src/components/sections/prose/prose.tsx +6 -7
  74. package/src/components/sections/river/river.stories.tsx +8 -8
  75. package/src/components/sections/river/river.test.tsx +4 -4
  76. package/src/components/sections/river/river.tsx +8 -16
  77. package/src/components/sections/tout/tout.stories.tsx +7 -31
  78. package/src/components/sections/tout/tout.test.tsx +1 -1
  79. package/src/components/sections/tout/tout.tsx +11 -11
  80. package/src/components/sections/two-column-section/two-column-section.tsx +7 -9
  81. package/src/components/shared/floating-arrow.tsx +78 -0
  82. package/src/components/shared/index.ts +5 -0
  83. package/src/index.ts +98 -0
  84. package/src/lib/form-control.ts +71 -0
  85. package/src/stories/grid-system.stories.tsx +309 -0
  86. package/src/stories/{Introduction.mdx → introduction.mdx} +29 -15
  87. package/src/stories/{ThemeProvider.stories.tsx → theme-provider.stories.tsx} +8 -22
  88. package/src/stories/{TokenShowcase.stories.tsx → token-showcase.stories.tsx} +1 -20
  89. package/src/stories/token-showcase.tsx +777 -0
  90. package/src/styles.css +3 -0
  91. package/src/tests/token-resolution.test.tsx +298 -0
  92. package/src/theme/hooks.ts +1 -1
  93. package/src/theme/index.ts +1 -1
  94. package/src/theme/theme-provider.test.tsx +270 -0
  95. package/src/theme/{ThemeProvider.tsx → theme-provider.tsx} +18 -2
  96. package/src/stories/GridSystem.stories.tsx +0 -84
  97. 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
- } as Meta<typeof 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>;
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
- Playground.argTypes = {
15
- size: {
16
- control: {
17
- type: "radio",
18
- },
19
- options: ["sm", "default", "lg"],
20
- },
21
- disabled: {
22
- control: {
23
- type: "boolean",
24
- },
25
- },
26
- variant: {
27
- control: {
28
- type: "radio",
29
- },
30
- options: ["solid", "outline", "ghost", "subtle"],
31
- },
32
- colorScheme: {
33
- control: {
34
- type: "radio",
35
- },
36
- options: ["dark", "light"],
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 (Dark Color Scheme - for light backgrounds)
71
+ // Individual Variants
48
72
  // =============================================================================
49
73
 
50
- export const Solid = () => <Button variant="solid">Solid</Button>;
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
- export const Outline = () => <Button variant="outline">Outline</Button>;
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
- export const Ghost = () => <Button variant="ghost">Ghost</Button>;
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
- export const Subtle = () => <Button variant="subtle">Subtle</Button>;
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
- // Variants (Light Color Scheme - for dark backgrounds)
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
- const DarkBackground = ({ children }: { children: React.ReactNode }) => (
63
- <div className="rounded-radius-12 bg-gray-1200 p-spacing-32">{children}</div>
64
- );
65
-
66
- export const SolidLight = () => (
67
- <DarkBackground>
68
- <Button variant="solid" colorScheme="light">
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
- // All Variants Comparison
131
+ // Sizes
100
132
  // =============================================================================
101
133
 
102
- export const AllVariants = () => (
103
- <div className="flex flex-col gap-spacing-32">
104
- <div>
105
- <h3 className="mb-spacing-16 text-14 font-medium text-text-secondary">
106
- Dark Color Scheme (for light backgrounds)
107
- </h3>
108
- <div className="flex gap-spacing-16">
109
- <Button variant="solid">Solid</Button>
110
- <Button variant="outline">Outline</Button>
111
- <Button variant="ghost">Ghost</Button>
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
- <DarkBackground>
116
- <h3 className="mb-spacing-16 text-14 font-medium text-gray-400">
117
- Light Color Scheme (for dark backgrounds)
118
- </h3>
119
- <div className="flex gap-spacing-16">
120
- <Button variant="solid" colorScheme="light">
121
- Solid
122
- </Button>
123
- <Button variant="outline" colorScheme="light">
124
- Outline
125
- </Button>
126
- <Button variant="ghost" colorScheme="light">
127
- Ghost
128
- </Button>
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
- // Sizes
161
+ // States
139
162
  // =============================================================================
140
163
 
141
- export const Small = () => <Button size="sm">Small</Button>;
142
-
143
- export const Medium = () => <Button size="default">Medium</Button>;
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 Large = () => <Button size="lg">Large</Button>;
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
- // States
200
+ // Size Variants Matrix
149
201
  // =============================================================================
150
202
 
151
- export const Disabled = () => <Button disabled>Disabled</Button>;
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
+ };