@kiva/kv-components 8.3.0 → 8.3.1

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/AGENTS.md CHANGED
@@ -13,7 +13,7 @@ Accessible UI component library built with Vue 3 Composition API, Tailwind CSS,
13
13
 
14
14
  ## Getting Started
15
15
 
16
- **Always run `nvm use` when working in this repo** to ensure you're using the correct Node.js version specified in [.nvmrc](../../../.nvmrc).
16
+ **Run `nvm use` before any terminal commands** (npm, node, etc.) to ensure you're using the correct Node.js version specified in [.nvmrc](../../../.nvmrc). This is not required for file reading or editing operations.
17
17
 
18
18
  ## Component Development Patterns
19
19
 
package/CLAUDE.md CHANGED
@@ -1,10 +1,10 @@
1
- @AGENTS.md
1
+ # CLAUDE.md
2
2
 
3
- # Claude AI Instructions
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
 
5
- > **Important**: Always include context from [AGENTS.md](AGENTS.md) as the primary directive for this package.
5
+ @AGENTS.md
6
6
 
7
- > **Note**: This file should only contain Claude-specific configurations or workarounds as a last resort. All general development instructions, patterns, and guidelines belong in [AGENTS.md](AGENTS.md).
7
+ > **Note**: This file imports [AGENTS.md](./AGENTS.md) which contains all general development instructions, patterns, and guidelines for this repository. This file should only contain Claude Code-specific configurations or workarounds as a last resort.
8
8
 
9
9
  ## Claude-Specific Configuration
10
10
 
