@eintrek/erp-theme 1.0.4 → 1.4.4

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 (45) hide show
  1. package/dist/components/data-table/data-table-cell.d.ts +35 -0
  2. package/dist/components/data-table/data-table-column-header.d.ts +9 -0
  3. package/dist/components/data-table/data-table-config.d.ts +124 -0
  4. package/dist/components/data-table/data-table-date-filter.d.ts +8 -0
  5. package/dist/components/data-table/data-table-faceted-filter.d.ts +10 -0
  6. package/dist/components/data-table/data-table-filter-dropdown.d.ts +12 -0
  7. package/dist/components/data-table/data-table-filter-list.d.ts +11 -0
  8. package/dist/components/data-table/data-table-pagination.d.ts +21 -0
  9. package/dist/components/data-table/data-table-range-filter.d.ts +11 -0
  10. package/dist/components/data-table/data-table-skeleton.d.ts +11 -0
  11. package/dist/components/data-table/data-table-slider-filter.d.ts +6 -0
  12. package/dist/components/data-table/data-table-sort-list.d.ts +8 -0
  13. package/dist/components/data-table/data-table-toolbar.d.ts +12 -0
  14. package/dist/components/data-table/data-table-types.d.ts +115 -0
  15. package/dist/components/data-table/data-table-view-options.d.ts +6 -0
  16. package/dist/components/data-table/data-table.d.ts +11 -0
  17. package/dist/components/data-table/hooks/use-callback-ref.d.ts +9 -0
  18. package/dist/components/data-table/hooks/use-data-table.d.ts +24 -0
  19. package/dist/components/data-table/hooks/use-debounced-callback.d.ts +4 -0
  20. package/dist/components/data-table/hooks/use-media-query.d.ts +1 -0
  21. package/dist/components/data-table/index.d.ts +17 -0
  22. package/dist/components/ui/custom-select-field2.d.ts +18 -0
  23. package/dist/components/ui/date-picker-field.d.ts +13 -0
  24. package/dist/components/ui/date-picker.d.ts +19 -0
  25. package/dist/components/ui/file-uploader.d.ts +33 -0
  26. package/dist/components/ui/form-skeleton.d.ts +11 -0
  27. package/dist/components/ui/input-field.d.ts +13 -0
  28. package/dist/components/ui/loading-screen.d.ts +1 -0
  29. package/dist/components/ui/page-header.d.ts +7 -0
  30. package/dist/components/ui/select-field.d.ts +31 -0
  31. package/dist/components/ui/textarea-field.d.ts +13 -0
  32. package/dist/components/ui/validation-errors.d.ts +25 -0
  33. package/dist/hooks/use-debounce.d.ts +1 -0
  34. package/dist/index.css +1 -1
  35. package/dist/index.d.ts +16 -0
  36. package/dist/index.esm.css +1 -1
  37. package/dist/index.esm.js +16123 -5962
  38. package/dist/index.esm.js.map +1 -1
  39. package/dist/index.js +16182 -5967
  40. package/dist/index.js.map +1 -1
  41. package/dist/lib/baht-text.d.ts +1 -0
  42. package/dist/lib/date-utils.d.ts +71 -0
  43. package/dist/lib/file.d.ts +20 -0
  44. package/dist/lib/format.d.ts +35 -0
  45. package/package.json +7 -4
@@ -0,0 +1 @@
1
+ export declare function thaiBahtText(amount: number): string;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Thai month names in Buddhist calendar
3
+ */
4
+ export declare const THAI_MONTH_NAMES: string[];
5
+ /**
6
+ * Convert Gregorian year to Buddhist year
7
+ * Buddhist calendar is 543 years ahead of Gregorian calendar
8
+ *
9
+ * @param gregorianYear - The Gregorian year (e.g., 2024)
10
+ * @returns The Buddhist year (e.g., 2567)
11
+ *
12
+ * @example
13
+ * toBuddhistYear(2024); // returns 2567
14
+ */
15
+ export declare function toBuddhistYear(gregorianYear: number): number;
16
+ /**
17
+ * Convert Buddhist year to Gregorian year
18
+ *
19
+ * @param buddhistYear - The Buddhist year (e.g., 2567)
20
+ * @returns The Gregorian year (e.g., 2024)
21
+ *
22
+ * @example
23
+ * toGregorianYear(2567); // returns 2024
24
+ */
25
+ export declare function toGregorianYear(buddhistYear: number): number;
26
+ /**
27
+ * Get the first and last day of a month
28
+ *
29
+ * @param date - The date within the month
30
+ * @returns Object with start and end dates of the month
31
+ *
32
+ * @example
33
+ * getMonthDateRange(new Date('2024-06-15'));
34
+ * // returns { start: Date('2024-06-01'), end: Date('2024-06-30') }
35
+ */
36
+ export declare function getMonthDateRange(date: Date): {
37
+ start: Date;
38
+ end: Date;
39
+ };
40
+ /**
41
+ * Format a date to Thai Buddhist calendar month display
42
+ *
43
+ * @param date - The date to format
44
+ * @returns Formatted string in Thai Buddhist calendar (e.g., "มกราคม 2568")
45
+ *
46
+ * @example
47
+ * formatThaiMonth(new Date('2024-01-15')); // returns "มกราคม 2567"
48
+ * formatThaiMonth(new Date('2024-12-25')); // returns "ธันวาคม 2567"
49
+ */
50
+ export declare function formatThaiMonth(date: Date): string;
51
+ /**
52
+ * Format a date to short Thai Buddhist calendar format
53
+ *
54
+ * @param date - The date to format
55
+ * @returns Formatted string (e.g., "01/2568")
56
+ *
57
+ * @example
58
+ * formatThaiMonthShort(new Date('2024-01-15')); // returns "01/2567"
59
+ */
60
+ export declare function formatThaiMonthShort(date: Date): string;
61
+ /**
62
+ * Get Thai month name by index (0-11)
63
+ *
64
+ * @param monthIndex - Month index (0 = January, 11 = December)
65
+ * @returns Thai month name
66
+ *
67
+ * @example
68
+ * getThaiMonthName(0); // returns "มกราคม"
69
+ * getThaiMonthName(11); // returns "ธันวาคม"
70
+ */
71
+ export declare function getThaiMonthName(monthIndex: number): string;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * File validation + helpers shared across ERP apps.
3
+ */
4
+ export interface FileValidationResult {
5
+ isValid: boolean;
6
+ error?: string;
7
+ }
8
+ /**
9
+ * Validate a file's MIME type or extension against an allow-list.
10
+ * Supports wildcards like "image/*".
11
+ */
12
+ export declare function validateFileType(file: File, acceptedTypes: string[]): FileValidationResult;
13
+ /** Validate that a file is at or below `maxSizeMB`. */
14
+ export declare function validateFileSize(file: File, maxSizeMB: number): FileValidationResult;
15
+ /** True if the file's MIME type starts with `image/`. */
16
+ export declare function isImageFile(file: File): boolean;
17
+ /** Format bytes as human-readable string (Bytes/KB/MB/GB). */
18
+ export declare function formatFileSize(bytes: number): string;
19
+ /** Generate a unique file ID using crypto.randomUUID when available. */
20
+ export declare function generateFileId(): string;
@@ -1 +1,36 @@
1
1
  export declare function formatDate(date: Date | string | number | undefined, opts?: Intl.DateTimeFormatOptions): string;
