@1money/component-ui 0.0.22 → 0.0.24

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 (101) hide show
  1. package/es/components/Input/Input/Input.css +1 -1
  2. package/es/index.css +1 -1
  3. package/es/stories/docs/ComponentDocsPage.js +234 -0
  4. package/es/stories/docs/componentDocMeta.js +97 -0
  5. package/es/stories/docs/storybook-docs.css +79 -0
  6. package/lib/components/Input/Input/Input.css +1 -1
  7. package/lib/index.css +1 -1
  8. package/lib/stories/docs/ComponentDocsPage.js +244 -0
  9. package/lib/stories/docs/componentDocMeta.js +104 -0
  10. package/lib/stories/docs/storybook-docs.css +79 -0
  11. package/package.json +23 -8
  12. package/scripts/mcp-server/README.md +267 -0
  13. package/scripts/mcp-server/bin.mjs +2 -0
  14. package/scripts/mcp-server/drift.json +5 -0
  15. package/scripts/mcp-server/examples.generated.json +2651 -0
  16. package/scripts/mcp-server/index.generated.json +18098 -0
  17. package/scripts/mcp-server/index.mjs +308 -26
  18. package/scripts/mcp-server/tools/get-examples.mjs +125 -0
  19. package/scripts/mcp-server/tools/get-library-info.mjs +25 -0
  20. package/scripts/mcp-server/tools/get-symbol.mjs +232 -0
  21. package/scripts/mcp-server/tools/get-token.mjs +60 -0
  22. package/scripts/mcp-server/tools/list-icons.mjs +38 -0
  23. package/scripts/mcp-server/tools/list-symbols.mjs +46 -0
  24. package/scripts/mcp-server/tools/resolve-import.mjs +125 -0
  25. package/scripts/mcp-server/tools/search-symbols.mjs +79 -0
  26. package/.agents/skills/1money-component-dev/SKILL.md +0 -224
  27. package/.agents/skills/1money-component-dev/checklist.md +0 -159
  28. package/.agents/skills/1money-component-dev/references/ComponentPatterns.md +0 -478
  29. package/.agents/skills/1money-component-dev/references/FigmaExtractionChecklist.md +0 -144
  30. package/.agents/skills/1money-component-dev/references/HooksGuide.md +0 -360
  31. package/.agents/skills/1money-component-dev/references/SemanticColors.md +0 -215
  32. package/.agents/skills/1money-component-dev/references/StyleSystemAPI.md +0 -389
  33. package/.claude/settings.local.json +0 -111
  34. package/.claude/skills/1money-component-dev/SKILL.md +0 -229
  35. package/.claude/skills/1money-component-dev/checklist.md +0 -159
  36. package/.claude/skills/1money-component-dev/references/ComponentPatterns.md +0 -478
  37. package/.claude/skills/1money-component-dev/references/FigmaExtractionChecklist.md +0 -144
  38. package/.claude/skills/1money-component-dev/references/HooksGuide.md +0 -360
  39. package/.claude/skills/1money-component-dev/references/SemanticColors.md +0 -215
  40. package/.claude/skills/1money-component-dev/references/StyleSystemAPI.md +0 -389
  41. package/.claude/skills/1money-component-review/SKILL.md +0 -316
  42. package/.claude/skills/component-pipeline/SKILL.md +0 -116
  43. package/.claude/skills/component-pipeline/checklist.md +0 -125
  44. package/.hintrc +0 -13
  45. package/@types/global.d.ts +0 -28
  46. package/AGENTS.md +0 -546
  47. package/CLAUDE.md +0 -1
  48. package/jest.setup.d.ts +0 -1
  49. package/jest.setup.ts +0 -1
  50. package/patches/primereact.patch +0 -323
  51. package/patches/react-pro-sidebar.patch +0 -6421
  52. package/public/favicon.ico +0 -0
  53. package/public/fonts/Aeonik/Aeonik-Air.ttf +0 -0
  54. package/public/fonts/Aeonik/Aeonik-AirItalic.ttf +0 -0
  55. package/public/fonts/Aeonik/Aeonik-Black.ttf +0 -0
  56. package/public/fonts/Aeonik/Aeonik-BlackItalic.ttf +0 -0
  57. package/public/fonts/Aeonik/Aeonik-Bold.ttf +0 -0
  58. package/public/fonts/Aeonik/Aeonik-BoldItalic.ttf +0 -0
  59. package/public/fonts/Aeonik/Aeonik-Light.ttf +0 -0
  60. package/public/fonts/Aeonik/Aeonik-LightItalic.ttf +0 -0
  61. package/public/fonts/Aeonik/Aeonik-Medium.ttf +0 -0
  62. package/public/fonts/Aeonik/Aeonik-MediumItalic.ttf +0 -0
  63. package/public/fonts/Aeonik/Aeonik-Regular.ttf +0 -0
  64. package/public/fonts/Aeonik/Aeonik-RegularItalic.ttf +0 -0
  65. package/public/fonts/Aeonik/Aeonik-Thin.ttf +0 -0
  66. package/public/fonts/Aeonik/Aeonik-ThinItalic.ttf +0 -0
  67. package/public/fonts/Inter/Inter-Black.ttf +0 -0
  68. package/public/fonts/Inter/Inter-BlackItalic.ttf +0 -0
  69. package/public/fonts/Inter/Inter-Bold.ttf +0 -0
  70. package/public/fonts/Inter/Inter-BoldItalic.ttf +0 -0
  71. package/public/fonts/Inter/Inter-ExtraBold.ttf +0 -0
  72. package/public/fonts/Inter/Inter-ExtraBoldItalic.ttf +0 -0
  73. package/public/fonts/Inter/Inter-ExtraLight.ttf +0 -0
  74. package/public/fonts/Inter/Inter-ExtraLightItalic.ttf +0 -0
  75. package/public/fonts/Inter/Inter-Italic.ttf +0 -0
  76. package/public/fonts/Inter/Inter-Light.ttf +0 -0
  77. package/public/fonts/Inter/Inter-LightItalic.ttf +0 -0
  78. package/public/fonts/Inter/Inter-Medium.ttf +0 -0
  79. package/public/fonts/Inter/Inter-MediumItalic.ttf +0 -0
  80. package/public/fonts/Inter/Inter-Regular.ttf +0 -0
  81. package/public/fonts/Inter/Inter-SemiBold.ttf +0 -0
  82. package/public/fonts/Inter/Inter-SemiBoldItalic.ttf +0 -0
  83. package/public/fonts/Inter/Inter-Thin.ttf +0 -0
  84. package/public/fonts/Inter/Inter-ThinItalic.ttf +0 -0
  85. package/public/fonts/Outfit/Outfit-Black.ttf +0 -0
  86. package/public/fonts/Outfit/Outfit-Bold.ttf +0 -0
  87. package/public/fonts/Outfit/Outfit-ExtraBold.ttf +0 -0
  88. package/public/fonts/Outfit/Outfit-ExtraLight.ttf +0 -0
  89. package/public/fonts/Outfit/Outfit-Light.ttf +0 -0
  90. package/public/fonts/Outfit/Outfit-Medium.ttf +0 -0
  91. package/public/fonts/Outfit/Outfit-Regular.ttf +0 -0
  92. package/public/fonts/Outfit/Outfit-SemiBold.ttf +0 -0
  93. package/public/fonts/Outfit/Outfit-Thin.ttf +0 -0
  94. package/public/github-mark.svg +0 -3
  95. package/public/tokens/GYEN.svg +0 -9
  96. package/public/tokens/PYUSD.svg +0 -9
  97. package/public/tokens/USDT.svg +0 -6
  98. package/scripts/mcp-server/resources.d.mts +0 -1
  99. package/scripts/mcp-server/resources.mjs +0 -102
  100. package/test/jsdom-global-register.d.ts +0 -1
  101. package/test/jsdom-global-register.js +0 -1