@@ -0,0 +1,306 @@
1
+ # AI Documentation Prompt
2
+
3
+ Use this prompt when generating component documentation with AI assistance.
4
+
5
+ ---
6
+
7
+ ## ⚠️ CRITICAL: ALWAYS Use the ComponentDocs.template.mdx Template
8
+
9
+ **When creating any component `.mdx` documentation file, you MUST use the template:**
10
+
11
+ 📄 **Template Location:** `@kiva/kv-components/src/vue/.storybook/templates/ComponentDocs.template.mdx`
12
+
13
+ **This is NOT optional. Do NOT create freeform MDX documentation.**
14
+
15
+ The template provides:
16
+ - Consistent structure across all component documentation
17
+ - Required sections (Variations, Usage Information, Behavior, Anatomy, Specs, Best Practices, Accessibility)
18
+ - Proper Storybook imports and Meta configuration
19
+ - Table of Contents with navigation
20
+ - Do/Don't best practices layout
21
+ - Controls integration for interactive demos
22
+
23
+ **Every `.mdx` file MUST:**
24
+ 1. Start by reading the ComponentDocs.template.mdx file
25
+ 2. Fill in ALL template placeholders with component-specific content
26
+ 3. Use the exact section structure and headings from the template
27
+ 4. Follow the established patterns for story references and code examples
28
+ 5. Include all required sections (do not skip sections)
29
+
30
+ ---
31
+
32
+ ## Prompt Template
33
+
34
+ ### For New Documentation
35
+
36
+ ```
37
+ I need to create comprehensive Storybook documentation for a Vue 3 component in the @kiva/kv-components library.
38
+
39
+ Component Name: {{ComponentName}}
40
+ Component File: @kiva/kv-components/src/vue/{{ComponentName}}.vue
41
+ Story File: @kiva/kv-components/src/vue/stories/{{ComponentName}}.stories.js [May not exist yet]
42
+ Existing Documentation: [None | Path to existing MDX file]
43
+
44
+ Please use the documentation template located at:
45
+ @kiva/kv-components/src/vue/.storybook/templates/ComponentDocs.template.mdx
46
+
47
+ **IMPORTANT - If Story File Does Not Exist:**
48
+ 1. Create a **stub** `.stories.js` file first (use the stories template with minimal working exports)
49
+ 2. Ensure the stub exports all story names referenced in the MDX (ComponentOverview, AllVariations, Default, etc.)
50
+ 3. Then proceed with documentation creation
51
+ 4. Add a TODO comment at the top indicating which stories need to be fully implemented
52
+ 5. The documentation can guide story creation later, but the file must exist to avoid MDX import errors
53
+
54
+ **IMPORTANT:** If existing documentation exists:
55
+ 1. Analyze the existing MDX file structure and content
56
+ 2. Compare it against the template structure
57
+ 3. Identify what sections are missing or need updates
58
+ 4. Preserve existing quality content, stories references, and examples
59
+ 5. Provide a migration plan to bring documentation up to current standards
60
+ 6. Suggest which existing stories can be reused vs. which need to be created
61
+
62
+ Generate a complete MDX documentation file by filling in all template placeholders with appropriate content based on the component's implementation.
63
+
64
+ Required steps:
65
+ 1. Analyze the component's props, slots, events, and implementation
66
+ 2. Identify all variants and states
67
+ 3. Fill in ALL template variables with specific, accurate content
68
+ 4. Ensure story references match the existing story file
69
+ 5. Create meaningful code examples using realistic prop values
70
+ 6. Write clear, actionable usage guidelines
71
+ 7. Document all accessibility features present in the component
72
+
73
+ Template Variables to Fill:
74
+
75
+ **Basic Info:**
76
+ - {{ComponentName}} - Component name (e.g., KvButton, KvModal)
77
+ - {{componentDescription}} - One-sentence component purpose
78
+ - {{componentOverviewDescription}} - Brief paragraph about the component
79
+
80
+ **Variations:**
81
+ - {{variationsDescription}} - Describe all available variations
82
+
83
+ **Usage:**
84
+ - {{usageInformationDescription}} - Main description of component usage
85
+ - {{whenToUseList}} - Bullet list of appropriate use cases
86
+ - {{whenNotToUseList}} - Bullet list of when NOT to use this component
87
+
88
+ **Behavior:**
89
+ - {{behaviorDescription}} - Overall behavior description
90
+ - {{BehaviorSubsection1Title}} - First behavior subsection title
91
+ - {{behaviorSubsection1Description}} - Description for first behavior
92
+ - {{BehaviorSubsection1StoryName}} - Story name for first behavior demo
93
+ - {{BehaviorSubsection2Title}} - Second behavior subsection title
94
+ - {{behaviorSubsection2Description}} - Description for second behavior
95
+ - {{BehaviorSubsection2StoryName}} - Story name for second behavior demo
96
+
97
+ **Anatomy:**
98
+ - {{anatomyDescription}} - Brief intro to component structure
99
+ - {{anatomyBulletList}} - Markdown bullet list of component parts
100
+
101
+ **Specs:**
102
+ - {{SpecsSubsection1Title}} - First specs subsection title
103
+ - {{specsSubsection1Description}} - Description for first spec
104
+ - {{SpecsSubsection1StoryName}} - Story name for first spec demo
105
+ - {{SpecsSubsection2Title}} - Second specs subsection title
106
+ - {{specsSubsection2Description}} - Description for second spec
107
+
108
+ **Best Practices:**
109
+ - {{bestPractice1ImageFileName}} - Image filename for first "Do" example
110
+ - {{bestPractice1DoDescription}} - Description for first "Do"
111
+ - {{bestPractice1DontImageFileName}} - Image filename for first "Don't"
112
+ - {{bestPractice1DontDescription}} - Description for first "Don't"
113
+ - {{bestPractice2ImageFileName}} - Image filename for second "Do"
114
+ - {{bestPractice2DoDescription}} - Description for second "Do"
115
+ - {{bestPractice2DontImageFileName}} - Image filename for second "Don't"
116
+ - {{bestPractice2DontDescription}} - Description for second "Don't"
117
+
118
+ **Accessibility:**
119
+ - {{accessibilityBulletList}} - Markdown bullet list of accessibility features
120
+
121
+ **Code Examples:**
122
+ - {{codeExample1Title}} - Title for first example
123
+ - {{codeExample1}} - Complete Vue code for first example
124
+ - {{codeExample2Title}} - Title for second example
125
+ - {{codeExample2}} - Complete Vue code for second example
126
+ - {{codeExample3Title}} - Title for third example
127
+ - {{codeExample3}} - Complete Vue code for third example
128
+
129
+ Guidelines:
130
+ - Use actual prop names and values from the component
131
+ - **PRESERVE existing story references** from the .stories.js file - don't rename stories that already exist
132
+ - **Reuse existing Default story** rather than creating a new one
133
+ - **Use existing stories** for ComponentOverview if suitable stories exist
134
+ - For AllVariations: If component is complex or has many existing variation stories, use multiple existing stories instead of requiring one comprehensive AllVariations story
135
+ - Follow the style and tone of existing documentation (see KvIconButtonDocs.mdx)
136
+ - Be specific and actionable in all descriptions
137
+ - Use realistic, practical code examples
138
+ - Include image placeholders with descriptive filenames using kebab-case
139
+ - Ensure all accessibility features are documented
140
+ - Adapt the template structure if needed (add/remove subsections based on component complexity)
141
+
142
+ Output:
143
+ A complete MDX file ready to save as {{ComponentName}}Docs.mdx
144
+
145
+ **After completion, verify using:**
146
+ 📋 [Component Documentation Checklist](./component-documentation-checklist.md)
147
+
148
+ ---
149
+
150
+ ### For Migrating Existing Documentation
151
+
152
+ ```
153
+ I need to migrate existing Storybook documentation to our current template standards.
154
+
155
+ Component Name: {{ComponentName}}
156
+ Existing Documentation: @kiva/kv-components/src/vue/stories/{{ComponentName}}Docs.mdx
157
+ Story File: @kiva/kv-components/src/vue/stories/{{ComponentName}}.stories.js
158
+ Template: @kiva/kv-components/src/vue/.storybook/templates/ComponentDocs.template.mdx
159
+
160
+ Task:
161
+ 1. Analyze the existing documentation against the template
162
+ 2. Identify missing sections (Variations, Usage Information, Behavior, Anatomy, Specs, Best Practices, Accessibility, etc.)
163
+ 3. Preserve all existing content, story references, and code examples
164
+ 4. Enhance with missing sections following template structure
165
+ 5. Maintain existing story names - do NOT rename or create new stories unnecessarily
166
+ 6. Update structure to match template where possible without losing valuable content
167
+ 7. Identify which new stories (if any) need to be created
168
+
169
+ Migration Approach:
170
+ - Keep what works: Preserve existing quality content
171
+ - Fill the gaps: Add missing required sections
172
+ - Standardize format: Adjust to template structure where beneficial
173
+ - Maintain continuity: Don't break existing story references
174
+
175
+ Output:
176
+ - Updated MDX file with enhanced documentation
177
+ - List of existing stories that are working well
178
+ - List of new stories needed (if any)
179
+ - Summary of changes made
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Recommended Creation Order
185
+
186
+ See [Component Stories Guide - Recommended Creation Order](./ai-stories-prompt.md#recommended-creation-order) for detailed workflow options.
187
+
188
+ **Quick Reference:**
189
+ - **Stories First**: Create stories → Test in Storybook → Document
190
+ - **Documentation First**: Document requirements → Create stories
191
+ - **Parallel**: Basic stories → Documentation → Fill gaps
192
+
193
+ ## Handling Missing Files
194
+
195
+ ### When Stories Don't Exist Yet
196
+ 1. **Create a stub stories file first** - The MDX import requires it
197
+ 2. **Reference standard story names** - ComponentOverview, AllVariations, Default, etc.
198
+ 3. **Add TODO comments** - Clearly list required stories to flesh out
199
+ 4. **Provide clear guidance** - Describe what each story should show
200
+
201
+ **Example TODO comment:**
202
+ ```mdx
203
+ <!--
204
+ TODO: Create the following stories in ComponentName.stories.js:
205
+
206
+ 1. ComponentOverview - Show 2-4 key variants (bare, with background, with border, toggle)
207
+ 2. AllVariations - Comprehensive showcase of all sizes and styles
208
+ 3. Default - Interactive playground with all props
209
+ 4. ComponentStates - Show enabled, hover, active, disabled states
210
+ 5. SpecialFeature - Demonstrate [specific behavior]
211
+
212
+ See ai-stories-prompt.md for story creation guidance.
213
+ -->
214
+ ```
215
+
216
+ ### When Component File Is Incomplete
217
+ If the component implementation is missing features:
218
+ 1. Document the **intended** behavior
219
+ 2. Add notes about features that need implementation
220
+ 3. Mark sections as "Coming Soon" or "Planned"
221
+ 4. Create story placeholders for future features
222
+
223
+ ## Usage Instructions
224
+
225
+ 1. **Copy the prompt template above**
226
+ 2. **Replace `{{ComponentName}}`** with your actual component name
227
+ 3. **Provide the AI with access to:**
228
+ - The component source file
229
+ - The existing story file
230
+ - The template file
231
+ - Reference documentation (like KvIconButtonDocs.mdx)
232
+ 4. **Review and refine** the generated documentation
233
+ 5. **Test all story references** to ensure they work
234
+ 6. **Add images** for Best Practices section
235
+ 7. **Verify code examples** are functional
236
+
237
+ ## Tips for Best Results
238
+
239
+ ### Context Provision
240
+ - Share the full component file content
241
+ - Include the complete stories file
242
+ - Reference existing good documentation as examples
243
+ - Mention any special features or complexity
244
+
245
+ ### Iteration Approach
246
+ Generate in stages if needed:
247
+ 1. First pass: Basic structure and content
248
+ 2. Second pass: Refine descriptions and examples
249
+ 3. Third pass: Add missing details, verify accuracy
250
+
251
+ ### Common Adjustments
252
+ After generation, typically need to:
253
+ - Add or adjust story references to match actual story names
254
+ - Create actual image files for Best Practices
255
+ - Fine-tune code examples for clarity
256
+ - Add domain-specific Kiva context
257
+ - Adjust accessibility details based on actual implementation
258
+
259
+ ### Review Checklist
260
+ - [ ] All template variables replaced with real content
261
+ - [ ] Story references match actual story names in .stories.js
262
+ - [ ] Code examples use correct prop names and types
263
+ - [ ] Accessibility section reflects actual implementation
264
+ - [ ] Usage guidelines are specific to this component
265
+ - [ ] Best Practices are relevant and actionable
266
+ - [ ] No placeholder text remains (search for `{{`)
267
+
268
+ ## Example Command
269
+
270
+ For a hypothetical KvModal component:
271
+
272
+ ```
273
+ Generate documentation for KvModal using the template at
274
+ @kiva/kv-components/src/vue/.storybook/templates/ComponentDocs.template.mdx
275
+
276
+ Component: @kiva/kv-components/src/vue/KvModal.vue
277
+ Stories: @kiva/kv-components/src/vue/stories/KvModal.stories.js
278
+
279
+ This is a modal dialog component with:
280
+ - Size variants (small, medium, large)
281
+ - Optional close button
282
+ - Header, body, and footer slots
283
+ - Backdrop click to close
284
+ - ESC key handling
285
+ - Focus trap when open
286
+
287
+ Follow all guidelines in the prompt template above.
288
+ ```
289
+
290
+ ## Advanced: Batch Generation
291
+
292
+ For generating documentation for multiple components:
293
+
294
+ 1. Create a list of components needing documentation
295
+ 2. Use the same prompt template for each
296
+ 3. Process 2-3 at a time to maintain quality
297
+ 4. Review and refine each before moving to the next batch
298
+ 5. Maintain consistency across all generated docs
299
+
300
+ ## Maintenance
301
+
302
+ Update this prompt when:
303
+ - Template structure changes
304
+ - New documentation patterns emerge
305
+ - Common generation issues are identified
306
+ - Documentation standards evolve