@fpkit/acss 1.0.0-beta.1 → 1.0.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 (43) hide show
  1. package/README.md +32 -0
  2. package/docs/README.md +325 -0
  3. package/docs/guides/accessibility.md +764 -0
  4. package/docs/guides/architecture.md +705 -0
  5. package/docs/guides/composition.md +688 -0
  6. package/docs/guides/css-variables.md +522 -0
  7. package/docs/guides/storybook.md +828 -0
  8. package/docs/guides/testing.md +817 -0
  9. package/docs/testing/focus-indicator-testing.md +437 -0
  10. package/libs/components/buttons/button.css +1 -1
  11. package/libs/components/buttons/button.css.map +1 -1
  12. package/libs/components/buttons/button.min.css +2 -2
  13. package/libs/components/icons/icon.d.cts +32 -32
  14. package/libs/components/icons/icon.d.ts +32 -32
  15. package/libs/components/list/list.css +1 -1
  16. package/libs/components/list/list.min.css +1 -1
  17. package/libs/index.css +1 -1
  18. package/libs/index.css.map +1 -1
  19. package/package.json +4 -3
  20. package/src/components/README.mdx +1 -1
  21. package/src/components/buttons/button.scss +5 -0
  22. package/src/components/buttons/button.stories.tsx +8 -5
  23. package/src/components/cards/card.stories.tsx +1 -1
  24. package/src/components/details/details.stories.tsx +1 -1
  25. package/src/components/form/form.stories.tsx +1 -1
  26. package/src/components/form/input.stories.tsx +1 -1
  27. package/src/components/form/select.stories.tsx +1 -1
  28. package/src/components/heading/README.mdx +292 -0
  29. package/src/components/icons/icon.stories.tsx +1 -1
  30. package/src/components/list/list.scss +1 -1
  31. package/src/components/nav/nav.stories.tsx +1 -1
  32. package/src/components/ui.stories.tsx +53 -19
  33. package/src/docs/accessibility.mdx +484 -0
  34. package/src/docs/composition.mdx +549 -0
  35. package/src/docs/css-variables.mdx +380 -0
  36. package/src/docs/fpkit-developer.mdx +545 -0
  37. package/src/introduction.mdx +356 -0
  38. package/src/styles/buttons/button.css +4 -0
  39. package/src/styles/buttons/button.css.map +1 -1
  40. package/src/styles/index.css +9 -3
  41. package/src/styles/index.css.map +1 -1
  42. package/src/styles/list/list.css +1 -1
  43. package/src/styles/utilities/_disabled.scss +5 -4
package/README.md CHANGED
@@ -519,6 +519,38 @@ test('renders button with text', () => {
519
519
  });
