@shipfox/react-ui 0.14.0 → 0.15.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/.storybook/preview.tsx +7 -0
- package/.turbo/turbo-build.log +7 -7
- package/.turbo/turbo-check.log +2 -2
- package/.turbo/turbo-type.log +1 -1
- package/CHANGELOG.md +10 -0
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/button-group/button-group.d.ts +17 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -0
- package/dist/components/button-group/button-group.js +74 -0
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/button-group/button-group.stories.js +644 -0
- package/dist/components/button-group/button-group.stories.js.map +1 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.d.ts.map +1 -0
- package/dist/components/button-group/index.js +3 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/code-block/code-block-footer.d.ts.map +1 -1
- package/dist/components/code-block/code-block-footer.js +4 -2
- package/dist/components/code-block/code-block-footer.js.map +1 -1
- package/dist/components/command/command.d.ts +28 -0
- package/dist/components/command/command.d.ts.map +1 -0
- package/dist/components/command/command.js +190 -0
- package/dist/components/command/command.js.map +1 -0
- package/dist/components/command/command.stories.js +228 -0
- package/dist/components/command/command.stories.js.map +1 -0
- package/dist/components/command/index.d.ts +2 -0
- package/dist/components/command/index.d.ts.map +1 -0
- package/dist/components/command/index.js +3 -0
- package/dist/components/command/index.js.map +1 -0
- package/dist/components/dashboard/components/analytics-content.d.ts +2 -0
- package/dist/components/dashboard/components/analytics-content.d.ts.map +1 -0
- package/dist/components/dashboard/components/analytics-content.js +180 -0
- package/dist/components/dashboard/components/analytics-content.js.map +1 -0
- package/dist/components/dashboard/components/animated-logo.d.ts +4 -0
- package/dist/components/dashboard/components/animated-logo.d.ts.map +1 -0
- package/dist/components/dashboard/components/animated-logo.js +23 -0
- package/dist/components/dashboard/components/animated-logo.js.map +1 -0
- package/dist/components/dashboard/components/complete-setup-button.d.ts +4 -0
- package/dist/components/dashboard/components/complete-setup-button.d.ts.map +1 -0
- package/dist/components/dashboard/components/complete-setup-button.js +28 -0
- package/dist/components/dashboard/components/complete-setup-button.js.map +1 -0
- package/dist/components/dashboard/components/jobs-content.d.ts +2 -0
- package/dist/components/dashboard/components/jobs-content.d.ts.map +1 -0
- package/dist/components/dashboard/components/jobs-content.js +69 -0
- package/dist/components/dashboard/components/jobs-content.js.map +1 -0
- package/dist/components/dashboard/components/mobile-menu.d.ts +2 -0
- package/dist/components/dashboard/components/mobile-menu.d.ts.map +1 -0
- package/dist/components/dashboard/components/mobile-menu.js +65 -0
- package/dist/components/dashboard/components/mobile-menu.js.map +1 -0
- package/dist/components/dashboard/components/organization-selector.d.ts +2 -0
- package/dist/components/dashboard/components/organization-selector.d.ts.map +1 -0
- package/dist/components/dashboard/components/organization-selector.js +92 -0
- package/dist/components/dashboard/components/organization-selector.js.map +1 -0
- package/dist/components/dashboard/components/top-menu.d.ts +5 -0
- package/dist/components/dashboard/components/top-menu.d.ts.map +1 -0
- package/dist/components/dashboard/components/top-menu.js +31 -0
- package/dist/components/dashboard/components/top-menu.js.map +1 -0
- package/dist/components/dashboard/components/topbar-button.d.ts +7 -0
- package/dist/components/dashboard/components/topbar-button.d.ts.map +1 -0
- package/dist/components/dashboard/components/topbar-button.js +18 -0
- package/dist/components/dashboard/components/topbar-button.js.map +1 -0
- package/dist/components/dashboard/components/topbar.d.ts +4 -0
- package/dist/components/dashboard/components/topbar.d.ts.map +1 -0
- package/dist/components/dashboard/components/topbar.js +62 -0
- package/dist/components/dashboard/components/topbar.js.map +1 -0
- package/dist/components/dashboard/components/user-profile.d.ts +2 -0
- package/dist/components/dashboard/components/user-profile.d.ts.map +1 -0
- package/dist/components/dashboard/components/user-profile.js +146 -0
- package/dist/components/dashboard/components/user-profile.js.map +1 -0
- package/dist/components/dashboard/dashboard.d.ts +2 -0
- package/dist/components/dashboard/dashboard.d.ts.map +1 -0
- package/dist/components/dashboard/dashboard.js +70 -0
- package/dist/components/dashboard/dashboard.js.map +1 -0
- package/dist/components/dashboard/dashboard.stories.js +23 -0
- package/dist/components/dashboard/dashboard.stories.js.map +1 -0
- package/dist/components/dashboard/index.d.ts +2 -0
- package/dist/components/dashboard/index.d.ts.map +1 -0
- package/dist/components/dashboard/index.js +3 -0
- package/dist/components/dashboard/index.js.map +1 -0
- package/dist/components/form/form.stories.js +6 -1
- package/dist/components/form/form.stories.js.map +1 -1
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +7 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/kbd/index.d.ts +2 -0
- package/dist/components/kbd/index.d.ts.map +1 -0
- package/dist/components/kbd/index.js +3 -0
- package/dist/components/kbd/index.js.map +1 -0
- package/dist/components/kbd/kbd.d.ts +7 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -0
- package/dist/components/kbd/kbd.js +18 -0
- package/dist/components/kbd/kbd.js.map +1 -0
- package/dist/components/kbd/kbd.stories.js +119 -0
- package/dist/components/kbd/kbd.stories.js.map +1 -0
- package/dist/components/search/index.d.ts +7 -0
- package/dist/components/search/index.d.ts.map +1 -0
- package/dist/components/search/index.js +8 -0
- package/dist/components/search/index.js.map +1 -0
- package/dist/components/search/search-context.d.ts +11 -0
- package/dist/components/search/search-context.d.ts.map +1 -0
- package/dist/components/search/search-context.js +56 -0
- package/dist/components/search/search-context.js.map +1 -0
- package/dist/components/search/search-inline.d.ts +9 -0
- package/dist/components/search/search-inline.d.ts.map +1 -0
- package/dist/components/search/search-inline.js +85 -0
- package/dist/components/search/search-inline.js.map +1 -0
- package/dist/components/search/search-modal.d.ts +25 -0
- package/dist/components/search/search-modal.d.ts.map +1 -0
- package/dist/components/search/search-modal.js +162 -0
- package/dist/components/search/search-modal.js.map +1 -0
- package/dist/components/search/search-trigger.d.ts +9 -0
- package/dist/components/search/search-trigger.d.ts.map +1 -0
- package/dist/components/search/search-trigger.js +37 -0
- package/dist/components/search/search-trigger.js.map +1 -0
- package/dist/components/search/search-variants.d.ts +14 -0
- package/dist/components/search/search-variants.d.ts.map +1 -0
- package/dist/components/search/search-variants.js +90 -0
- package/dist/components/search/search-variants.js.map +1 -0
- package/dist/components/search/search.d.ts +11 -0
- package/dist/components/search/search.d.ts.map +1 -0
- package/dist/components/search/search.js +35 -0
- package/dist/components/search/search.js.map +1 -0
- package/dist/components/search/search.stories.js +630 -0
- package/dist/components/search/search.stories.js.map +1 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.d.ts.map +1 -0
- package/dist/components/select/index.js +3 -0
- package/dist/components/select/index.js.map +1 -0
- package/dist/components/select/select.d.ts +25 -0
- package/dist/components/select/select.d.ts.map +1 -0
- package/dist/components/select/select.js +153 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/select/select.stories.js +393 -0
- package/dist/components/select/select.stories.js.map +1 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.d.ts.map +1 -0
- package/dist/components/skeleton/index.js +3 -0
- package/dist/components/skeleton/index.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +5 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.js +11 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/skeleton/skeleton.stories.js +345 -0
- package/dist/components/skeleton/skeleton.stories.js.map +1 -0
- package/dist/components/table/data-table.d.ts +70 -0
- package/dist/components/table/data-table.d.ts.map +1 -0
- package/dist/components/table/data-table.js +159 -0
- package/dist/components/table/data-table.js.map +1 -0
- package/dist/components/table/index.d.ts +6 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.js +6 -0
- package/dist/components/table/index.js.map +1 -0
- package/dist/components/table/table-column-header.d.ts +79 -0
- package/dist/components/table/table-column-header.d.ts.map +1 -0
- package/dist/components/table/table-column-header.js +99 -0
- package/dist/components/table/table-column-header.js.map +1 -0
- package/dist/components/table/table-pagination.d.ts +53 -0
- package/dist/components/table/table-pagination.d.ts.map +1 -0
- package/dist/components/table/table-pagination.js +139 -0
- package/dist/components/table/table-pagination.js.map +1 -0
- package/dist/components/table/table.d.ts +11 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +64 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/table/table.stories.columns.d.ts +24 -0
- package/dist/components/table/table.stories.columns.d.ts.map +1 -0
- package/dist/components/table/table.stories.columns.js +310 -0
- package/dist/components/table/table.stories.columns.js.map +1 -0
- package/dist/components/table/table.stories.components.d.ts +14 -0
- package/dist/components/table/table.stories.components.d.ts.map +1 -0
- package/dist/components/table/table.stories.components.js +107 -0
- package/dist/components/table/table.stories.components.js.map +1 -0
- package/dist/components/table/table.stories.data.d.ts +54 -0
- package/dist/components/table/table.stories.data.d.ts.map +1 -0
- package/dist/components/table/table.stories.data.js +122 -0
- package/dist/components/table/table.stories.data.js.map +1 -0
- package/dist/components/table/table.stories.js +302 -0
- package/dist/components/table/table.stories.js.map +1 -0
- package/dist/styles.css +1 -1
- package/index.css +48 -0
- package/package.json +3 -2
- package/src/components/avatar/avatar.tsx +1 -1
- package/src/components/button-group/button-group.stories.tsx +361 -0
- package/src/components/button-group/button-group.tsx +111 -0
- package/src/components/button-group/index.ts +1 -0
- package/src/components/code-block/code-block-footer.tsx +8 -1
- package/src/components/command/command.stories.tsx +133 -0
- package/src/components/command/command.tsx +265 -0
- package/src/components/command/index.ts +1 -0
- package/src/components/dashboard/components/analytics-content.tsx +102 -0
- package/src/components/dashboard/components/animated-logo.tsx +25 -0
- package/src/components/dashboard/components/complete-setup-button.tsx +30 -0
- package/src/components/dashboard/components/jobs-content.tsx +51 -0
- package/src/components/dashboard/components/mobile-menu.tsx +50 -0
- package/src/components/dashboard/components/organization-selector.tsx +51 -0
- package/src/components/dashboard/components/top-menu.tsx +26 -0
- package/src/components/dashboard/components/topbar-button.tsx +27 -0
- package/src/components/dashboard/components/topbar.tsx +40 -0
- package/src/components/dashboard/components/user-profile.tsx +90 -0
- package/src/components/dashboard/dashboard.stories.tsx +25 -0
- package/src/components/dashboard/dashboard.tsx +61 -0
- package/src/components/dashboard/index.ts +1 -0
- package/src/components/form/form.stories.tsx +5 -0
- package/src/components/index.ts +7 -0
- package/src/components/kbd/index.ts +1 -0
- package/src/components/kbd/kbd.stories.tsx +64 -0
- package/src/components/kbd/kbd.tsx +32 -0
- package/src/components/search/index.ts +28 -0
- package/src/components/search/search-context.tsx +78 -0
- package/src/components/search/search-inline.tsx +107 -0
- package/src/components/search/search-modal.tsx +198 -0
- package/src/components/search/search-trigger.tsx +47 -0
- package/src/components/search/search-variants.ts +88 -0
- package/src/components/search/search.stories.tsx +392 -0
- package/src/components/search/search.tsx +47 -0
- package/src/components/select/index.ts +1 -0
- package/src/components/select/select.stories.tsx +207 -0
- package/src/components/select/select.tsx +220 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.stories.tsx +178 -0
- package/src/components/skeleton/skeleton.tsx +14 -0
- package/src/components/table/data-table.tsx +254 -0
- package/src/components/table/index.ts +5 -0
- package/src/components/table/table-column-header.tsx +141 -0
- package/src/components/table/table-pagination.tsx +161 -0
- package/src/components/table/table.stories.columns.tsx +198 -0
- package/src/components/table/table.stories.components.tsx +104 -0
- package/src/components/table/table.stories.data.ts +117 -0
- package/src/components/table/table.stories.tsx +256 -0
- package/src/components/table/table.tsx +95 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/index.ts"],"sourcesContent":["export type {ColumnDef} from '@tanstack/react-table';\nexport * from './data-table';\nexport * from './table';\nexport * from './table-column-header';\nexport * from './table-pagination';\n"],"names":[],"mappings":"AACA,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,wBAAwB;AACtC,cAAc,qBAAqB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { Column } from '@tanstack/react-table';
|
|
2
|
+
import type { HTMLAttributes } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the {@link TableColumnHeader} component.
|
|
5
|
+
*
|
|
6
|
+
* Defines the properties needed to render a sortable table column header
|
|
7
|
+
* with interactive sorting controls.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam TData - The shape of the row data in the table.
|
|
10
|
+
* @typeParam TValue - The type of the value in this specific column.
|
|
11
|
+
*/
|
|
12
|
+
export interface TableColumnHeaderProps<TData, TValue> extends HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
/**
|
|
14
|
+
* The TanStack Table column instance for this header.
|
|
15
|
+
*
|
|
16
|
+
* This instance provides access to column state and sorting methods.
|
|
17
|
+
* It's typically obtained from the `header.column` property when mapping
|
|
18
|
+
* over header groups in TanStack Table.
|
|
19
|
+
*
|
|
20
|
+
* The column determines:
|
|
21
|
+
* - Whether sorting is enabled (`getCanSort()`)
|
|
22
|
+
* - Current sort direction (`getIsSorted()`)
|
|
23
|
+
* - Methods to toggle sorting (`toggleSorting()`)
|
|
24
|
+
*
|
|
25
|
+
* @see {@link https://tanstack.com/table/latest/docs/api/core/column TanStack Column API}
|
|
26
|
+
*/
|
|
27
|
+
column: Column<TData, TValue>;
|
|
28
|
+
/**
|
|
29
|
+
* The display text for the column header.
|
|
30
|
+
*
|
|
31
|
+
* This is the human-readable label that appears in the table header.
|
|
32
|
+
* For sortable columns, this text appears in a button with sort indicators.
|
|
33
|
+
* For non-sortable columns, it renders as plain text.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <TableColumnHeader column={column} title="Customer Name" />
|
|
38
|
+
* <TableColumnHeader column={column} title="Order Date" />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
title: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Renders a table column header with optional sorting functionality.
|
|
45
|
+
*
|
|
46
|
+
* This component automatically adapts based on whether the column supports sorting:
|
|
47
|
+
* - **Sortable columns**: Renders an interactive button with a dropdown menu for
|
|
48
|
+
* ascending/descending sort options and visual indicators for the current sort state
|
|
49
|
+
* - **Non-sortable columns**: Renders plain text without interactive controls
|
|
50
|
+
*
|
|
51
|
+
* The component integrates seamlessly with TanStack Table's sorting system and
|
|
52
|
+
* manages sort state through the provided column instance.
|
|
53
|
+
*
|
|
54
|
+
* @typeParam TData - The shape of the row data in the table.
|
|
55
|
+
* @typeParam TValue - The type of the value in this specific column.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* // In your column definitions:
|
|
60
|
+
* const columns: ColumnDef<User>[] = [
|
|
61
|
+
* {
|
|
62
|
+
* accessorKey: 'name',
|
|
63
|
+
* header: ({ column }) => (
|
|
64
|
+
* <TableColumnHeader column={column} title="Name" />
|
|
65
|
+
* ),
|
|
66
|
+
* enableSorting: true,
|
|
67
|
+
* },
|
|
68
|
+
* {
|
|
69
|
+
* accessorKey: 'email',
|
|
70
|
+
* header: ({ column }) => (
|
|
71
|
+
* <TableColumnHeader column={column} title="Email" />
|
|
72
|
+
* ),
|
|
73
|
+
* enableSorting: false,
|
|
74
|
+
* },
|
|
75
|
+
* ];
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function TableColumnHeader<TData, TValue>({ column, title, className, }: TableColumnHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
//# sourceMappingURL=table-column-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-column-header.d.ts","sourceRoot":"","sources":["../../../src/components/table/table-column-header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAC;AAElD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAU1C;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAE,SAAQ,cAAc,CAAC,cAAc,CAAC;IAC3F;;;;;;;;;;;;;OAaG;IACH,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9B;;;;;;;;;;;;OAYG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,EAC/C,MAAM,EACN,KAAK,EACL,SAAS,GACV,EAAE,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,2CAgDvC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../../components/icon/index.js';
|
|
3
|
+
import { cn } from '../../utils/cn.js';
|
|
4
|
+
import { Button } from '../button/index.js';
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from '../dropdown-menu/index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Renders a table column header with optional sorting functionality.
|
|
8
|
+
*
|
|
9
|
+
* This component automatically adapts based on whether the column supports sorting:
|
|
10
|
+
* - **Sortable columns**: Renders an interactive button with a dropdown menu for
|
|
11
|
+
* ascending/descending sort options and visual indicators for the current sort state
|
|
12
|
+
* - **Non-sortable columns**: Renders plain text without interactive controls
|
|
13
|
+
*
|
|
14
|
+
* The component integrates seamlessly with TanStack Table's sorting system and
|
|
15
|
+
* manages sort state through the provided column instance.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam TData - The shape of the row data in the table.
|
|
18
|
+
* @typeParam TValue - The type of the value in this specific column.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // In your column definitions:
|
|
23
|
+
* const columns: ColumnDef<User>[] = [
|
|
24
|
+
* {
|
|
25
|
+
* accessorKey: 'name',
|
|
26
|
+
* header: ({ column }) => (
|
|
27
|
+
* <TableColumnHeader column={column} title="Name" />
|
|
28
|
+
* ),
|
|
29
|
+
* enableSorting: true,
|
|
30
|
+
* },
|
|
31
|
+
* {
|
|
32
|
+
* accessorKey: 'email',
|
|
33
|
+
* header: ({ column }) => (
|
|
34
|
+
* <TableColumnHeader column={column} title="Email" />
|
|
35
|
+
* ),
|
|
36
|
+
* enableSorting: false,
|
|
37
|
+
* },
|
|
38
|
+
* ];
|
|
39
|
+
* ```
|
|
40
|
+
*/ export function TableColumnHeader({ column, title, className }) {
|
|
41
|
+
if (!column.getCanSort()) {
|
|
42
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
43
|
+
className: cn('text-xs font-medium', className),
|
|
44
|
+
children: title
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const isSorted = column.getIsSorted();
|
|
48
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
49
|
+
className: cn('flex items-center space-x-2', className),
|
|
50
|
+
children: /*#__PURE__*/ _jsxs(DropdownMenu, {
|
|
51
|
+
children: [
|
|
52
|
+
/*#__PURE__*/ _jsx(DropdownMenuTrigger, {
|
|
53
|
+
asChild: true,
|
|
54
|
+
children: /*#__PURE__*/ _jsxs(Button, {
|
|
55
|
+
variant: "transparent",
|
|
56
|
+
size: "xs",
|
|
57
|
+
className: "-ml-12 h-32 px-8 data-[state=open]:bg-background-components-hover gap-0",
|
|
58
|
+
children: [
|
|
59
|
+
/*#__PURE__*/ _jsx("span", {
|
|
60
|
+
className: "text-xs font-medium text-foreground-neutral-subtle",
|
|
61
|
+
children: title
|
|
62
|
+
}),
|
|
63
|
+
isSorted === 'desc' ? /*#__PURE__*/ _jsx(Icon, {
|
|
64
|
+
name: "arrowDownLongLine",
|
|
65
|
+
className: "ml-2 size-14 text-foreground-neutral-muted"
|
|
66
|
+
}) : isSorted === 'asc' ? /*#__PURE__*/ _jsx(Icon, {
|
|
67
|
+
name: "arrowUpLongLine",
|
|
68
|
+
className: "ml-2 size-14 text-foreground-neutral-muted"
|
|
69
|
+
}) : /*#__PURE__*/ _jsx(Icon, {
|
|
70
|
+
name: "arrowUpDownLine",
|
|
71
|
+
className: "ml-4 size-16 text-foreground-neutral-muted"
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ _jsxs(DropdownMenuContent, {
|
|
77
|
+
align: "start",
|
|
78
|
+
size: "sm",
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ _jsx(DropdownMenuItem, {
|
|
81
|
+
icon: "arrowUpLongLine",
|
|
82
|
+
onClick: ()=>column.toggleSorting(false),
|
|
83
|
+
closeOnSelect: true,
|
|
84
|
+
children: "Asc"
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ _jsx(DropdownMenuItem, {
|
|
87
|
+
icon: "arrowDownLongLine",
|
|
88
|
+
onClick: ()=>column.toggleSorting(true),
|
|
89
|
+
closeOnSelect: true,
|
|
90
|
+
children: "Desc"
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=table-column-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table-column-header.tsx"],"sourcesContent":["import type {Column} from '@tanstack/react-table';\nimport {Icon} from 'components/icon';\nimport type {HTMLAttributes} from 'react';\nimport {cn} from 'utils/cn';\nimport {Button} from '../button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../dropdown-menu';\n\n/**\n * Props for the {@link TableColumnHeader} component.\n *\n * Defines the properties needed to render a sortable table column header\n * with interactive sorting controls.\n *\n * @typeParam TData - The shape of the row data in the table.\n * @typeParam TValue - The type of the value in this specific column.\n */\nexport interface TableColumnHeaderProps<TData, TValue> extends HTMLAttributes<HTMLDivElement> {\n /**\n * The TanStack Table column instance for this header.\n *\n * This instance provides access to column state and sorting methods.\n * It's typically obtained from the `header.column` property when mapping\n * over header groups in TanStack Table.\n *\n * The column determines:\n * - Whether sorting is enabled (`getCanSort()`)\n * - Current sort direction (`getIsSorted()`)\n * - Methods to toggle sorting (`toggleSorting()`)\n *\n * @see {@link https://tanstack.com/table/latest/docs/api/core/column TanStack Column API}\n */\n column: Column<TData, TValue>;\n /**\n * The display text for the column header.\n *\n * This is the human-readable label that appears in the table header.\n * For sortable columns, this text appears in a button with sort indicators.\n * For non-sortable columns, it renders as plain text.\n *\n * @example\n * ```tsx\n * <TableColumnHeader column={column} title=\"Customer Name\" />\n * <TableColumnHeader column={column} title=\"Order Date\" />\n * ```\n */\n title: string;\n}\n\n/**\n * Renders a table column header with optional sorting functionality.\n *\n * This component automatically adapts based on whether the column supports sorting:\n * - **Sortable columns**: Renders an interactive button with a dropdown menu for\n * ascending/descending sort options and visual indicators for the current sort state\n * - **Non-sortable columns**: Renders plain text without interactive controls\n *\n * The component integrates seamlessly with TanStack Table's sorting system and\n * manages sort state through the provided column instance.\n *\n * @typeParam TData - The shape of the row data in the table.\n * @typeParam TValue - The type of the value in this specific column.\n *\n * @example\n * ```tsx\n * // In your column definitions:\n * const columns: ColumnDef<User>[] = [\n * {\n * accessorKey: 'name',\n * header: ({ column }) => (\n * <TableColumnHeader column={column} title=\"Name\" />\n * ),\n * enableSorting: true,\n * },\n * {\n * accessorKey: 'email',\n * header: ({ column }) => (\n * <TableColumnHeader column={column} title=\"Email\" />\n * ),\n * enableSorting: false,\n * },\n * ];\n * ```\n */\nexport function TableColumnHeader<TData, TValue>({\n column,\n title,\n className,\n}: TableColumnHeaderProps<TData, TValue>) {\n if (!column.getCanSort()) {\n return <div className={cn('text-xs font-medium', className)}>{title}</div>;\n }\n\n const isSorted = column.getIsSorted();\n\n return (\n <div className={cn('flex items-center space-x-2', className)}>\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"transparent\"\n size=\"xs\"\n className=\"-ml-12 h-32 px-8 data-[state=open]:bg-background-components-hover gap-0\"\n >\n <span className=\"text-xs font-medium text-foreground-neutral-subtle\">{title}</span>\n {isSorted === 'desc' ? (\n <Icon\n name=\"arrowDownLongLine\"\n className=\"ml-2 size-14 text-foreground-neutral-muted\"\n />\n ) : isSorted === 'asc' ? (\n <Icon name=\"arrowUpLongLine\" className=\"ml-2 size-14 text-foreground-neutral-muted\" />\n ) : (\n <Icon name=\"arrowUpDownLine\" className=\"ml-4 size-16 text-foreground-neutral-muted\" />\n )}\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" size=\"sm\">\n <DropdownMenuItem\n icon=\"arrowUpLongLine\"\n onClick={() => column.toggleSorting(false)}\n closeOnSelect\n >\n Asc\n </DropdownMenuItem>\n <DropdownMenuItem\n icon=\"arrowDownLongLine\"\n onClick={() => column.toggleSorting(true)}\n closeOnSelect\n >\n Desc\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n );\n}\n"],"names":["Icon","cn","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","TableColumnHeader","column","title","className","getCanSort","div","isSorted","getIsSorted","asChild","variant","size","span","name","align","icon","onClick","toggleSorting","closeOnSelect"],"mappings":";AACA,SAAQA,IAAI,QAAO,kBAAkB;AAErC,SAAQC,EAAE,QAAO,WAAW;AAC5B,SAAQC,MAAM,QAAO,YAAY;AACjC,SACEC,YAAY,EACZC,mBAAmB,EACnBC,gBAAgB,EAChBC,mBAAmB,QACd,mBAAmB;AA2C1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCC,GACD,OAAO,SAASC,kBAAiC,EAC/CC,MAAM,EACNC,KAAK,EACLC,SAAS,EAC6B;IACtC,IAAI,CAACF,OAAOG,UAAU,IAAI;QACxB,qBAAO,KAACC;YAAIF,WAAWT,GAAG,uBAAuBS;sBAAaD;;IAChE;IAEA,MAAMI,WAAWL,OAAOM,WAAW;IAEnC,qBACE,KAACF;QAAIF,WAAWT,GAAG,+BAA+BS;kBAChD,cAAA,MAACP;;8BACC,KAACG;oBAAoBS,OAAO;8BAC1B,cAAA,MAACb;wBACCc,SAAQ;wBACRC,MAAK;wBACLP,WAAU;;0CAEV,KAACQ;gCAAKR,WAAU;0CAAsDD;;4BACrEI,aAAa,uBACZ,KAACb;gCACCmB,MAAK;gCACLT,WAAU;iCAEVG,aAAa,sBACf,KAACb;gCAAKmB,MAAK;gCAAkBT,WAAU;+CAEvC,KAACV;gCAAKmB,MAAK;gCAAkBT,WAAU;;;;;8BAI7C,MAACN;oBAAoBgB,OAAM;oBAAQH,MAAK;;sCACtC,KAACZ;4BACCgB,MAAK;4BACLC,SAAS,IAAMd,OAAOe,aAAa,CAAC;4BACpCC,aAAa;sCACd;;sCAGD,KAACnB;4BACCgB,MAAK;4BACLC,SAAS,IAAMd,OAAOe,aAAa,CAAC;4BACpCC,aAAa;sCACd;;;;;;;AAOX"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Table } from '@tanstack/react-table';
|
|
2
|
+
import type { ComponentProps } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the {@link TablePagination} component.
|
|
5
|
+
*
|
|
6
|
+
* Provides pagination controls for data tables, including page navigation,
|
|
7
|
+
* page size selection, and row count displays.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam TData - The shape of the row data in the table.
|
|
10
|
+
*/
|
|
11
|
+
interface TablePaginationProps<TData> extends ComponentProps<'tfoot'> {
|
|
12
|
+
/**
|
|
13
|
+
* The TanStack Table instance that manages the table state and behavior.
|
|
14
|
+
*
|
|
15
|
+
* This is typically created using `useReactTable` from `@tanstack/react-table`.
|
|
16
|
+
* The table instance provides access to pagination state, row data, and methods
|
|
17
|
+
* for controlling pagination (e.g., `setPageSize`, `nextPage`, `previousPage`).
|
|
18
|
+
*
|
|
19
|
+
* @see {@link https://tanstack.com/table/latest/docs/api/core/table TanStack Table API}
|
|
20
|
+
*/
|
|
21
|
+
table: Table<TData>;
|
|
22
|
+
/**
|
|
23
|
+
* Array of page size options to display in the page size selector.
|
|
24
|
+
* When provided, a dropdown will be rendered allowing users to change the number of rows per page.
|
|
25
|
+
*
|
|
26
|
+
* @default [10, 20, 50, 100]
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <TablePagination table={table} pageSizeOptions={[10, 25, 50]} />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
pageSizeOptions?: number[];
|
|
33
|
+
/**
|
|
34
|
+
* When `true`, displays the count of selected rows instead of pagination range.
|
|
35
|
+
*
|
|
36
|
+
* - If `true`: Shows "X of Y row(s) selected" where X is the number of selected rows
|
|
37
|
+
* - If `false`: Shows "A — B of C results" where A-B is the current page range
|
|
38
|
+
*
|
|
39
|
+
* This is useful when row selection is enabled and you want to give users feedback
|
|
40
|
+
* on how many rows they have selected.
|
|
41
|
+
*
|
|
42
|
+
* @default false
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* <TablePagination table={table} showSelectedCount={true} />
|
|
46
|
+
* // Displays: "5 of 100 row(s) selected"
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
showSelectedCount?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare function TablePagination<TData>({ table, className, pageSizeOptions, showSelectedCount, ...props }: TablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=table-pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-pagination.d.ts","sourceRoot":"","sources":["../../../src/components/table/table-pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAM1C;;;;;;;GAOG;AACH,UAAU,oBAAoB,CAAC,KAAK,CAAE,SAAQ,cAAc,CAAC,OAAO,CAAC;IACnE;;;;;;;;OAQG;IACH,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpB;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B;;;;;;;;;;;;;;;OAeG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,EACrC,KAAK,EACL,SAAS,EACT,eAAmC,EACnC,iBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,KAAK,CAAC,2CAiG7B"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '../../components/typography/index.js';
|
|
3
|
+
import { Button } from '../button/index.js';
|
|
4
|
+
import { Icon } from '../icon/index.js';
|
|
5
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../select/select.js';
|
|
6
|
+
import { TableCell, TableFooter, TableRow } from './table.js';
|
|
7
|
+
export function TablePagination({ table, className, pageSizeOptions = [
|
|
8
|
+
10,
|
|
9
|
+
20,
|
|
10
|
+
50,
|
|
11
|
+
100
|
|
12
|
+
], showSelectedCount = false, ...props }) {
|
|
13
|
+
const currentPage = table.getState().pagination.pageIndex + 1;
|
|
14
|
+
const pageSize = table.getState().pagination.pageSize;
|
|
15
|
+
const totalRows = table.getFilteredRowModel().rows.length;
|
|
16
|
+
const startRow = totalRows === 0 ? 0 : currentPage === 1 ? 1 : (currentPage - 1) * pageSize + 1;
|
|
17
|
+
const endRow = Math.min(currentPage * pageSize, totalRows);
|
|
18
|
+
return /*#__PURE__*/ _jsx(TableFooter, {
|
|
19
|
+
className: className,
|
|
20
|
+
...props,
|
|
21
|
+
children: /*#__PURE__*/ _jsx(TableRow, {
|
|
22
|
+
className: "hover:bg-transparent",
|
|
23
|
+
children: /*#__PURE__*/ _jsx(TableCell, {
|
|
24
|
+
colSpan: table.getAllColumns().length,
|
|
25
|
+
className: "group-hover/row:bg-transparent",
|
|
26
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
27
|
+
className: "flex items-center justify-between gap-16",
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
30
|
+
className: "flex items-center gap-16",
|
|
31
|
+
children: [
|
|
32
|
+
showSelectedCount && /*#__PURE__*/ _jsxs(Text, {
|
|
33
|
+
size: "sm",
|
|
34
|
+
className: "text-foreground-neutral-muted",
|
|
35
|
+
children: [
|
|
36
|
+
table.getFilteredSelectedRowModel().rows.length,
|
|
37
|
+
" of ",
|
|
38
|
+
totalRows,
|
|
39
|
+
" row(s) selected"
|
|
40
|
+
]
|
|
41
|
+
}),
|
|
42
|
+
!showSelectedCount && /*#__PURE__*/ _jsxs(Text, {
|
|
43
|
+
size: "sm",
|
|
44
|
+
className: "text-foreground-neutral-muted",
|
|
45
|
+
children: [
|
|
46
|
+
startRow,
|
|
47
|
+
" — ",
|
|
48
|
+
endRow,
|
|
49
|
+
" of ",
|
|
50
|
+
totalRows,
|
|
51
|
+
" results"
|
|
52
|
+
]
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
55
|
+
className: "flex items-center gap-8",
|
|
56
|
+
children: [
|
|
57
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
58
|
+
size: "sm",
|
|
59
|
+
className: "text-foreground-neutral-muted",
|
|
60
|
+
children: "Rows per page"
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ _jsxs(Select, {
|
|
63
|
+
value: String(pageSize),
|
|
64
|
+
onValueChange: (value)=>{
|
|
65
|
+
table.setPageSize(Number(value));
|
|
66
|
+
},
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ _jsx(SelectTrigger, {
|
|
69
|
+
className: "h-28 w-80",
|
|
70
|
+
size: "small",
|
|
71
|
+
children: /*#__PURE__*/ _jsx(SelectValue, {})
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ _jsx(SelectContent, {
|
|
74
|
+
children: pageSizeOptions.map((size)=>/*#__PURE__*/ _jsx(SelectItem, {
|
|
75
|
+
value: String(size),
|
|
76
|
+
children: size
|
|
77
|
+
}, size))
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
}),
|
|
85
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
86
|
+
className: "flex items-center",
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
89
|
+
variant: "transparent",
|
|
90
|
+
size: "xs",
|
|
91
|
+
onClick: ()=>table.setPageIndex(0),
|
|
92
|
+
disabled: !table.getCanPreviousPage(),
|
|
93
|
+
className: "h-32 w-32 p-0",
|
|
94
|
+
"aria-label": "Go to first page",
|
|
95
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
96
|
+
name: "arrowLeftDoubleLine",
|
|
97
|
+
className: "size-16"
|
|
98
|
+
})
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
101
|
+
variant: "transparent",
|
|
102
|
+
size: "xs",
|
|
103
|
+
onClick: ()=>table.previousPage(),
|
|
104
|
+
disabled: !table.getCanPreviousPage(),
|
|
105
|
+
className: "h-32 px-12",
|
|
106
|
+
"aria-label": "Go to previous page",
|
|
107
|
+
children: "Prev"
|
|
108
|
+
}),
|
|
109
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
110
|
+
variant: "transparent",
|
|
111
|
+
size: "xs",
|
|
112
|
+
onClick: ()=>table.nextPage(),
|
|
113
|
+
disabled: !table.getCanNextPage(),
|
|
114
|
+
className: "h-32 px-12",
|
|
115
|
+
"aria-label": "Go to next page",
|
|
116
|
+
children: "Next"
|
|
117
|
+
}),
|
|
118
|
+
/*#__PURE__*/ _jsx(Button, {
|
|
119
|
+
variant: "transparent",
|
|
120
|
+
size: "xs",
|
|
121
|
+
onClick: ()=>table.setPageIndex(table.getPageCount() - 1),
|
|
122
|
+
disabled: !table.getCanNextPage(),
|
|
123
|
+
className: "h-32 w-32 p-0",
|
|
124
|
+
"aria-label": "Go to last page",
|
|
125
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
126
|
+
name: "arrowRightDoubleLine",
|
|
127
|
+
className: "size-16"
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=table-pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table-pagination.tsx"],"sourcesContent":["import type {Table} from '@tanstack/react-table';\nimport {Text} from 'components/typography';\nimport type {ComponentProps} from 'react';\nimport {Button} from '../button';\nimport {Icon} from '../icon';\nimport {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from '../select/select';\nimport {TableCell, TableFooter, TableRow} from './table';\n\n/**\n * Props for the {@link TablePagination} component.\n *\n * Provides pagination controls for data tables, including page navigation,\n * page size selection, and row count displays.\n *\n * @typeParam TData - The shape of the row data in the table.\n */\ninterface TablePaginationProps<TData> extends ComponentProps<'tfoot'> {\n /**\n * The TanStack Table instance that manages the table state and behavior.\n *\n * This is typically created using `useReactTable` from `@tanstack/react-table`.\n * The table instance provides access to pagination state, row data, and methods\n * for controlling pagination (e.g., `setPageSize`, `nextPage`, `previousPage`).\n *\n * @see {@link https://tanstack.com/table/latest/docs/api/core/table TanStack Table API}\n */\n table: Table<TData>;\n /**\n * Array of page size options to display in the page size selector.\n * When provided, a dropdown will be rendered allowing users to change the number of rows per page.\n *\n * @default [10, 20, 50, 100]\n * @example\n * ```tsx\n * <TablePagination table={table} pageSizeOptions={[10, 25, 50]} />\n * ```\n */\n pageSizeOptions?: number[];\n /**\n * When `true`, displays the count of selected rows instead of pagination range.\n *\n * - If `true`: Shows \"X of Y row(s) selected\" where X is the number of selected rows\n * - If `false`: Shows \"A — B of C results\" where A-B is the current page range\n *\n * This is useful when row selection is enabled and you want to give users feedback\n * on how many rows they have selected.\n *\n * @default false\n * @example\n * ```tsx\n * <TablePagination table={table} showSelectedCount={true} />\n * // Displays: \"5 of 100 row(s) selected\"\n * ```\n */\n showSelectedCount?: boolean;\n}\n\nexport function TablePagination<TData>({\n table,\n className,\n pageSizeOptions = [10, 20, 50, 100],\n showSelectedCount = false,\n ...props\n}: TablePaginationProps<TData>) {\n const currentPage = table.getState().pagination.pageIndex + 1;\n const pageSize = table.getState().pagination.pageSize;\n const totalRows = table.getFilteredRowModel().rows.length;\n const startRow = totalRows === 0 ? 0 : currentPage === 1 ? 1 : (currentPage - 1) * pageSize + 1;\n const endRow = Math.min(currentPage * pageSize, totalRows);\n\n return (\n <TableFooter className={className} {...props}>\n <TableRow className=\"hover:bg-transparent\">\n <TableCell\n colSpan={table.getAllColumns().length}\n className=\"group-hover/row:bg-transparent\"\n >\n <div className=\"flex items-center justify-between gap-16\">\n <div className=\"flex items-center gap-16\">\n {showSelectedCount && (\n <Text size=\"sm\" className=\"text-foreground-neutral-muted\">\n {table.getFilteredSelectedRowModel().rows.length} of {totalRows} row(s) selected\n </Text>\n )}\n {!showSelectedCount && (\n <Text size=\"sm\" className=\"text-foreground-neutral-muted\">\n {startRow} — {endRow} of {totalRows} results\n </Text>\n )}\n <div className=\"flex items-center gap-8\">\n <Text size=\"sm\" className=\"text-foreground-neutral-muted\">\n Rows per page\n </Text>\n <Select\n value={String(pageSize)}\n onValueChange={(value) => {\n table.setPageSize(Number(value));\n }}\n >\n <SelectTrigger className=\"h-28 w-80\" size=\"small\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {pageSizeOptions.map((size) => (\n <SelectItem key={size} value={String(size)}>\n {size}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </div>\n </div>\n\n <div className=\"flex items-center\">\n <Button\n variant=\"transparent\"\n size=\"xs\"\n onClick={() => table.setPageIndex(0)}\n disabled={!table.getCanPreviousPage()}\n className=\"h-32 w-32 p-0\"\n aria-label=\"Go to first page\"\n >\n <Icon name=\"arrowLeftDoubleLine\" className=\"size-16\" />\n </Button>\n <Button\n variant=\"transparent\"\n size=\"xs\"\n onClick={() => table.previousPage()}\n disabled={!table.getCanPreviousPage()}\n className=\"h-32 px-12\"\n aria-label=\"Go to previous page\"\n >\n Prev\n </Button>\n <Button\n variant=\"transparent\"\n size=\"xs\"\n onClick={() => table.nextPage()}\n disabled={!table.getCanNextPage()}\n className=\"h-32 px-12\"\n aria-label=\"Go to next page\"\n >\n Next\n </Button>\n <Button\n variant=\"transparent\"\n size=\"xs\"\n onClick={() => table.setPageIndex(table.getPageCount() - 1)}\n disabled={!table.getCanNextPage()}\n className=\"h-32 w-32 p-0\"\n aria-label=\"Go to last page\"\n >\n <Icon name=\"arrowRightDoubleLine\" className=\"size-16\" />\n </Button>\n </div>\n </div>\n </TableCell>\n </TableRow>\n </TableFooter>\n );\n}\n"],"names":["Text","Button","Icon","Select","SelectContent","SelectItem","SelectTrigger","SelectValue","TableCell","TableFooter","TableRow","TablePagination","table","className","pageSizeOptions","showSelectedCount","props","currentPage","getState","pagination","pageIndex","pageSize","totalRows","getFilteredRowModel","rows","length","startRow","endRow","Math","min","colSpan","getAllColumns","div","size","getFilteredSelectedRowModel","value","String","onValueChange","setPageSize","Number","map","variant","onClick","setPageIndex","disabled","getCanPreviousPage","aria-label","name","previousPage","nextPage","getCanNextPage","getPageCount"],"mappings":";AACA,SAAQA,IAAI,QAAO,wBAAwB;AAE3C,SAAQC,MAAM,QAAO,YAAY;AACjC,SAAQC,IAAI,QAAO,UAAU;AAC7B,SAAQC,MAAM,EAAEC,aAAa,EAAEC,UAAU,EAAEC,aAAa,EAAEC,WAAW,QAAO,mBAAmB;AAC/F,SAAQC,SAAS,EAAEC,WAAW,EAAEC,QAAQ,QAAO,UAAU;AAmDzD,OAAO,SAASC,gBAAuB,EACrCC,KAAK,EACLC,SAAS,EACTC,kBAAkB;IAAC;IAAI;IAAI;IAAI;CAAI,EACnCC,oBAAoB,KAAK,EACzB,GAAGC,OACyB;IAC5B,MAAMC,cAAcL,MAAMM,QAAQ,GAAGC,UAAU,CAACC,SAAS,GAAG;IAC5D,MAAMC,WAAWT,MAAMM,QAAQ,GAAGC,UAAU,CAACE,QAAQ;IACrD,MAAMC,YAAYV,MAAMW,mBAAmB,GAAGC,IAAI,CAACC,MAAM;IACzD,MAAMC,WAAWJ,cAAc,IAAI,IAAIL,gBAAgB,IAAI,IAAI,AAACA,CAAAA,cAAc,CAAA,IAAKI,WAAW;IAC9F,MAAMM,SAASC,KAAKC,GAAG,CAACZ,cAAcI,UAAUC;IAEhD,qBACE,KAACb;QAAYI,WAAWA;QAAY,GAAGG,KAAK;kBAC1C,cAAA,KAACN;YAASG,WAAU;sBAClB,cAAA,KAACL;gBACCsB,SAASlB,MAAMmB,aAAa,GAAGN,MAAM;gBACrCZ,WAAU;0BAEV,cAAA,MAACmB;oBAAInB,WAAU;;sCACb,MAACmB;4BAAInB,WAAU;;gCACZE,mCACC,MAACf;oCAAKiC,MAAK;oCAAKpB,WAAU;;wCACvBD,MAAMsB,2BAA2B,GAAGV,IAAI,CAACC,MAAM;wCAAC;wCAAKH;wCAAU;;;gCAGnE,CAACP,mCACA,MAACf;oCAAKiC,MAAK;oCAAKpB,WAAU;;wCACvBa;wCAAS;wCAAIC;wCAAO;wCAAKL;wCAAU;;;8CAGxC,MAACU;oCAAInB,WAAU;;sDACb,KAACb;4CAAKiC,MAAK;4CAAKpB,WAAU;sDAAgC;;sDAG1D,MAACV;4CACCgC,OAAOC,OAAOf;4CACdgB,eAAe,CAACF;gDACdvB,MAAM0B,WAAW,CAACC,OAAOJ;4CAC3B;;8DAEA,KAAC7B;oDAAcO,WAAU;oDAAYoB,MAAK;8DACxC,cAAA,KAAC1B;;8DAEH,KAACH;8DACEU,gBAAgB0B,GAAG,CAAC,CAACP,qBACpB,KAAC5B;4DAAsB8B,OAAOC,OAAOH;sEAClCA;2DADcA;;;;;;;;sCAS3B,MAACD;4BAAInB,WAAU;;8CACb,KAACZ;oCACCwC,SAAQ;oCACRR,MAAK;oCACLS,SAAS,IAAM9B,MAAM+B,YAAY,CAAC;oCAClCC,UAAU,CAAChC,MAAMiC,kBAAkB;oCACnChC,WAAU;oCACViC,cAAW;8CAEX,cAAA,KAAC5C;wCAAK6C,MAAK;wCAAsBlC,WAAU;;;8CAE7C,KAACZ;oCACCwC,SAAQ;oCACRR,MAAK;oCACLS,SAAS,IAAM9B,MAAMoC,YAAY;oCACjCJ,UAAU,CAAChC,MAAMiC,kBAAkB;oCACnChC,WAAU;oCACViC,cAAW;8CACZ;;8CAGD,KAAC7C;oCACCwC,SAAQ;oCACRR,MAAK;oCACLS,SAAS,IAAM9B,MAAMqC,QAAQ;oCAC7BL,UAAU,CAAChC,MAAMsC,cAAc;oCAC/BrC,WAAU;oCACViC,cAAW;8CACZ;;8CAGD,KAAC7C;oCACCwC,SAAQ;oCACRR,MAAK;oCACLS,SAAS,IAAM9B,MAAM+B,YAAY,CAAC/B,MAAMuC,YAAY,KAAK;oCACzDP,UAAU,CAAChC,MAAMsC,cAAc;oCAC/BrC,WAAU;oCACViC,cAAW;8CAEX,cAAA,KAAC5C;wCAAK6C,MAAK;wCAAuBlC,WAAU;;;;;;;;;;AAQ5D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
declare function Table({ className, ...props }: ComponentProps<'table'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function TableHeader({ className, ...props }: ComponentProps<'thead'>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function TableBody({ className, ...props }: ComponentProps<'tbody'>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function TableFooter({ className, ...props }: ComponentProps<'tfoot'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function TableRow({ className, ...props }: ComponentProps<'tr'>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function TableHead({ className, ...props }: ComponentProps<'th'>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function TableCell({ className, ...props }: ComponentProps<'td'>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function TableCaption({ className, ...props }: ComponentProps<'caption'>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption };
|
|
11
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/components/table/table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAG1C,iBAAS,KAAK,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,OAAO,CAAC,2CAU5D;AAED,iBAAS,WAAW,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,OAAO,CAAC,2CAElE;AAED,iBAAS,SAAS,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,OAAO,CAAC,2CAEhE;AAED,iBAAS,WAAW,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,OAAO,CAAC,2CAWlE;AAED,iBAAS,QAAQ,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,IAAI,CAAC,2CAc5D;AAED,iBAAS,SAAS,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,IAAI,CAAC,2CAa7D;AAED,iBAAS,SAAS,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,IAAI,CAAC,2CAe7D;AAED,iBAAS,YAAY,CAAC,EAAC,SAAS,EAAE,GAAG,KAAK,EAAC,EAAE,cAAc,CAAC,SAAS,CAAC,2CAQrE;AAED,OAAO,EAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../utils/cn.js';
|
|
3
|
+
function Table({ className, ...props }) {
|
|
4
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
5
|
+
className: "relative w-full overflow-auto scrollbar",
|
|
6
|
+
children: /*#__PURE__*/ _jsx("table", {
|
|
7
|
+
"data-slot": "table",
|
|
8
|
+
className: cn('w-full caption-bottom text-sm', className),
|
|
9
|
+
...props
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function TableHeader({ className, ...props }) {
|
|
14
|
+
return /*#__PURE__*/ _jsx("thead", {
|
|
15
|
+
"data-slot": "table-header",
|
|
16
|
+
className: cn(className),
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function TableBody({ className, ...props }) {
|
|
21
|
+
return /*#__PURE__*/ _jsx("tbody", {
|
|
22
|
+
"data-slot": "table-body",
|
|
23
|
+
className: cn(className),
|
|
24
|
+
...props
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function TableFooter({ className, ...props }) {
|
|
28
|
+
return /*#__PURE__*/ _jsx("tfoot", {
|
|
29
|
+
"data-slot": "table-footer",
|
|
30
|
+
className: cn('border-t border-border-neutral-base bg-background-neutral-base font-medium', className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function TableRow({ className, ...props }) {
|
|
35
|
+
return /*#__PURE__*/ _jsx("tr", {
|
|
36
|
+
"data-slot": "table-row",
|
|
37
|
+
className: cn('group/row border-b border-border-neutral-base transition-colors', '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
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function TableHead({ className, ...props }) {
|
|
42
|
+
return /*#__PURE__*/ _jsx("th", {
|
|
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),
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function TableCell({ className, ...props }) {
|
|
49
|
+
return /*#__PURE__*/ _jsx("td", {
|
|
50
|
+
"data-slot": "table-cell",
|
|
51
|
+
className: cn('px-12 py-10 align-middle text-sm leading-20 text-foreground-neutral-base', 'bg-background-neutral-base', 'group-hover/row:bg-background-neutral-hover', 'group-data-[selected=true]/row:bg-background-neutral-pressed!', '[&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:pt-14', className),
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function TableCaption({ className, ...props }) {
|
|
56
|
+
return /*#__PURE__*/ _jsx("caption", {
|
|
57
|
+
"data-slot": "table-caption",
|
|
58
|
+
className: cn('mt-16 text-sm text-foreground-neutral-muted', className),
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export { Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import type {ComponentProps} from 'react';\nimport {cn} from 'utils/cn';\n\nfunction Table({className, ...props}: ComponentProps<'table'>) {\n return (\n <div className=\"relative w-full overflow-auto scrollbar\">\n <table\n data-slot=\"table\"\n className={cn('w-full caption-bottom text-sm', className)}\n {...props}\n />\n </div>\n );\n}\n\nfunction TableHeader({className, ...props}: ComponentProps<'thead'>) {\n return <thead data-slot=\"table-header\" className={cn(className)} {...props} />;\n}\n\nfunction TableBody({className, ...props}: ComponentProps<'tbody'>) {\n return <tbody data-slot=\"table-body\" className={cn(className)} {...props} />;\n}\n\nfunction TableFooter({className, ...props}: ComponentProps<'tfoot'>) {\n return (\n <tfoot\n data-slot=\"table-footer\"\n className={cn(\n 'border-t border-border-neutral-base bg-background-neutral-base font-medium',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction TableRow({className, ...props}: ComponentProps<'tr'>) {\n return (\n <tr\n data-slot=\"table-row\"\n className={cn(\n 'group/row border-b border-border-neutral-base transition-colors',\n 'last:border-b-0',\n 'hover:bg-background-neutral-hover',\n 'data-[selected=true]:bg-background-neutral-pressed data-[selected=true]:hover:bg-background-neutral-pressed',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction TableHead({className, ...props}: ComponentProps<'th'>) {\n return (\n <th\n data-slot=\"table-head\"\n className={cn(\n 'h-40 px-16 text-left align-middle text-xs font-medium leading-20 text-foreground-neutral-subtle',\n 'bg-background-subtle-base',\n '[&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:px-12 [&:has([role=checkbox])]:w-0 [&:has([role=checkbox])]:pt-6',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction TableCell({className, ...props}: ComponentProps<'td'>) {\n return (\n <td\n data-slot=\"table-cell\"\n className={cn(\n 'px-12 py-10 align-middle text-sm leading-20 text-foreground-neutral-base',\n 'bg-background-neutral-base',\n 'group-hover/row:bg-background-neutral-hover',\n 'group-data-[selected=true]/row:bg-background-neutral-pressed!',\n '[&:has([role=checkbox])]:pr-0 [&:has([role=checkbox])]:pt-14',\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction TableCaption({className, ...props}: ComponentProps<'caption'>) {\n return (\n <caption\n data-slot=\"table-caption\"\n className={cn('mt-16 text-sm text-foreground-neutral-muted', className)}\n {...props}\n />\n );\n}\n\nexport {Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption};\n"],"names":["cn","Table","className","props","div","table","data-slot","TableHeader","thead","TableBody","tbody","TableFooter","tfoot","TableRow","tr","TableHead","th","TableCell","td","TableCaption","caption"],"mappings":";AACA,SAAQA,EAAE,QAAO,WAAW;AAE5B,SAASC,MAAM,EAACC,SAAS,EAAE,GAAGC,OAA+B;IAC3D,qBACE,KAACC;QAAIF,WAAU;kBACb,cAAA,KAACG;YACCC,aAAU;YACVJ,WAAWF,GAAG,iCAAiCE;YAC9C,GAAGC,KAAK;;;AAIjB;AAEA,SAASI,YAAY,EAACL,SAAS,EAAE,GAAGC,OAA+B;IACjE,qBAAO,KAACK;QAAMF,aAAU;QAAeJ,WAAWF,GAAGE;QAAa,GAAGC,KAAK;;AAC5E;AAEA,SAASM,UAAU,EAACP,SAAS,EAAE,GAAGC,OAA+B;IAC/D,qBAAO,KAACO;QAAMJ,aAAU;QAAaJ,WAAWF,GAAGE;QAAa,GAAGC,KAAK;;AAC1E;AAEA,SAASQ,YAAY,EAACT,SAAS,EAAE,GAAGC,OAA+B;IACjE,qBACE,KAACS;QACCN,aAAU;QACVJ,WAAWF,GACT,8EACAE;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASU,SAAS,EAACX,SAAS,EAAE,GAAGC,OAA4B;IAC3D,qBACE,KAACW;QACCR,aAAU;QACVJ,WAAWF,GACT,mEACA,mBACA,qCACA,+GACAE;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASY,UAAU,EAACb,SAAS,EAAE,GAAGC,OAA4B;IAC5D,qBACE,KAACa;QACCV,aAAU;QACVJ,WAAWF,GACT,mGACA,6BACA,2HACAE;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASc,UAAU,EAACf,SAAS,EAAE,GAAGC,OAA4B;IAC5D,qBACE,KAACe;QACCZ,aAAU;QACVJ,WAAWF,GACT,4EACA,8BACA,+CACA,iEACA,gEACAE;QAED,GAAGC,KAAK;;AAGf;AAEA,SAASgB,aAAa,EAACjB,SAAS,EAAE,GAAGC,OAAiC;IACpE,qBACE,KAACiB;QACCd,aAAU;QACVJ,WAAWF,GAAG,+CAA+CE;QAC5D,GAAGC,KAAK;;AAGf;AAEA,SAAQF,KAAK,EAAEM,WAAW,EAAEE,SAAS,EAAEE,WAAW,EAAEE,QAAQ,EAAEE,SAAS,EAAEE,SAAS,EAAEE,YAAY,GAAE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Column definitions for Table stories
|
|
3
|
+
*/
|
|
4
|
+
import type { ColumnDef } from '@tanstack/react-table';
|
|
5
|
+
import type { JobData, SearchJobData, User } from './table.stories.data';
|
|
6
|
+
/**
|
|
7
|
+
* Create column definitions for JobData
|
|
8
|
+
*/
|
|
9
|
+
export declare const createJobColumns: () => ColumnDef<JobData>[];
|
|
10
|
+
/**
|
|
11
|
+
* Create column definitions for User data
|
|
12
|
+
*/
|
|
13
|
+
export declare const createUserColumns: () => ColumnDef<User>[];
|
|
14
|
+
/**
|
|
15
|
+
* Create column definitions for SearchJobData
|
|
16
|
+
*/
|
|
17
|
+
export declare const createSearchJobColumns: () => ColumnDef<SearchJobData>[];
|
|
18
|
+
/**
|
|
19
|
+
* Column instances for reuse in stories
|
|
20
|
+
*/
|
|
21
|
+
export declare const jobColumns: ColumnDef<JobData>[];
|
|
22
|
+
export declare const userColumns: ColumnDef<User>[];
|
|
23
|
+
export declare const searchJobColumns: ColumnDef<SearchJobData>[];
|
|
24
|
+
//# sourceMappingURL=table.stories.columns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.stories.columns.d.ts","sourceRoot":"","sources":["../../../src/components/table/table.stories.columns.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAGrD,OAAO,KAAK,EAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAC,MAAM,sBAAsB,CAAC;AAGvE;;GAEG;AACH,eAAO,MAAM,gBAAgB,QAAO,SAAS,CAAC,OAAO,CAAC,EAoErD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAO,SAAS,CAAC,IAAI,CAAC,EA8BnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAO,SAAS,CAAC,aAAa,CAAC,EAqEjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,sBAAqB,CAAC;AAC7C,eAAO,MAAM,WAAW,mBAAsB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,4BAA2B,CAAC"}
|