@tanishraj/ui-kit 1.0.3

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 (72) hide show
  1. package/dist/.storybook/StorybookThemeProvider.d.ts +6 -0
  2. package/dist/.storybook/main.d.ts +3 -0
  3. package/dist/.storybook/preview.d.ts +3 -0
  4. package/dist/eslint.config.d.mts +2 -0
  5. package/dist/index.cjs.js +3 -0
  6. package/dist/index.cjs.js.map +1 -0
  7. package/dist/index.es.js +14 -0
  8. package/dist/index.es.js.map +1 -0
  9. package/dist/setupTests.d.ts +0 -0
  10. package/dist/src/components/Alert/Alert.d.ts +11 -0
  11. package/dist/src/components/Alert/Alert.stories.d.ts +10 -0
  12. package/dist/src/components/Alert/Alert.styles.d.ts +35 -0
  13. package/dist/src/components/Alert/Alert.test.d.ts +1 -0
  14. package/dist/src/components/Alert/index.d.ts +2 -0
  15. package/dist/src/components/Alert/types.d.ts +6 -0
  16. package/dist/src/components/Avatar/Avatar.d.ts +17 -0
  17. package/dist/src/components/Avatar/Avatar.stories.d.ts +11 -0
  18. package/dist/src/components/Avatar/Avatar.styles.d.ts +23 -0
  19. package/dist/src/components/Avatar/Avatar.test.d.ts +1 -0
  20. package/dist/src/components/Avatar/index.d.ts +2 -0
  21. package/dist/src/components/Avatar/types.d.ts +14 -0
  22. package/dist/src/components/AvatarGroup/AvatarGroup.d.ts +3 -0
  23. package/dist/src/components/AvatarGroup/AvatarGroup.stories.d.ts +9 -0
  24. package/dist/src/components/AvatarGroup/AvatarGroup.styles.d.ts +8 -0
  25. package/dist/src/components/AvatarGroup/AvatarGroup.test.d.ts +1 -0
  26. package/dist/src/components/AvatarGroup/index.d.ts +2 -0
  27. package/dist/src/components/AvatarGroup/types.d.ts +17 -0
  28. package/dist/src/components/Badge/Badge.d.ts +7 -0
  29. package/dist/src/components/Badge/Badge.stories.d.ts +10 -0
  30. package/dist/src/components/Badge/Badge.styles.d.ts +14 -0
  31. package/dist/src/components/Badge/Badge.test.d.ts +1 -0
  32. package/dist/src/components/Badge/index.d.ts +2 -0
  33. package/dist/src/components/Badge/types.d.ts +7 -0
  34. package/dist/src/components/Button/Button.d.ts +10 -0
  35. package/dist/src/components/Button/Button.stories.d.ts +12 -0
  36. package/dist/src/components/Button/Button.styles.d.ts +15 -0
  37. package/dist/src/components/Button/Button.test.d.ts +1 -0
  38. package/dist/src/components/Button/index.d.ts +2 -0
  39. package/dist/src/components/Button/types.d.ts +6 -0
  40. package/dist/src/components/ButtonGroup/ButtonGroup.d.ts +3 -0
  41. package/dist/src/components/ButtonGroup/ButtonGroup.stories.d.ts +12 -0
  42. package/dist/src/components/ButtonGroup/ButtonGroup.styles.d.ts +11 -0
  43. package/dist/src/components/ButtonGroup/ButtonGroup.test.d.ts +1 -0
  44. package/dist/src/components/ButtonGroup/index.d.ts +2 -0
  45. package/dist/src/components/ButtonGroup/types.d.ts +15 -0
  46. package/dist/src/components/OrganizationChart/OrganizationChart.d.ts +2 -0
  47. package/dist/src/components/OrganizationChart/OrganizationChart.stories.d.ts +7 -0
  48. package/dist/src/components/OrganizationChart/OrganizationChart.styles.d.ts +5 -0
  49. package/dist/src/components/OrganizationChart/OrganizationChart.test.d.ts +1 -0
  50. package/dist/src/components/OrganizationChart/index.d.ts +2 -0
  51. package/dist/src/components/OrganizationChart/mockData.d.ts +4 -0
  52. package/dist/src/components/OrganizationChart/types.d.ts +62 -0
  53. package/dist/src/components/OrganizationChart/utils.d.ts +10 -0
  54. package/dist/src/components/OrganizationChart/utils.test.d.ts +1 -0
  55. package/dist/src/components/index.d.ts +7 -0
  56. package/dist/src/hooks/index.d.ts +2 -0
  57. package/dist/src/hooks/useTheme.d.ts +5 -0
  58. package/dist/src/hooks/useToggle.d.ts +1 -0
  59. package/dist/src/index.d.ts +3 -0
  60. package/dist/src/providers/index.d.ts +1 -0
  61. package/dist/src/providers/theme/ThemeProvider.d.ts +11 -0
  62. package/dist/src/providers/theme/context.d.ts +6 -0
  63. package/dist/src/providers/theme/index.d.ts +3 -0
  64. package/dist/src/providers/theme/types.d.ts +4 -0
  65. package/dist/src/utils/classNames.d.ts +2 -0
  66. package/dist/src/utils/index.d.ts +2 -0
  67. package/dist/src/utils/types.d.ts +3 -0
  68. package/dist/themes/primary.css +558 -0
  69. package/dist/themes/secondary.css +555 -0
  70. package/dist/vite.config.d.mts +2 -0
  71. package/package.json +118 -0
  72. package/readme.md +238 -0
