@shipfox/react-ui 0.17.0 → 0.19.0
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/components/calendar/calendar.js +12 -12
- package/dist/components/count-up/count-up.d.ts +14 -0
- package/dist/components/count-up/count-up.js +98 -0
- package/dist/components/count-up/count-up.stories.js +568 -0
- package/dist/components/count-up/index.d.ts +2 -0
- package/dist/components/count-up/index.js +3 -0
- package/dist/components/dashboard/components/kpi-card.d.ts +8 -9
- package/dist/components/dashboard/components/kpi-card.js +29 -44
- package/dist/components/dashboard/index.d.ts +1 -6
- package/dist/components/dashboard/index.js +0 -11
- package/dist/components/dashboard/pages/analytics-page.d.ts +0 -18
- package/dist/components/dashboard/pages/analytics-page.js +83 -37
- package/dist/components/dashboard/pages/jobs-page.d.ts +0 -18
- package/dist/components/dashboard/pages/jobs-page.js +27 -24
- package/dist/components/dashboard/table/table-wrapper.d.ts +21 -24
- package/dist/components/dashboard/table/table-wrapper.js +38 -51
- package/dist/components/date-picker/date-picker.d.ts +1 -0
- package/dist/components/date-picker/date-picker.js +20 -4
- package/dist/components/date-picker/date-picker.stories.js +16 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.d.ts +1 -0
- package/dist/components/date-time-range-picker/date-time-range-picker.js +51 -23
- package/dist/components/dropdown-input/dropdown-input.d.ts +25 -0
- package/dist/components/dropdown-input/dropdown-input.js +188 -0
- package/dist/components/dropdown-input/dropdown-input.stories.js +240 -0
- package/dist/components/dropdown-input/index.d.ts +2 -0
- package/dist/components/dropdown-input/index.js +3 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/input/input.d.ts +6 -3
- package/dist/components/input/input.js +27 -11
- package/dist/components/input/input.stories.js +66 -0
- package/dist/components/item/item.stories.js +3 -3
- package/dist/components/table/data-table.d.ts +8 -1
- package/dist/components/table/data-table.js +5 -4
- package/dist/components/table/table-column-header.d.ts +14 -1
- package/dist/components/table/table-column-header.js +12 -5
- package/dist/components/table/table-pagination.d.ts +14 -1
- package/dist/components/table/table-pagination.js +6 -2
- package/dist/components/table/table.js +3 -3
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/components/index.js
CHANGED
|
@@ -9,10 +9,12 @@ export * from './checkbox/index.js';
|
|
|
9
9
|
export * from './code-block/index.js';
|
|
10
10
|
export * from './command/index.js';
|
|
11
11
|
export * from './confetti/index.js';
|
|
12
|
+
export * from './count-up/index.js';
|
|
12
13
|
export * from './dashboard/index.js';
|
|
13
14
|
export * from './date-picker/index.js';
|
|
14
15
|
export * from './date-time-range-picker/index.js';
|
|
15
16
|
export * from './dot-grid/index.js';
|
|
17
|
+
export * from './dropdown-input/index.js';
|
|
16
18
|
export * from './dropdown-menu/index.js';
|
|
17
19
|
export * from './dynamic-item/index.js';
|
|
18
20
|
export * from './empty-state/index.js';
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
-
import type { ComponentProps } from 'react';
|
|
2
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
3
3
|
export declare const inputVariants: (props?: ({
|
|
4
4
|
variant?: "base" | "component" | null | undefined;
|
|
5
5
|
size?: "base" | "small" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
type InputProps = Omit<ComponentProps<'input'>, 'size'> & VariantProps<typeof inputVariants
|
|
8
|
-
|
|
7
|
+
type InputProps = Omit<ComponentProps<'input'>, 'size'> & VariantProps<typeof inputVariants> & {
|
|
8
|
+
iconLeft?: ReactNode;
|
|
9
|
+
iconRight?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare const Input: import("react").ForwardRefExoticComponent<Omit<InputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
9
12
|
export {};
|
|
10
13
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
3
4
|
import { cn } from '../../utils/cn.js';
|
|
4
5
|
export const inputVariants = cva('', {
|
|
5
6
|
variants: {
|
|
@@ -17,16 +18,31 @@ export const inputVariants = cva('', {
|
|
|
17
18
|
size: 'base'
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
|
-
export
|
|
21
|
-
return /*#__PURE__*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
export const Input = /*#__PURE__*/ forwardRef(({ className, type, variant, size, iconLeft, iconRight, ...props }, ref)=>{
|
|
22
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
23
|
+
className: "relative flex items-center w-full",
|
|
24
|
+
children: [
|
|
25
|
+
iconLeft && /*#__PURE__*/ _jsx("div", {
|
|
26
|
+
className: "absolute left-8 top-1/2 -translate-y-1/2 flex items-center justify-center shrink-0 pointer-events-none z-10",
|
|
27
|
+
children: iconLeft
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ _jsx("input", {
|
|
30
|
+
ref: ref,
|
|
31
|
+
type: type,
|
|
32
|
+
"data-slot": "input",
|
|
33
|
+
className: cn('placeholder:text-foreground-neutral-muted w-full min-w-0 rounded-6 text-sm leading-20 text-foreground-neutral-base shadow-button-neutral transition-[color,box-shadow] outline-none', 'hover:bg-background-field-hover', 'selection:bg-background-accent-neutral-soft selection:text-foreground-neutral-on-inverted', 'file:text-foreground-neutral-base file:inline-flex file:font-medium', 'disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-background-neutral-disabled disabled:shadow-none disabled:text-foreground-neutral-disabled', 'focus-visible:shadow-border-interactive-with-active', 'aria-invalid:shadow-border-error', iconLeft ? 'pl-32' : 'pl-8', iconRight ? 'pr-32' : 'pr-8', inputVariants({
|
|
34
|
+
variant,
|
|
35
|
+
size
|
|
36
|
+
}), className),
|
|
37
|
+
...props
|
|
38
|
+
}),
|
|
39
|
+
iconRight && /*#__PURE__*/ _jsx("div", {
|
|
40
|
+
className: "absolute right-8 top-1/2 -translate-y-1/2 flex items-center justify-center shrink-0 pointer-events-none z-10",
|
|
41
|
+
children: iconRight
|
|
42
|
+
})
|
|
43
|
+
]
|
|
29
44
|
});
|
|
30
|
-
}
|
|
45
|
+
});
|
|
46
|
+
Input.displayName = 'Input';
|
|
31
47
|
|
|
32
48
|
//# sourceMappingURL=input.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../../components/icon/index.js';
|
|
2
3
|
import { Code, Header } from '../../components/typography/index.js';
|
|
3
4
|
import { Input } from './input.js';
|
|
4
5
|
const typeOptions = [
|
|
@@ -195,5 +196,70 @@ export const Types = {
|
|
|
195
196
|
}, t))
|
|
196
197
|
})
|
|
197
198
|
};
|
|
199
|
+
export const WithIcons = {
|
|
200
|
+
render: (args)=>/*#__PURE__*/ _jsxs("div", {
|
|
201
|
+
className: "flex flex-col gap-24 w-full max-w-400",
|
|
202
|
+
children: [
|
|
203
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
204
|
+
className: "flex flex-col gap-8",
|
|
205
|
+
children: [
|
|
206
|
+
/*#__PURE__*/ _jsx(Code, {
|
|
207
|
+
variant: "label",
|
|
208
|
+
className: "text-foreground-neutral-subtle",
|
|
209
|
+
children: "Left Icon"
|
|
210
|
+
}),
|
|
211
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
212
|
+
...args,
|
|
213
|
+
placeholder: "Search...",
|
|
214
|
+
iconLeft: /*#__PURE__*/ _jsx(Icon, {
|
|
215
|
+
name: "searchLine",
|
|
216
|
+
className: "size-16 text-foreground-neutral-muted"
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
}),
|
|
221
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
222
|
+
className: "flex flex-col gap-8",
|
|
223
|
+
children: [
|
|
224
|
+
/*#__PURE__*/ _jsx(Code, {
|
|
225
|
+
variant: "label",
|
|
226
|
+
className: "text-foreground-neutral-subtle",
|
|
227
|
+
children: "Right Icon"
|
|
228
|
+
}),
|
|
229
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
230
|
+
...args,
|
|
231
|
+
placeholder: "Enter email",
|
|
232
|
+
iconRight: /*#__PURE__*/ _jsx(Icon, {
|
|
233
|
+
name: "mailLine",
|
|
234
|
+
className: "size-16 text-foreground-neutral-muted"
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
]
|
|
238
|
+
}),
|
|
239
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
240
|
+
className: "flex flex-col gap-8",
|
|
241
|
+
children: [
|
|
242
|
+
/*#__PURE__*/ _jsx(Code, {
|
|
243
|
+
variant: "label",
|
|
244
|
+
className: "text-foreground-neutral-subtle",
|
|
245
|
+
children: "Both Icons"
|
|
246
|
+
}),
|
|
247
|
+
/*#__PURE__*/ _jsx(Input, {
|
|
248
|
+
...args,
|
|
249
|
+
placeholder: "Search users...",
|
|
250
|
+
iconLeft: /*#__PURE__*/ _jsx(Icon, {
|
|
251
|
+
name: "searchLine",
|
|
252
|
+
className: "size-16 text-foreground-neutral-muted"
|
|
253
|
+
}),
|
|
254
|
+
iconRight: /*#__PURE__*/ _jsx(Icon, {
|
|
255
|
+
name: "userLine",
|
|
256
|
+
className: "size-16 text-foreground-neutral-muted"
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
]
|
|
260
|
+
})
|
|
261
|
+
]
|
|
262
|
+
})
|
|
263
|
+
};
|
|
198
264
|
|
|
199
265
|
//# sourceMappingURL=input.stories.js.map
|
|
@@ -3,6 +3,7 @@ import { Button } from '../../components/button/button.js';
|
|
|
3
3
|
import { DatePicker } from '../../components/date-picker/index.js';
|
|
4
4
|
import { Icon } from '../../components/icon/icon.js';
|
|
5
5
|
import { Input } from '../../components/input/input.js';
|
|
6
|
+
import { Kbd } from '../../components/kbd/index.js';
|
|
6
7
|
import { Label } from '../../components/label/label.js';
|
|
7
8
|
import { useState } from 'react';
|
|
8
9
|
import { Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemSeparator, ItemTitle } from './item.js';
|
|
@@ -139,9 +140,8 @@ export const ImportPastJobsModal = {
|
|
|
139
140
|
/*#__PURE__*/ _jsxs("div", {
|
|
140
141
|
className: "flex items-center gap-8",
|
|
141
142
|
children: [
|
|
142
|
-
/*#__PURE__*/ _jsx(
|
|
143
|
-
|
|
144
|
-
children: "esc"
|
|
143
|
+
/*#__PURE__*/ _jsx(Kbd, {
|
|
144
|
+
children: "Esc"
|
|
145
145
|
}),
|
|
146
146
|
/*#__PURE__*/ _jsx(Button, {
|
|
147
147
|
variant: "transparent",
|
|
@@ -81,7 +81,14 @@ interface DataTableProps<TData, TValue> extends Omit<ComponentProps<'div'>, 'chi
|
|
|
81
81
|
* When `true`, displays a loading skeleton instead of the table.
|
|
82
82
|
*/
|
|
83
83
|
isLoading?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Optional scoped container element for dropdown portals.
|
|
86
|
+
*
|
|
87
|
+
* When provided, dropdowns (like pagination select) will be rendered inside this container
|
|
88
|
+
* instead of the document body. This is useful for scoped CSS styling.
|
|
89
|
+
*/
|
|
90
|
+
scopedContainer?: HTMLElement | null;
|
|
84
91
|
}
|
|
85
|
-
export declare function DataTable<TData, TValue>({ columns, data, pagination, pageSize, pageSizeOptions, showSelectedCount, onRowClick, emptyState, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, isLoading, className, ...props }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
92
|
+
export declare function DataTable<TData, TValue>({ columns, data, pagination, pageSize, pageSizeOptions, showSelectedCount, onRowClick, emptyState, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, isLoading, scopedContainer, className, ...props }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
86
93
|
export {};
|
|
87
94
|
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -8,7 +8,7 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
8
8
|
import { cn } from '../../utils/cn.js';
|
|
9
9
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from './table.js';
|
|
10
10
|
import { TablePagination } from './table-pagination.js';
|
|
11
|
-
export function DataTable({ columns, data, pagination = true, pageSize = 10, pageSizeOptions, showSelectedCount = false, onRowClick, emptyState, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, isLoading, className, ...props }) {
|
|
11
|
+
export function DataTable({ columns, data, pagination = true, pageSize = 10, pageSizeOptions, showSelectedCount = false, onRowClick, emptyState, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange, isLoading, scopedContainer, className, ...props }) {
|
|
12
12
|
const [sorting, setSorting] = useState([]);
|
|
13
13
|
const [columnFilters, setColumnFilters] = useState([]);
|
|
14
14
|
const [internalColumnVisibility, setInternalColumnVisibility] = useState({});
|
|
@@ -91,7 +91,7 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
|
|
|
91
91
|
className: cn('p-0 gap-0', className),
|
|
92
92
|
...props,
|
|
93
93
|
children: /*#__PURE__*/ _jsx(CardContent, {
|
|
94
|
-
className: "
|
|
94
|
+
className: "overflow-hidden p-0",
|
|
95
95
|
children: /*#__PURE__*/ _jsxs(Table, {
|
|
96
96
|
children: [
|
|
97
97
|
/*#__PURE__*/ _jsx(TableHeader, {
|
|
@@ -125,7 +125,7 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
|
|
|
125
125
|
className: cn('p-0 gap-0', className),
|
|
126
126
|
...props,
|
|
127
127
|
children: /*#__PURE__*/ _jsx(CardContent, {
|
|
128
|
-
className: "
|
|
128
|
+
className: "overflow-hidden p-0",
|
|
129
129
|
children: /*#__PURE__*/ _jsxs(Table, {
|
|
130
130
|
children: [
|
|
131
131
|
table.getRowModel().rows.length > 0 ? /*#__PURE__*/ _jsx(TableHeader, {
|
|
@@ -165,7 +165,8 @@ export function DataTable({ columns, data, pagination = true, pageSize = 10, pag
|
|
|
165
165
|
pagination && table.getRowModel().rows?.length > 0 && /*#__PURE__*/ _jsx(TablePagination, {
|
|
166
166
|
table: table,
|
|
167
167
|
pageSizeOptions: pageSizeOptions,
|
|
168
|
-
showSelectedCount: showSelectedCount
|
|
168
|
+
showSelectedCount: showSelectedCount,
|
|
169
|
+
scopedContainer: scopedContainer
|
|
169
170
|
})
|
|
170
171
|
]
|
|
171
172
|
})
|
|
@@ -39,6 +39,19 @@ export interface TableColumnHeaderProps<TData, TValue> extends HTMLAttributes<HT
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
title: string;
|
|
42
|
+
/**
|
|
43
|
+
* Optional scoped container element for dropdown portal.
|
|
44
|
+
*
|
|
45
|
+
* When provided, the dropdown menu will be rendered inside this container
|
|
46
|
+
* instead of the document body. This is useful for scoped CSS styling.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```tsx
|
|
50
|
+
* const {scopedContainer} = useScopedContainer();
|
|
51
|
+
* <TableColumnHeader column={column} title="Name" scopedContainer={scopedContainer} />
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
scopedContainer?: HTMLElement | null;
|
|
42
55
|
}
|
|
43
56
|
/**
|
|
44
57
|
* Renders a table column header with optional sorting functionality.
|
|
@@ -75,5 +88,5 @@ export interface TableColumnHeaderProps<TData, TValue> extends HTMLAttributes<HT
|
|
|
75
88
|
* ];
|
|
76
89
|
* ```
|
|
77
90
|
*/
|
|
78
|
-
export declare function TableColumnHeader<TData, TValue>({ column, title, className, }: TableColumnHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
91
|
+
export declare function TableColumnHeader<TData, TValue>({ column, title, className, scopedContainer, }: TableColumnHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
79
92
|
//# sourceMappingURL=table-column-header.d.ts.map
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Icon } from '../../components/icon/index.js';
|
|
3
|
+
import { useRef } from 'react';
|
|
3
4
|
import { cn } from '../../utils/cn.js';
|
|
4
5
|
import { Button } from '../button/index.js';
|
|
5
6
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../dropdown-menu/index.js';
|
|
7
|
+
import { Text } from '../typography/index.js';
|
|
6
8
|
/**
|
|
7
9
|
* Renders a table column header with optional sorting functionality.
|
|
8
10
|
*
|
|
@@ -37,15 +39,18 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigge
|
|
|
37
39
|
* },
|
|
38
40
|
* ];
|
|
39
41
|
* ```
|
|
40
|
-
*/ export function TableColumnHeader({ column, title, className }) {
|
|
42
|
+
*/ export function TableColumnHeader({ column, title, className, scopedContainer }) {
|
|
43
|
+
const headerRef = useRef(null);
|
|
41
44
|
if (!column.getCanSort()) {
|
|
42
|
-
return /*#__PURE__*/ _jsx(
|
|
43
|
-
|
|
45
|
+
return /*#__PURE__*/ _jsx(Text, {
|
|
46
|
+
size: "xs",
|
|
47
|
+
className: cn('font-medium', className),
|
|
44
48
|
children: title
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
const isSorted = column.getIsSorted();
|
|
48
52
|
return /*#__PURE__*/ _jsx("div", {
|
|
53
|
+
ref: headerRef,
|
|
49
54
|
className: cn('flex items-center space-x-2', className),
|
|
50
55
|
children: /*#__PURE__*/ _jsxs(DropdownMenu, {
|
|
51
56
|
children: [
|
|
@@ -56,8 +61,9 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigge
|
|
|
56
61
|
size: "xs",
|
|
57
62
|
className: "-ml-12 h-32 px-8 data-[state=open]:bg-background-components-hover gap-0",
|
|
58
63
|
children: [
|
|
59
|
-
/*#__PURE__*/ _jsx(
|
|
60
|
-
|
|
64
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
65
|
+
size: "xs",
|
|
66
|
+
className: "font-medium text-foreground-neutral-subtle",
|
|
61
67
|
children: title
|
|
62
68
|
}),
|
|
63
69
|
isSorted === 'desc' ? /*#__PURE__*/ _jsx(Icon, {
|
|
@@ -76,6 +82,7 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigge
|
|
|
76
82
|
/*#__PURE__*/ _jsxs(DropdownMenuContent, {
|
|
77
83
|
align: "start",
|
|
78
84
|
size: "sm",
|
|
85
|
+
container: scopedContainer ?? undefined,
|
|
79
86
|
children: [
|
|
80
87
|
/*#__PURE__*/ _jsx(DropdownMenuItem, {
|
|
81
88
|
icon: "arrowUpLongLine",
|
|
@@ -47,7 +47,20 @@ interface TablePaginationProps<TData> extends ComponentProps<'tfoot'> {
|
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
showSelectedCount?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Optional scoped container element for select dropdown portal.
|
|
52
|
+
*
|
|
53
|
+
* When provided, the select dropdown will be rendered inside this container
|
|
54
|
+
* instead of the document body. This is useful for scoped CSS styling.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* const {scopedContainer} = useScopedContainer();
|
|
59
|
+
* <TablePagination table={table} scopedContainer={scopedContainer} />
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
scopedContainer?: HTMLElement | null;
|
|
50
63
|
}
|
|
51
|
-
export declare function TablePagination<TData>({ table, className, pageSizeOptions, showSelectedCount, ...props }: TablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
export declare function TablePagination<TData>({ table, className, pageSizeOptions, showSelectedCount, scopedContainer, ...props }: TablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
52
65
|
export {};
|
|
53
66
|
//# sourceMappingURL=table-pagination.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from '../../components/typography/index.js';
|
|
3
|
+
import { useRef } from 'react';
|
|
3
4
|
import { Button } from '../button/index.js';
|
|
4
5
|
import { Icon } from '../icon/index.js';
|
|
5
6
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../select/select.js';
|
|
@@ -9,17 +10,19 @@ export function TablePagination({ table, className, pageSizeOptions = [
|
|
|
9
10
|
20,
|
|
10
11
|
50,
|
|
11
12
|
100
|
|
12
|
-
], showSelectedCount = false, ...props }) {
|
|
13
|
+
], showSelectedCount = false, scopedContainer, ...props }) {
|
|
14
|
+
const paginationRef = useRef(null);
|
|
13
15
|
const currentPage = table.getState().pagination.pageIndex + 1;
|
|
14
16
|
const pageSize = table.getState().pagination.pageSize;
|
|
15
17
|
const totalRows = table.getFilteredRowModel().rows.length;
|
|
16
18
|
const startRow = totalRows === 0 ? 0 : currentPage === 1 ? 1 : (currentPage - 1) * pageSize + 1;
|
|
17
19
|
const endRow = Math.min(currentPage * pageSize, totalRows);
|
|
18
20
|
return /*#__PURE__*/ _jsx(TableFooter, {
|
|
21
|
+
ref: paginationRef,
|
|
19
22
|
className: className,
|
|
20
23
|
...props,
|
|
21
24
|
children: /*#__PURE__*/ _jsx(TableRow, {
|
|
22
|
-
className: "hover:bg-transparent",
|
|
25
|
+
className: "hover:bg-transparent border-b-0",
|
|
23
26
|
children: /*#__PURE__*/ _jsx(TableCell, {
|
|
24
27
|
colSpan: table.getAllColumns().length,
|
|
25
28
|
className: "group-hover/row:bg-transparent",
|
|
@@ -71,6 +74,7 @@ export function TablePagination({ table, className, pageSizeOptions = [
|
|
|
71
74
|
children: /*#__PURE__*/ _jsx(SelectValue, {})
|
|
72
75
|
}),
|
|
73
76
|
/*#__PURE__*/ _jsx(SelectContent, {
|
|
77
|
+
container: scopedContainer ?? undefined,
|
|
74
78
|
children: pageSizeOptions.map((size)=>/*#__PURE__*/ _jsx(SelectItem, {
|
|
75
79
|
value: String(size),
|
|
76
80
|
children: size
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { cn } from '../../utils/cn.js';
|
|
3
3
|
function Table({ className, ...props }) {
|
|
4
4
|
return /*#__PURE__*/ _jsx("div", {
|
|
5
|
-
className: "relative w-full overflow-auto scrollbar",
|
|
5
|
+
className: "relative w-full overflow-auto scrollbar rounded-x-8 rounded-b-8",
|
|
6
6
|
children: /*#__PURE__*/ _jsx("table", {
|
|
7
7
|
"data-slot": "table",
|
|
8
8
|
className: cn('w-full caption-bottom text-sm', className),
|
|
@@ -34,14 +34,14 @@ function TableFooter({ className, ...props }) {
|
|
|
34
34
|
function TableRow({ className, ...props }) {
|
|
35
35
|
return /*#__PURE__*/ _jsx("tr", {
|
|
36
36
|
"data-slot": "table-row",
|
|
37
|
-
className: cn('group/row border-b border-border-neutral-base transition-colors', 'last:
|
|
37
|
+
className: cn('group/row border-b border-border-neutral-base transition-colors', 'last:rounded-b-8 last:border-b-0', 'hover:bg-background-neutral-hover', 'data-[selected=true]:bg-background-neutral-pressed data-[selected=true]:hover:bg-background-neutral-pressed', className),
|
|
38
38
|
...props
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
function TableHead({ className, ...props }) {
|
|
42
42
|
return /*#__PURE__*/ _jsx("th", {
|
|
43
43
|
"data-slot": "table-head",
|
|
44
|
-
className: cn('h-40 px-16 text-left align-middle text-xs font-medium leading-20 text-foreground-neutral-subtle', 'bg-background-subtle-base', '[&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:px-12 [&:has([role=checkbox])]:w-0 [&:has([role=checkbox])]:pt-6', className),
|
|
44
|
+
className: cn('h-40 px-16 text-left align-middle text-xs font-medium leading-20 text-foreground-neutral-subtle', 'bg-background-subtle-base border-b border-border-neutral-base', '[&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:px-12 [&:has([role=checkbox])]:w-0 [&:has([role=checkbox])]:pt-6', className),
|
|
45
45
|
...props
|
|
46
46
|
});
|
|
47
47
|
}
|