@makolabs/ripple 0.0.1-dev.20 → 0.0.1-dev.21
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/index.d.ts
CHANGED
|
@@ -163,52 +163,49 @@ export type StatsCardProps = {
|
|
|
163
163
|
class?: ClassValue;
|
|
164
164
|
formatLargeNumbers?: boolean;
|
|
165
165
|
};
|
|
166
|
-
export type KeyType = string | number;
|
|
167
166
|
export type DataRow = Record<string, any>;
|
|
168
|
-
export type
|
|
169
|
-
export type
|
|
170
|
-
export type
|
|
171
|
-
|
|
172
|
-
direction: SortDirection;
|
|
173
|
-
};
|
|
174
|
-
export type TableColumn = {
|
|
175
|
-
key: string;
|
|
167
|
+
export type KeyType = keyof DataRow;
|
|
168
|
+
export type StatusType = 'active' | 'inactive' | 'pending' | 'error' | 'default';
|
|
169
|
+
export type TableColumn<T extends DataRow = any> = {
|
|
170
|
+
key: KeyType;
|
|
176
171
|
header: string;
|
|
172
|
+
cell?: Snippet<[row: T, key: KeyType, index?: number]>;
|
|
177
173
|
sortable?: boolean;
|
|
174
|
+
sortKey?: string;
|
|
178
175
|
align?: 'left' | 'center' | 'right';
|
|
179
176
|
width?: string;
|
|
180
|
-
|
|
177
|
+
class?: ClassValue;
|
|
181
178
|
};
|
|
182
|
-
export type
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
179
|
+
export type SortDirection = 'asc' | 'desc' | null;
|
|
180
|
+
export type SortState = {
|
|
181
|
+
column: string | null;
|
|
182
|
+
direction: SortDirection;
|
|
183
|
+
};
|
|
184
|
+
export type TableProps<T extends DataRow = any> = {
|
|
185
|
+
data: T[];
|
|
186
|
+
columns: TableColumn<T>[];
|
|
187
|
+
color?: VariantColors;
|
|
188
|
+
size?: VariantSizes;
|
|
189
|
+
bordered?: boolean;
|
|
190
|
+
striped?: boolean;
|
|
191
|
+
emptyStateText?: string;
|
|
192
|
+
pageSize?: number;
|
|
192
193
|
selectable?: boolean;
|
|
193
|
-
|
|
194
|
-
onSelectionChange?: (selectedRows: DataRow[]) => void;
|
|
195
|
-
onSortChange?: (sortState: SortState) => void;
|
|
196
|
-
onPageChange?: (page: number) => void;
|
|
197
|
-
emptyMessage?: string;
|
|
198
|
-
errorMessage?: string;
|
|
199
|
-
searchPlaceholder?: string;
|
|
194
|
+
selected?: T[];
|
|
200
195
|
class?: ClassValue;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
196
|
+
wrapperclass?: ClassValue;
|
|
197
|
+
tableclass?: ClassValue;
|
|
198
|
+
theadclass?: ClassValue;
|
|
199
|
+
tbodyclass?: ClassValue;
|
|
200
|
+
trclass?: ClassValue;
|
|
201
|
+
thclass?: ClassValue;
|
|
202
|
+
tdclass?: ClassValue;
|
|
203
|
+
footerclass?: ClassValue;
|
|
204
|
+
onrowclick?: (row: T, index: number) => void;
|
|
205
|
+
onsort?: (sortState: SortState) => void;
|
|
206
|
+
onselect?: (selected: T[]) => void;
|
|
207
|
+
rowclass?: (row: T, index: number) => ClassValue;
|
|
208
|
+
loading?: boolean;
|
|
212
209
|
};
|
|
213
210
|
export type BreadcrumbItem = {
|
|
214
211
|
label: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn } from '../../helper/cls.js';
|
|
3
|
-
import { table
|
|
4
|
-
|
|
3
|
+
import { table } from './table.js';
|
|
4
|
+
import type { TableProps, SortDirection, SortState } from '../../index.js';
|
|
5
5
|
let {
|
|
6
6
|
data = [],
|
|
7
7
|
columns = [],
|
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
import type { ClassValue } from 'tailwind-variants';
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
2
|
import type { VariantColors, VariantSizes } from '../../index.js';
|
|
4
|
-
export type DataRow = Record<string, any>;
|
|
5
|
-
export type KeyType = keyof DataRow;
|
|
6
|
-
export type StatusType = 'active' | 'inactive' | 'pending' | 'error' | 'default';
|
|
7
|
-
export type TableColumn<T extends DataRow = any> = {
|
|
8
|
-
key: KeyType;
|
|
9
|
-
header: string;
|
|
10
|
-
cell?: Snippet<[row: T, key: KeyType, index?: number]>;
|
|
11
|
-
sortable?: boolean;
|
|
12
|
-
sortKey?: string;
|
|
13
|
-
align?: 'left' | 'center' | 'right';
|
|
14
|
-
width?: string;
|
|
15
|
-
class?: ClassValue;
|
|
16
|
-
};
|
|
17
|
-
export type SortDirection = 'asc' | 'desc' | null;
|
|
18
|
-
export type SortState = {
|
|
19
|
-
column: string | null;
|
|
20
|
-
direction: SortDirection;
|
|
21
|
-
};
|
|
22
3
|
export declare const table: import("tailwind-variants").TVReturnType<{
|
|
23
4
|
size: {
|
|
24
5
|
xs: {
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
import { tv } from 'tailwind-variants';
|
|
2
|
-
// Prebuild Cell rendering options
|
|
3
|
-
// Snippet 1 - Date
|
|
4
|
-
// Snippet 2 - Currency
|
|
5
|
-
// Snippet 3 - Percentage
|
|
6
|
-
// Snippet 4 - Phone Number
|
|
7
|
-
// Snippet 5 - Email
|
|
8
|
-
// Snippet 6 - Status
|
|
9
|
-
// Snippet 7 - Time
|
|
10
2
|
export const table = tv({
|
|
11
3
|
slots: {
|
|
12
4
|
base: 'w-full',
|