520
520
  ```
521
521
 
522
+ ## 📚 Documentation
523
+
524
+ Comprehensive guides to help you build accessible, maintainable applications with @fpkit/acss:
525
+
526
+ ### Core Guides
527
+
528
+ - **[CSS Variables Guide](docs/guides/css-variables.md)** - Learn how to discover and customize CSS custom properties for theming and styling
529
+ - **[Composition Guide](docs/guides/composition.md)** - Master component composition patterns to build custom components by combining fpkit primitives
530
+ - **[Accessibility Guide](docs/guides/accessibility.md)** - Understand and maintain WCAG 2.1 Level AA compliance when using and composing components
531
+ - **[Architecture Guide](docs/guides/architecture.md)** - Learn fpkit's architectural patterns, component structure, and how to work effectively with the library
532
+ - **[Testing Guide](docs/guides/testing.md)** - Test applications and custom components using Vitest and React Testing Library
533
+ - **[Storybook Guide](docs/guides/storybook.md)** - Document custom components and compositions using Storybook
534
+
535
+ ### Quick Links
536
+
537
+ - **[Documentation Index](docs/README.md)** - Complete documentation hub with guide navigator and workflows
538
+ - **[Storybook](https://fpkit.netlify.app/)** - Interactive component documentation and playground
539
+
540
+ ### Common Tasks
541
+
542
+ **Customizing component appearance?**
543
+ → Start with [CSS Variables Guide](docs/guides/css-variables.md)
544
+
545
+ **Building a custom component?**
546
+ → Read [Composition Guide](docs/guides/composition.md), then [Architecture Guide](docs/guides/architecture.md)
547
+
548
+ **Ensuring accessibility?**
549
+ → Study [Accessibility Guide](docs/guides/accessibility.md)
550
+
551
+ **Testing components?**
552
+ → Follow [Testing Guide](docs/guides/testing.md)
553
+
522
554
  ## 🤝 Contributing
523
555
 
524
556
  We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
package/docs/README.md ADDED
@@ -0,0 +1,325 @@
1
+ # @fpkit/acss Documentation
2
+
3
+ Welcome to the @fpkit/acss documentation! This collection of guides helps you build accessible, maintainable applications using the fpkit component library.
4
+
5
+ ---
6
+
7
+ ## 📚 Guides
8
+
9
+ ### [CSS Variables Guide](./guides/css-variables.md)
10
+
11
+ Learn how to discover, customize, and override CSS custom properties in fpkit components.
12
+
13
+ **Topics:**
14
+ - Understanding the naming convention
15
+ - Discovering available variables
16
+ - Customization strategies (global, theme, component-specific)
17
+ - rem units and accessibility
18
+ - Framework integration (React, Next.js, CSS Modules)
19
+
20
+ **Use when:**
21
+ - Customizing component appearance
22
+ - Creating themes
23
+ - Building design systems
24
+ - Understanding fpkit styling architecture
25
+
26
+ ---
27
+
28
+ ### [Composition Guide](./guides/composition.md)
29
+
30
+ Master component composition patterns to build custom components by combining fpkit primitives.
31
+
32
+ **Topics:**
33
+ - Composition vs creation decision tree
34
+ - Common composition patterns (container + content, conditional, enhanced wrapper, compound)
35
+ - Real-world examples (AlertDialog, IconButton, TagInput)
36
+ - Anti-patterns to avoid
37
+ - TypeScript support for compositions
38
+
39
+ **Use when:**
40
+ - Building custom components
41
+ - Extending fpkit functionality
42
+ - Creating application-specific components
43
+ - Deciding whether to compose or create from scratch
44
+
45
+ ---
46
+
47
+ ### [Accessibility Guide](./guides/accessibility.md)
48
+
49
+ Understand and maintain WCAG 2.1 Level AA compliance when using and composing fpkit components.
50
+
51
+ **Topics:**
52
+ - Core accessibility principles
53
+ - ARIA attributes and patterns
54
+ - Keyboard navigation
55
+ - Focus management
56
+ - Screen reader support
57
+ - Color contrast requirements
58
+ - Testing accessibility (manual and automated)
59
+
60
+ **Use when:**
61
+ - Ensuring accessible applications
62
+ - Testing for WCAG compliance
63
+ - Implementing keyboard navigation
64
+ - Adding ARIA attributes
65
+ - Composing accessible custom components
66
+
67
+ ---
68
+
69
+ ### [Architecture Guide](./guides/architecture.md)
70
+
71
+ Learn fpkit's architectural patterns, component structure, and how to work effectively with the library.
72
+
73
+ **Topics:**
74
+ - Polymorphic UI component foundation
75
+ - Simple vs compound component patterns
76
+ - TypeScript support and prop types
77
+ - Composition patterns
78
+ - Styling architecture (data attributes, CSS variables)
79
+ - Props patterns and conventions
80
+ - Framework integration
81
+
82
+ **Use when:**
83
+ - Understanding fpkit component structure
84
+ - Working with polymorphic `as` prop
85
+ - Extending component props
86
+ - Integrating with frameworks (React, Next.js)
87
+ - Building type-safe compositions
88
+
89
+ ---
90
+
91
+ ### [Testing Guide](./guides/testing.md)
92
+
93
+ Test applications and custom components built with fpkit using Vitest and React Testing Library.
94
+
95
+ **Topics:**
96
+ - Vitest and React Testing Library setup
97
+ - Testing composed components
98
+ - Query best practices (getByRole, getByLabelText)
99
+ - Event testing (clicks, keyboard, forms)
100
+ - Accessibility testing (automated with jest-axe)
101
+ - Async testing and loading states
102
+ - Mock functions and test organization
103
+
104
+ **Use when:**
105
+ - Setting up test infrastructure
106
+ - Testing custom compositions
107
+ - Testing user interactions
108
+ - Testing accessibility
109
+ - Writing integration tests
110
+
111
+ ---
112
+
113
+ ### [Storybook Guide](./guides/storybook.md)
114
+
115
+ Document custom components and compositions using Storybook for development and showcase.
116
+
117
+ **Topics:**
118
+ - Storybook setup and configuration
119
+ - Story structure and patterns
120
+ - Documenting composed components
121
+ - CSS variable customization stories
122
+ - Interactive testing with play functions
123
+ - ArgTypes configuration
124
+ - Accessibility testing in Storybook
125
+
126
+ **Use when:**
127
+ - Documenting custom components
128
+ - Creating component showcases
129
+ - Interactive component development
130
+ - Testing components in isolation
131
+ - Building internal component libraries
132
+
133
+ ---
134
+
135
+ ## 🚀 Quick Start
136
+
137
+ ### Installation
138
+
139
+ ```bash
140
+ npm install @fpkit/acss
141
+ ```
142
+
143
+ ### Basic Usage
144
+
145
+ ```tsx
146
+ import { Button, Card } from '@fpkit/acss'
147
+ import '@fpkit/acss/libs/index.css'
148
+
149
+ function App() {
150
+ return (
151
+ <Card>
152
+ <Card.Header>
153
+ <Card.Title>Welcome</Card.Title>
154
+ </Card.Header>
155
+ <Card.Content>
156
+ <p>Get started with fpkit components.</p>
157
+ <Button variant="primary">Get Started</Button>
158
+ </Card.Content>
159
+ </Card>
160
+ )
161
+ }
162
+ ```
163
+
164
+ ---
165
+
166
+ ## 📖 Guide Navigator
167
+
168
+ ### I want to...
169
+
170
+ **Customize component appearance**
171
+ → Start with [CSS Variables Guide](./guides/css-variables.md)
172
+
173
+ **Build a custom component**
174
+ → Read [Composition Guide](./guides/composition.md), then [Architecture Guide](./guides/architecture.md)
175
+
176
+ **Ensure my app is accessible**
177
+ → Study [Accessibility Guide](./guides/accessibility.md)
178
+
179
+ **Test my components**
180
+ → Follow [Testing Guide](./guides/testing.md)
181
+
182
+ **Document components**
183
+ → Learn [Storybook Guide](./guides/storybook.md)
184
+
185
+ **Understand fpkit patterns**
186
+ → Start with [Architecture Guide](./guides/architecture.md)
187
+
188
+ ---
189
+
190
+ ## 🎯 Common Workflows
191
+
192
+ ### Creating a Custom Component
193
+
194
+ 1. **Plan** - Use [Composition Guide](./guides/composition.md) decision tree
195
+ 2. **Compose** - Combine fpkit components following [Architecture Guide](./guides/architecture.md) patterns
196
+ 3. **Style** - Customize with CSS variables from [CSS Variables Guide](./guides/css-variables.md)
197
+ 4. **Accessibility** - Maintain standards from [Accessibility Guide](./guides/accessibility.md)
198
+ 5. **Test** - Write tests using [Testing Guide](./guides/testing.md)
199
+ 6. **Document** - Create stories with [Storybook Guide](./guides/storybook.md)
200
+
201
+ ### Building an Accessible Application
202
+
203
+ 1. **Foundation** - Use semantic fpkit components ([Architecture Guide](./guides/architecture.md))
204
+ 2. **Compliance** - Follow patterns in [Accessibility Guide](./guides/accessibility.md)
205
+ 3. **Testing** - Verify with manual and automated tests ([Testing Guide](./guides/testing.md))
206
+ 4. **Theming** - Ensure color contrast ([CSS Variables Guide](./guides/css-variables.md))
207
+
208
+ ### Creating a Theme
209
+
210
+ 1. **Variables** - Discover customizable CSS variables ([CSS Variables Guide](./guides/css-variables.md))
211
+ 2. **Contrast** - Verify color contrast ratios ([Accessibility Guide](./guides/accessibility.md))
212
+ 3. **Testing** - Test theme across components ([Testing Guide](./guides/testing.md))
213
+ 4. **Documentation** - Document theme in Storybook ([Storybook Guide](./guides/storybook.md))
214
+
215
+ ---
216
+
217
+ ## 💡 Key Concepts
218
+
219
+ ### Composition Over Creation
220
+
221
+ fpkit encourages **composing** existing components rather than creating new ones from scratch. This ensures:
222
+ - Consistency across your application
223
+ - Maintained accessibility features
224
+ - Reduced code duplication
225
+ - Leveraged test coverage
226
+
227
+ Learn more in the [Composition Guide](./guides/composition.md).
228
+
229
+ ### CSS Variables for Customization
230
+
231
+ All fpkit components use **CSS custom properties** for styling, enabling:
232
+ - Theme creation without rebuilding
233
+ - Component-specific customization
234
+ - Real-time style updates
235
+ - Scoped styling overrides
236
+
237
+ Learn more in the [CSS Variables Guide](./guides/css-variables.md).
238
+
239
+ ### WCAG 2.1 Level AA Compliance
240
+
241
+ fpkit components meet **WCAG 2.1 Level AA** standards by default:
242
+ - Semantic HTML elements
243
+ - Proper ARIA attributes
244
+ - Keyboard navigation
245
+ - Screen reader support
246
+ - Sufficient color contrast
247
+
248
+ Learn more in the [Accessibility Guide](./guides/accessibility.md).
249
+
250
+ ### Polymorphic Components
251
+
252
+ Most fpkit components support the **`as` prop** for rendering as different HTML elements:
253
+ - Semantic flexibility (Button as `<a>`, Card as `<section>`)
254
+ - Type-safe prop spreading
255
+ - Maintained component behavior
256
+
257
+ Learn more in the [Architecture Guide](./guides/architecture.md).
258
+
259
+ ---
260
+
261
+ ## 🔗 External Resources
262
+
263
+ ### fpkit Resources
264
+ - [GitHub Repository](https://github.com/shawn-sandy/acss)
265
+ - [Storybook Documentation](https://fpkit.netlify.app) _(if deployed)_
266
+ - [npm Package](https://www.npmjs.com/package/@fpkit/acss)
267
+
268
+ ### Web Standards
269
+ - [WCAG 2.1 Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)
270
+ - [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/)
271
+ - [MDN Web Docs](https://developer.mozilla.org/)
272
+
273
+ ### Testing Resources
274
+ - [Vitest Documentation](https://vitest.dev/)
275
+ - [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/)
276
+ - [jest-axe](https://github.com/nickcolley/jest-axe)
277
+
278
+ ### Development Tools
279
+ - [Storybook](https://storybook.js.org/)
280
+ - [TypeScript](https://www.typescriptlang.org/)
281
+ - [Vite](https://vitejs.dev/)
282
+
283
+ ---
284
+
285
+ ## 🆘 Getting Help
286
+
287
+ ### Common Issues
288
+
289
+ **Problem: Styles not loading**
290
+ → Ensure you've imported `@fpkit/acss/libs/index.css` in your entry file
291
+
292
+ **Problem: TypeScript errors with `as` prop**
293
+ → Check that you're passing valid HTML element props for the specified `as` value
294
+
295
+ **Problem: Custom CSS variables not applying**
296
+ → Verify you're using the correct naming convention (see [CSS Variables Guide](./guides/css-variables.md))
297
+
298
+ **Problem: Component not keyboard accessible**
299
+ → Review accessibility patterns in [Accessibility Guide](./guides/accessibility.md)
300
+
301
+ ### Contributing
302
+
303
+ Found an issue or want to contribute? Visit our [GitHub repository](https://github.com/shawn-sandy/acss).
304
+
305
+ ---
306
+
307
+ ## 📝 Documentation Structure
308
+
309
+ ```
310
+ docs/
311
+ ├── README.md (this file)
312
+ └── guides/
313
+ ├── css-variables.md - Styling and customization
314
+ ├── composition.md - Component composition patterns
315
+ ├── accessibility.md - WCAG compliance and a11y
316
+ ├── architecture.md - Component structure and patterns
317
+ ├── testing.md - Testing strategies
318
+ └── storybook.md - Component documentation
319
+ ```
320
+
321
+ ---
322
+
323
+ **Version**: 1.0.0
324
+ **Last Updated**: 2025-01-05
325
+ **License**: MIT