@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
@@ -0,0 +1,545 @@
1
+ import { Meta } from "@storybook/addon-docs/blocks";
2
+
3
+ <Meta title="Guides/FPKit Developer" />
4
+
5
+ # FPKit Developer
6
+
7
+ **Build applications with @fpkit/acss using Claude Code assistance**
8
+
9
+ A portable Claude Code skill for developers using the @fpkit/acss component library in their applications.
10
+
11
+ ---
12
+
13
+ ## What This Skill Does
14
+
15
+ This skill helps you:
16
+
17
+ ✅ **Compose custom components** from fpkit primitives
18
+ ✅ **Validate CSS variables** against fpkit conventions
19
+ ✅ **Maintain accessibility** (WCAG 2.1 Level AA)
20
+ ✅ **Follow best practices** for component composition
21
+ ✅ **TypeScript support** for type-safe compositions
22
+
23
+ ---
24
+
25
+ ## Installation
26
+
27
+ ### Option 1: Manual Installation (Recommended)
28
+
29
+ 1. **Copy this skill directory** to your Claude Code skills folder:
30
+
31
+ ```bash
32
+ # Copy to global skills (available in all projects)
33
+ cp -r /path/to/fpkit-developer ~/.claude/skills/
34
+
35
+ # Or copy to project-specific skills
36
+ cp -r /path/to/fpkit-developer ./.claude/skills/
37
+ ```
38
+
39
+ 2. **Verify installation**:
40
+
41
+ ```bash
42
+ ls ~/.claude/skills/fpkit-developer/
43
+ # Should show: README.md SKILL.md references/ scripts/
44
+ ```
45
+
46
+ 3. **Restart Claude Code** to load the skill.
47
+
48
+ ### Option 2: Clone from GitHub (Future)
49
+
50
+ When this skill is published to GitHub:
51
+
52
+ ```bash
53
+ # Global installation
54
+ cd ~/.claude/skills/
55
+ git clone https://github.com/shawn-sandy/fpkit-consumer-skill.git fpkit-consumer
56
+
57
+ # Project-specific installation
58
+ cd ./.claude/skills/
59
+ git clone https://github.com/shawn-sandy/fpkit-consumer-skill.git fpkit-consumer
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Prerequisites
65
+
66
+ Your project must have **@fpkit/acss** installed:
67
+
68
+ ```bash
69
+ npm install @fpkit/acss
70
+ # or
71
+ yarn add @fpkit/acss
72
+ # or
73
+ pnpm add @fpkit/acss
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Usage
79
+
80
+ ### Activating the Skill
81
+
82
+ The skill activates automatically when you're working in a project using @fpkit/acss.
83
+
84
+ **Trigger phrases:**
85
+ - "Build a custom component using fpkit"
86
+ - "Create a [component name] with @fpkit/acss"
87
+ - "Compose a [feature] from fpkit components"
88
+ - "Help me use fpkit components"
89
+
90
+ ### Example Interactions
91
+
92
+ #### Example 1: Composing a StatusButton
93
+
94
+ **You:**
95
+ > Create a StatusButton component that combines Button and Badge from fpkit
96
+
97
+ **Claude Code:**
98
+ > I'll help you create a StatusButton by composing fpkit components.
99
+ >
100
+ > ```tsx
101
+ > import { Button, Badge } from '@fpkit/acss'
102
+ >
103
+ > export interface StatusButtonProps extends React.ComponentProps<typeof Button> {
104
+ > status: 'active' | 'inactive' | 'pending'
105
+ > }
106
+ >
107
+ > export const StatusButton = ({ status, children, ...props }: StatusButtonProps) => {
108
+ > return (
109
+ > <Button {...props}>
110
+ > {children}
111
+ > <Badge variant={status}>{status}</Badge>
112
+ > </Button>
113
+ > )
114
+ > }
115
+ > ```
116
+ >
117
+ > This composition:
118
+ > - ✅ Extends Button props with TypeScript
119
+ > - ✅ Preserves all fpkit Button functionality
120
+ > - ✅ Maintains accessibility (ARIA, keyboard support)
121
+ > - ✅ Keeps styling customizable via CSS variables
122
+
123
+ #### Example 2: Custom Styling
124
+
125
+ **You:**
126
+ > How do I customize the button padding in my StatusButton?
127
+
128
+ **Claude Code:**
129
+ > You can customize fpkit components using CSS variables:
130
+ >
131
+ > ```tsx
132
+ > <StatusButton
133
+ > status="active"
134
+ > style={{
135
+ > '--btn-padding-inline': '2rem',
136
+ > '--btn-padding-block': '1rem',
137
+ > }}
138
+ > >
139
+ > Server Status
140
+ > </StatusButton>
141
+ > ```
142
+ >
143
+ > Or create a CSS class:
144
+ >
145
+ > ```css
146
+ > .hero-status-button {
147
+ > --btn-padding-inline: 2rem;
148
+ > --btn-padding-block: 1rem;
149
+ > --btn-fs: 1.25rem;
150
+ > }
151
+ > ```
152
+ >
153
+ > See `references/css-variables.md` for all available variables.
154
+
155
+ #### Example 3: Accessibility Check
156
+
157
+ **You:**
158
+ > Is this component accessible?
159
+
160
+ **Claude Code:**
161
+ > Let me check accessibility:
162
+ >
163
+ > ✅ Uses semantic Button element
164
+ > ✅ Inherits keyboard navigation
165
+ > ✅ Maintains focus indicators
166
+ > ⚠️ Add `aria-label` if using icon-only button
167
+ >
168
+ > Example with accessibility:
169
+ > ```tsx
170
+ > <StatusButton
171
+ > status="active"
172
+ > aria-label="Server status: active"
173
+ > >
174
+ > <ServerIcon aria-hidden="true" />
175
+ > </StatusButton>
176
+ > ```
177
+ >
178
+ > Run automated testing:
179
+ > ```tsx
180
+ > import { axe, toHaveNoViolations } from 'jest-axe'
181
+ >
182
+ > expect.extend(toHaveNoViolations)
183
+ >
184
+ > it('should not have accessibility violations', async () => {
185
+ > const { container } = render(<StatusButton status="active">Server</StatusButton>)
186
+ > const results = await axe(container)
187
+ > expect(results).toHaveNoViolations()
188
+ > })
189
+ > ```
190
+
191
+ ---
192
+
193
+ ## Features
194
+
195
+ ### 1. Component Composition Guidance
196
+
197
+ The skill uses a **decision tree** to determine the best approach:
198
+
199
+ ```
200
+ Does fpkit have the component?
201
+ → Use it directly
202
+
203
+ Can you compose 2+ fpkit components?
204
+ → Composition (Pattern 1-5)
205
+
206
+ Can you extend an fpkit component?
207
+ → Enhanced wrapper
208
+
209
+ Need something completely custom?
210
+ → Custom implementation (with fpkit patterns)
211
+ ```
212
+
213
+ ### 2. CSS Variable Validation
214
+
215
+ Run the validation script on your custom styles:
216
+
217
+ ```bash
218
+ # Validate a file
219
+ python ~/.claude/skills/fpkit-developer/scripts/validate_css_vars.py styles/button.scss
220
+
221
+ # Validate a directory
222
+ python ~/.claude/skills/fpkit-developer/scripts/validate_css_vars.py styles/
223
+
224
+ # From your project root
225
+ python ~/.claude/skills/fpkit-developer/scripts/validate_css_vars.py .
226
+ ```
227
+
228
+ **What it checks:**
229
+ - ✅ Naming pattern: `--{component}-{property}`
230
+ - ✅ rem units (not px)
231
+ - ✅ Approved abbreviations: `bg`, `fs`, `fw`, `radius`, `gap`
232
+ - ✅ Full words for: `padding`, `margin`, `color`, `border`, `display`, `width`, `height`
233
+
234
+ ### 3. Reference Documentation
235
+
236
+ Access comprehensive guides without leaving your terminal:
237
+
238
+ ```bash
239
+ # View composition patterns
240
+ cat ~/.claude/skills/fpkit-developer/references/composition.md
241
+
242
+ # View CSS variable guide
243
+ cat ~/.claude/skills/fpkit-developer/references/css-variables.md
244
+
245
+ # View accessibility guide
246
+ cat ~/.claude/skills/fpkit-developer/references/accessibility.md
247
+
248
+ # View architecture guide
249
+ cat ~/.claude/skills/fpkit-developer/references/architecture.md
250
+
251
+ # View testing guide
252
+ cat ~/.claude/skills/fpkit-developer/references/testing.md
253
+
254
+ # View Storybook guide
255
+ cat ~/.claude/skills/fpkit-developer/references/storybook.md
256
+ ```
257
+
258
+ Or ask Claude Code to reference them:
259
+ > "Show me composition patterns from the fpkit skill"
260
+
261
+ ### 4. Documentation Sync
262
+
263
+ Keep documentation up-to-date with the latest fpkit guides:
264
+
265
+ ```bash
266
+ # Sync all documentation from fpkit package
267
+ ~/.claude/skills/fpkit-developer/scripts/sync-docs.sh
268
+
269
+ # Check which docs need updating
270
+ ~/.claude/skills/fpkit-developer/scripts/sync-docs.sh --check
271
+
272
+ # Sync a specific guide
273
+ ~/.claude/skills/fpkit-developer/scripts/sync-docs.sh --guide testing.md
274
+ ```
275
+
276
+ **When to sync:**
277
+ - After updating @fpkit/acss to a new version
278
+ - When fpkit documentation is updated
279
+ - Periodically to ensure you have the latest patterns and examples
280
+
281
+ **Configuration:**
282
+ Edit `config.json` to customize documentation source:
283
+ - `docsSource`: "local" (default) or "online"
284
+ - `onlineDocsUrl`: GitHub raw URL for online fallback
285
+ - `fpkitDocsPath`: Relative path to fpkit docs in monorepo
286
+
287
+ ---
288
+
289
+ ## Skill Structure
290
+
291
+ ```
292
+ fpkit-developer/
293
+ ├── README.md # This file
294
+ ├── SKILL.md # Claude Code skill workflow
295
+ ├── config.json # Configuration (docs source, paths)
296
+ ├── references/
297
+ │ ├── composition.md # Composition patterns and examples
298
+ │ ├── css-variables.md # CSS variable naming and customization
299
+ │ ├── accessibility.md # WCAG 2.1 AA compliance patterns
300
+ │ ├── architecture.md # fpkit architecture and patterns
301
+ │ ├── testing.md # Testing strategies and examples
302
+ │ └── storybook.md # Storybook documentation patterns
303
+ └── scripts/
304
+ ├── validate_css_vars.py # Portable CSS validation script
305
+ └── sync-docs.sh # Sync docs from fpkit package
306
+ ```
307
+
308
+ ---
309
+
310
+ ## Compatibility
311
+
312
+ - **@fpkit/acss:** v1.x
313
+ - **Claude Code:** Latest version
314
+ - **Python:** 3.7+ (for validation script)
315
+ - **Node.js:** 18+ (for npm package)
316
+
317
+ ---
318
+
319
+ ## Available fpkit Components
320
+
321
+ The skill knows about these fpkit components:
322
+
323
+ **Layout:**
324
+ - Header, Main, Footer, Aside, Nav
325
+
326
+ **Content:**
327
+ - Heading, Text, Badge, Tag
328
+
329
+ **Forms:**
330
+ - Input, Field, FieldLabel, FieldInput, FieldTextarea
331
+
332
+ **Buttons & Actions:**
333
+ - Button
334
+
335
+ **Cards:**
336
+ - Card, CardHeader, CardTitle, CardContent, CardFooter
337
+
338
+ **Dialogs:**
339
+ - Dialog, Modal
340
+
341
+ **Feedback:**
342
+ - Alert
343
+
344
+ **Data Display:**
345
+ - Table, List
346
+
347
+ **Interactive:**
348
+ - Details, Popover
349
+
350
+ **Icons:**
351
+ - Icon library
352
+
353
+ ---
354
+
355
+ ## Common Workflows
356
+
357
+ ### Workflow 1: Build a Custom Component
358
+
359
+ 1. **Describe what you want:**
360
+ > "Create a ConfirmButton that shows a confirmation dialog before executing an action"
361
+
362
+ 2. **Claude Code identifies fpkit components:**
363
+ - Button (for the trigger)
364
+ - Dialog (for the confirmation modal)
365
+
366
+ 3. **Composes solution:**
367
+ ```tsx
368
+ import { Button, Dialog } from '@fpkit/acss'
369
+ import { useState } from 'react'
370
+
371
+ export const ConfirmButton = ({ onConfirm, children, ...props }) => {
372
+ const [showConfirm, setShowConfirm] = useState(false)
373
+ // ... implementation
374
+ }
375
+ ```
376
+
377
+ 4. **Validates accessibility:**
378
+ - Keyboard navigation ✅
379
+ - ARIA attributes ✅
380
+ - Focus management ✅
381
+
382
+ 5. **Provides usage example:**
383
+ ```tsx
384
+ <ConfirmButton
385
+ variant="danger"
386
+ onConfirm={handleDelete}
387
+ >
388
+ Delete Account
389
+ </ConfirmButton>
390
+ ```
391
+
392
+ ### Workflow 2: Customize Styling
393
+
394
+ 1. **Ask about customization:**
395
+ > "How do I make the buttons larger and change the primary color?"
396
+
397
+ 2. **Claude Code provides CSS variable solution:**
398
+ ```css
399
+ :root {
400
+ --btn-padding-inline: 2rem;
401
+ --btn-padding-block: 1rem;
402
+ --btn-fs: 1.125rem;
403
+ --btn-primary-bg: #0066cc;
404
+ }
405
+ ```
406
+
407
+ 3. **Validates your custom CSS** (if needed):
408
+ ```bash
409
+ python scripts/validate_css_vars.py styles/
410
+ ```
411
+
412
+ ### Workflow 3: Ensure Accessibility
413
+
414
+ 1. **Request accessibility review:**
415
+ > "Check if my component is accessible"
416
+
417
+ 2. **Claude Code reviews:**
418
+ - Semantic HTML ✅
419
+ - Keyboard navigation ✅
420
+ - ARIA attributes ⚠️ (suggests improvements)
421
+ - Color contrast ✅
422
+
423
+ 3. **Suggests automated testing:**
424
+ ```tsx
425
+ import { axe, toHaveNoViolations } from 'jest-axe'
426
+ // ... test code
427
+ ```
428
+
429
+ ---
430
+
431
+ ## Best Practices Enforced
432
+
433
+ The skill helps you follow these best practices:
434
+
435
+ ### ✅ Composition Over Duplication
436
+ - Reuse fpkit components instead of creating from scratch
437
+ - Compose 2-3 fpkit components to build complex UIs
438
+
439
+ ### ✅ Type Safety
440
+ - Extend fpkit prop types with TypeScript
441
+ - Preserve all fpkit functionality with `...props` spreading
442
+
443
+ ### ✅ Accessibility
444
+ - Maintain ARIA attributes from fpkit
445
+ - Support keyboard navigation
446
+ - Ensure color contrast meets WCAG AA
447
+
448
+ ### ✅ Styling Conventions
449
+ - Use CSS variables for customization
450
+ - Use rem units (not px)
451
+ - Follow naming pattern: `--{component}-{property}`
452
+
453
+ ### ✅ Testing
454
+ - Focus on testing your composition logic
455
+ - Trust fpkit's internal testing
456
+ - Use jest-axe for accessibility testing
457
+
458
+ ---
459
+
460
+ ## Troubleshooting
461
+
462
+ ### Skill Not Activating
463
+
464
+ 1. **Check installation path:**
465
+ ```bash
466
+ ls ~/.claude/skills/fpkit-developer/SKILL.md
467
+ ```
468
+
469
+ 2. **Restart Claude Code** after installation
470
+
471
+ 3. **Verify @fpkit/acss is installed:**
472
+ ```bash
473
+ npm list @fpkit/acss
474
+ ```
475
+
476
+ ### Validation Script Not Working
477
+
478
+ 1. **Check Python version:**
479
+ ```bash
480
+ python --version # Should be 3.7+
481
+ ```
482
+
483
+ 2. **Make script executable:**
484
+ ```bash
485
+ chmod +x ~/.claude/skills/fpkit-developer/scripts/validate_css_vars.py
486
+ ```
487
+
488
+ 3. **Run with python3 explicitly:**
489
+ ```bash
490
+ python3 ~/.claude/skills/fpkit-developer/scripts/validate_css_vars.py styles/
491
+ ```
492
+
493
+ ### Documentation Not Found
494
+
495
+ Reference docs are copied to the skill directory:
496
+
497
+ ```bash
498
+ # List references
499
+ ls ~/.claude/skills/fpkit-developer/references/
500
+
501
+ # View a guide
502
+ cat ~/.claude/skills/fpkit-developer/references/composition.md
503
+ ```
504
+
505
+ ---
506
+
507
+ ## Contributing
508
+
509
+ This skill is part of the @fpkit/acss project. To suggest improvements:
510
+
511
+ 1. **Report issues:** [GitHub Issues](https://github.com/shawn-sandy/acss/issues)
512
+ 2. **Suggest features:** Open a discussion on GitHub
513
+ 3. **Contribute code:** Submit a pull request
514
+
515
+ ---
516
+
517
+ ## Resources
518
+
519
+ ### Official Documentation
520
+ - **[fpkit Docs](https://github.com/shawn-sandy/acss/tree/main/packages/fpkit/docs)** - Complete documentation
521
+ - **[Storybook](https://fpkit.netlify.app/)** - Interactive component examples
522
+ - **[npm Package](https://www.npmjs.com/package/@fpkit/acss)** - Installation and API reference
523
+
524
+ ### Learning Resources
525
+ - **[WCAG 2.1 Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)** - Accessibility standards
526
+ - **[React TypeScript Cheatsheet](https://react-typescript-cheatsheet.netlify.app/)** - TypeScript patterns
527
+ - **[Testing Library](https://testing-library.com/)** - Testing best practices
528
+
529
+ ---
530
+
531
+ ## License
532
+
533
+ MIT License - Same as @fpkit/acss
534
+
535
+ ---
536
+
537
+ ## Version
538
+
539
+ **Skill Version:** 1.0.0
540
+ **Compatible with:** @fpkit/acss v1.x
541
+ **Last Updated:** 2025-01-06
542
+
543
+ ---
544
+
545
+ **Happy building with @fpkit/acss and Claude Code!** 🚀