@sito/dashboard 0.0.61 → 0.0.62
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 +138 -243
- package/dist/components/Badge/Badge.d.ts +5 -0
- package/dist/components/Form/AutocompleteInput/types.d.ts +3 -2
- package/dist/components/Form/FileInput/FileInput.d.ts +3 -0
- package/dist/components/Form/FileInput/utils.d.ts +6 -0
- package/dist/components/Form/FileInput/utils.test.d.ts +1 -0
- package/dist/components/Form/SelectInput/types.d.ts +1 -1
- package/dist/components/Form/TextInput/types.d.ts +1 -1
- package/dist/components/Form/index.d.ts +4 -4
- package/dist/components/Form/types.d.ts +2 -2
- package/dist/components/Form/utils.test.d.ts +1 -0
- package/dist/components/SvgIcons/ChevronDown.d.ts +5 -0
- package/dist/components/SvgIcons/ChevronLeft.d.ts +5 -0
- package/dist/components/SvgIcons/ChevronRight.d.ts +5 -0
- package/dist/components/SvgIcons/ChevronUp.d.ts +5 -0
- package/dist/components/SvgIcons/Close.d.ts +5 -0
- package/dist/components/SvgIcons/File.d.ts +5 -0
- package/dist/components/SvgIcons/Filters.d.ts +5 -0
- package/dist/components/SvgIcons/index.d.ts +3 -3
- package/dist/components/Table/Table.d.ts +6 -1
- package/dist/components/Table/Table.expandable.test.d.ts +1 -0
- package/dist/components/Table/Table.selection.test.d.ts +1 -0
- package/dist/components/Table/Table.stories.d.ts +2 -0
- package/dist/components/Table/components/Filters/ActiveFilters/ActiveFilters.d.ts +5 -0
- package/dist/components/Table/components/Filters/ActiveFilters/ArrayChip.d.ts +5 -0
- package/dist/components/Table/components/Filters/ActiveFilters/RangeChip.d.ts +6 -1
- package/dist/components/Table/components/Filters/FilterDropdown/FilterDropdown.d.ts +5 -0
- package/dist/components/Table/components/Filters/FilterDropdown/FilterDropdown.test.d.ts +1 -0
- package/dist/components/Table/components/Filters/FilterDropdown/types.d.ts +1 -1
- package/dist/components/Table/components/Filters/FilterDropdown/utils.d.ts +6 -1
- package/dist/components/Table/components/Footer/CountOfTotal.d.ts +4 -0
- package/dist/components/Table/components/Footer/Navigation.d.ts +4 -0
- package/dist/components/Table/components/Footer/index.d.ts +1 -1
- package/dist/components/Table/components/Rows.d.ts +6 -1
- package/dist/components/Table/components/TableHeader/TableHeader.d.ts +5 -0
- package/dist/components/Table/components/TableHeader/types.d.ts +2 -2
- package/dist/components/Table/components/Widgets/AutocompleteWidget.d.ts +5 -0
- package/dist/components/Table/components/Widgets/CheckWidget.d.ts +5 -0
- package/dist/components/Table/components/Widgets/RangeWidget.d.ts +6 -1
- package/dist/components/Table/components/Widgets/SelectWidget.d.ts +5 -0
- package/dist/components/Table/components/Widgets/TextWidget.d.ts +5 -0
- package/dist/components/Table/components/Widgets/index.d.ts +2 -2
- package/dist/components/Table/components/Widgets/types.d.ts +1 -1
- package/dist/components/Table/components/index.d.ts +3 -3
- package/dist/components/Table/components/types.d.ts +11 -4
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Table/types.d.ts +5 -0
- package/dist/components/Tooltip/Tooltip.d.ts +5 -0
- package/dist/components/index.d.ts +3 -3
- package/dist/dashboard.cjs +1 -1
- package/dist/dashboard.js +1458 -1235
- package/dist/lib/index.d.ts +1 -1
- package/dist/main.css +1 -1
- package/dist/providers/FiltersProvider/FiltersProvider.d.ts +7 -2
- package/dist/providers/FiltersProvider/types.d.ts +1 -1
- package/dist/providers/FiltersProvider/utils.d.ts +12 -1
- package/dist/providers/FiltersProvider/utils.test.d.ts +1 -0
- package/dist/providers/TableOptions/TableOptionsProvider.d.ts +7 -2
- package/dist/providers/TableOptions/TableOptionsProvider.test.d.ts +1 -0
- package/dist/providers/TableOptions/types.d.ts +1 -1
- package/dist/providers/Translation/TranslationProvider.d.ts +10 -1
- package/dist/providers/Translation/types.d.ts +2 -1
- package/dist/providers/index.d.ts +2 -2
- package/package.json +19 -8
package/README.md
CHANGED
|
@@ -1,331 +1,226 @@
|
|
|
1
1
|
# @sito/dashboard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@sito/dashboard` is a React + TypeScript UI library focused on reusable dashboard components.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Project Description
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **Bulk Actions & Selection Bar**: Built-in checkbox column, selectable rows, and a contextual banner for executing multi-row actions.
|
|
9
|
-
- **Translation Support**: Built-in translation support using a `TranslationProvider`.
|
|
10
|
-
- **Customizable & Lightweight**: Easily style and configure components to fit your needs without sacrificing performance.
|
|
7
|
+
This package provides ready-to-use components for admin/dashboard use cases, with focus on data-heavy screens:
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
- `Table` with sorting, filtering, pagination, row selection, bulk actions, and expandable rows.
|
|
10
|
+
- Form inputs and utility components (`Badge`, `Chip`, `Tooltip`, `Loading`, icons).
|
|
11
|
+
- Built-in providers for translations and table state management.
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
## Installation
|
|
15
14
|
|
|
16
15
|
```bash
|
|
17
|
-
#
|
|
16
|
+
# npm
|
|
18
17
|
npm install @sito/dashboard
|
|
19
18
|
|
|
20
|
-
#
|
|
19
|
+
# yarn
|
|
21
20
|
yarn add @sito/dashboard
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
### Peer dependencies
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
Make sure your app provides compatible versions:
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
import { Table } from "sito-dashboard";
|
|
27
|
+
- `react` (`>=18.2 <20`)
|
|
28
|
+
- `@emotion/css` (`11.13.5`)
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
const rows = [
|
|
34
|
-
{ id: 1, name: "John Doe", age: 30 },
|
|
35
|
-
{ id: 2, name: "Jane Smith", age: 25 },
|
|
36
|
-
];
|
|
30
|
+
## Usage
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
{ key: "name", label: "Name" },
|
|
40
|
-
{ key: "age", label: "Age" },
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Table title="User Table" data={rows} columns={columns} />
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default App;
|
|
49
|
-
```
|
|
32
|
+
Important:
|
|
50
33
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
34
|
+
- Import from `@sito/dashboard` (not from `@sito/dashboard/lib`).
|
|
35
|
+
- `Table` should be wrapped by `TranslationProvider` and `TableOptionsProvider`.
|
|
36
|
+
- `actions` is a callback per row: `(row) => ActionType[]`.
|
|
54
37
|
|
|
55
38
|
```tsx
|
|
56
|
-
import {
|
|
57
|
-
|
|
39
|
+
import {
|
|
40
|
+
FilterTypes,
|
|
41
|
+
Table,
|
|
42
|
+
TableOptionsProvider,
|
|
43
|
+
TranslationProvider,
|
|
44
|
+
type BaseDto,
|
|
45
|
+
} from "@sito/dashboard";
|
|
46
|
+
|
|
47
|
+
type UserRow = BaseDto & {
|
|
48
|
+
name: string;
|
|
49
|
+
age: number;
|
|
50
|
+
};
|
|
58
51
|
|
|
59
|
-
const rows = [
|
|
60
|
-
{ id: 1, name: "John Doe", age: 30 },
|
|
61
|
-
{ id: 2, name: "Jane Smith", age: 25 },
|
|
52
|
+
const rows: UserRow[] = [
|
|
53
|
+
{ id: 1, deletedAt: null, name: "John Doe", age: 30 },
|
|
54
|
+
{ id: 2, deletedAt: null, name: "Jane Smith", age: 25 },
|
|
62
55
|
];
|
|
63
56
|
|
|
64
|
-
const actions = (row) => [
|
|
57
|
+
const actions = (row: UserRow) => [
|
|
65
58
|
{
|
|
66
59
|
id: "view",
|
|
67
60
|
tooltip: `View ${row.name}`,
|
|
68
|
-
icon: <span
|
|
61
|
+
icon: <span>View</span>,
|
|
69
62
|
onClick: () => console.log("View", row),
|
|
70
63
|
},
|
|
71
64
|
{
|
|
72
65
|
id: "delete",
|
|
73
66
|
tooltip: "Delete selected",
|
|
74
|
-
icon: <span
|
|
67
|
+
icon: <span>Delete</span>,
|
|
75
68
|
multiple: true,
|
|
76
69
|
onClick: () => console.log("Delete", row),
|
|
77
|
-
onMultipleClick: (selectedRows) =>
|
|
70
|
+
onMultipleClick: (selectedRows: UserRow[]) =>
|
|
78
71
|
console.log("Bulk delete", selectedRows.map(({ name }) => name)),
|
|
79
72
|
},
|
|
80
73
|
];
|
|
81
74
|
|
|
82
|
-
const translations = {
|
|
75
|
+
const translations: Record<string, string> = {
|
|
83
76
|
"_accessibility:components.table.selectedCount": "Selected {{count}} items",
|
|
84
77
|
"_accessibility:labels.actions": "Actions",
|
|
78
|
+
"_accessibility:buttons.filters": "Filters",
|
|
79
|
+
"_accessibility:buttons.previous": "Previous page",
|
|
80
|
+
"_accessibility:buttons.next": "Next page",
|
|
81
|
+
"_accessibility:buttons.clear": "Clear",
|
|
82
|
+
"_accessibility:buttons.applyFilters": "Apply filters",
|
|
83
|
+
"_accessibility:components.table.pageSizes": "Rows per page",
|
|
84
|
+
"_accessibility:components.table.jumpToPage": "Jump to page",
|
|
85
|
+
"_accessibility:components.table.of": "of",
|
|
86
|
+
"_accessibility:components.table.empty": "No data available",
|
|
87
|
+
"_accessibility:components.table.selectRow": "Select row",
|
|
88
|
+
"_accessibility:components.table.selectAllRows": "Select all visible rows",
|
|
85
89
|
};
|
|
86
90
|
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<Table
|
|
93
|
-
title="User Table"
|
|
94
|
-
data={rows}
|
|
95
|
-
columns={[
|
|
96
|
-
{ key: "name", label: "Name", filterOptions: { type: FilterTypes.text } },
|
|
97
|
-
{ key: "age", label: "Age" },
|
|
98
|
-
]}
|
|
99
|
-
actions={actions}
|
|
100
|
-
onRowSelect={(row, selected) =>
|
|
101
|
-
console.log(selected ? "Selected" : "Unselected", row)
|
|
102
|
-
}
|
|
103
|
-
onSelectedRowsChange={(selectedRows) =>
|
|
104
|
-
console.log("Current selection", selectedRows)
|
|
105
|
-
}
|
|
106
|
-
/>
|
|
107
|
-
</TranslationProvider>
|
|
108
|
-
);
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
When any row is selected, the built-in selection bar appears above the table headers with the translated count and any actions marked with `multiple: true`.
|
|
112
|
-
|
|
113
|
-
## Translation for its components
|
|
114
|
-
|
|
115
|
-
Wrap your application with the TranslationProvider to enable translations:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
import React from "react";
|
|
119
|
-
import { TranslationProvider } from "@sito/dashboard";
|
|
91
|
+
const t = (key: string, options?: Record<string, unknown>) => {
|
|
92
|
+
if (key === "_accessibility:components.table.selectedCount") {
|
|
93
|
+
const count = typeof options?.count === "number" ? options.count : 0;
|
|
94
|
+
return translations[key].replace("{{count}}", String(count));
|
|
95
|
+
}
|
|
120
96
|
|
|
121
|
-
|
|
122
|
-
en: { hello: "Hello" },
|
|
123
|
-
es: { hello: "Hola" },
|
|
97
|
+
return translations[key] ?? key;
|
|
124
98
|
};
|
|
125
99
|
|
|
126
|
-
|
|
127
|
-
const t = (key) => translations["en"][key]; // Example translation function
|
|
128
|
-
|
|
100
|
+
export function UsersTable() {
|
|
129
101
|
return (
|
|
130
|
-
<TranslationProvider t={t}>
|
|
131
|
-
<
|
|
102
|
+
<TranslationProvider t={t} language="en">
|
|
103
|
+
<TableOptionsProvider>
|
|
104
|
+
<Table<UserRow>
|
|
105
|
+
entity="users"
|
|
106
|
+
title="Users"
|
|
107
|
+
data={rows}
|
|
108
|
+
columns={[
|
|
109
|
+
{
|
|
110
|
+
key: "name",
|
|
111
|
+
label: "Name",
|
|
112
|
+
sortable: true,
|
|
113
|
+
filterOptions: {
|
|
114
|
+
type: FilterTypes.text,
|
|
115
|
+
placeholder: "Search by name",
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{ key: "age", label: "Age", sortable: true },
|
|
119
|
+
]}
|
|
120
|
+
actions={actions}
|
|
121
|
+
onRowSelect={(row, selected) => console.log(selected, row)}
|
|
122
|
+
onSelectedRowsChange={(selectedRows) =>
|
|
123
|
+
console.log("Selected rows", selectedRows)
|
|
124
|
+
}
|
|
125
|
+
/>
|
|
126
|
+
</TableOptionsProvider>
|
|
132
127
|
</TranslationProvider>
|
|
133
128
|
);
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
export default App;
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Components
|
|
140
|
-
|
|
141
|
-
### Table
|
|
142
|
-
|
|
143
|
-
The Table component is a flexible and feature-rich table for displaying data.
|
|
144
|
-
|
|
145
|
-
#### Props
|
|
146
|
-
| Propiedad | Tipo | Valor por defecto | Descripción |
|
|
147
|
-
|-----------------------|---------------|-------------------------|--------------------------------------------------------------------|
|
|
148
|
-
| `title` | `string` | `""` | El título de la tabla. |
|
|
149
|
-
| `data` | `array` | — | Los datos a mostrar en la tabla. |
|
|
150
|
-
| `columns` | `array` | `[]` | Definiciones de columnas, incluyendo claves (`key`) y etiquetas. |
|
|
151
|
-
| `isLoading` | `boolean` | `false` | Indica si la tabla está en estado de carga. |
|
|
152
|
-
| `actions` | `ActionType[]` | — | Función para renderizar acciones por fila. |
|
|
153
|
-
| `className` | `string` | `""` | Clase personalizada para el contenedor de la tabla. |
|
|
154
|
-
| `contentClassName` | `string` | `""` | Clase personalizada para el contenido de la tabla. |
|
|
155
|
-
| `softDeleteProperty` | `string` | `"deletedAt"` | Propiedad usada para lógica de borrado suave (fecha/hora). |
|
|
156
|
-
| `toolbar` | `ReactNode` | `<></>` | Componente personalizado para la barra de herramientas. |
|
|
157
|
-
| `onSort` | `function` | — | Callback que se llama cuando se cambia el orden de la tabla. |
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
### TranslationProvider
|
|
161
|
-
|
|
162
|
-
Provides translation support for your application.
|
|
163
|
-
|
|
164
|
-
#### Props
|
|
165
|
-
- `t` (function): A translation function that takes a key and returns the translated string.
|
|
166
|
-
|
|
167
|
-
### Examples
|
|
168
|
-
|
|
169
|
-
#### Columns definition
|
|
170
|
-
|
|
171
|
-
```
|
|
172
|
-
key: string;
|
|
173
|
-
label: string;
|
|
174
|
-
sortable?: boolean;
|
|
175
|
-
sortOptions: {
|
|
176
|
-
icons: {
|
|
177
|
-
className: string;
|
|
178
|
-
asc: string;
|
|
179
|
-
desc: string;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
className?: string;
|
|
183
|
-
display?: "visible" | "none";
|
|
184
|
-
pos?: number;
|
|
185
|
-
renderBody?: (value: any, row: any) => ReactNode;
|
|
186
|
-
renderHead?: () => void;
|
|
187
|
-
filterOptions?: ColumnFilterOptions;
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
ColumnFilterOptions
|
|
191
|
-
|
|
192
|
-
```
|
|
193
|
-
{
|
|
194
|
-
type: FilterTypes;
|
|
195
|
-
defaultValue: any;
|
|
196
|
-
label?: string;
|
|
197
129
|
}
|
|
198
130
|
```
|
|
199
131
|
|
|
200
|
-
|
|
132
|
+
## Core Table Props
|
|
201
133
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
134
|
+
| Prop | Type | Required | Description |
|
|
135
|
+
|---|---|---|---|
|
|
136
|
+
| `entity` | `string` | Yes | Entity name used by internal components. |
|
|
137
|
+
| `data` | `TRow[]` | Yes | Rows to render. `TRow` must extend `BaseDto` and include `id`. |
|
|
138
|
+
| `columns` | `ColumnType<TRow>[]` | No | Column definitions. |
|
|
139
|
+
| `actions` | `(row: TRow) => ActionType<TRow>[]` | No | Per-row action factory. |
|
|
140
|
+
| `title` | `string` | No | Header title. |
|
|
141
|
+
| `toolbar` | `ReactNode` | No | Custom header content. |
|
|
142
|
+
| `onSort` | `(prop: string, sortOrder: SortOrder) => void` | No | Sort callback. |
|
|
143
|
+
| `onRowSelect` | `(row: TRow, selected: boolean) => void` | No | Row selection callback. |
|
|
144
|
+
| `onSelectedRowsChange` | `(rows: TRow[]) => void` | No | Selected rows callback. |
|
|
145
|
+
| `onRowExpand` | `(expandedRow: TRow, collapsedRow: TRow \| null) => ReactNode` | No | Expand row content callback. |
|
|
146
|
+
| `allowMultipleExpandedRows` | `boolean` | No | Allows multiple expanded rows at once. |
|
|
147
|
+
| `expandedRowId` | `TRow["id"] \| null` | No | Controlled expansion mode. |
|
|
210
148
|
|
|
211
|
-
|
|
212
|
-
import { Table } from "@sito/dashboard";
|
|
149
|
+
## Development Setup (Step-by-step)
|
|
213
150
|
|
|
214
|
-
|
|
215
|
-
{
|
|
216
|
-
key: "tagIds",
|
|
217
|
-
label: t("_entities:news.tags.label"),
|
|
218
|
-
filterOptions: {
|
|
219
|
-
type: FilterTypes.autocomplete,
|
|
220
|
-
options: tagsList,
|
|
221
|
-
defaultValue: [],
|
|
222
|
-
},
|
|
223
|
-
sortable: false,
|
|
224
|
-
renderBody: (_, news) =>
|
|
225
|
-
(
|
|
226
|
-
<div className="flex flex-wrap gap-3">
|
|
227
|
-
{news.tags?.map(({ name, id }) => (
|
|
228
|
-
<Chip key={id} label={name} spanClassName="text-xs" />
|
|
229
|
-
))}
|
|
230
|
-
</div>
|
|
231
|
-
) ?? " - ",
|
|
232
|
-
},
|
|
233
|
-
]
|
|
151
|
+
1. Clone the repository.
|
|
234
152
|
|
|
235
|
-
|
|
153
|
+
```bash
|
|
154
|
+
git clone https://github.com/sito8943/-sito-dashboard.git
|
|
155
|
+
cd -- -sito-dashboard
|
|
236
156
|
```
|
|
237
157
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
```
|
|
241
|
-
{
|
|
242
|
-
id: string;
|
|
243
|
-
onClick: (entity: object) => void;
|
|
244
|
-
icon: any;
|
|
245
|
-
tooltip: string;
|
|
246
|
-
hidden?: boolean | ((entity: object) => boolean);
|
|
247
|
-
disabled?: boolean;
|
|
248
|
-
multiple?: boolean;
|
|
249
|
-
onMultipleClick?: (entities: object[]) => void;
|
|
250
|
-
}
|
|
251
|
-
```
|
|
158
|
+
2. Use the expected Node version.
|
|
252
159
|
|
|
160
|
+
```bash
|
|
161
|
+
nvm install 20.19.0
|
|
162
|
+
nvm use 20.19.0
|
|
253
163
|
```
|
|
254
|
-
import { Table } from "@sito/dashboard";
|
|
255
164
|
|
|
256
|
-
|
|
257
|
-
id: "add",
|
|
258
|
-
hidden: false,
|
|
259
|
-
onClick: async () => {
|
|
260
|
-
// do some stuff here
|
|
261
|
-
},
|
|
262
|
-
icon: (
|
|
263
|
-
<FontAwesomeIcon
|
|
264
|
-
icon={isLoading ? faSpinner : faAdd}
|
|
265
|
-
className={`text-success ${isLoading ? "rotate" : ""}`}
|
|
266
|
-
/>
|
|
267
|
-
),
|
|
268
|
-
tooltip: t("_accessibility:buttons.add"),
|
|
269
|
-
}
|
|
165
|
+
3. Install dependencies.
|
|
270
166
|
|
|
271
|
-
|
|
167
|
+
```bash
|
|
168
|
+
npm install
|
|
272
169
|
```
|
|
273
170
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
```
|
|
277
|
-
import { Table } from "@sito/dashboard";
|
|
171
|
+
4. Start local development.
|
|
278
172
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
</div>
|
|
283
|
-
}
|
|
173
|
+
```bash
|
|
174
|
+
# Vite dev server
|
|
175
|
+
npm run dev
|
|
284
176
|
|
|
285
|
-
|
|
177
|
+
# Component-focused development (recommended)
|
|
178
|
+
npm run storybook
|
|
286
179
|
```
|
|
287
180
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
Running Locally
|
|
181
|
+
5. Build the library.
|
|
291
182
|
|
|
292
|
-
|
|
183
|
+
```bash
|
|
184
|
+
npm run build
|
|
185
|
+
```
|
|
293
186
|
|
|
294
|
-
|
|
187
|
+
## How To Run Tests
|
|
295
188
|
|
|
296
189
|
```bash
|
|
297
|
-
|
|
190
|
+
# run all tests once
|
|
191
|
+
npm run test
|
|
298
192
|
|
|
299
|
-
|
|
193
|
+
# run a specific test file
|
|
194
|
+
npm run test -- src/components/Table/Table.expandable.test.tsx
|
|
300
195
|
```
|
|
301
196
|
|
|
302
|
-
|
|
197
|
+
## How To Run Linters
|
|
303
198
|
|
|
304
199
|
```bash
|
|
305
|
-
|
|
200
|
+
# runs ESLint with auto-fix enabled in this project
|
|
201
|
+
npm run lint
|
|
306
202
|
```
|
|
307
203
|
|
|
308
|
-
|
|
204
|
+
## Additional Useful Scripts
|
|
309
205
|
|
|
310
206
|
```bash
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
Building the Library
|
|
207
|
+
# format source files
|
|
208
|
+
npm run format
|
|
315
209
|
|
|
316
|
-
|
|
210
|
+
# build static Storybook
|
|
211
|
+
npm run build-storybook
|
|
317
212
|
|
|
318
|
-
|
|
319
|
-
npm run
|
|
213
|
+
# preview production build
|
|
214
|
+
npm run preview
|
|
320
215
|
```
|
|
321
216
|
|
|
322
217
|
## Contributing
|
|
323
218
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
219
|
+
1. Create a branch from `main`.
|
|
220
|
+
2. Add/adjust tests for your changes.
|
|
221
|
+
3. Run lint and tests.
|
|
222
|
+
4. Open a pull request with a clear summary.
|
|
328
223
|
|
|
329
224
|
## License
|
|
330
225
|
|
|
331
|
-
|
|
226
|
+
MIT
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface AutocompleteInputPropsType extends Omit<TextInputPropsType, "onChange"> {
|
|
1
|
+
import { Option, TextInputPropsType } from '../..';
|
|
2
|
+
export interface AutocompleteInputPropsType extends Omit<TextInputPropsType, "onChange" | "value"> {
|
|
3
|
+
value: Option | Option[] | null;
|
|
3
4
|
onChange: (value: Option | Option[] | null) => void;
|
|
4
5
|
multiple?: boolean;
|
|
5
6
|
inputContainerClassName?: string;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
import { FileInputPropsType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Renders a file input with preview and clear/remove actions.
|
|
4
|
+
*/
|
|
2
5
|
export declare const FileInput: import('react').ForwardRefExoticComponent<Omit<FileInputPropsType, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,6 +5,6 @@ export type Option = {
|
|
|
5
5
|
value?: number | string;
|
|
6
6
|
name?: string;
|
|
7
7
|
};
|
|
8
|
-
export interface SelectInputPropsType extends Omit<HTMLProps<HTMLSelectElement>, "value">, BaseInputPropsType {
|
|
8
|
+
export interface SelectInputPropsType extends Omit<HTMLProps<HTMLSelectElement>, "value">, BaseInputPropsType<string | number | readonly string[] | undefined> {
|
|
9
9
|
options: Option[];
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTMLProps, ReactNode } from 'react';
|
|
2
2
|
import { BaseInputPropsType } from '../types';
|
|
3
|
-
export interface TextInputPropsType extends Omit<HTMLProps<HTMLInputElement>, "value">, BaseInputPropsType {
|
|
3
|
+
export interface TextInputPropsType extends Omit<HTMLProps<HTMLInputElement>, "value">, BaseInputPropsType<string | number | readonly string[] | undefined> {
|
|
4
4
|
children?: ReactNode;
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './SelectInput';
|
|
2
|
-
export * from './TextInput';
|
|
3
|
-
export * from './CheckInput';
|
|
4
1
|
export * from './AutocompleteInput';
|
|
2
|
+
export * from './CheckInput';
|
|
5
3
|
export * from './FileInput';
|
|
6
|
-
export * from './
|
|
4
|
+
export * from './SelectInput';
|
|
5
|
+
export * from './TextInput';
|
|
7
6
|
export * from './types';
|
|
7
|
+
export * from './utils';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './ChevronDown';
|
|
2
|
-
export * from './ChevronUp';
|
|
3
|
-
export * from './ChevronRight';
|
|
4
2
|
export * from './ChevronLeft';
|
|
5
|
-
export * from './
|
|
3
|
+
export * from './ChevronRight';
|
|
4
|
+
export * from './ChevronUp';
|
|
6
5
|
export * from './Close';
|
|
7
6
|
export * from './File';
|
|
7
|
+
export * from './Filters';
|
|
8
8
|
export * from './types';
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { TablePropsType } from './types';
|
|
2
1
|
import { BaseDto } from '../../lib';
|
|
2
|
+
import { TablePropsType } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Renders the Table component.
|
|
5
|
+
* @param props - props parameter.
|
|
6
|
+
* @returns Function result.
|
|
7
|
+
*/
|
|
3
8
|
export declare function Table<TRow extends BaseDto>(props: TablePropsType<TRow>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,3 +12,5 @@ export declare const Basic: Story;
|
|
|
12
12
|
export declare const WithAutocompleteFilter: Story;
|
|
13
13
|
export declare const WithSimpleActions: Story;
|
|
14
14
|
export declare const WithMultipleActions: Story;
|
|
15
|
+
export declare const WithExpandableRows: Story;
|
|
16
|
+
export declare const WithMultipleExpandableRows: Story;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import { ActiveFiltersPropsType } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Renders the ActiveFilters component.
|
|
4
|
+
* @param props - props parameter.
|
|
5
|
+
* @returns Function result.
|
|
6
|
+
*/
|
|
2
7
|
export declare const ActiveFilters: (props: ActiveFiltersPropsType) => import("react/jsx-runtime").JSX.Element;
|