tabulify 1.0.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/.eslintrc.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "settings": {
3
+ "react": {
4
+ "version": "detect"
5
+ }
6
+ },
7
+ "env": {
8
+ "browser": true,
9
+ "es2021": true
10
+ },
11
+ "extends": [
12
+ "eslint:recommended",
13
+ "plugin:react/recommended",
14
+ "plugin:@typescript-eslint/recommended",
15
+ "airbnb",
16
+ "plugin:prettier/recommended"
17
+ ],
18
+ "parser": "@typescript-eslint/parser",
19
+ "parserOptions": {
20
+ "ecmaFeatures": {
21
+ "jsx": true
22
+ },
23
+ "ecmaVersion": "latest",
24
+ "sourceType": "module"
25
+ },
26
+ "plugins": ["react", "@typescript-eslint"],
27
+ "rules": {
28
+ "react/react-in-jsx-scope": "off",
29
+ "react/prop-types": "off",
30
+ "no-unused-vars": "warn",
31
+ "@typescript-eslint/no-unused-vars": ["warn"],
32
+ "jsx-a11y/anchor-is-valid": "off"
33
+ }
34
+ }
package/.prettierrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "singleQuote": true,
3
+ "semi": true,
4
+ "tabWidth": 2,
5
+ "trailingComma": "es5"
6
+ }
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Tabulify
2
+
3
+ `Tabulify` is a lightweight and flexible React table component designed for building customizable and feature-rich data tables. It supports features like pagination, row selection, and custom rendering.
4
+
5
+ ## Features
6
+
7
+ - **Customizable Columns**: Easily define columns and their renderers.
8
+ - **Row Selection**: Support for single and multiple row selection.
9
+ - **Pagination**: Built-in pagination for large datasets.
10
+ - **TypeScript Support**: Fully typed for TypeScript projects.
11
+
12
+ ## Installation
13
+
14
+ Install the package using npm or yarn:
15
+
16
+ ```bash
17
+ npm install tabulify
18
+ ```
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ interface PaginationProps {
3
+ pageSize: number;
4
+ total: number;
5
+ currentPage: number;
6
+ onPageChange: (page: number) => void;
7
+ }
8
+ declare const Pagination: React.FC<PaginationProps>;
9
+ export default Pagination;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { TableProps } from './types';
3
+ declare const Table: <T extends {
4
+ key: React.Key;
5
+ }>({ columns, dataSource, rowSelection, pagination, }: TableProps<T>) => any;
6
+ export default Table;
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ export interface Column<T> {
3
+ title: string;
4
+ dataIndex: keyof T;
5
+ key: string;
6
+ sorter?: (a: T, b: T) => number;
7
+ render?: (value: T[keyof T], record: T, index: number) => React.ReactNode;
8
+ }
9
+ export interface RowSelection<T> {
10
+ type: 'checkbox' | 'radio';
11
+ selectedRowKeys?: (keyof T)[];
12
+ onChange?: (selectedRowKeys: (keyof T)[], selectedRows: T[]) => void;
13
+ }
14
+ export interface Pagination {
15
+ pageSize: number;
16
+ total: number;
17
+ current?: number;
18
+ onChange?: (page: number) => void;
19
+ }
20
+ export interface TableProps<T extends {
21
+ key: React.Key;
22
+ }> {
23
+ columns: Column<T>[];
24
+ dataSource: T[];
25
+ rowSelection?: RowSelection<T>;
26
+ pagination?: Pagination;
27
+ }
@@ -0,0 +1,14 @@
1
+ import globals from "globals";
2
+ import pluginJs from "@eslint/js";
3
+ import tseslint from "typescript-eslint";
4
+ import pluginReact from "eslint-plugin-react";
5
+
6
+
7
+ /** @type {import('eslint').Linter.Config[]} */
8
+ export default [
9
+ {files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
10
+ {languageOptions: { globals: globals.browser }},
11
+ pluginJs.configs.recommended,
12
+ ...tseslint.configs.recommended,
13
+ pluginReact.configs.flat.recommended,
14
+ ];
package/jest.config.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { Config } from 'jest';
2
+
3
+ const config: Config = {
4
+ preset: 'ts-jest',
5
+ testEnvironment: 'jest-environment-jsdom',
6
+ testMatch: ['**/*.test.ts', '**/*.test.tsx'], // Match test files
7
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], // Resolve these extensions
8
+ };
9
+
10
+ export default config;
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "tabulify",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.esm.js",
9
+ "types": "dist/types/index.d.ts",
10
+ "build": "rollup -c",
11
+ "prepublishOnly": "npm run build",
12
+ "test": "jest",
13
+ "test:watch": "jest --watch",
14
+ "test:coverage": "jest --coverage",
15
+ "lint": "eslint . --quiet",
16
+ "lint:fix": "eslint . --fix"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "description": "",
22
+ "peerDependencies": {
23
+ "react": "^18.3.1",
24
+ "react-dom": "^18.3.1"
25
+ },
26
+ "devDependencies": {
27
+ "@eslint/js": "^9.15.0",
28
+ "@rollup/plugin-commonjs": "^28.0.1",
29
+ "@rollup/plugin-json": "^6.1.0",
30
+ "@rollup/plugin-node-resolve": "^15.3.0",
31
+ "@rollup/plugin-typescript": "^12.1.1",
32
+ "@testing-library/jest-dom": "^6.6.3",
33
+ "@types/jest": "^29.5.14",
34
+ "@types/mocha": "^10.0.9",
35
+ "@types/node": "^22.9.0",
36
+ "@types/testing-library__jest-dom": "^5.14.9",
37
+ "@typescript-eslint/eslint-plugin": "^8.15.0",
38
+ "@typescript-eslint/parser": "^8.15.0",
39
+ "eslint": "^9.15.0",
40
+ "eslint-config-prettier": "^9.1.0",
41
+ "eslint-plugin-prettier": "^5.2.1",
42
+ "eslint-plugin-react": "^7.37.2",
43
+ "globals": "^15.12.0",
44
+ "jest": "^29.7.0",
45
+ "jest-environment-jsdom": "^29.7.0",
46
+ "prettier": "^3.3.3",
47
+ "rollup": "^4.27.3",
48
+ "rollup-plugin-peer-deps-external": "^2.2.4",
49
+ "ts-jest": "^29.2.5",
50
+ "ts-node": "^10.9.2",
51
+ "typescript": "^5.6.3",
52
+ "typescript-eslint": "^8.15.0"
53
+ },
54
+ "dependencies": {
55
+ "@testing-library/react": "^16.0.1"
56
+ }
57
+ }