@namuna-nur/ui-kit 1.0.2 → 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 (2) hide show
  1. package/README.md +1 -219
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,84 +1,4 @@
1
1
 
2
- - [Technologies Used](#technologies-used)
3
- - [Project Structure](#project-structure)
4
- - [Prerequisites](#prerequisites)
5
- - [Local Setup](#local-setup)
6
- - [Development Approach](#development-approach)
7
- - [Development Patterns](#development-patterns)
8
- - [Atomic Design Principles](#atomic-design-principles)
9
- - [Design Tokens](#design-tokens)
10
- - [Naming Conventions](#naming-conventions)
11
- - [Branch Naming Conventions](#branch-naming-conventions)
12
- - [Scripts](#scripts)
13
- - [Git Hooks](#git-hooks)
14
- - [pre-commit](#pre-commit)
15
- - [commit-msg](#commit-msg)
16
- - [Guidelines](#guidelines)
17
- - [Examples](#examples)
18
- - [Rules](#rules)
19
- - [Copyright](#copyright)
20
-
21
- ## Technologies Used
22
- - **[React](https://react.dev/)**: JavaScript library for building user interfaces
23
- - **[TypeScript](https://www.typescriptlang.org/)**: Provides static typing for JavaScript to enhance development quality
24
- - **[Tailwind CSS](https://tailwindcss.com/)**: Utility-first CSS framework for rapid UI development
25
- - **[Radix UI](https://www.radix-ui.com/)**: Library for building accessible React components
26
- - **[Storybook](https://storybook.js.org/)**: UI development environment to build and document components in isolation
27
- - **[React Testing Library](https://testing-library.com/)**: For testing React components
28
-
29
- ## Project Structure
30
-
31
- The project's folder structure is organized as follows:
32
-
33
- ```sh
34
- ├── public # Public assets such as images and icons
35
- └── src # Main source code directory
36
- ├── _shared # Shared components
37
- ├── atoms # Basic building blocks of the UI (Button, Input, etc.)
38
- ├── molecules # Combination of atoms (InputGroup, TabGroup, etc.)
39
- ├── organisms # Complex components (Form, Modal, etc.)
40
- ├── hooks # Custom React hooks
41
- ├── tokens # Design tokens (colors, typography, spacing, etc.)
42
- └── utils # Utility functions
43
- ```
44
-
45
- ## Prerequisites
46
- - **[Node.js](https://nodejs.org/)**: v20.x or higher
47
- - **NPM**: v10.x or higher
48
-
49
- ## Local Setup
50
-
51
- 1. **Clone the Repository**
52
- ```sh
53
- git clone git@git.devsymfony.io:Namuna/ui-kit.git
54
- cd ui-kit
55
- ```
56
-
57
- 2. **Install Dependencies**
58
- ```sh
59
- npm install
60
- ```
61
-
62
- 3. **Launch Storybook**
63
- ```sh
64
- npm dev
65
- ```
66
- This will start the Storybook at `http://localhost:6006`
67
-
68
- 4. **Run Tests**
69
- ```sh
70
- npm test
71
- ```
72
- This will run the test suite to verify that everything is working as expected.
73
-
74
- 5. (Optional) **Run Test Coverage**
75
- ```sh
76
- npm run test:coverage:ui
77
- ```
78
- This will check the current test coverage using `istanbul` to visually identify uncovered lines of code.
79
-
80
- You are all set! **Happy coding!**
81
-
82
2
  ## Installation (as NPM Package)
83
3
 
84
4
  Install the UI Kit in a consuming project:
@@ -113,6 +33,7 @@ You can also import category entry points for potentially smaller bundles:
113
33
  import { Button } from '@namuna-nur/ui-kit/atoms'
114
34
  import { TabGroup } from '@namuna-nur/ui-kit/molecules'
115
35
  ```
36
+ You are all set! **Happy coding!**
116
37
 
117
38
  ### Styles & Tailwind Setup
118
39
  This kit relies on Tailwind utility classes. In the consumer project:
@@ -194,145 +115,6 @@ Yes—import only what you need.
194
115
  **ESM only?**
195
116
  Yes. If you need CJS, use a transpilation step in your app bundler.
196
117
 
197
- **Storybook usage?**
198
- Clone the repo and run `npm run storybook:dev` for full docs.
199
-
200
-
201
- ## Development Approach
202
-
203
- This project follows the **Atomic Design** methodology for building reusable UI components. The Atomic Design pattern encourages breaking down the UI into small, reusable parts (atoms, molecules, organisms, etc.), ensuring a consistent and maintainable codebase. More details on Atomic Design can be found [here](https://bradfrost.com/blog/post/atomic-web-design/).
204
-
205
- **Storybook** is used extensively to develop and document components in isolation. Storybook helps visualize components, understand their states and variants, and provides a seamless way to test each component individually before integration. You can read more about testing with Storybook [here](https://storybook.js.org/docs/writing-tests/).
206
-
207
- ### Development Patterns
208
- - **Atomic Design Pattern**: The components are divided into atoms, molecules, organisms, and templates. This approach facilitates better reusability and maintainability of the code.
209
- - **Component Isolation in Storybook**: Each component is built and tested independently using Storybook to ensure that they behave correctly in isolation. This helps reduce bugs when integrating components together.
210
- - **Testing**: We use a **React Testing Library** for unit tests. Writing comprehensive tests ensures the stability of the system and catches regressions early.
211
- - **Best Practices**: Code should follow established best practices, including clear separation of concerns, meaningful naming conventions, and usage of utility classes from **Tailwind CSS** for styling.
212
-
213
- ### Atomic Design Principles
214
-
215
- - **Atoms**: The basic building blocks of the UI, such as buttons, labels, and input fields. Examples:
216
- - `Button`: A reusable button element with different styles (e.g., primary, secondary).
217
- - `Input`: A text input field with different states (e.g., disabled, active).
218
- - **Molecules**: Groupings of atoms that work together as a unit, like forms or toolbars. Examples:
219
- - `InputGroup`: A label and input field grouped together.
220
- - `DropdownGroup`: A dropdown combined with a button for more specific actions.
221
- - **Organisms**: More complex components that consist of molecules and/or atoms to form a section of a UI. Examples:
222
- - `Form`: A complete form component with multiple inputs, buttons, and labels.
223
- - `Navbar`: A navigation bar with links, search input, and user menu.
224
-
225
- ### Design Tokens
226
-
227
- To maintain consistent styling across components, we use design tokens. Tokens encapsulate values for colors, typography, spacing, and more, and are defined centrally in the `tokens` directory, as well as local tokens follow `<component>.tokens.ts` naming pattern.
228
-
229
- ### Naming Conventions
230
- - **Component Files**: Component files should be named using PascalCase, e.g., `InputField.tsx`, `DropdownMenu.tsx`.
231
- - **CSS Classes**: Use `kebab-case` for class names, e.g., `.button-primary`.
232
- - **Props and Variables**: Use camelCase for props and variables, e.g., `isDisabled`, `inputValue`.
233
- - **Test Files**: The test files should have the same name as the component they test, with `.test.tsx` as a suffix, e.g., `Button.test.tsx`.
234
-
235
- ### Branch Naming Conventions
236
- Branch names should be descriptive and follow a consistent format to ensure that they clearly convey the purpose of the branch. The format to be used is:
237
-
238
- ```
239
- <type>/<NUR-ticket>_<description>
240
- ```
241
-
242
- - **type**: The type of work the branch is intended for. The common types are:
243
- - `feature` (e.g., `feature/NUR-123_new-navbar`): New features.
244
- - `fix` (e.g., `fix/NUR-456_bugfix-modal`): Bug fixes.
245
- - `chore` (e.g., `chore/NUR-789_update-dependencies`): Maintenance tasks.
246
- - `hotfix` (e.g., `hotfix/NUR-101_critical-fix`): Critical issues that need an immediate fix.
247
- - **JIRA Ticket**: Always include the Task Manager ticket identifier to associate branches with tasks.
248
- - **Description**: A short description of the branch's purpose separated from Task Manager ticket number with underscore (`_`). It should be lowercase and use hyphens instead of spaces.
249
-
250
- Examples:
251
- - `feature/NUR-110_add-login-button`
252
- - `fix/NUR-220_correct-header-issue`
253
- - `chore/NUR-320_refactor-storybook-setup`
254
-
255
- ### Scripts
256
-
257
- Here are some of the commonly used scripts available in `package.json`:
258
-
259
- - **Development**:
260
- - `dev`: Starts Storybook locally for component development.
261
- - `build`: Builds the `Storybook` documentation for deployment.
262
-
263
- - **Linting & Formatting**:
264
- - `prepare`: Prepares `husky` hooks.
265
- - `format`: Checks the formatting of `TypeScript` files using `Prettier`.
266
- - `format:fix`: Automatically formats `TypeScript` files.
267
- - `lint`: Runs `ESLint` to find code issues.
268
- - `lint:fix`: Attempts to fix code issues automatically.
269
-
270
- - **Testing**:
271
- - `test`: Runs unit and integration tests using `Vitest` with a basic reporter.
272
- - `test:watch`: Watches for changes and runs tests interactively.
273
- - `test:coverage`: Runs tests and provides coverage reports.
274
- - `test:coverage:ui`: Runs tests and serves a UI for viewing coverage reports.
275
-
276
- ## Git Hooks
277
-
278
- To maintain code quality and consistency across the development team, we use Git Hooks with [Husky](https://typicode.github.io/husky) to automate certain checks before committing code.
279
-
280
- ### [pre-commit](/.husky/pre-commit)
281
-
282
- The `pre-commit` hook is set up to run the following commands in sequence:
283
-
284
- ```sh
285
- npm run format # Runs the code formatter to maintain code style guidelines
286
- npm run lint # Runs ESLint to identify any coding style issues
287
- npm run test # Executes all unit tests
288
- npm run build # Compiles TypeScript files to check for type errors
289
- npm run storybook:build # Builds Storybook
290
- ```
291
-
292
- Check out **Husky** [docs](https://typicode.github.io/husky/how-to.html#adding-a-new-hook) for instructions on how to add new hooks.
293
-
294
- ### [commit-msg](./husky/commit-msg)
295
-
296
- The `commit-msg` hook ensures that all commit messages follow the conventional commit style as enforced by [commitlint](https://github.com/conventional-changelog/commitlint). This helps maintain a consistent format for commit messages, which makes it easier to read and understand the project's history.
297
-
298
- #### Guidelines
299
-
300
- According to the rules specified in `commitlint.config.ts`, commit messages should be structured in the following format:
301
-
302
- ```
303
- <type>(optional scope): <subject>
304
- ```
305
-
306
- - **type**: Specifies the purpose of the commit. Common types include:
307
- - `feat`: A new feature
308
- - `fix`: A bug fix
309
- - `chore`: Routine tasks, like maintenance
310
- - `docs`: Changes to documentation
311
- - `style`: Code style changes that do not affect the code's logic
312
- - `refactor`: A code change that neither fixes a bug nor adds a feature
313
- - `test`: Adding or modifying tests
314
- - `perf`: Changes that improve performance
315
- - `poc`: Reserved for POCs
316
-
317
- - **scope**: Specifies the task number from Task Manager, e.g., `NUR-123`
318
-
319
- - **subject**: A brief description of the changes. It should be imperative and in lowercase.
320
-
321
- #### Examples
322
-
323
- - `feat(NUR-123): add new button component`
324
- - `fix(NUR-123): correct route mapping issue`
325
- - `chore(NUR-123): update dependencies`
326
- feat(86et1d8y6): add income tax on dividends and interest
327
- #### Rules
328
-
329
- The rules from `commitlint.config.ts` include:
330
- - **Header Length**: Commit message headers must not exceed 100 characters
331
- - **Type and Scope**: Only the specified types are allowed, and scopes must start with `NUR-`
332
- - **Case Sensitivity**: The type and scope should always be lowercase
333
-
334
- To learn more, refer to the **Commitlint** [docs](https://commitlint.js.org/#/).
335
-
336
118
  ## Copyright
337
119
  This project is solely owned by (c) Namuna - NUR. All rights reserved.
338
120
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namuna-nur/ui-kit",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "UI Kit for Namuna NUR",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -60,7 +60,7 @@
60
60
  "lint": "eslint .",
61
61
  "lint:fix": "eslint . --fix",
62
62
  "prepare": "husky",
63
- "build": "tsc -b && vite build",
63
+ "build": "tsc -b && vite build",
64
64
  "storybook:dev": "storybook dev -p 6006",
65
65
  "storybook:build": "storybook build --quiet --loglevel=error",
66
66
  "test": "vitest run --reporter=basic --reporter=hanging-process",