minka-ds 0.1.0 → 0.1.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/package.json
CHANGED
|
@@ -25,8 +25,6 @@ const badgeVariants = cva(
|
|
|
25
25
|
"bg-[var(--color-bg-error)] text-[var(--color-feedback-error)] border-transparent",
|
|
26
26
|
info:
|
|
27
27
|
"bg-[var(--color-bg-info)] text-[var(--color-feedback-info)] border-transparent",
|
|
28
|
-
pending:
|
|
29
|
-
"bg-[var(--color-bg-warning)] text-[var(--color-text-default)] border-transparent",
|
|
30
28
|
outline:
|
|
31
29
|
"border-[var(--color-border-default)] text-[var(--color-text-default)] [a&]:hover:bg-[var(--color-action-ghost-hover)]",
|
|
32
30
|
ghost:
|
|
@@ -24,15 +24,15 @@ function TextStack({ primary, secondary, className }: TextStackProps) {
|
|
|
24
24
|
)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
// ──
|
|
28
|
-
// Single-line
|
|
27
|
+
// ── DataCell ──────────────────────────────────────────────────────────────────
|
|
28
|
+
// Single-line plain data value. Use for IDs, timestamps, codes.
|
|
29
29
|
|
|
30
|
-
interface
|
|
30
|
+
interface DataCellProps {
|
|
31
31
|
children: React.ReactNode
|
|
32
32
|
className?: string
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
function
|
|
35
|
+
function DataCell({ children, className }: DataCellProps) {
|
|
36
36
|
return (
|
|
37
37
|
<span
|
|
38
38
|
className={cn(
|
|
@@ -94,10 +94,10 @@ function ActionCell({ children, className }: ActionCellProps) {
|
|
|
94
94
|
)
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export { TextStack,
|
|
97
|
+
export { TextStack, DataCell, AmountCell, BadgeCell, ActionCell }
|
|
98
98
|
export type {
|
|
99
99
|
TextStackProps,
|
|
100
|
-
|
|
100
|
+
DataCellProps,
|
|
101
101
|
AmountCellProps,
|
|
102
102
|
BadgeCellProps,
|
|
103
103
|
ActionCellProps,
|
|
@@ -190,12 +190,14 @@ interface DataTableProps<TData, TValue> {
|
|
|
190
190
|
columns: ColumnDef<TData, TValue>[]
|
|
191
191
|
data: TData[]
|
|
192
192
|
pageSize?: number
|
|
193
|
+
onRowClick?: (row: TData) => void
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
function DataTable<TData, TValue>({
|
|
196
197
|
columns,
|
|
197
198
|
data,
|
|
198
199
|
pageSize = 10,
|
|
200
|
+
onRowClick,
|
|
199
201
|
}: DataTableProps<TData, TValue>) {
|
|
200
202
|
const [sorting, setSorting] = React.useState<SortingState>([])
|
|
201
203
|
const [columnVisibility, setColumnVisibility] = React.useState<VisibilityState>({})
|
|
@@ -240,6 +242,8 @@ function DataTable<TData, TValue>({
|
|
|
240
242
|
<TableRow
|
|
241
243
|
key={row.id}
|
|
242
244
|
data-state={row.getIsSelected() ? "selected" : undefined}
|
|
245
|
+
onClick={onRowClick ? () => onRowClick(row.original) : undefined}
|
|
246
|
+
className={onRowClick ? "cursor-pointer" : undefined}
|
|
243
247
|
>
|
|
244
248
|
{row.getVisibleCells().map((cell) => (
|
|
245
249
|
<TableCell key={cell.id}>
|