@kingteza/crud-component 1.0.25 → 1.0.27

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.
Files changed (2) hide show
  1. package/README.md +89 -0
  2. package/package.json +6 -8
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # @kingteza/crud-component
2
+
3
+ React CRUD component library built with Ant Design and TypeScript.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @kingteza/crud-component
9
+ ```
10
+
11
+ ## Prerequisites
12
+
13
+ This library has the following peer dependencies that need to be installed:
14
+
15
+ ```bash
16
+ npm install antd@^5.22.6 react@^18.3.1 react-dom@^18.3.1 react-router-dom@^7.0.0
17
+ ```
18
+
19
+ ## Setup
20
+
21
+ ### 1. Initialize translations
22
+
23
+ The library uses i18next for internationalization. You need to set it up before using the components:
24
+
25
+ ```typescript
26
+ import { setupI18n } from '@kingteza/crud-component';
27
+
28
+ // Basic setup with default English translations
29
+ setupI18n();
30
+
31
+ // Or with custom options
32
+ setupI18n({
33
+ language: 'en', // default language
34
+ translations: {
35
+ en: {
36
+ 'crud-component': {
37
+ // your custom translations
38
+ }
39
+ }
40
+ },
41
+ i18nInstance: existingI18nInstance // optional: use your existing i18n instance
42
+ });
43
+ ```
44
+
45
+ ### 2. Usage
46
+
47
+ ```typescript
48
+ import { CrudComponent } from '@kingteza/crud-component';
49
+ import { Button } from '@kingteza/crud-component/common';
50
+
51
+ function App() {
52
+ return (
53
+ <CrudComponent
54
+ fields={[
55
+ { type: "text", name: "name", label: "Name", required: true },
56
+ { type: "select", name: "status", label: "Status", options: [
57
+ { value: "active", label: "Active" },
58
+ { value: "inactive", label: "Inactive" }
59
+ ]}
60
+ ]}
61
+ data={[]}
62
+ onSave={(data) => console.log(data)}
63
+ />
64
+ );
65
+ }
66
+ ```
67
+
68
+ ### 3. Available Imports
69
+
70
+ The library provides several entry points for importing components:
71
+
72
+ ```typescript
73
+ // Main CRUD component
74
+ import { CrudComponent } from '@kingteza/crud-component';
75
+
76
+ // Common components
77
+ import { Button, Select, DatePicker } from '@kingteza/crud-component/common';
78
+
79
+ // Utility functions
80
+ import { DateUtil } from '@kingteza/crud-component/util';
81
+ ```
82
+
83
+ ## Documentation
84
+
85
+ For detailed documentation of components and their props, please visit our [GitHub repository](https://github.com/kingteza/crud-component).
86
+
87
+ ## License
88
+
89
+ MIT
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.25",
4
+ "version": "1.0.27",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",
@@ -25,15 +25,15 @@
25
25
  "/components/",
26
26
  "/util/",
27
27
  "/locale/",
28
- "../README.md"
28
+ "/README.md"
29
29
  ],
30
30
  "type": "module",
31
31
  "sideEffects": false,
32
32
  "scripts": {
33
33
  "dev": "vite",
34
34
  "clean": "rm -rf dist",
35
- "build": "npm run clean && tsc && vite build && cp package.json dist/",
36
- "publish-npm": "yarn build && cd dist && npm publish",
35
+ "build": "npm run clean && tsc && vite build && cp package.json README.md dist/",
36
+ "publish-npm": "yarn build && cd dist && npm whoami >/dev/null 2>&1 || npm login && npm publish",
37
37
  "lint": "eslint .",
38
38
  "preview": "vite preview"
39
39
  },
@@ -67,9 +67,7 @@
67
67
  "mime": "^4.0.6",
68
68
  "papaparse": "^5.4.1",
69
69
  "path-browserify": "^1.0.1",
70
- "react": "^18.3.1",
71
70
  "react-cropper": "^2.3.3",
72
- "react-dom": "^18.3.1",
73
71
  "react-highlight-words": "^0.20.0",
74
72
  "react-i18next": "^15.2.0",
75
73
  "react-responsive": "^10.0.0",
@@ -91,8 +89,8 @@
91
89
  "eslint-plugin-react-hooks": "^5.0.0",
92
90
  "eslint-plugin-react-refresh": "^0.4.16",
93
91
  "globals": "^15.14.0",
94
- "react": "^18.0.0",
95
- "react-dom": "^18.0.0",
92
+ "react": "^18.3.1",
93
+ "react-dom": "^18.3.1",
96
94
  "react-router-dom": "^7.0.2",
97
95
  "tsup": "^8.3.5",
98
96
  "typescript": "~5.6.2",