@tealca/core-components 1.0.8 → 1.0.10
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/README.md +99 -9
- package/dist/index.d.ts +1546 -3
- package/dist/main.css +1 -1
- package/dist/tealca-core-components.cjs.js +69 -10
- package/dist/tealca-core-components.es.js +17520 -419
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Tealca Core Components
|
|
2
2
|
|
|
3
3
|
> A set of reusable and accessible React components, built with TypeScript. This library centralizes all of Tealca's UI components, ensuring a consistent user experience and a unified brand identity across all our web applications.
|
|
4
4
|
|
|
@@ -17,19 +17,54 @@ This repository contains reusable components developed for TEALCA, enabling inte
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm
|
|
20
|
+
npm i @tealca/core-components
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Usage
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
-
import { PrimaryButton } from "tealca
|
|
26
|
+
import { PrimaryButton } from "@tealca/core-components";
|
|
27
27
|
|
|
28
28
|
function App() {
|
|
29
29
|
return <PrimaryButton>Click Me</PrimaryButton>;
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
## Theming and Customization
|
|
34
|
+
|
|
35
|
+
The primary color theme of this component library is based on the `indigo` color palette from Tailwind CSS. Components like `PrimaryButton`, `Link`, and others use shades of `indigo` by default.
|
|
36
|
+
|
|
37
|
+
If you wish to customize the main theme in your own project, you can override the `indigo` colors in your `tailwind.config.js` file. By replacing the `indigo` palette, you can change the primary color of the components to match your application's brand.
|
|
38
|
+
|
|
39
|
+
**Example `tailwind.config.js`:**
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
module.exports = {
|
|
43
|
+
theme: {
|
|
44
|
+
extend: {
|
|
45
|
+
colors: {
|
|
46
|
+
indigo: {
|
|
47
|
+
50: "#eef2ff",
|
|
48
|
+
100: "#e0e7ff",
|
|
49
|
+
200: "#c7d2fe",
|
|
50
|
+
300: "#a5b4fc",
|
|
51
|
+
400: "#818cf8",
|
|
52
|
+
500: "#6366f1", // Your brand's primary color
|
|
53
|
+
600: "#4f46e5", // A darker shade
|
|
54
|
+
700: "#4338ca",
|
|
55
|
+
800: "#3730a3",
|
|
56
|
+
900: "#312e81",
|
|
57
|
+
950: "#1e1b4b",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
plugins: [],
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> By replacing the hex codes with your own brand's colors, you can easily adapt the component library's theme.
|
|
67
|
+
|
|
33
68
|
## Available Scripts
|
|
34
69
|
|
|
35
70
|
- `npm run dev`: Starts the development environment.
|
|
@@ -40,15 +75,70 @@ function App() {
|
|
|
40
75
|
## Project Structure
|
|
41
76
|
|
|
42
77
|
```
|
|
43
|
-
|
|
44
|
-
├── public/ # Public assets
|
|
45
|
-
├── index.html # Main entry point
|
|
46
|
-
├── package.json # Dependencies and scripts
|
|
47
|
-
├── tsconfig.json # TypeScript configuration
|
|
48
|
-
├── vite.config.ts # Vite configuration
|
|
78
|
+
.
|
|
49
79
|
├── .storybook/ # Storybook configuration
|
|
80
|
+
├── src/
|
|
81
|
+
│ ├── assets/
|
|
82
|
+
│ ├── components/
|
|
83
|
+
│ ├── contexts/
|
|
84
|
+
│ ├── objects/
|
|
85
|
+
│ ├── providers/
|
|
86
|
+
│ ├── services/
|
|
87
|
+
│ └── utils/
|
|
88
|
+
├── .gitignore
|
|
89
|
+
├── package.json
|
|
90
|
+
├── tsconfig.json
|
|
91
|
+
└── vite.config.ts
|
|
50
92
|
```
|
|
51
93
|
|
|
94
|
+
## How to create a component
|
|
95
|
+
|
|
96
|
+
To create a new component, follow these steps:
|
|
97
|
+
|
|
98
|
+
1. **Create a directory for the component**: Inside `src/components/{category}` create a new directory with the name of the component in PascalCase. For example, if you are creating a new component called `MyComponent` in the `base` category, you should create the directory `src/components/base/MyComponent`.
|
|
99
|
+
|
|
100
|
+
2. **Create the component file**: Inside the directory you just created, create a new file called `MyComponent.tsx`. This file will contain the logic and structure of the component.
|
|
101
|
+
|
|
102
|
+
3. **Create the story file**: Inside the same directory, create a new file called `MyComponent.stories.tsx`. This file will contain the Storybook stories for the component, which will allow you to visualize and test the component in isolation.
|
|
103
|
+
|
|
104
|
+
4. **Export the component**: You must export the component in the `index.ts` file of the corresponding category. For example, in `src/components/base/index.ts`. Then, you must also export it in the main `index.ts` of the components, `src/components/index.ts`.
|
|
105
|
+
|
|
106
|
+
## Publishing to NPM
|
|
107
|
+
|
|
108
|
+
To publish a new version of the package to NPM, follow these steps:
|
|
109
|
+
|
|
110
|
+
1. **Build the project:** This command compiles the code and prepares it for distribution.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
npm run build
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
2. **Update the version:** Before publishing, you must update the package version in `package.json`. You can do this manually or by using the `npm version` command, which also creates a commit and a git tag.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Example for a patch update (e.g., 1.0.0 -> 1.0.1)
|
|
120
|
+
npm version patch
|
|
121
|
+
|
|
122
|
+
# Example for a minor update (e.g., 1.0.0 -> 1.1.0)
|
|
123
|
+
npm version minor
|
|
124
|
+
|
|
125
|
+
# Example for a major update (e.g., 1.0.0 -> 2.0.0)
|
|
126
|
+
npm version major
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
> **Note:** The `npm version` command requires a clean working directory (no uncommitted changes). Make sure to commit your changes before running it.
|
|
130
|
+
|
|
131
|
+
3. **Login to NPM:** You need to be authenticated with your NPM account.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npm login
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
4. **Publish the package:** This command uploads the package to the NPM registry.
|
|
138
|
+
```bash
|
|
139
|
+
npm publish
|
|
140
|
+
```
|
|
141
|
+
|
|
52
142
|
## Contributing
|
|
53
143
|
|
|
54
144
|
Contributions are welcome! Please follow best development practices and ensure consistency with existing components.
|