@sito/dashboard 0.0.49 → 0.0.51
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/LICENSE +21 -21
- package/README.md +269 -269
- package/dist/components/Badge/Badge.stories.d.ts +8 -0
- package/dist/components/Chip/Chip.stories.d.ts +7 -0
- package/dist/components/Chip/types.d.ts +8 -5
- package/dist/components/Form/AutocompleteInput/AutocompleteInput.d.ts +1 -1
- package/dist/components/Form/AutocompleteInput/AutocompleteInput.stories.d.ts +7 -0
- package/dist/components/Form/CheckInput/CheckInput.stories.d.ts +6 -0
- package/dist/components/Form/FileInput/FileInput.stories.d.ts +7 -0
- package/dist/components/Form/SelectInput/SelectInput.stories.d.ts +7 -0
- package/dist/components/Form/TextInput/TextInput.stories.d.ts +9 -0
- package/dist/components/Loading/Loading.stories.d.ts +7 -0
- package/dist/components/Table/Table.stories.d.ts +12 -0
- package/dist/components/Table/components/Filters/ActiveFilters/types.d.ts +1 -0
- package/dist/components/Table/components/TableEmpty.d.ts +5 -0
- package/dist/components/Table/components/index.d.ts +1 -1
- package/dist/components/Table/components/types.d.ts +2 -2
- package/dist/components/Table/types.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.stories.d.ts +6 -0
- package/dist/dashboard.cjs +1 -1
- package/dist/dashboard.js +589 -552
- package/dist/main.css +1 -1
- package/package.json +76 -67
- package/dist/components/Table/components/Empty.d.ts +0 -5
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 Sito
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Sito
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,270 +1,270 @@
|
|
|
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 columns = [
|
|
39
|
-
{ key: "name", label: "Name" },
|
|
40
|
-
{ key: "age", label: "Age" },
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Table
|
|
45
|
-
title="User Table"
|
|
46
|
-
data={rows}
|
|
47
|
-
columns={columns}
|
|
48
|
-
/>
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default App;
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Translation for its components
|
|
56
|
-
|
|
57
|
-
Wrap your application with the TranslationProvider to enable translations:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
import React from "react";
|
|
61
|
-
import { TranslationProvider } from "@sito/dashboard";
|
|
62
|
-
|
|
63
|
-
const translations = {
|
|
64
|
-
en: { hello: "Hello" },
|
|
65
|
-
es: { hello: "Hola" },
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const App = () => {
|
|
69
|
-
const t = (key) => translations["en"][key]; // Example translation function
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<TranslationProvider t={t}>
|
|
73
|
-
<h1>{t("hello")}</h1>
|
|
74
|
-
</TranslationProvider>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export default App;
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Components
|
|
82
|
-
|
|
83
|
-
### Table
|
|
84
|
-
|
|
85
|
-
The Table component is a flexible and feature-rich table for displaying data.
|
|
86
|
-
|
|
87
|
-
#### Props
|
|
88
|
-
| Propiedad | Tipo
|
|
89
|
-
|
|
90
|
-
| `title` | `string`
|
|
91
|
-
| `data` | `array`
|
|
92
|
-
| `columns` | `array`
|
|
93
|
-
| `isLoading` | `boolean`
|
|
94
|
-
| `actions` | `
|
|
95
|
-
| `className` | `string`
|
|
96
|
-
| `contentClassName` | `string`
|
|
97
|
-
| `softDeleteProperty` | `string`
|
|
98
|
-
| `toolbar` | `ReactNode`
|
|
99
|
-
| `onSort` | `function`
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
### TranslationProvider
|
|
103
|
-
|
|
104
|
-
Provides translation support for your application.
|
|
105
|
-
|
|
106
|
-
#### Props
|
|
107
|
-
- `t` (function): A translation function that takes a key and returns the translated string.
|
|
108
|
-
|
|
109
|
-
### Examples
|
|
110
|
-
|
|
111
|
-
#### Columns definition
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
key: string;
|
|
115
|
-
label: string;
|
|
116
|
-
sortable?: boolean;
|
|
117
|
-
sortOptions: {
|
|
118
|
-
icons: {
|
|
119
|
-
className: string;
|
|
120
|
-
asc: string;
|
|
121
|
-
desc: string;
|
|
122
|
-
};
|
|
123
|
-
};
|
|
124
|
-
className?: string;
|
|
125
|
-
display?: "visible" | "none";
|
|
126
|
-
pos?: number;
|
|
127
|
-
renderBody?: (value: any, row: any) => ReactNode;
|
|
128
|
-
renderHead?: () => void;
|
|
129
|
-
filterOptions?: ColumnFilterOptions;
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
ColumnFilterOptions
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
{
|
|
136
|
-
type: FilterTypes;
|
|
137
|
-
defaultValue: any;
|
|
138
|
-
label?: string;
|
|
139
|
-
}
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
FilterTypes enum
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
text,
|
|
146
|
-
number,
|
|
147
|
-
select,
|
|
148
|
-
autocomplete,
|
|
149
|
-
date,
|
|
150
|
-
check,
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
import { Table } from "@sito/dashboard";
|
|
155
|
-
|
|
156
|
-
const columns = [
|
|
157
|
-
{
|
|
158
|
-
key: "tagIds",
|
|
159
|
-
label: t("_entities:news.tags.label"),
|
|
160
|
-
filterOptions: {
|
|
161
|
-
type: FilterTypes.autocomplete,
|
|
162
|
-
options: tagsList,
|
|
163
|
-
defaultValue: [],
|
|
164
|
-
},
|
|
165
|
-
sortable: false,
|
|
166
|
-
renderBody: (_, news) =>
|
|
167
|
-
(
|
|
168
|
-
<div className="flex flex-wrap gap-3">
|
|
169
|
-
{news.tags?.map(({ name, id }) => (
|
|
170
|
-
<Chip key={id} label={name} spanClassName="text-xs" />
|
|
171
|
-
))}
|
|
172
|
-
</div>
|
|
173
|
-
) ?? " - ",
|
|
174
|
-
},
|
|
175
|
-
]
|
|
176
|
-
|
|
177
|
-
<Table data={...} columns={columns} />
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
#### Actions definition
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
{
|
|
184
|
-
id: string;
|
|
185
|
-
onClick: (entity: object) => void;
|
|
186
|
-
icon: any;
|
|
187
|
-
tooltip: string;
|
|
188
|
-
hidden: (entity: object) => boolean;
|
|
189
|
-
}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
import { Table } from "@sito/dashboard";
|
|
194
|
-
|
|
195
|
-
const addAction = {
|
|
196
|
-
id: "add",
|
|
197
|
-
hidden: false,
|
|
198
|
-
onClick: async () => {
|
|
199
|
-
// do some stuff here
|
|
200
|
-
},
|
|
201
|
-
icon: (
|
|
202
|
-
<FontAwesomeIcon
|
|
203
|
-
icon={isLoading ? faSpinner : faAdd}
|
|
204
|
-
className={`text-success ${isLoading ? "rotate" : ""}`}
|
|
205
|
-
/>
|
|
206
|
-
),
|
|
207
|
-
tooltip: t("_accessibility:buttons.add"),
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
<Table data={...} columns={...} actions={[addAction]} />
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
#### Your custom toolbar
|
|
214
|
-
|
|
215
|
-
```
|
|
216
|
-
import { Table } from "@sito/dashboard";
|
|
217
|
-
|
|
218
|
-
const Toolbar = () => {
|
|
219
|
-
return <div>
|
|
220
|
-
<h1>My custom toolbar</h1>
|
|
221
|
-
</div>
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
<Table data={...} columns={...} toolbar={<Toolbar />} />
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
## Development
|
|
228
|
-
|
|
229
|
-
Running Locally
|
|
230
|
-
|
|
231
|
-
To run the project locally:
|
|
232
|
-
|
|
233
|
-
1. Clone the repository:
|
|
234
|
-
|
|
235
|
-
```bash
|
|
236
|
-
git clone https://github.com/your-repo/sito-dashboard.git
|
|
237
|
-
|
|
238
|
-
cd sito-dashboard
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
2. Install dependencies:
|
|
242
|
-
|
|
243
|
-
```bash
|
|
244
|
-
npm install
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
3. Start the development server
|
|
248
|
-
|
|
249
|
-
```bash
|
|
250
|
-
npm start
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
Building the Library
|
|
254
|
-
|
|
255
|
-
To build the library for production
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
npm run build
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
## Contributing
|
|
262
|
-
|
|
263
|
-
Contributions are welcome! Please follow these steps:
|
|
264
|
-
1. Fork the repository.
|
|
265
|
-
2. Create a new branch for your feature or bugfix.
|
|
266
|
-
3. Submit a pull request with a detailed description of your changes.
|
|
267
|
-
|
|
268
|
-
## License
|
|
269
|
-
|
|
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 columns = [
|
|
39
|
+
{ key: "name", label: "Name" },
|
|
40
|
+
{ key: "age", label: "Age" },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Table
|
|
45
|
+
title="User Table"
|
|
46
|
+
data={rows}
|
|
47
|
+
columns={columns}
|
|
48
|
+
/>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default App;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Translation for its components
|
|
56
|
+
|
|
57
|
+
Wrap your application with the TranslationProvider to enable translations:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
import React from "react";
|
|
61
|
+
import { TranslationProvider } from "@sito/dashboard";
|
|
62
|
+
|
|
63
|
+
const translations = {
|
|
64
|
+
en: { hello: "Hello" },
|
|
65
|
+
es: { hello: "Hola" },
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const App = () => {
|
|
69
|
+
const t = (key) => translations["en"][key]; // Example translation function
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<TranslationProvider t={t}>
|
|
73
|
+
<h1>{t("hello")}</h1>
|
|
74
|
+
</TranslationProvider>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export default App;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Components
|
|
82
|
+
|
|
83
|
+
### Table
|
|
84
|
+
|
|
85
|
+
The Table component is a flexible and feature-rich table for displaying data.
|
|
86
|
+
|
|
87
|
+
#### Props
|
|
88
|
+
| Propiedad | Tipo | Valor por defecto | Descripción |
|
|
89
|
+
|-----------------------|---------------|-------------------------|--------------------------------------------------------------------|
|
|
90
|
+
| `title` | `string` | `""` | El título de la tabla. |
|
|
91
|
+
| `data` | `array` | — | Los datos a mostrar en la tabla. |
|
|
92
|
+
| `columns` | `array` | `[]` | Definiciones de columnas, incluyendo claves (`key`) y etiquetas. |
|
|
93
|
+
| `isLoading` | `boolean` | `false` | Indica si la tabla está en estado de carga. |
|
|
94
|
+
| `actions` | `ActionType[]` | — | Función para renderizar acciones por fila. |
|
|
95
|
+
| `className` | `string` | `""` | Clase personalizada para el contenedor de la tabla. |
|
|
96
|
+
| `contentClassName` | `string` | `""` | Clase personalizada para el contenido de la tabla. |
|
|
97
|
+
| `softDeleteProperty` | `string` | `"deleted"` | Propiedad usada para lógica de borrado suave. |
|
|
98
|
+
| `toolbar` | `ReactNode` | `<></>` | Componente personalizado para la barra de herramientas. |
|
|
99
|
+
| `onSort` | `function` | — | Callback que se llama cuando se cambia el orden de la tabla. |
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
### TranslationProvider
|
|
103
|
+
|
|
104
|
+
Provides translation support for your application.
|
|
105
|
+
|
|
106
|
+
#### Props
|
|
107
|
+
- `t` (function): A translation function that takes a key and returns the translated string.
|
|
108
|
+
|
|
109
|
+
### Examples
|
|
110
|
+
|
|
111
|
+
#### Columns definition
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
key: string;
|
|
115
|
+
label: string;
|
|
116
|
+
sortable?: boolean;
|
|
117
|
+
sortOptions: {
|
|
118
|
+
icons: {
|
|
119
|
+
className: string;
|
|
120
|
+
asc: string;
|
|
121
|
+
desc: string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
className?: string;
|
|
125
|
+
display?: "visible" | "none";
|
|
126
|
+
pos?: number;
|
|
127
|
+
renderBody?: (value: any, row: any) => ReactNode;
|
|
128
|
+
renderHead?: () => void;
|
|
129
|
+
filterOptions?: ColumnFilterOptions;
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
ColumnFilterOptions
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
{
|
|
136
|
+
type: FilterTypes;
|
|
137
|
+
defaultValue: any;
|
|
138
|
+
label?: string;
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
FilterTypes enum
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
text,
|
|
146
|
+
number,
|
|
147
|
+
select,
|
|
148
|
+
autocomplete,
|
|
149
|
+
date,
|
|
150
|
+
check,
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
import { Table } from "@sito/dashboard";
|
|
155
|
+
|
|
156
|
+
const columns = [
|
|
157
|
+
{
|
|
158
|
+
key: "tagIds",
|
|
159
|
+
label: t("_entities:news.tags.label"),
|
|
160
|
+
filterOptions: {
|
|
161
|
+
type: FilterTypes.autocomplete,
|
|
162
|
+
options: tagsList,
|
|
163
|
+
defaultValue: [],
|
|
164
|
+
},
|
|
165
|
+
sortable: false,
|
|
166
|
+
renderBody: (_, news) =>
|
|
167
|
+
(
|
|
168
|
+
<div className="flex flex-wrap gap-3">
|
|
169
|
+
{news.tags?.map(({ name, id }) => (
|
|
170
|
+
<Chip key={id} label={name} spanClassName="text-xs" />
|
|
171
|
+
))}
|
|
172
|
+
</div>
|
|
173
|
+
) ?? " - ",
|
|
174
|
+
},
|
|
175
|
+
]
|
|
176
|
+
|
|
177
|
+
<Table data={...} columns={columns} />
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### Actions definition
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
{
|
|
184
|
+
id: string;
|
|
185
|
+
onClick: (entity: object) => void;
|
|
186
|
+
icon: any;
|
|
187
|
+
tooltip: string;
|
|
188
|
+
hidden: (entity: object) => boolean;
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
import { Table } from "@sito/dashboard";
|
|
194
|
+
|
|
195
|
+
const addAction = {
|
|
196
|
+
id: "add",
|
|
197
|
+
hidden: false,
|
|
198
|
+
onClick: async () => {
|
|
199
|
+
// do some stuff here
|
|
200
|
+
},
|
|
201
|
+
icon: (
|
|
202
|
+
<FontAwesomeIcon
|
|
203
|
+
icon={isLoading ? faSpinner : faAdd}
|
|
204
|
+
className={`text-success ${isLoading ? "rotate" : ""}`}
|
|
205
|
+
/>
|
|
206
|
+
),
|
|
207
|
+
tooltip: t("_accessibility:buttons.add"),
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
<Table data={...} columns={...} actions={[addAction]} />
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
#### Your custom toolbar
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
import { Table } from "@sito/dashboard";
|
|
217
|
+
|
|
218
|
+
const Toolbar = () => {
|
|
219
|
+
return <div>
|
|
220
|
+
<h1>My custom toolbar</h1>
|
|
221
|
+
</div>
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
<Table data={...} columns={...} toolbar={<Toolbar />} />
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Development
|
|
228
|
+
|
|
229
|
+
Running Locally
|
|
230
|
+
|
|
231
|
+
To run the project locally:
|
|
232
|
+
|
|
233
|
+
1. Clone the repository:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
git clone https://github.com/your-repo/sito-dashboard.git
|
|
237
|
+
|
|
238
|
+
cd sito-dashboard
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
2. Install dependencies:
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
npm install
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
3. Start the development server
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
npm start
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Building the Library
|
|
254
|
+
|
|
255
|
+
To build the library for production
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
npm run build
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Contributing
|
|
262
|
+
|
|
263
|
+
Contributions are welcome! Please follow these steps:
|
|
264
|
+
1. Fork the repository.
|
|
265
|
+
2. Create a new branch for your feature or bugfix.
|
|
266
|
+
3. Submit a pull request with a detailed description of your changes.
|
|
267
|
+
|
|
268
|
+
## License
|
|
269
|
+
|
|
270
270
|
This project is licensed under the MIT License.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Badge } from '..';
|
|
3
|
+
declare const meta: Meta<typeof Badge>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Badge>;
|
|
6
|
+
export declare const Zero: Story;
|
|
7
|
+
export declare const Small: Story;
|
|
8
|
+
export declare const Large: Story;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { DetailedHTMLProps, HTMLAttributes, MouseEventHandler, ReactNode } from 'react';
|
|
2
|
+
export interface ChipPropsType extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
3
|
+
text?: string | ReactNode;
|
|
4
|
+
variant?: "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark" | "none";
|
|
4
5
|
onDelete?: MouseEventHandler<HTMLElement>;
|
|
5
6
|
className?: string;
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
textClassName?: string;
|
|
9
|
+
iconClassName?: string;
|
|
10
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AutocompleteInputPropsType } from './types';
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
4
|
+
* @param props
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
7
|
export declare const AutocompleteInput: import('react').ForwardRefExoticComponent<Omit<AutocompleteInputPropsType, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AutocompleteInput } from '../..';
|
|
3
|
+
declare const meta: Meta<typeof AutocompleteInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AutocompleteInput>;
|
|
6
|
+
export declare const Single: Story;
|
|
7
|
+
export declare const Multiple: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { FileInput } from '../..';
|
|
3
|
+
declare const meta: Meta<typeof FileInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof FileInput>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const MultipleFiles: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SelectInput } from '../..';
|
|
3
|
+
declare const meta: Meta<typeof SelectInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SelectInput>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const ErrorState: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { TextInput } from '../..';
|
|
3
|
+
declare const meta: Meta<typeof TextInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof TextInput>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const WithHelperText: Story;
|
|
8
|
+
export declare const ErrorState: Story;
|
|
9
|
+
export declare const Controlled: Story;
|