@kiva/kv-components 8.3.0 → 8.4.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/AGENTS.md +1 -1
- package/CLAUDE.md +4 -4
- package/dist/vue/KvCompactLoanCard.css +1 -1
- package/dist/vue/KvCompactLoanCard.js +5 -5
- package/dist/vue/KvCompactLoanCard.vue.d.ts +1 -0
- package/dist/vue/KvCompactLoanCard2.js +49 -48
- package/docs/ai-documentation-prompt.md +306 -0
- package/docs/ai-stories-prompt.md +630 -0
- package/docs/component-documentation-checklist.md +258 -0
- package/docs/component-documentation-guide.md +364 -0
- package/docs/component-stories-checklist.md +326 -0
- package/docs/component-stories-guide.md +765 -0
- package/docs/how-to-use-ai-prompts.md +331 -0
- package/package.json +3 -3
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
|
-
**
|
|
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
|
-
|
|
1
|
+
# CLAUDE.md
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
@AGENTS.md
|
|
6
6
|
|
|
7
|
-
> **Note**: This file should only contain Claude-specific configurations or workarounds as a last resort.
|
|
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
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.loan-card-use[data-v-
|
|
1
|
+
.loan-card-use[data-v-1e5999ce]:hover,.loan-card-use[data-v-1e5999ce]:focus{--tw-text-opacity: 1;color:rgba(var(--text-primary),var(--tw-text-opacity, 1))}.loan-card-active-hover:hover .loan-card-use[data-v-1e5999ce]{text-decoration-line:underline}.loan-card-progress[data-v-1e5999ce]:hover,.loan-card-progress[data-v-1e5999ce]:focus{text-decoration-line:none}.loan-card-use-text[data-v-1e5999ce] p{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;line-clamp:4;overflow:hidden;text-overflow:ellipsis}.loan-card-cta[data-v-1e5999ce] form,.loan-card-cta[data-v-1e5999ce] fieldset,.loan-card-cta[data-v-1e5999ce] .tw-w-full,.loan-card-cta[data-v-1e5999ce] button{height:40px!important;max-height:40px!important;display:flex!important;align-items:center!important;justify-content:center!important}.loan-card-cta[data-v-1e5999ce] .tw-inline-flex{height:40px!important;max-height:40px!important;min-height:40px!important}
|
|
@@ -9,7 +9,7 @@ const V = { class: "tw-flex tw-flex-col tw-items-start tw-w-full" }, R = { class
|
|
|
9
9
|
}, F = { class: "tw-text-primary !tw-font-medium tw-text-base tw-leading-normal tw-truncate" }, W = ["href"], j = { class: "tw-truncate" }, E = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "loan-card-use-text tw-w-full tw-overflow-hidden"
|
|
12
|
-
},
|
|
12
|
+
}, U = { class: "tw-flex-1 tw-min-w-0 tw-mr-1" }, O = { class: "tw-flex-1 tw-min-w-0" }, K = { class: "tw-p-1 tw-rounded-l-sm tw-border tw-border-gray-100 tw-border-r-0" };
|
|
13
13
|
function z(h, o, t, e, G, H) {
|
|
14
14
|
const b = w("kv-material-icon"), v = w("kv-borrower-image"), x = w("kv-loan-tag"), m = w("kv-loading-placeholder"), _ = w("kv-loan-use"), y = w("kv-loan-callouts"), L = w("kv-loan-progress-group"), C = w("kv-lend-cta");
|
|
15
15
|
return a(), l("div", {
|
|
@@ -114,7 +114,7 @@ function z(h, o, t, e, G, H) {
|
|
|
114
114
|
}, {
|
|
115
115
|
default: f(() => [
|
|
116
116
|
e.isLoading ? (a(), l("div", E, [
|
|
117
|
-
(a(!0), l(g, null, A([...Array(
|
|
117
|
+
(a(!0), l(g, null, A([...Array(e.loanUseLoadingRows)], (n, M) => (a(), l("div", {
|
|
118
118
|
key: M,
|
|
119
119
|
class: "tw-h-2 tw-mb-1"
|
|
120
120
|
}, [
|
|
@@ -161,7 +161,7 @@ function z(h, o, t, e, G, H) {
|
|
|
161
161
|
])
|
|
162
162
|
}, [
|
|
163
163
|
e.hasProgressData ? (a(), l(g, { key: 1 }, [
|
|
164
|
-
r("div",
|
|
164
|
+
r("div", O, [
|
|
165
165
|
e.sharesAvailable ? (a(), s(u(e.tag), {
|
|
166
166
|
key: 0,
|
|
167
167
|
to: e.readMorePath,
|
|
@@ -221,7 +221,7 @@ function z(h, o, t, e, G, H) {
|
|
|
221
221
|
}, null, 8, ["loan", "unreserved-amount", "basket-items", "is-loading", "is-adding", "enable-five-dollars-notes", "five-dollars-selected", "kv-track-function", "show-view-loan", "custom-loan-details", "external-links", "route", "user-balance", "get-cookie", "set-cookie", "is-visitor", "primary-button-text", "secondary-button-text", "secondary-button-handler"])
|
|
222
222
|
], 2))
|
|
223
223
|
], 64)) : (a(), l(g, { key: 0 }, [
|
|
224
|
-
r("div",
|
|
224
|
+
r("div", U, [
|
|
225
225
|
i(m, {
|
|
226
226
|
class: "tw-mb-0.5",
|
|
227
227
|
style: { width: "100%", maxWidth: "11rem", height: "1rem" }
|
|
@@ -240,7 +240,7 @@ function z(h, o, t, e, G, H) {
|
|
|
240
240
|
], 2)
|
|
241
241
|
], 2);
|
|
242
242
|
}
|
|
243
|
-
const Q = /* @__PURE__ */ B(N, [["render", z], ["__scopeId", "data-v-
|
|
243
|
+
const Q = /* @__PURE__ */ B(N, [["render", z], ["__scopeId", "data-v-1e5999ce"]]);
|
|
244
244
|
export {
|
|
245
245
|
p as KV_COMPACT_LOAN_CARD_FRAGMENT,
|
|
246
246
|
$ as KV_COMPACT_LOAN_CARD_USER_FRAGMENT,
|
|
@@ -165,6 +165,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
|
|
|
165
165
|
height: string;
|
|
166
166
|
maxHeight: string;
|
|
167
167
|
}>;
|
|
168
|
+
loanUseLoadingRows: import('vue').ComputedRef<3 | 4>;
|
|
168
169
|
clickReadMore: (target: string, event: Event) => void;
|
|
169
170
|
trackWebsiteClick: () => void;
|
|
170
171
|
handleCloseButton: (event: any) => void;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import r from "graphql-tag";
|
|
2
|
-
import
|
|
2
|
+
import F from "numeral";
|
|
3
3
|
import { computed as n } from "vue";
|
|
4
|
-
import { mdiMapMarker as
|
|
5
|
-
import { LOAN_CALLOUTS_FRAGMENT as
|
|
4
|
+
import { mdiMapMarker as M, mdiHome as S, mdiLink as E, mdiClose as R } from "@mdi/js";
|
|
5
|
+
import { LOAN_CALLOUTS_FRAGMENT as O, LOAN_GEOCODE_FRAGMENT as G, LOAN_PROGRESS_FRAGMENT as P, loanCardComputedProperties as V, loanCardMethods as U } from "../utils/loanCard.js";
|
|
6
6
|
import D from "./KvLoanUse.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { KV_LEND_CTA_FRAGMENT as
|
|
16
|
-
import { KV_LOAN_TAG_FRAGMENT as
|
|
17
|
-
import { KV_LOAN_USE_FRAGMENT as
|
|
7
|
+
import $ from "./KvBorrowerImage.js";
|
|
8
|
+
import W from "./KvLoanCallouts.js";
|
|
9
|
+
import I from "./KvLendCta.js";
|
|
10
|
+
import x from "./KvLoanProgressGroup.js";
|
|
11
|
+
import H from "./KvLoanTag.js";
|
|
12
|
+
import j from "./KvMaterialIcon.js";
|
|
13
|
+
import q from "./KvLoadingPlaceholder.js";
|
|
14
|
+
import z from "./KvLoanTeamPick.js";
|
|
15
|
+
import { KV_LEND_CTA_FRAGMENT as J, KV_LEND_CTA_USER_FRAGMENT as Q } from "./KvLendCta2.js";
|
|
16
|
+
import { KV_LOAN_TAG_FRAGMENT as X } from "./KvLoanTag2.js";
|
|
17
|
+
import { KV_LOAN_USE_FRAGMENT as Y } from "./KvLoanUse2.js";
|
|
18
18
|
const Ce = r`
|
|
19
19
|
fragment KvCompactLoanCard on LoanBasic {
|
|
20
20
|
id
|
|
@@ -37,30 +37,30 @@ const Ce = r`
|
|
|
37
37
|
...LoanGeocode
|
|
38
38
|
...LoanProgress
|
|
39
39
|
}
|
|
40
|
-
${
|
|
41
|
-
${Q}
|
|
40
|
+
${J}
|
|
42
41
|
${X}
|
|
43
|
-
${
|
|
42
|
+
${Y}
|
|
44
43
|
${O}
|
|
45
44
|
${G}
|
|
46
|
-
|
|
45
|
+
${P}
|
|
46
|
+
`, he = r`
|
|
47
47
|
fragment KvCompactLoanCardUser on LoanBasic {
|
|
48
48
|
id
|
|
49
49
|
...KvLendCtaUser
|
|
50
50
|
}
|
|
51
|
-
${
|
|
52
|
-
`,
|
|
51
|
+
${Q}
|
|
52
|
+
`, Ae = {
|
|
53
53
|
name: "KvCompactLoanCard",
|
|
54
54
|
components: {
|
|
55
|
-
KvBorrowerImage:
|
|
56
|
-
KvLoadingPlaceholder:
|
|
55
|
+
KvBorrowerImage: $,
|
|
56
|
+
KvLoadingPlaceholder: q,
|
|
57
57
|
KvLoanUse: D,
|
|
58
|
-
KvMaterialIcon:
|
|
59
|
-
KvLendCta:
|
|
60
|
-
KvLoanTag:
|
|
61
|
-
KvLoanCallouts:
|
|
62
|
-
KvLoanTeamPick:
|
|
63
|
-
KvLoanProgressGroup:
|
|
58
|
+
KvMaterialIcon: j,
|
|
59
|
+
KvLendCta: I,
|
|
60
|
+
KvLoanTag: H,
|
|
61
|
+
KvLoanCallouts: W,
|
|
62
|
+
KvLoanTeamPick: z,
|
|
63
|
+
KvLoanProgressGroup: x
|
|
64
64
|
},
|
|
65
65
|
props: {
|
|
66
66
|
loanId: {
|
|
@@ -205,8 +205,8 @@ const Ce = r`
|
|
|
205
205
|
setup(e, { emit: t }) {
|
|
206
206
|
const {
|
|
207
207
|
allDataLoaded: a,
|
|
208
|
-
borrowerName:
|
|
209
|
-
city:
|
|
208
|
+
borrowerName: i,
|
|
209
|
+
city: l,
|
|
210
210
|
countryName: s,
|
|
211
211
|
distributionModel: u,
|
|
212
212
|
formattedLocation: d,
|
|
@@ -216,29 +216,29 @@ const Ce = r`
|
|
|
216
216
|
isLoading: p,
|
|
217
217
|
loanAmount: L,
|
|
218
218
|
loanBorrowerCount: y,
|
|
219
|
-
loanCallouts:
|
|
220
|
-
loanStatus:
|
|
219
|
+
loanCallouts: g,
|
|
220
|
+
loanStatus: C,
|
|
221
221
|
loanUse: h,
|
|
222
222
|
readMorePath: A,
|
|
223
223
|
state: _,
|
|
224
224
|
tag: N,
|
|
225
225
|
unreservedAmount: b,
|
|
226
226
|
sharesAvailable: B
|
|
227
|
-
} =
|
|
227
|
+
} = V(e), {
|
|
228
228
|
clickReadMore: T
|
|
229
|
-
} =
|
|
229
|
+
} = U(e, t), v = n(() => {
|
|
230
230
|
if (!e.website)
|
|
231
231
|
return "";
|
|
232
232
|
const o = e.website.trim();
|
|
233
233
|
return o.startsWith("http://") || o.startsWith("https://") ? o : `https://${o}`;
|
|
234
|
-
}),
|
|
234
|
+
}), w = n(() => {
|
|
235
235
|
const o = e.showLightView ? "auto" : "6.75rem", K = e.showLightView ? "none" : "6.75rem";
|
|
236
236
|
return { height: o, maxHeight: K };
|
|
237
|
-
});
|
|
237
|
+
}), k = n(() => e.showLightView ? 3 : 4);
|
|
238
238
|
return {
|
|
239
239
|
allDataLoaded: a,
|
|
240
|
-
borrowerName:
|
|
241
|
-
city:
|
|
240
|
+
borrowerName: i,
|
|
241
|
+
city: l,
|
|
242
242
|
countryName: s,
|
|
243
243
|
distributionModel: u,
|
|
244
244
|
formattedLocation: d,
|
|
@@ -249,19 +249,20 @@ const Ce = r`
|
|
|
249
249
|
isLoading: p,
|
|
250
250
|
loanAmount: L,
|
|
251
251
|
loanBorrowerCount: y,
|
|
252
|
-
loanCallouts:
|
|
253
|
-
loanStatus:
|
|
252
|
+
loanCallouts: g,
|
|
253
|
+
loanStatus: C,
|
|
254
254
|
loanUse: h,
|
|
255
|
-
mdiMapMarker:
|
|
256
|
-
mdiHome:
|
|
257
|
-
mdiLink:
|
|
258
|
-
mdiClose:
|
|
255
|
+
mdiMapMarker: M,
|
|
256
|
+
mdiHome: S,
|
|
257
|
+
mdiLink: E,
|
|
258
|
+
mdiClose: R,
|
|
259
259
|
readMorePath: A,
|
|
260
260
|
state: _,
|
|
261
261
|
tag: N,
|
|
262
262
|
unreservedAmount: b,
|
|
263
263
|
sharesAvailable: B,
|
|
264
|
-
customStyle:
|
|
264
|
+
customStyle: w,
|
|
265
|
+
loanUseLoadingRows: k,
|
|
265
266
|
clickReadMore: T,
|
|
266
267
|
trackWebsiteClick: () => {
|
|
267
268
|
e.kvTrackFunction("Lending", "click-Business Website", "Website", e.loanId);
|
|
@@ -279,12 +280,12 @@ const Ce = r`
|
|
|
279
280
|
amountLent() {
|
|
280
281
|
var t, a;
|
|
281
282
|
const e = ((a = (t = this.loan) == null ? void 0 : t.loanFundraisingInfo) == null ? void 0 : a.fundedAmount) ?? 0;
|
|
282
|
-
return
|
|
283
|
+
return F(e).format("$0,0");
|
|
283
284
|
}
|
|
284
285
|
}
|
|
285
286
|
};
|
|
286
287
|
export {
|
|
287
288
|
Ce as KV_COMPACT_LOAN_CARD_FRAGMENT,
|
|
288
|
-
|
|
289
|
-
|
|
289
|
+
he as KV_COMPACT_LOAN_CARD_USER_FRAGMENT,
|
|
290
|
+
Ae as default
|
|
290
291
|
};
|
|
@@ -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
|