2
+ /**
3
+ * Format a date with Thai locale (Asia/Bangkok timezone).
4
+ *
5
+ * @example
6
+ * formatDateThai(new Date("2024-06-01")); // "1 มิถุนายน 2024" (Gregorian, Thai locale)
7
+ */
8
+ export declare function formatDateThai(date: Date | string | number | undefined, opts?: Intl.DateTimeFormatOptions): string;
9
+ /**
10
+ * Format a date as RFC3339 with Asia/Bangkok offset (UTC+7).
11
+ *
12
+ * @example
13
+ * formatDateThaiShort(new Date("2024-06-01")); // "2024-06-01T00:00:00+07:00"
14
+ */
15
+ export declare function formatDateThaiShort(date: Date | string | number | undefined | null): string;
16
+ /**
17
+ * Format a number as currency. Defaults to THB; pass `currency: "USD"` for USD.
18
+ */
19
+ export declare function formatCurrency(amount?: number, currency?: string, locale?: string): string;
20
+ /**
21
+ * Format a number or numeric string with comma separators and three decimal places.
22
+ * Returns "0.00" for non-numeric input.
23
+ *
24
+ * @example
25
+ * formatNumber(1234567.8); // "1,234,567.800"
26
+ */
27
+ export declare const formatNumber: (value: number | string) => string;
28
+ /**
29
+ * Convert a Gregorian "YYYY-MM-DD" date string to a Buddhist calendar string.
30
+ * Supports a custom output format using YYYY/MM/DD tokens.
31
+ *
32
+ * @example
33
+ * toBuddhistIso("2024-06-01"); // "2567-06-01"
34
+ * toBuddhistIso("2024-06-01", "DD/MM/YYYY"); // "01/06/2567"
35
+ */
36
+ export declare const toBuddhistIso: (dateString: string, format?: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eintrek/erp-theme",
3
- "version": "1.0.4",
3
+ "version": "1.4.4",
4
4
  "private": false,
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "type": "module",
@@ -32,10 +32,11 @@
32
32
  "typescript"
33
33
  ],
34
34
  "peerDependencies": {
35
+ "embla-carousel-react": "^8.6.0",
35
36
  "next": "^15.5.3",
37
+ "nuqs": "^2.7.1",
36
38
  "react": "^19.1.1",
37
- "react-dom": "^19.1.1",
38
- "embla-carousel-react": "^8.6.0"
39
+ "react-dom": "^19.1.1"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@eslint/eslintrc": "^3.3.1",
@@ -57,6 +58,7 @@
57
58
  "eslint": "^9.29.0",
58
59
  "eslint-config-next": "^15.3.4",
59
60
  "eslint-plugin-storybook": "^9.0.12",
61
+ "nuqs": "^2.7.1",
60
62
  "postcss": "^8.4.32",
61
63
  "postcss-import": "^16.1.0",
62
64
  "postcss-prefix-selector": "^1.15.0",
@@ -90,6 +92,7 @@
90
92
  "@radix-ui/react-separator": "^1.1.7",
91
93
  "@radix-ui/react-slot": "^1.2.3",
92
94
  "@radix-ui/react-tabs": "^1.1.13",
95
+ "@tanstack/react-table": "^8.21.3",
93
96
  "class-variance-authority": "^0.7.1",
94
97
  "clsx": "^2.1.1",
95
98
  "cmdk": "^1.1.1",
@@ -106,8 +109,8 @@
106
109
  "prettier": "^3.5.3",
107
110
  "radix-ui": "^1.4.2",
108
111
  "react": "^19.1.1",
109
- "react-dom": "^19.1.1",
110
112
  "react-day-picker": "^9.11.0",
113
+ "react-dom": "^19.1.1",
111
114
  "react-dropzone": "^14.3.8",
112
115
  "react-error-boundary": "6.0.0",
113
116
  "react-hook-form": "^7.58.1",