@@ -1,229 +0,0 @@
1
- ---
2
- name: 1money-component-dev
3
- description: Scaffold and implement new components for @1money/components-ui. Wraps PrimeReact, uses the internal SCSS style system, and follows all library conventions. Use when building components that go INTO the library.
4
- metadata:
5
- short-description: Build new @1money/components-ui library components from Figma designs
6
- requires:
7
- - spec-write-plan
8
- ---
9
-
10
- # 1money-component-dev
11
-
12
- ## Activation
13
-
14
- **Act when**: Building a new component (or major variant) that will be added to `@1money/components-ui`.
15
- **Goal**: Produce a complete, lint-clean, Storybook-ready component directory following every library convention.
16
-
17
- ## Resources
18
-
19
- *Agent must utilize these references:*
20
-
21
- - **Checklist**: `checklist.md`
22
- - **Style System API**: `references/StyleSystemAPI.md`
23
- - **Semantic Colors**: `references/SemanticColors.md`
24
- - **Component Patterns**: `references/ComponentPatterns.md`
25
- - **Hooks Guide**: `references/HooksGuide.md`
26
- - **Figma Extraction**: `references/FigmaExtractionChecklist.md`
27
- - **Planning Skill**: `spec-write-plan` (Plan mode only)
28
-
29
- ## Inputs
30
-
31
- - **Figma URL** (recommended): Design source URL for the component.
32
- - **Node ID** (optional): Specific Figma frame. If absent, auto-explore top-level frames.
33
- - **Component Name** (required): PascalCase name for the component (e.g., `Chip`, `ToggleGroup`).
34
- - **Output Mode** (optional, default=Code): `Code` (implement files) or `Plan` (spec-write-plan document).
35
-
36
- ## Workflow
37
-
38
- ### Phase 1 — Confirm & Extract
39
-
40
- 1. **Confirm Output Mode** *(gate)*: If the user did not explicitly state `Plan` or `Code`, ask now. Default is `Code`.
41
-
42
- 2. **Confirm Component Name** *(gate)*: Validate the name is PascalCase. Check if a component with the same name already exists in `src/components/` to avoid conflicts.
43
-
44
- 3. **Extract Figma Design** (if URL provided): Follow `references/FigmaExtractionChecklist.md`.
45
- - Call `mcp__figma__get_design_context` to retrieve node structure.
46
- - Call `mcp__figma__get_screenshot` when layout or spacing is ambiguous.
47
- - Call `mcp__figma__get_variable_defs` to retrieve design tokens.
48
- - If no Node ID is provided, call `mcp__figma__get_metadata` to list top-level frames and present them to the user for selection.
49
-
50
- ### Phase 2 — Analyze & Map
51
-
52
- 4. **Identify PrimeReact Base**: Determine which `primereact/*` component to wrap. Check the [PrimeReact documentation](https://primereact.org/) for available components and their props. If no suitable PrimeReact base exists, build from scratch using native HTML elements (see `Flex`, `Grid`, `Space`, `Notification`, `Tag` as examples of non-PrimeReact components).
53
-
54
- 5. **Identify Icons**: When the design includes icons, **always check the existing `Icons` component first** (`src/components/Icons/`):
55
- - Read `src/components/Icons/SVGs.tsx` to browse all available icon names and their visual descriptions.
56
- - Match Figma icon assets to existing `IconName` entries by comparing shape/purpose (e.g., a chevron-right in Figma → `chevronRight`, a trash icon → `remove`, a copy icon → `copy`).
57
- - Use `<Icons name="..." />` with appropriate `size` and `color` props — do not create inline SVGs or import external icon libraries.
58
- - If no matching icon exists, flag it to the user and propose either: (a) adding the new icon to `SVGs.tsx` following the existing pattern, or (b) using the closest available alternative.
59
- - Import icons as: `import { Icons } from '@/components/Icons';` and the type as `import type { IconName } from '@/components/Icons';`.
60
-
61
- 6. **Map Design Tokens**: Using `references/StyleSystemAPI.md` and `references/SemanticColors.md`, map every visual value from the Figma design to the internal style system:
62
- - Colors -> `theme.palette(bg, ...)`, `theme.palette(text, ...)`, `theme.palette(icon, ...)`, `theme.palette(border, ...)` (semantic — preferred for all new components). When a component has multiple color variants, use the Variant DSL with `variants.om-variant-schema($component, $keys...)` to auto-generate the schema, then define a variants map. See `references/StyleSystemAPI.md` for the full Variant DSL reference and `src/styles/README.md` for semantic color token quick-reference tables.
63
- - Spacing -> `theme.spacing(scale, key)`, `theme.spacing(gap, key)`, `theme.spacing(component-padding, key)`, `theme.spacing(section-padding, key)`
64
- - Typography -> `@include theme.typography(category, size)` (emits `var()` references to `--om-{cat}-{size}-*` CSS custom properties)
65
- - Heights -> `theme.sizing(component-height, key)`
66
- - Radius -> `theme.shape(key)`
67
- - Shadows -> `theme.shadows(key)` (keys: `0`, `100`, `200`)
68
- - Opacity -> `theme.opacity(key)`
69
- - **No raw hex, px, or font-family values in SCSS** (except `!important` overrides on third-party styles)
70
-
71
- 7. **Identify Hooks**: Determine which library hooks the component needs — see `references/HooksGuide.md`:
72
- - Controlled/uncontrolled value → `useControlledState`
73
- - Event handlers passed to PrimeReact or memoized children → `useEventCallback` or `useMemoizedFn`
74
- - Latest value in imperative handles or async callbacks → `useLatest`
75
- - State set from async operations → `useSafeState`
76
- - Skip-initial-mount effects → `useUpdateEffect`
77
- - Import from `@1money/hooks` — never from `@1money/components-ui`.
78
-
79
- 8. **Define Props Interface**: Design the TypeScript interface following `references/ComponentPatterns.md`:
80
- - Extend PrimeReact props with `Omit<PrimeXProps, ...>` to remove conflicting props.
81
- - Add `prefixCls?: string` for class name customization.
82
- - Use union types for variant props (e.g., `color`, `size`, `variant`).
83
- - Add `ref` prop with correct element type.
84
- - If the component accepts an icon, type it as `IconName` (imported from `@/components/Icons`) rather than `string` or `ReactNode`.
85
-
86
- 9. **Identify Missing States**: Proactively identify states not shown in the design but required:
87
- - `disabled` — **must follow the Figma design exactly**. Extract disabled colors, opacity, and cursor styles from the Figma file. Do NOT invent or assume disabled styles (e.g., generic opacity or color dimming) — if the Figma design does not specify a disabled state, ask the user for guidance.
88
- - `loading` — spinner integration
89
- - `hover` / `focus` / `active` — interaction states
90
- - `error` / `warning` / `success` — validation states (if applicable)
91
-
92
- ### Phase 3 — Scaffold & Implement
93
-
94
- 10. **Create All Component Files**: Generate the complete directory following `references/ComponentPatterns.md` and `checklist.md`. The 8 files are:
95
-
96
- ```
97
- src/components/{Name}/
98
- ├── {Name}.tsx # Main component
99
- ├── interface.ts # TypeScript interfaces
100
- ├── index.ts # Barrel export
101
- ├── {Name}.stories.tsx # Storybook stories
102
- ├── README.md # Component documentation
103
- ├── style/
104
- │ ├── {Name}.scss # Component styles
105
- │ └── index.ts # Style import
106
- └── __test__/
107
- └── index.test.tsx # Snapshot test
108
- ```
109
-
110
- ### Phase 4 — Register Exports
111
-
112
- 11. **Update Library Barrel** (`src/index.ts`):
113
- - Add `export { {Name} } from './components/{Name}';` to the named export block.
114
- - Add `export type { {Name}Props } from './components/{Name}';` for the props type.
115
-
116
- ### Phase 5 — Generate Plan (Plan mode only)
117
-
118
- 12. **Write Plan**: If output mode is `Plan`, invoke `spec-write-plan` to generate a comprehensive implementation plan:
119
- - Save to `docs/plans/YYYY-MM-DD-{name}-component.md`
120
- - Include one task per file to create
121
- - Include one task per state to implement
122
- - Include token mapping table as a reference section
123
-
124
- ### Phase 6 — Validate
125
-
126
- 13. **Lint**: Run `pnpm lint` and fix all errors.
127
-
128
- 14. **Test**: Run `pnpm test` and ensure snapshot tests pass.
129
-
130
- 15. **Storybook**: Verify the component renders correctly in Storybook (`pnpm dev`).
131
-
132
- 16. **Self-Review** *(mandatory)*: Walk through `checklist.md` item by item. For each section, verify the implementation against the corresponding reference document:
133
- - SCSS values against `references/StyleSystemAPI.md` and `references/SemanticColors.md`
134
- - File structure and code patterns against `references/ComponentPatterns.md`
135
- - Token mapping completeness against `references/FigmaExtractionChecklist.md` (if Figma was used)
136
- - Fix all violations before presenting output to the user.
137
-
138
- ## Constraints
139
-
140
- ### SCSS Rules
141
-
142
- - **Import**: Always use `@use '@/styles/api' as theme;` and `@use '@/styles/recipes/variants' as variants;` (if using variants).
143
- - **Architecture**: The API forwards three layers — tokens (raw primitives), theme (CSS var resolvers, typography mixin, breakpoint mixins), and system (`om-sx` — for business code only, not component SCSS).
144
- - **Component variable**: Define `$component: '{kebab-case-name}';` at the top.
145
- - **Root selector**: `.#{theme.$prefix}-#{$component}` where `theme.$prefix` is `om-react-ui`.
146
- - **Color variants**: Use the Variant DSL (`variants.om-variant-schema` + `variants.om-variant-default` + `variants.om-variant-classes` with `$default:` param) — see `references/StyleSystemAPI.md` Variant DSL section.
147
- - **Size variants**: Use `&-{size}` nesting (e.g., `&-medium`, `&-small`).
148
- - **Disabled state**: Target `.p-disabled` class (PrimeReact convention). Styles must match the Figma design — do not invent disabled styles. Extract exact colors, opacity, and cursor values from the design file.
149
- - **No raw values**: Every color, spacing, radius, shadow, font, and height must use a token function.
150
- - **Color functions**: Use `theme.palette(domain, token)` where domain is `bg`, `text`, `icon`, or `border`.
151
-
152
- ### TypeScript Rules
153
-
154
- - **Interface over type**: Use `interface` for all object structures.
155
- - **No `any`**: Define types precisely.
156
- - **No `enum`**: Use `as const` arrays + derived union types.
157
- - **Props naming**: `{Name}Props` (e.g., `ButtonProps`).
158
- - **Component export**: Named export `export const {Name}` + `export default memo({Name})`.
159
-
160
- ### Hooks Rules
161
-
162
- - **Use library hooks**: For controlled/uncontrolled state, stable callbacks, latest refs, and other common patterns — always use the library's custom hooks. See `references/HooksGuide.md` for the full list.
163
- - **Import path**: `import { useXxx } from '@1money/hooks'` — never from `@1money/components-ui` or external packages (e.g., `ahooks`).
164
- - **Controlled/uncontrolled**: Components with `value`/`defaultValue` must use `useControlledState`.
165
- - **Event handlers**: Use `useEventCallback` for simple handlers (onChange, onClick) or `useMemoizedFn` for render callbacks and complex handlers.
166
- - **No `useCallback` with stale closures**: Prefer `useEventCallback`/`useMemoizedFn` over manual `useCallback` with long dependency arrays.
167
- - **Async safety**: Use `useSafeState` instead of `useState` when state may be set after unmount.
168
-
169
- ### Component Rules
170
-
171
- - **Wrap default export in `memo()`**: Every component's default export must be memoized.
172
- - **PrimeReact imports**: Import directly from `primereact/{component}` — never from `@1money/components-ui`.
173
- - **classnames utility**: Import `classnames` and `joinCls` from `@/utils/classnames`. The default export is pre-configured with `om-react-ui` prefix.
174
- - **`prefixCls` prop**: Every component must accept `prefixCls` with a sensible default.
175
- - **Spread remaining props**: Always `{...rest}` onto the PrimeReact base component.
176
-
177
- ### Story Rules
178
-
179
- - **File**: `{Name}.stories.tsx` in the component directory.
180
- - **Meta title**: `Components/{Name}`.
181
- - **Tags**: Include `['autodocs']` on meta.
182
- - **Import style**: `import './style';` to load SCSS in Storybook.
183
- - **Variant constants**: Define as `as const` arrays, not inline.
184
- - **AllVariants story**: Matrix of all size x color/variant combinations with `tags: ['!autodocs', 'dev']`.
185
-
186
- ### Test Rules
187
-
188
- - **Console suppression**: Suppress `Could not parse CSS stylesheet` and `findDOMNode is deprecated` errors.
189
- - **Lottie mock**: Always mock `lottie-web` if any component in the dependency chain uses it.
190
- - **Snapshot test**: At minimum, render the component and call `toMatchSnapshot()`.
191
-
192
- ### Skill Rules
193
-
194
- - **Do NOT invoke** the `1money-components-ui` or `figma-1money-codegen` skills during this workflow. This skill is self-contained and already includes all necessary Figma extraction steps and component implementation patterns.
195
-
196
- ### Typography Rules
197
-
198
- - **Use Typography component**: When rendering text, prefer `src/components/Typography` over raw HTML elements (`<span>`, `<p>`, `<h1>`–`<h6>`, etc.). Import as `import { Typography } from '@/components/Typography';`.
199
- - **Consistency**: The Typography component ensures consistent font family, sizes, weights, and line heights across all components via the design system.
200
-
201
- ### Icon Rules
202
-
203
- - **Reuse first**: Always check existing `Icons` component (`src/components/Icons/SVGs.tsx`) before creating inline SVGs or importing external icon libraries.
204
- - **Import**: `import { Icons } from '@/components/Icons';` and `import type { IconName } from '@/components/Icons';`.
205
- - **Usage**: `<Icons name="iconName" size={24} />` — never embed raw `<svg>` elements for icons that already exist.
206
- - **Icon props**: When a component accepts an icon, type it as `IconName` (not `string` or `ReactNode`). Use `<Icons name={iconProp} />` to render.
207
- - **Missing icons**: If a needed icon doesn't exist, flag it to the user before adding to `SVGs.tsx`.
208
- - **Color**: Use the `color` prop on `<Icons>` and bind it to a semantic token via CSS `var()` or pass a style-system value.
209
-
210
- ## Anti-Patterns
211
-
212
- - Importing from `@1money/components-ui` inside the library itself
213
- - Using inline SVGs or external icon libraries (e.g., `react-icons`, `lucide-react`) when the icon already exists in the `Icons` component
214
- - Using `Foundation` tokens or consumer-facing SCSS imports
215
- - Using `om-sx` mixin in component SCSS (that's for business code layout, not component internals)
216
- - Using flat namespace `@use '@/styles/api' as *` — always use namespaced `@use '@/styles/api' as theme`
217
- - Using old function names like `om-bg()`, `om-text()`, `om-spacing()`, `om-radius()`, `om-shadow()`, `om-component-height()`, `om-gap()`, `om-component-padding()`, `om-opacity()` — always use `theme.palette()`, `theme.spacing()`, `theme.shape()`, `theme.shadows()`, `theme.sizing()`, `theme.opacity()` instead
218
- - Writing manual `&-{variant}` blocks for color variants instead of using the Variant DSL (`variants.om-variant-schema` + `variants.om-variant-default` + `variants.om-variant-classes`)
219
- - Hand-writing variant schema maps instead of using `variants.om-variant-schema($component, $keys...)`
220
- - Hardcoding colors, spacing, or fonts instead of using token functions
221
- - Using old shadow keys (`1`, `2`, `3`) instead of the current scale (`0`, `100`, `200`)
222
- - Creating `.css` files instead of `.scss`
223
- - Skipping the barrel export update in `src/index.ts`
224
- - Forgetting `memo()` on the default export
225
- - Using `useState` + manual `useCallback` when `useControlledState` + `useEventCallback` would suffice
226
- - Importing hooks from `@1money/components-ui` or external packages (`ahooks`, `react-use`) instead of `@1money/hooks`
227
- - Using raw `useState` for async-set state (use `useSafeState` to prevent unmount leaks)
228
- - Writing `useCallback` with long dependency arrays instead of `useEventCallback` / `useMemoizedFn`
229
- - Invoking `1money-components-ui` or `figma-1money-codegen` skills (this skill handles everything)
@@ -1,159 +0,0 @@
1
- # Component Development Checklist
2
-
3
- Use this checklist to validate every new `@1money/components-ui` component. Walk through each section before considering the component complete.
4
-
5
- ## Pre-Implementation
6
-
7
- - [ ] Component name is PascalCase
8
- - [ ] PrimeReact base component identified (or confirmed "from scratch")
9
- - [ ] Figma design extracted (if URL provided) — see `references/FigmaExtractionChecklist.md`
10
- - [ ] All Figma tokens mapped to style system functions — see `references/StyleSystemAPI.md`
11
- - [ ] All icons matched to existing `Icons` component names (check `src/components/Icons/SVGs.tsx` first)
12
- - [ ] Missing icons flagged to user (if any icon in the design has no match in `Icons`)
13
- - [ ] Props interface designed with variant union types
14
- - [ ] All required states identified (disabled, loading, hover, focus, error, etc.)
15
- - [ ] Output mode confirmed: `Code` or `Plan`
16
-
17
- ## File Structure
18
-
19
- - [ ] `src/components/{Name}/{Name}.tsx` exists
20
- - [ ] `src/components/{Name}/interface.ts` exists
21
- - [ ] `src/components/{Name}/index.ts` exists
22
- - [ ] `src/components/{Name}/{Name}.stories.tsx` exists
23
- - [ ] `src/components/{Name}/README.md` exists
24
- - [ ] `src/components/{Name}/style/{Name}.scss` exists
25
- - [ ] `src/components/{Name}/style/index.ts` exists
26
- - [ ] `src/components/{Name}/__test__/index.test.tsx` exists
27
-
28
- ## interface.ts
29
-
30
- - [ ] Uses `interface` (not `type`) for props definition
31
- - [ ] Named `{Name}Props`
32
- - [ ] Extends PrimeReact props via `Omit<PrimeXProps, ...>` (if wrapping PrimeReact)
33
- - [ ] Includes `prefixCls?: string`
34
- - [ ] Includes `ref?: RefObject<HTMLElement | null>` with correct element type
35
- - [ ] Variant props use union types (e.g., `'primary' | 'secondary'`)
36
- - [ ] No `any` types
37
- - [ ] No `enum` — uses `as const` arrays + derived union types for constants
38
- - [ ] All props documented with JSDoc comments for non-obvious fields
39
-
40
- ## {Name}.tsx
41
-
42
- - [ ] Imports `memo` from `react`
43
- - [ ] Imports PrimeReact base from `primereact/{component}` (not from `@1money/components-ui`)
44
- - [ ] Imports `classnames` (default) and `joinCls` from `@/utils/classnames`
45
- - [ ] Imports type `{Name}Props` from `./interface`
46
- - [ ] Component is typed as `FC<PropsWithChildren<{Name}Props>>` (or without `PropsWithChildren` if no children)
47
- - [ ] Destructures props with defaults: `prefixCls = '{kebab-name}'`, variant defaults
48
- - [ ] Creates `classes` via `classnames(prefixCls)`
49
- - [ ] Root element uses `classes(void 0, joinCls(classes(variant), classes(size), className))`
50
- - [ ] Spreads `{...rest}` onto PrimeReact base component
51
- - [ ] Named export: `export const {Name}: FC<...> = props => { ... }`
52
- - [ ] Default export: `export default memo({Name})`
53
- - [ ] Icons use `<Icons name="..." />` from `@/components/Icons` (no inline SVGs or external icon libs)
54
- - [ ] Icon props typed as `IconName` (from `@/components/Icons`) — not `string` or `ReactNode`
55
- - [ ] No direct DOM manipulation
56
- - [ ] Constants extracted (no magic strings)
57
-
58
- ## Hooks Usage — see `references/HooksGuide.md`
59
-
60
- - [ ] Controlled/uncontrolled components use `useControlledState` from `@1money/hooks`
61
- - [ ] Event handlers use `useEventCallback` or `useMemoizedFn` (not manual `useCallback` with long deps)
62
- - [ ] Async state updates use `useSafeState` (not raw `useState`)
63
- - [ ] All hooks imported from `@1money/hooks` (not from `@1money/components-ui` or external packages like `ahooks`)
64
- - [ ] No `useCallback` with stale closures — `useEventCallback` / `useMemoizedFn` preferred
65
- - [ ] `useLatest` used when accessing current state in imperative handles or async callbacks
66
- - [ ] `useUpdateEffect` used when effects should skip initial mount
67
-
68
- ## SCSS (`style/{Name}.scss`)
69
-
70
- - [ ] First line: `@use '@/styles/api' as theme;`
71
- - [ ] Second line (if using variants): `@use '@/styles/recipes/variants' as variants;`
72
- - [ ] `$component: '{kebab-name}';` defined
73
- - [ ] Root selector: `.#{theme.$prefix}-#{$component}`
74
- - [ ] All colors use `theme.palette(bg, ...)`, `theme.palette(text, ...)`, `theme.palette(icon, ...)`, `theme.palette(border, ...)`
75
- - [ ] All spacing uses `theme.spacing(scale, key)`, `theme.spacing(gap, key)`, `theme.spacing(component-padding, key)`, or `theme.spacing(section-padding, key)`
76
- - [ ] All border-radius uses `theme.shape(key)`
77
- - [ ] All box-shadow uses `theme.shadows(key)` (keys: 0/100/200)
78
- - [ ] All heights use `theme.sizing(component-height, key)`
79
- - [ ] All opacity uses `theme.opacity(key)`
80
- - [ ] Typography uses `@include theme.typography(category, size)` (emits `var(--om-{cat}-{size}-*)` references)
81
- - [ ] No raw hex values (e.g., `#073387`)
82
- - [ ] No raw pixel values for design tokens (e.g., `16px` for spacing)
83
- - [ ] No raw font-family declarations
84
- - [ ] No old function names (`om-bg`, `om-text`, `om-spacing`, `om-radius`, etc.) — use `theme.*` namespaced functions
85
- - [ ] Color variants use the Variant DSL (`variants.om-variant-schema` + `variants.om-variant-default` + `variants.om-variant-classes`)
86
- - [ ] Variant schema generated via `variants.om-variant-schema($component, $keys...)` (not hand-written)
87
- - [ ] Variant schema variable named `$component-variant-schema`
88
- - [ ] Variants map variable named `$component-variants`
89
- - [ ] All variant names are quoted strings (e.g., `'primary'`, `'white'`)
90
- - [ ] `variants.om-variant-default` called with default variant name
91
- - [ ] `variants.om-variant-classes` called with `$default:` param to skip the default variant
92
- - [ ] Base styles consume variant values via `var(--om-{component}-{key})`
93
- - [ ] Size variants use `&-{size}` nesting (not the Variant DSL)
94
- - [ ] Disabled state targets `.p-disabled` (PrimeReact convention)
95
- - [ ] Hover states use `&:hover:not(.p-disabled)`
96
- - [ ] Responsive styles use `@include theme.down()` (if needed)
97
-
98
- ## style/index.ts
99
-
100
- - [ ] Single line: `import './{Name}.scss';`
101
-
102
- ## index.ts
103
-
104
- - [ ] Imports default export: `import {Name} from './{Name}';`
105
- - [ ] Re-exports named: `export { {Name} } from './{Name}';`
106
- - [ ] Re-exports default: `export default {Name};`
107
- - [ ] Re-exports types: `export * from './interface';`
108
-
109
- ## Stories (`{Name}.stories.tsx`)
110
-
111
- - [ ] Imports from `@storybook/react` (`Meta`, `StoryObj`)
112
- - [ ] Imports `fn` from `@storybook/test` for action handlers
113
- - [ ] Imports component from `./index`
114
- - [ ] Imports styles: `import './style';`
115
- - [ ] Variant constants defined as `as const` arrays
116
- - [ ] Meta has `title: 'Components/{Name}'`
117
- - [ ] Meta has `component: {Name}`
118
- - [ ] Meta has `tags: ['autodocs']`
119
- - [ ] Meta has `argTypes` with controls for all variant props
120
- - [ ] Meta has `args` with sensible defaults
121
- - [ ] `AllVariants` story exists with `tags: ['!autodocs', 'dev']` — shows matrix of all variants
122
- - [ ] At least one additional story demonstrating key features (e.g., `WithIcons`, `Sizes`)
123
- - [ ] Type alias: `type Story = StoryObj<typeof {Name}>;`
124
-
125
- ## Tests (`__test__/index.test.tsx`)
126
-
127
- - [ ] Imports `jsdom-global/register`
128
- - [ ] Imports `render` from `@testing-library/react`
129
- - [ ] Imports `@testing-library/jest-dom`
130
- - [ ] Console error suppression for `Could not parse CSS stylesheet` and `findDOMNode is deprecated`
131
- - [ ] Mocks `lottie-web` (if component dependency chain includes it)
132
- - [ ] `describe('{Name}')` block
133
- - [ ] At least one `it('renders correctly')` with `toMatchSnapshot()`
134
-
135
- ## README.md
136
-
137
- - [ ] Component name as heading
138
- - [ ] Brief description of purpose
139
- - [ ] Import example
140
- - [ ] Basic usage example
141
- - [ ] Props table with name, type, default, and description columns
142
-
143
- ## Library Registration
144
-
145
- - [ ] `export { {Name} } from './components/{Name}';` added to `src/index.ts`
146
- - [ ] `export type { {Name}Props } from './components/{Name}';` added to `src/index.ts`
147
-
148
- ## Validation
149
-
150
- - [ ] `pnpm lint` passes with no errors
151
- - [ ] `pnpm test` passes (snapshots created/updated)
152
- - [ ] Component renders in Storybook (`pnpm dev`)
153
- - [ ] All variant combinations visually verified in Storybook
154
- - [ ] Self-review: every SCSS value cross-checked against `StyleSystemAPI.md` / `SemanticColors.md`
155
- - [ ] Self-review: file structure and code patterns cross-checked against `ComponentPatterns.md`
156
- - [ ] Self-review: no raw hex, px (for tokens), or font-family values in SCSS
157
- - [ ] Self-review: no inline SVGs or external icon libraries — all icons use `<Icons name="..." />`
158
- - [ ] Self-review: hooks usage cross-checked against `HooksGuide.md` (correct hook for each pattern)
159
- - [ ] Self-review: no anti-patterns present (see SKILL.md Anti-Patterns section)