@entropix/data 0.0.0 → 1.0.1
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/dist/area-chart.cjs +14 -0
- package/dist/area-chart.css +144 -0
- package/dist/area-chart.d.cts +19 -0
- package/dist/area-chart.d.ts +19 -0
- package/dist/area-chart.js +5 -0
- package/dist/bar-chart.cjs +14 -0
- package/dist/bar-chart.css +144 -0
- package/dist/bar-chart.d.cts +18 -0
- package/dist/bar-chart.d.ts +18 -0
- package/dist/bar-chart.js +5 -0
- package/dist/chunk-42HKJHUY.js +96 -0
- package/dist/chunk-4WXLJDQU.js +74 -0
- package/dist/chunk-6YAOO76S.cjs +142 -0
- package/dist/chunk-CMAQ7DZD.js +135 -0
- package/dist/chunk-FQACLZYR.js +137 -0
- package/dist/chunk-GCZSXJAA.cjs +77 -0
- package/dist/chunk-K6ZRQYSZ.cjs +131 -0
- package/dist/chunk-QBI5NOHT.cjs +126 -0
- package/dist/chunk-SDCNTA7E.cjs +275 -0
- package/dist/chunk-VCSKHJLZ.js +124 -0
- package/dist/chunk-VGT2QF7D.cjs +98 -0
- package/dist/chunk-WOVSQALY.cjs +137 -0
- package/dist/chunk-X7GZD7KZ.js +129 -0
- package/dist/chunk-YINCJQN6.js +271 -0
- package/dist/data-table.cjs +20 -0
- package/dist/data-table.css +227 -0
- package/dist/data-table.d.cts +20 -0
- package/dist/data-table.d.ts +20 -0
- package/dist/data-table.js +3 -0
- package/dist/index.cjs +36 -269
- package/dist/index.css +144 -0
- package/dist/index.d.cts +8 -21
- package/dist/index.d.ts +8 -21
- package/dist/index.js +7 -269
- package/dist/line-chart.cjs +14 -0
- package/dist/line-chart.css +144 -0
- package/dist/line-chart.d.cts +19 -0
- package/dist/line-chart.d.ts +19 -0
- package/dist/line-chart.js +5 -0
- package/dist/pie-chart.cjs +13 -0
- package/dist/pie-chart.css +144 -0
- package/dist/pie-chart.d.cts +15 -0
- package/dist/pie-chart.d.ts +15 -0
- package/dist/pie-chart.js +4 -0
- package/dist/styles/chart.css +1 -0
- package/dist/styles/data-table.css +1 -304
- package/package.json +54 -3
- package/dist/index.cjs.map +0 -1
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/* src/styles/data-table.css */
|
|
2
|
+
:root {
|
|
3
|
+
--datatable-cell-padding: var(--entropix-spacing-3) var(--entropix-spacing-4);
|
|
4
|
+
--datatable-row-height: 48px;
|
|
5
|
+
--datatable-header-bg: var(--entropix-color-bg-secondary, #f9fafb);
|
|
6
|
+
--datatable-border-color: var(--entropix-color-border-default, #e5e7eb);
|
|
7
|
+
--datatable-stripe-bg: var(--entropix-color-bg-tertiary, #f3f4f6);
|
|
8
|
+
--datatable-hover-bg: var(--entropix-color-action-secondary-hover, #f0f0f0);
|
|
9
|
+
--datatable-selected-bg: var( --entropix-color-action-primary-subtle, #eff6ff );
|
|
10
|
+
}
|
|
11
|
+
.entropix-datatable {
|
|
12
|
+
width: 100%;
|
|
13
|
+
font-family: var(--entropix-font-family-sans, system-ui, sans-serif);
|
|
14
|
+
font-size: var(--entropix-font-size-sm, 0.875rem);
|
|
15
|
+
line-height: var(--entropix-line-height-normal, 1.5);
|
|
16
|
+
color: var(--entropix-color-text-primary, #111827);
|
|
17
|
+
}
|
|
18
|
+
.entropix-datatable__table {
|
|
19
|
+
width: 100%;
|
|
20
|
+
border-collapse: collapse;
|
|
21
|
+
border: 1px solid var(--datatable-border-color);
|
|
22
|
+
border-radius: var(--entropix-radius-md, 6px);
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
.entropix-datatable__thead {
|
|
26
|
+
background: var(--datatable-header-bg);
|
|
27
|
+
}
|
|
28
|
+
.entropix-datatable__thead[data-sticky=true] {
|
|
29
|
+
position: sticky;
|
|
30
|
+
top: 0;
|
|
31
|
+
z-index: 10;
|
|
32
|
+
}
|
|
33
|
+
.entropix-datatable__th {
|
|
34
|
+
padding: var(--datatable-cell-padding);
|
|
35
|
+
min-height: var(--datatable-row-height);
|
|
36
|
+
text-align: left;
|
|
37
|
+
font-weight: var(--entropix-font-weight-semibold, 600);
|
|
38
|
+
font-size: var(--entropix-font-size-xs, 0.75rem);
|
|
39
|
+
text-transform: uppercase;
|
|
40
|
+
letter-spacing: 0.05em;
|
|
41
|
+
color: var(--entropix-color-text-secondary, #6b7280);
|
|
42
|
+
border-bottom: 2px solid var(--datatable-border-color);
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
user-select: none;
|
|
45
|
+
}
|
|
46
|
+
.entropix-datatable__th--sortable {
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
transition: color var(--entropix-duration-fast, 150ms) var(--entropix-easing-default, ease);
|
|
49
|
+
}
|
|
50
|
+
.entropix-datatable__th--sortable:hover {
|
|
51
|
+
color: var(--entropix-color-text-primary, #111827);
|
|
52
|
+
}
|
|
53
|
+
.entropix-datatable__th--sortable:focus-visible {
|
|
54
|
+
outline: 2px solid var(--entropix-color-border-focus, #3b82f6);
|
|
55
|
+
outline-offset: -2px;
|
|
56
|
+
}
|
|
57
|
+
.entropix-datatable__th[data-sort=asc],
|
|
58
|
+
.entropix-datatable__th[data-sort=desc] {
|
|
59
|
+
color: var(--entropix-color-text-primary, #111827);
|
|
60
|
+
}
|
|
61
|
+
.entropix-datatable__th--checkbox {
|
|
62
|
+
width: 48px;
|
|
63
|
+
min-width: 48px;
|
|
64
|
+
max-width: 48px;
|
|
65
|
+
text-align: center;
|
|
66
|
+
padding: var(--entropix-spacing-2);
|
|
67
|
+
}
|
|
68
|
+
.entropix-datatable__th-content {
|
|
69
|
+
display: inline-flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
gap: var(--entropix-spacing-1, 4px);
|
|
72
|
+
}
|
|
73
|
+
.entropix-datatable__sort-icon {
|
|
74
|
+
display: inline-block;
|
|
75
|
+
font-size: var(--entropix-font-size-xs, 0.75rem);
|
|
76
|
+
line-height: 1;
|
|
77
|
+
color: var(--entropix-color-action-primary-default, #3b82f6);
|
|
78
|
+
}
|
|
79
|
+
.entropix-datatable__filter-row {
|
|
80
|
+
background: var(--datatable-header-bg);
|
|
81
|
+
}
|
|
82
|
+
.entropix-datatable__th--filter {
|
|
83
|
+
padding: var(--entropix-spacing-1) var(--entropix-spacing-4) var(--entropix-spacing-2);
|
|
84
|
+
border-bottom: 1px solid var(--datatable-border-color);
|
|
85
|
+
font-weight: var(--entropix-font-weight-normal, 400);
|
|
86
|
+
}
|
|
87
|
+
.entropix-datatable__filter {
|
|
88
|
+
width: 100%;
|
|
89
|
+
padding: var(--entropix-spacing-1) var(--entropix-spacing-2);
|
|
90
|
+
border: 1px solid var(--datatable-border-color);
|
|
91
|
+
border-radius: var(--entropix-radius-sm, 4px);
|
|
92
|
+
font-family: inherit;
|
|
93
|
+
font-size: var(--entropix-font-size-sm, 0.875rem);
|
|
94
|
+
color: var(--entropix-color-text-primary, #111827);
|
|
95
|
+
background: var(--entropix-color-bg-primary, #ffffff);
|
|
96
|
+
outline: none;
|
|
97
|
+
transition: border-color var(--entropix-duration-fast, 150ms) var(--entropix-easing-default, ease);
|
|
98
|
+
}
|
|
99
|
+
.entropix-datatable__filter::placeholder {
|
|
100
|
+
color: var(--entropix-color-text-muted, #9ca3af);
|
|
101
|
+
}
|
|
102
|
+
.entropix-datatable__filter:focus {
|
|
103
|
+
border-color: var(--entropix-color-border-focus, #3b82f6);
|
|
104
|
+
box-shadow: 0 0 0 1px var(--entropix-color-border-focus, #3b82f6);
|
|
105
|
+
}
|
|
106
|
+
.entropix-datatable__tbody {
|
|
107
|
+
background: var(--entropix-color-bg-primary, #ffffff);
|
|
108
|
+
}
|
|
109
|
+
.entropix-datatable__tr {
|
|
110
|
+
border-bottom: 1px solid var(--datatable-border-color);
|
|
111
|
+
transition: background var(--entropix-duration-fast, 150ms) var(--entropix-easing-default, ease);
|
|
112
|
+
}
|
|
113
|
+
.entropix-datatable__tr:last-child {
|
|
114
|
+
border-bottom: none;
|
|
115
|
+
}
|
|
116
|
+
.entropix-datatable__tbody .entropix-datatable__tr:nth-child(even) {
|
|
117
|
+
background: var(--datatable-stripe-bg);
|
|
118
|
+
}
|
|
119
|
+
.entropix-datatable__tbody .entropix-datatable__tr:hover {
|
|
120
|
+
background: var(--datatable-hover-bg);
|
|
121
|
+
}
|
|
122
|
+
.entropix-datatable__tr[data-selected=true] {
|
|
123
|
+
background: var(--datatable-selected-bg);
|
|
124
|
+
}
|
|
125
|
+
.entropix-datatable__tbody .entropix-datatable__tr[data-selected=true]:hover {
|
|
126
|
+
background: var(--datatable-selected-bg);
|
|
127
|
+
}
|
|
128
|
+
.entropix-datatable__td {
|
|
129
|
+
padding: var(--datatable-cell-padding);
|
|
130
|
+
min-height: var(--datatable-row-height);
|
|
131
|
+
vertical-align: middle;
|
|
132
|
+
color: var(--entropix-color-text-primary, #111827);
|
|
133
|
+
}
|
|
134
|
+
.entropix-datatable__td--checkbox {
|
|
135
|
+
width: 48px;
|
|
136
|
+
min-width: 48px;
|
|
137
|
+
max-width: 48px;
|
|
138
|
+
text-align: center;
|
|
139
|
+
padding: var(--entropix-spacing-2);
|
|
140
|
+
}
|
|
141
|
+
.entropix-datatable__checkbox {
|
|
142
|
+
width: 16px;
|
|
143
|
+
height: 16px;
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
accent-color: var(--entropix-color-action-primary-default, #3b82f6);
|
|
146
|
+
}
|
|
147
|
+
.entropix-datatable__loading,
|
|
148
|
+
.entropix-datatable__empty {
|
|
149
|
+
display: flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
min-height: 120px;
|
|
153
|
+
color: var(--entropix-color-text-muted, #9ca3af);
|
|
154
|
+
font-size: var(--entropix-font-size-sm, 0.875rem);
|
|
155
|
+
font-style: italic;
|
|
156
|
+
}
|
|
157
|
+
.entropix-datatable__td--loading,
|
|
158
|
+
.entropix-datatable__td--empty {
|
|
159
|
+
text-align: center;
|
|
160
|
+
}
|
|
161
|
+
.entropix-datatable__pagination {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: center;
|
|
165
|
+
gap: var(--entropix-spacing-2, 8px);
|
|
166
|
+
padding: var(--entropix-spacing-3, 12px) var(--entropix-spacing-4, 16px);
|
|
167
|
+
border-top: 1px solid var(--datatable-border-color);
|
|
168
|
+
}
|
|
169
|
+
.entropix-datatable__pagination-btn {
|
|
170
|
+
display: inline-flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
min-width: 36px;
|
|
174
|
+
height: 36px;
|
|
175
|
+
padding: var(--entropix-spacing-1, 4px) var(--entropix-spacing-2, 8px);
|
|
176
|
+
border: 1px solid var(--datatable-border-color);
|
|
177
|
+
border-radius: var(--entropix-radius-md, 6px);
|
|
178
|
+
background: var(--entropix-color-bg-primary, #ffffff);
|
|
179
|
+
color: var(--entropix-color-text-primary, #111827);
|
|
180
|
+
font-family: inherit;
|
|
181
|
+
font-size: var(--entropix-font-size-sm, 0.875rem);
|
|
182
|
+
font-weight: var(--entropix-font-weight-medium, 500);
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
user-select: none;
|
|
185
|
+
transition:
|
|
186
|
+
background var(--entropix-duration-fast, 150ms) var(--entropix-easing-default, ease),
|
|
187
|
+
border-color var(--entropix-duration-fast, 150ms) var(--entropix-easing-default, ease),
|
|
188
|
+
color var(--entropix-duration-fast, 150ms) var(--entropix-easing-default, ease);
|
|
189
|
+
}
|
|
190
|
+
.entropix-datatable__pagination-btn:hover:not(:disabled) {
|
|
191
|
+
background: var(--entropix-color-action-secondary-hover, #f0f0f0);
|
|
192
|
+
border-color: var(--entropix-color-border-hover, #d1d5db);
|
|
193
|
+
}
|
|
194
|
+
.entropix-datatable__pagination-btn:focus-visible {
|
|
195
|
+
outline: 2px solid var(--entropix-color-border-focus, #3b82f6);
|
|
196
|
+
outline-offset: 2px;
|
|
197
|
+
}
|
|
198
|
+
.entropix-datatable__pagination-btn:disabled {
|
|
199
|
+
opacity: 0.4;
|
|
200
|
+
cursor: not-allowed;
|
|
201
|
+
}
|
|
202
|
+
.entropix-datatable__pagination-info {
|
|
203
|
+
padding: 0 var(--entropix-spacing-2, 8px);
|
|
204
|
+
font-size: var(--entropix-font-size-sm, 0.875rem);
|
|
205
|
+
color: var(--entropix-color-text-secondary, #6b7280);
|
|
206
|
+
white-space: nowrap;
|
|
207
|
+
}
|
|
208
|
+
@media (max-width: 640px) {
|
|
209
|
+
.entropix-datatable__th,
|
|
210
|
+
.entropix-datatable__td {
|
|
211
|
+
padding: var(--entropix-spacing-2, 8px) var(--entropix-spacing-3, 12px);
|
|
212
|
+
}
|
|
213
|
+
.entropix-datatable__pagination {
|
|
214
|
+
gap: var(--entropix-spacing-1, 4px);
|
|
215
|
+
padding: var(--entropix-spacing-2, 8px);
|
|
216
|
+
}
|
|
217
|
+
.entropix-datatable__pagination-btn {
|
|
218
|
+
min-width: 32px;
|
|
219
|
+
height: 32px;
|
|
220
|
+
font-size: var(--entropix-font-size-xs, 0.75rem);
|
|
221
|
+
}
|
|
222
|
+
.entropix-datatable__filter {
|
|
223
|
+
padding: var(--entropix-spacing-2, 8px);
|
|
224
|
+
font-size: 16px;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/*# sourceMappingURL=data-table.css.map */
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { UseTableOptions, ColumnDef, UseTableReturn } from '@entropix/core';
|
|
5
|
+
|
|
6
|
+
interface DataTableProps<TData = unknown> extends UseTableOptions<TData> {
|
|
7
|
+
className?: string;
|
|
8
|
+
emptyMessage?: string;
|
|
9
|
+
renderCell?: (value: unknown, row: TData, column: ColumnDef<TData>) => React__default.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function DataTable<TData = unknown>(props: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
interface DataTableContextValue<TData = unknown> extends UseTableReturn<TData> {
|
|
14
|
+
columns: ColumnDef<TData>[];
|
|
15
|
+
getRowKey: (row: TData, index: number) => string;
|
|
16
|
+
}
|
|
17
|
+
declare const DataTableContext: React.Context<DataTableContextValue<unknown> | null>;
|
|
18
|
+
declare function useDataTableContext<TData = unknown>(): DataTableContextValue<TData>;
|
|
19
|
+
|
|
20
|
+
export { DataTable, DataTableContext, type DataTableContextValue, type DataTableProps, useDataTableContext };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { UseTableOptions, ColumnDef, UseTableReturn } from '@entropix/core';
|
|
5
|
+
|
|
6
|
+
interface DataTableProps<TData = unknown> extends UseTableOptions<TData> {
|
|
7
|
+
className?: string;
|
|
8
|
+
emptyMessage?: string;
|
|
9
|
+
renderCell?: (value: unknown, row: TData, column: ColumnDef<TData>) => React__default.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function DataTable<TData = unknown>(props: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
12
|
+
|
|
13
|
+
interface DataTableContextValue<TData = unknown> extends UseTableReturn<TData> {
|
|
14
|
+
columns: ColumnDef<TData>[];
|
|
15
|
+
getRowKey: (row: TData, index: number) => string;
|
|
16
|
+
}
|
|
17
|
+
declare const DataTableContext: React.Context<DataTableContextValue<unknown> | null>;
|
|
18
|
+
declare function useDataTableContext<TData = unknown>(): DataTableContextValue<TData>;
|
|
19
|
+
|
|
20
|
+
export { DataTable, DataTableContext, type DataTableContextValue, type DataTableProps, useDataTableContext };
|
package/dist/index.cjs
CHANGED
|
@@ -1,275 +1,42 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkSDCNTA7E_cjs = require('./chunk-SDCNTA7E.cjs');
|
|
4
|
+
var chunkK6ZRQYSZ_cjs = require('./chunk-K6ZRQYSZ.cjs');
|
|
5
|
+
var chunkQBI5NOHT_cjs = require('./chunk-QBI5NOHT.cjs');
|
|
6
|
+
var chunkWOVSQALY_cjs = require('./chunk-WOVSQALY.cjs');
|
|
7
|
+
require('./chunk-GCZSXJAA.cjs');
|
|
8
|
+
var chunkVGT2QF7D_cjs = require('./chunk-VGT2QF7D.cjs');
|
|
9
|
+
require('./chunk-6YAOO76S.cjs');
|
|
6
10
|
|
|
7
|
-
// src/components/data-table/data-table.tsx
|
|
8
|
-
var DataTableContext = react.createContext(
|
|
9
|
-
null
|
|
10
|
-
);
|
|
11
|
-
function useDataTableContext() {
|
|
12
|
-
const ctx = react.useContext(DataTableContext);
|
|
13
|
-
if (!ctx) {
|
|
14
|
-
throw new Error(
|
|
15
|
-
"useDataTableContext must be used within a <DataTable /> component."
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
return ctx;
|
|
19
|
-
}
|
|
20
|
-
function mapA11yToAria(a) {
|
|
21
|
-
const result = {};
|
|
22
|
-
if (a.role) result.role = a.role;
|
|
23
|
-
if (a.label) result["aria-label"] = a.label;
|
|
24
|
-
if (a.labelledBy) result["aria-labelledby"] = a.labelledBy;
|
|
25
|
-
if (a.describedBy) result["aria-describedby"] = a.describedBy;
|
|
26
|
-
if (a.disabled != null) result["aria-disabled"] = a.disabled;
|
|
27
|
-
if (a.expanded != null) result["aria-expanded"] = a.expanded;
|
|
28
|
-
if (a.selected != null) result["aria-selected"] = a.selected;
|
|
29
|
-
if (a.checked != null) result["aria-checked"] = a.checked;
|
|
30
|
-
if (a.busy != null) result["aria-busy"] = a.busy;
|
|
31
|
-
if (a.hidden != null) result["aria-hidden"] = a.hidden;
|
|
32
|
-
if (a.tabIndex != null) result.tabIndex = a.tabIndex;
|
|
33
|
-
if (a.controls) result["aria-controls"] = a.controls;
|
|
34
|
-
if (a.orientation) result["aria-orientation"] = a.orientation;
|
|
35
|
-
if (a.required != null) result["aria-required"] = a.required;
|
|
36
|
-
if (a.invalid != null) result["aria-invalid"] = a.invalid;
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
function DataTable(props) {
|
|
40
|
-
const {
|
|
41
|
-
className,
|
|
42
|
-
emptyMessage = "No data",
|
|
43
|
-
renderCell,
|
|
44
|
-
stickyHeader = false,
|
|
45
|
-
...tableOptions
|
|
46
|
-
} = props;
|
|
47
|
-
const table = core.useTable(tableOptions);
|
|
48
|
-
const {
|
|
49
|
-
columns,
|
|
50
|
-
getRowKey = (_, i) => String(i),
|
|
51
|
-
selectionMode = "none"
|
|
52
|
-
} = tableOptions;
|
|
53
|
-
const contextValue = react.useMemo(
|
|
54
|
-
() => ({
|
|
55
|
-
...table,
|
|
56
|
-
columns,
|
|
57
|
-
getRowKey
|
|
58
|
-
}),
|
|
59
|
-
[table, columns, getRowKey]
|
|
60
|
-
);
|
|
61
|
-
const tableAriaProps = mapA11yToAria(table.getTableProps().accessibility);
|
|
62
|
-
const getSortDir = (colKey) => {
|
|
63
|
-
const s = table.sortState.find((st) => st.columnKey === colKey);
|
|
64
|
-
return s ? s.direction : "none";
|
|
65
|
-
};
|
|
66
|
-
const hasFilters = columns.some((c) => c.filterable);
|
|
67
|
-
return /* @__PURE__ */ jsxRuntime.jsx(DataTableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `entropix-datatable ${className ?? ""}`.trim(), children: [
|
|
68
|
-
/* @__PURE__ */ jsxRuntime.jsxs("table", { className: "entropix-datatable__table", ...tableAriaProps, children: [
|
|
69
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
70
|
-
"thead",
|
|
71
|
-
{
|
|
72
|
-
className: "entropix-datatable__thead",
|
|
73
|
-
"data-sticky": stickyHeader ? "true" : void 0,
|
|
74
|
-
...mapA11yToAria(table.getHeaderRowProps().accessibility),
|
|
75
|
-
children: [
|
|
76
|
-
hasFilters && /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "entropix-datatable__filter-row", children: [
|
|
77
|
-
selectionMode !== "none" && /* @__PURE__ */ jsxRuntime.jsx("th", { className: "entropix-datatable__th entropix-datatable__th--checkbox" }),
|
|
78
|
-
columns.map((col) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
79
|
-
"th",
|
|
80
|
-
{
|
|
81
|
-
className: "entropix-datatable__th entropix-datatable__th--filter",
|
|
82
|
-
children: col.filterable ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
-
"input",
|
|
84
|
-
{
|
|
85
|
-
type: "text",
|
|
86
|
-
className: "entropix-datatable__filter",
|
|
87
|
-
placeholder: `Filter ${col.header}...`,
|
|
88
|
-
value: table.columnFilters[col.key] ?? "",
|
|
89
|
-
onChange: (e) => table.setColumnFilter(col.key, e.target.value),
|
|
90
|
-
"aria-label": `Filter by ${col.header}`
|
|
91
|
-
}
|
|
92
|
-
) : null
|
|
93
|
-
},
|
|
94
|
-
`filter-${col.key}`
|
|
95
|
-
))
|
|
96
|
-
] }),
|
|
97
|
-
/* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "entropix-datatable__tr entropix-datatable__tr--header", children: [
|
|
98
|
-
selectionMode !== "none" && /* @__PURE__ */ jsxRuntime.jsx("th", { className: "entropix-datatable__th entropix-datatable__th--checkbox", children: selectionMode === "multi" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
99
|
-
"input",
|
|
100
|
-
{
|
|
101
|
-
type: "checkbox",
|
|
102
|
-
className: "entropix-datatable__checkbox",
|
|
103
|
-
checked: table.isAllSelected,
|
|
104
|
-
ref: (el) => {
|
|
105
|
-
if (el) el.indeterminate = table.isIndeterminate;
|
|
106
|
-
},
|
|
107
|
-
onChange: table.toggleAllSelection,
|
|
108
|
-
"aria-label": "Select all rows"
|
|
109
|
-
}
|
|
110
|
-
) }),
|
|
111
|
-
columns.map((col) => {
|
|
112
|
-
const headerProps = table.getHeaderCellProps(col.key);
|
|
113
|
-
const ariaProps = mapA11yToAria(headerProps.accessibility);
|
|
114
|
-
const sortDir = getSortDir(col.key);
|
|
115
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
116
|
-
"th",
|
|
117
|
-
{
|
|
118
|
-
className: `entropix-datatable__th${col.sortable ? " entropix-datatable__th--sortable" : ""}`,
|
|
119
|
-
"data-sort": col.sortable ? sortDir : void 0,
|
|
120
|
-
onClick: headerProps.onAction,
|
|
121
|
-
onKeyDown: col.sortable ? (e) => {
|
|
122
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
123
|
-
e.preventDefault();
|
|
124
|
-
headerProps.onAction?.();
|
|
125
|
-
}
|
|
126
|
-
} : void 0,
|
|
127
|
-
style: col.width ? {
|
|
128
|
-
width: typeof col.width === "number" ? `${col.width}px` : col.width
|
|
129
|
-
} : void 0,
|
|
130
|
-
...ariaProps,
|
|
131
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "entropix-datatable__th-content", children: [
|
|
132
|
-
col.header,
|
|
133
|
-
col.sortable && sortDir !== "none" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
134
|
-
"span",
|
|
135
|
-
{
|
|
136
|
-
className: "entropix-datatable__sort-icon",
|
|
137
|
-
"aria-hidden": "true",
|
|
138
|
-
children: sortDir === "asc" ? " \u25B2" : " \u25BC"
|
|
139
|
-
}
|
|
140
|
-
)
|
|
141
|
-
] })
|
|
142
|
-
},
|
|
143
|
-
col.key
|
|
144
|
-
);
|
|
145
|
-
})
|
|
146
|
-
] })
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
),
|
|
150
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
151
|
-
"tbody",
|
|
152
|
-
{
|
|
153
|
-
className: "entropix-datatable__tbody",
|
|
154
|
-
...mapA11yToAria(table.getBodyProps().accessibility),
|
|
155
|
-
children: table.isLoading ? /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "entropix-datatable__tr entropix-datatable__tr--loading", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
156
|
-
"td",
|
|
157
|
-
{
|
|
158
|
-
className: "entropix-datatable__td entropix-datatable__td--loading",
|
|
159
|
-
colSpan: columns.length + (selectionMode !== "none" ? 1 : 0),
|
|
160
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "entropix-datatable__loading", children: "Loading..." })
|
|
161
|
-
}
|
|
162
|
-
) }) : table.rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "entropix-datatable__tr entropix-datatable__tr--empty", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
163
|
-
"td",
|
|
164
|
-
{
|
|
165
|
-
className: "entropix-datatable__td entropix-datatable__td--empty",
|
|
166
|
-
colSpan: columns.length + (selectionMode !== "none" ? 1 : 0),
|
|
167
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "entropix-datatable__empty", children: emptyMessage })
|
|
168
|
-
}
|
|
169
|
-
) }) : table.rows.map((row, i) => {
|
|
170
|
-
const globalIndex = table.page * table.pageSize + i;
|
|
171
|
-
const rowKey = getRowKey(row, globalIndex);
|
|
172
|
-
const rowProps = table.getRowProps(rowKey, i);
|
|
173
|
-
const isSelected = table.selectedKeys.has(rowKey);
|
|
174
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
175
|
-
"tr",
|
|
176
|
-
{
|
|
177
|
-
className: "entropix-datatable__tr",
|
|
178
|
-
"data-selected": isSelected ? "true" : void 0,
|
|
179
|
-
...mapA11yToAria(rowProps.accessibility),
|
|
180
|
-
children: [
|
|
181
|
-
selectionMode !== "none" && /* @__PURE__ */ jsxRuntime.jsx("td", { className: "entropix-datatable__td entropix-datatable__td--checkbox", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
182
|
-
"input",
|
|
183
|
-
{
|
|
184
|
-
type: "checkbox",
|
|
185
|
-
className: "entropix-datatable__checkbox",
|
|
186
|
-
checked: isSelected,
|
|
187
|
-
onChange: () => table.toggleRowSelection(rowKey),
|
|
188
|
-
"aria-label": `Select row ${rowKey}`
|
|
189
|
-
}
|
|
190
|
-
) }),
|
|
191
|
-
columns.map((col) => {
|
|
192
|
-
const cellValue = col.accessor ? col.accessor(row) : row[col.key];
|
|
193
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
-
"td",
|
|
195
|
-
{
|
|
196
|
-
className: "entropix-datatable__td",
|
|
197
|
-
...mapA11yToAria(
|
|
198
|
-
table.getCellProps(col.key, rowKey).accessibility
|
|
199
|
-
),
|
|
200
|
-
children: renderCell ? renderCell(cellValue, row, col) : String(cellValue ?? "")
|
|
201
|
-
},
|
|
202
|
-
col.key
|
|
203
|
-
);
|
|
204
|
-
})
|
|
205
|
-
]
|
|
206
|
-
},
|
|
207
|
-
rowKey
|
|
208
|
-
);
|
|
209
|
-
})
|
|
210
|
-
}
|
|
211
|
-
)
|
|
212
|
-
] }),
|
|
213
|
-
table.pageCount > 1 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
214
|
-
"nav",
|
|
215
|
-
{
|
|
216
|
-
className: "entropix-datatable__pagination",
|
|
217
|
-
"aria-label": "Table pagination",
|
|
218
|
-
children: [
|
|
219
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
-
"button",
|
|
221
|
-
{
|
|
222
|
-
className: "entropix-datatable__pagination-btn",
|
|
223
|
-
onClick: table.firstPage,
|
|
224
|
-
disabled: !table.canPreviousPage,
|
|
225
|
-
"aria-label": "First page",
|
|
226
|
-
children: "\u27E8\u27E8"
|
|
227
|
-
}
|
|
228
|
-
),
|
|
229
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
230
|
-
"button",
|
|
231
|
-
{
|
|
232
|
-
className: "entropix-datatable__pagination-btn",
|
|
233
|
-
onClick: table.previousPage,
|
|
234
|
-
disabled: !table.canPreviousPage,
|
|
235
|
-
"aria-label": "Previous page",
|
|
236
|
-
children: "\u27E8"
|
|
237
|
-
}
|
|
238
|
-
),
|
|
239
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "entropix-datatable__pagination-info", children: [
|
|
240
|
-
"Page ",
|
|
241
|
-
table.page + 1,
|
|
242
|
-
" of ",
|
|
243
|
-
table.pageCount
|
|
244
|
-
] }),
|
|
245
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
246
|
-
"button",
|
|
247
|
-
{
|
|
248
|
-
className: "entropix-datatable__pagination-btn",
|
|
249
|
-
onClick: table.nextPage,
|
|
250
|
-
disabled: !table.canNextPage,
|
|
251
|
-
"aria-label": "Next page",
|
|
252
|
-
children: "\u27E9"
|
|
253
|
-
}
|
|
254
|
-
),
|
|
255
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
256
|
-
"button",
|
|
257
|
-
{
|
|
258
|
-
className: "entropix-datatable__pagination-btn",
|
|
259
|
-
onClick: table.lastPage,
|
|
260
|
-
disabled: !table.canNextPage,
|
|
261
|
-
"aria-label": "Last page",
|
|
262
|
-
children: "\u27E9\u27E9"
|
|
263
|
-
}
|
|
264
|
-
)
|
|
265
|
-
]
|
|
266
|
-
}
|
|
267
|
-
)
|
|
268
|
-
] }) });
|
|
269
|
-
}
|
|
270
11
|
|
|
271
|
-
|
|
272
|
-
exports
|
|
273
|
-
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "DataTable", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunkSDCNTA7E_cjs.DataTable; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "DataTableContext", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkSDCNTA7E_cjs.DataTableContext; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "useDataTableContext", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunkSDCNTA7E_cjs.useDataTableContext; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "BarChart", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkK6ZRQYSZ_cjs.BarChart; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "LineChart", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkQBI5NOHT_cjs.LineChart; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "AreaChart", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkWOVSQALY_cjs.AreaChart; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "PieChart", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkVGT2QF7D_cjs.PieChart; }
|
|
40
|
+
});
|
|
274
41
|
//# sourceMappingURL=index.cjs.map
|
|
275
42
|
//# sourceMappingURL=index.cjs.map
|