package/readme.md ADDED
@@ -0,0 +1,238 @@
1
+ # @tanishraj/ui-kit
2
+
3
+ ## About
4
+
5
+ @tanishraj/ui-kit is an industry-style React component library with built-in tooling for publishing, documentation, and testing.
6
+
7
+ ## Features
8
+
9
+ - **Vite** - Fast bundling and development
10
+ - **React & TypeScript** - Strict type safety for better development
11
+ - **Tailwind CSS** - Utility-first styling approach
12
+ - **Tailwind Merge & CVA** - Class name manipulation
13
+ - **CLSX** - Conditional class name handling
14
+ - **ESLint & Prettier** - Code linting and formatting
15
+ - **Vitest & React Testing Library** - Unit testing setup
16
+ - **Storybook** - Interactive documentation for components
17
+
18
+ ## Getting Started
19
+
20
+ ### Installation
21
+
22
+ Clone the repository and install dependencies:
23
+
24
+ ```sh
25
+ git clone https://github.com/tanishraj/ui-kit.git
26
+ cd ui-kit
27
+ npm install
28
+ ```
29
+
30
+ ### Running Storybook
31
+
32
+ To start Storybook for interactive component documentation:
33
+
34
+ ```sh
35
+ npm run storybook
36
+ ```
37
+
38
+ ## Automated UI Component Generation
39
+
40
+ You can now generate a new component from a Figma node and existing local code patterns:
41
+
42
+ ```sh
43
+ npm run generate:component -- \
44
+ --name MyNewComponent \
45
+ --figma-url "https://www.figma.com/file/<FILE_KEY>/<NAME>?node-id=<NODE_ID>" \
46
+ --openai-key "$OPENAI_API_KEY" \
47
+ --figma-token "$FIGMA_API_TOKEN" \
48
+ --stories \
49
+ --tests
50
+ ```
51
+
52
+ Alternative arguments:
53
+
54
+ - `--figma-file-key` and `--node-id` if you prefer separate args.
55
+ - `--skip-ai` to only scaffold fallback files without OpenAI.
56
+ - `--pattern-limit` to control how many local component examples are used.
57
+ - `--overwrite` to replace existing files.
58
+
59
+ Required environment variables:
60
+
61
+ - `OPENAI_API_KEY`
62
+ - `FIGMA_API_TOKEN`
63
+
64
+ ### GitHub Actions (Manual trigger)
65
+
66
+ There is a workflow at [.github/workflows/generate-ui-component.yml](.github/workflows/generate-ui-component.yml) that can generate components and open a PR for review.
67
+
68
+ Dispatch inputs:
69
+
70
+ - `component_name`: component name.
71
+ - `figma_url`: full Figma URL containing `node-id`.
72
+ - `stories`: generate story file.
73
+ - `tests`: generate test file.
74
+ - `overwrite`: overwrite existing files.
75
+ - `pattern_limit`: how many existing components to include in AI context.
76
+ - `skip_ai`: scaffold fallback only.
77
+
78
+ Set repository secrets:
79
+
80
+ - `OPENAI_API_KEY`
81
+ - `FIGMA_API_TOKEN`
82
+
83
+ ### VS Code / Codex MCP setup (Figma)
84
+
85
+ This repository includes a workspace MCP config at [.vscode/mcp.json](.vscode/mcp.json) for Figma.
86
+
87
+ If you're using Codex in VS Code (GitHub Copilot Agent mode), ensure:
88
+
89
+ - GitHub Copilot is enabled.
90
+ - Agent mode is turned on.
91
+ - Figma authentication completes in the MCP prompt flow.
92
+
93
+ The configured server is:
94
+
95
+ - `https://mcp.figma.com/mcp`
96
+
97
+ If the server does not appear, restart VS Code and reopen Copilot Chat in Agent mode, then check MCP tools.
98
+
99
+ ### Cleanup temporary generated components
100
+
101
+ Use cleanup after local smoke tests so temporary components are not committed:
102
+
103
+ ```sh
104
+ npm run cleanup:component -- --prefix AutoGenerated --force
105
+ ```
106
+
107
+ Preview only (no delete):
108
+
109
+ ```sh
110
+ npm run cleanup:component -- --prefix AutoGenerated --dry-run
111
+ ```
112
+
113
+ You can also target a specific component:
114
+
115
+ ```sh
116
+ npm run cleanup:component -- --name AutoGeneratedSmoke --force
117
+ ```
118
+
119
+ ### Building the Library
120
+
121
+ Build the component library for distribution:
122
+
123
+ ```sh
124
+ npm run build
125
+ ```
126
+
127
+ > Note:
128
+ > `vite build` may print non-blocking warnings:
129
+ > - `Unknown at rule: @theme`
130
+ > - `Unknown at rule: @utility`
131
+ >
132
+ > These are expected with the current Tailwind CSS v4 setup and do not fail the build.
133
+
134
+ ### Running Tests
135
+
136
+ Run unit tests with Vitest:
137
+
138
+ ```sh
139
+ npm test
140
+ ```
141
+
142
+ To watch tests:
143
+
144
+ ```sh
145
+ npm run test:watch
146
+ ```
147
+
148
+ ### Linting & Formatting
149
+
150
+ Lint and format code using ESLint and Prettier:
151
+
152
+ ```sh
153
+ npm run lint
154
+ npm run format
155
+ ```
156
+
157
+ ### Cleaning the Project
158
+
159
+ To remove generated files:
160
+
161
+ ```sh
162
+ npm run clean
163
+ ```
164
+
165
+ ## Folder Structure
166
+
167
+ ```
168
+ ├── src/ # Component source code
169
+ │ ├── components/ # React components
170
+ │ ├── hooks/ # Custom hooks (if any)
171
+ │ ├── utils/ # Utility functions
172
+ │ ├── index.ts # Library entry point
173
+ ├── .storybook/ # Storybook configuration
174
+ ├── tests/ # Unit tests
175
+ ├── dist/ # Compiled library output
176
+ ├── package.json # Project metadata and scripts
177
+ └── README.md # Documentation
178
+ ```
179
+
180
+ ## Publishing / Deployment to NPM
181
+
182
+ This project ships with an automated GitHub Actions publish pipeline at:
183
+
184
+ - [`.github/workflows/npm-publish.yml`](.github/workflows/npm-publish.yml)
185
+ - [release.md](release.md)
186
+
187
+ The workflow runs:
188
+
189
+ 1. `npm run lint`
190
+ 2. `npm run type-check`
191
+ 3. `npm run test -- --run`
192
+ 4. `npm run build`
193
+ 5. `npm publish` with the correct dist-tag
194
+
195
+ ### Required setup
196
+
197
+ Add this repository secret in GitHub:
198
+
199
+ - `NPM_TOKEN` (npm automation token with publish permissions)
200
+
201
+ ### Deployment flow (recommended)
202
+
203
+ 1. Update version locally:
204
+
205
+ ```sh
206
+ npm version patch # or minor / major
207
+ ```
208
+
209
+ 2. Push commit and tag:
210
+
211
+ ```sh
212
+ git push
213
+ git push --tags
214
+ ```
215
+
216
+ 3. GitHub Actions triggers on `v*` tags and publishes automatically.
217
+
218
+ ### Manual deployment
219
+
220
+ From the Actions tab, run the **Publish to npm** workflow manually.
221
+
222
+ - Optionally pass `distTag` (`latest`, `next`, `beta`, `canary`, etc.) for manual run.
223
+ - Prerelease tags (like `v1.2.3-beta.0`) auto-publish with `next` by default.
224
+
225
+ ### Optional local publish (bypasses CI)
226
+
227
+ For quick local validation:
228
+
229
+ ```sh
230
+ npm run build
231
+ npm view @tanishraj/ui-kit version
232
+ ```
233
+
234
+ Use this only when you already handle release checks outside GitHub Actions.
235
+
236
+ ## License
237
+
238
+ This project is licensed under the MIT License.