@sito/dashboard 0.0.17 → 0.0.19

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 +153 -2
  2. package/package.json +6 -3
package/README.md CHANGED
@@ -1,2 +1,153 @@
1
- # -sito-dashboard
2
- The library for dashboard
1
+ # @sito/dashboard
2
+
3
+ A React library for building customizable and responsive dashboards with ease.
4
+
5
+ ## Features
6
+
7
+ - **Table Component**: A powerful table component with support for sorting, pagination, and customizable columns.
8
+ - **Translation Support**: Built-in translation support using a `TranslationProvider`.
9
+ - **Customizable**: Easily style and configure components to fit your needs.
10
+ - **Lightweight**: Optimized for performance and usability.
11
+
12
+ ## Installation
13
+
14
+ To install the library, use npm or yarn:
15
+
16
+ ```bash
17
+ # Using npm
18
+ npm install @sito/dashboard
19
+
20
+ # Using yarn
21
+ yarn add @sito/dashboard
22
+ ```
23
+
24
+ ## Table
25
+
26
+ Here’s how you can use the Table component in your project:
27
+
28
+ ```bash
29
+ import React from "react";
30
+ import { Table } from "sito-dashboard";
31
+
32
+ const App = () => {
33
+ const rows = [
34
+ { id: 1, name: "John Doe", age: 30 },
35
+ { id: 2, name: "Jane Smith", age: 25 },
36
+ ];
37
+
38
+ const parseRows = (row) => ({
39
+ id: row.id,
40
+ name: row.name,
41
+ age: row.age,
42
+ });
43
+
44
+ const columns = [
45
+ { key: "name", label: "Name" },
46
+ { key: "age", label: "Age" },
47
+ ];
48
+
49
+ return (
50
+ <Table
51
+ title="User Table"
52
+ rows={rows}
53
+ parseRows={parseRows}
54
+ columns={columns}
55
+ />
56
+ );
57
+ };
58
+
59
+ export default App;
60
+ ```
61
+
62
+ ## Translation for its components
63
+
64
+ Wrap your application with the TranslationProvider to enable translations:
65
+
66
+ ```bash
67
+ import React from "react";
68
+ import { TranslationProvider } from "@sito/dashboard";
69
+
70
+ const translations = {
71
+ en: { hello: "Hello" },
72
+ es: { hello: "Hola" },
73
+ };
74
+
75
+ const App = () => {
76
+ const t = (key) => translations["en"][key]; // Example translation function
77
+
78
+ return (
79
+ <TranslationProvider t={t}>
80
+ <h1>{t("hello")}</h1>
81
+ </TranslationProvider>
82
+ );
83
+ };
84
+
85
+ export default App;
86
+ ```
87
+
88
+ ## Components
89
+
90
+ ### Table
91
+
92
+ The Table component is a flexible and feature-rich table for displaying data.
93
+
94
+ #### Props
95
+ - `title` (string): The title of the table.
96
+ - `rows` (array): The data to display in the table.
97
+ - `parseRows` (function): A function to parse rows for rendering.
98
+ - `columns` (array): Column definitions, including keys and labels.
99
+ - `isLoading` (boolean): Whether the table is in a loading state.
100
+ - `actions` (function): A function to render actions for each row.
101
+ - `className` (string): Custom class for the table container.
102
+
103
+ ### TranslationProvider
104
+
105
+ Provides translation support for your application.
106
+
107
+ #### Props
108
+ - `t` (function): A translation function that takes a key and returns the translated string.
109
+
110
+ ## Development
111
+
112
+ Running Locally
113
+
114
+ To run the project locally:
115
+
116
+ 1. Clone the repository:
117
+
118
+ ```bash
119
+ git clone https://github.com/your-repo/sito-dashboard.git
120
+
121
+ cd sito-dashboard
122
+ ```
123
+
124
+ 2. Install dependencies:
125
+
126
+ ```bash
127
+ npm install
128
+ ```
129
+
130
+ 3. Start the development server
131
+
132
+ ```bash
133
+ npm start
134
+ ```
135
+
136
+ Building the Library
137
+
138
+ To build the library for production
139
+
140
+ ```bash
141
+ npm run build
142
+ ```
143
+
144
+ ## Contributing
145
+
146
+ Contributions are welcome! Please follow these steps:
147
+ 1. Fork the repository.
148
+ 2. Create a new branch for your feature or bugfix.
149
+ 3. Submit a pull request with a detailed description of your changes.
150
+
151
+ ## License
152
+
153
+ This project is licensed under the MIT License.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sito/dashboard",
3
3
  "private": false,
4
- "version": "0.0.17",
4
+ "version": "0.0.19",
5
5
  "type": "module",
6
6
  "description": "UI library with custom components for dashboards",
7
7
  "main": "dist/dashboard.cjs",
@@ -31,8 +31,11 @@
31
31
  "preview": "vite preview",
32
32
  "format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\""
33
33
  },
34
- "keywords": [],
35
- "author": "",
34
+ "keywords": [
35
+ "sito",
36
+ "dashboard"
37
+ ],
38
+ "author": "sito8943",
36
39
  "license": "ISC",
37
40
  "devDependencies": {
38
41
  "@types/node": "20.8.10",