@gostack-framework/react 0.0.0-stage → 0.1.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.
Files changed (138) hide show
  1. package/dist/api.d.ts +83 -0
  2. package/dist/api.js +170 -0
  3. package/dist/api.js.map +1 -0
  4. package/dist/auth.d.ts +60 -0
  5. package/dist/auth.js +136 -0
  6. package/dist/auth.js.map +1 -0
  7. package/dist/data.d.ts +25 -0
  8. package/dist/data.js +73 -0
  9. package/dist/data.js.map +1 -0
  10. package/dist/examples.d.ts +6 -0
  11. package/dist/examples.js +47 -0
  12. package/dist/examples.js.map +1 -0
  13. package/dist/hooks.d.ts +58 -0
  14. package/dist/hooks.js +109 -0
  15. package/dist/hooks.js.map +1 -0
  16. package/dist/index.d.ts +20 -0
  17. package/dist/index.js +21 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/layouts.d.ts +6 -0
  20. package/dist/layouts.js +34 -0
  21. package/dist/layouts.js.map +1 -0
  22. package/dist/line-flow/bus.d.ts +13 -0
  23. package/dist/line-flow/bus.js +52 -0
  24. package/dist/line-flow/bus.js.map +1 -0
  25. package/dist/line-flow/derived-line.d.ts +21 -0
  26. package/dist/line-flow/derived-line.js +122 -0
  27. package/dist/line-flow/derived-line.js.map +1 -0
  28. package/dist/line-flow/errors.d.ts +62 -0
  29. package/dist/line-flow/errors.js +91 -0
  30. package/dist/line-flow/errors.js.map +1 -0
  31. package/dist/line-flow/event-line.d.ts +16 -0
  32. package/dist/line-flow/event-line.js +81 -0
  33. package/dist/line-flow/event-line.js.map +1 -0
  34. package/dist/line-flow/index.d.ts +11 -0
  35. package/dist/line-flow/index.js +11 -0
  36. package/dist/line-flow/index.js.map +1 -0
  37. package/dist/line-flow/interchange.d.ts +17 -0
  38. package/dist/line-flow/interchange.js +86 -0
  39. package/dist/line-flow/interchange.js.map +1 -0
  40. package/dist/line-flow/lineflow.d.ts +12 -0
  41. package/dist/line-flow/lineflow.js +15 -0
  42. package/dist/line-flow/lineflow.js.map +1 -0
  43. package/dist/line-flow/network.d.ts +28 -0
  44. package/dist/line-flow/network.js +165 -0
  45. package/dist/line-flow/network.js.map +1 -0
  46. package/dist/line-flow/react/bridge.d.ts +23 -0
  47. package/dist/line-flow/react/bridge.js +40 -0
  48. package/dist/line-flow/react/bridge.js.map +1 -0
  49. package/dist/line-flow/react/hooks.d.ts +29 -0
  50. package/dist/line-flow/react/hooks.js +117 -0
  51. package/dist/line-flow/react/hooks.js.map +1 -0
  52. package/dist/line-flow/react/index.d.ts +3 -0
  53. package/dist/line-flow/react/index.js +4 -0
  54. package/dist/line-flow/react/index.js.map +1 -0
  55. package/dist/line-flow/react/provider.d.ts +15 -0
  56. package/dist/line-flow/react/provider.js +25 -0
  57. package/dist/line-flow/react/provider.js.map +1 -0
  58. package/dist/line-flow/scope.d.ts +21 -0
  59. package/dist/line-flow/scope.js +157 -0
  60. package/dist/line-flow/scope.js.map +1 -0
  61. package/dist/line-flow/state-line.d.ts +21 -0
  62. package/dist/line-flow/state-line.js +106 -0
  63. package/dist/line-flow/state-line.js.map +1 -0
  64. package/dist/line-flow/taxi.d.ts +15 -0
  65. package/dist/line-flow/taxi.js +81 -0
  66. package/dist/line-flow/taxi.js.map +1 -0
  67. package/dist/line-flow/types.d.ts +222 -0
  68. package/dist/line-flow/types.js +2 -0
  69. package/dist/line-flow/types.js.map +1 -0
  70. package/dist/line-flow/utils.d.ts +24 -0
  71. package/dist/line-flow/utils.js +53 -0
  72. package/dist/line-flow/utils.js.map +1 -0
  73. package/dist/paramsSerializer.d.ts +87 -0
  74. package/dist/paramsSerializer.js +138 -0
  75. package/dist/paramsSerializer.js.map +1 -0
  76. package/dist/registry.d.ts +10 -0
  77. package/dist/registry.js +115 -0
  78. package/dist/registry.js.map +1 -0
  79. package/dist/runtime.d.ts +80 -0
  80. package/dist/runtime.js +442 -0
  81. package/dist/runtime.js.map +1 -0
  82. package/dist/schemas.d.ts +88 -0
  83. package/dist/schemas.js +146 -0
  84. package/dist/schemas.js.map +1 -0
  85. package/dist/services.d.ts +35 -0
  86. package/dist/services.js +65 -0
  87. package/dist/services.js.map +1 -0
  88. package/dist/shared-types/file.types.d.ts +12 -0
  89. package/dist/shared-types/file.types.js +2 -0
  90. package/dist/shared-types/file.types.js.map +1 -0
  91. package/dist/shared-types/gallery.types.d.ts +22 -0
  92. package/dist/shared-types/gallery.types.js +2 -0
  93. package/dist/shared-types/gallery.types.js.map +1 -0
  94. package/dist/shared-types/governorates.types.d.ts +12 -0
  95. package/dist/shared-types/governorates.types.js +2 -0
  96. package/dist/shared-types/governorates.types.js.map +1 -0
  97. package/dist/shared-types/grade.types.d.ts +7 -0
  98. package/dist/shared-types/grade.types.js +2 -0
  99. package/dist/shared-types/grade.types.js.map +1 -0
  100. package/dist/shared-types/index.d.ts +13 -0
  101. package/dist/shared-types/index.js +14 -0
  102. package/dist/shared-types/index.js.map +1 -0
  103. package/dist/shared-types/metadata.types.d.ts +61 -0
  104. package/dist/shared-types/metadata.types.js +3 -0
  105. package/dist/shared-types/metadata.types.js.map +1 -0
  106. package/dist/shared-types/table.types.d.ts +33 -0
  107. package/dist/shared-types/table.types.js +2 -0
  108. package/dist/shared-types/table.types.js.map +1 -0
  109. package/dist/shared-types/viewCard.types.d.ts +78 -0
  110. package/dist/shared-types/viewCard.types.js +3 -0
  111. package/dist/shared-types/viewCard.types.js.map +1 -0
  112. package/dist/styles.css +347 -0
  113. package/dist/types.d.ts +126 -0
  114. package/dist/types.js +19 -0
  115. package/dist/types.js.map +1 -0
  116. package/dist/utils/conditionCompiler.d.ts +11 -0
  117. package/dist/utils/conditionCompiler.js +18 -0
  118. package/dist/utils/conditionCompiler.js.map +1 -0
  119. package/dist/utils/fileUtils.d.ts +50 -0
  120. package/dist/utils/fileUtils.js +266 -0
  121. package/dist/utils/fileUtils.js.map +1 -0
  122. package/dist/utils/metadataUtils.d.ts +35 -0
  123. package/dist/utils/metadataUtils.js +176 -0
  124. package/dist/utils/metadataUtils.js.map +1 -0
  125. package/dist/utils/normalizeTime.d.ts +1 -0
  126. package/dist/utils/normalizeTime.js +25 -0
  127. package/dist/utils/normalizeTime.js.map +1 -0
  128. package/dist/utils/tableUtils.d.ts +9 -0
  129. package/dist/utils/tableUtils.js +92 -0
  130. package/dist/utils/tableUtils.js.map +1 -0
  131. package/dist/utils/toFormData.d.ts +152 -0
  132. package/dist/utils/toFormData.js +250 -0
  133. package/dist/utils/toFormData.js.map +1 -0
  134. package/dist/utils/wizard.utils.d.ts +420 -0
  135. package/dist/utils/wizard.utils.js +596 -0
  136. package/dist/utils/wizard.utils.js.map +1 -0
  137. package/package.json +49 -3
  138. package/README.md +0 -3
@@ -0,0 +1,146 @@
1
+ /**
2
+ * Common Zod Schemas
3
+ *
4
+ * Reusable validation schemas for common field types.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import { z } from 'zod';
9
+ * import { emailSchema, requiredString, fileSchema } from '@/shared/forms';
10
+ *
11
+ * const courseSchema = z.object({
12
+ * title: requiredString('Title'),
13
+ * email: emailSchema,
14
+ * image: fileSchema({ maxSize: 5 * 1024 * 1024 }),
15
+ * });
16
+ * ```
17
+ */
18
+ import { z } from "zod";
19
+ // ============================================================================
20
+ // String Schemas
21
+ // ============================================================================
22
+ /**
23
+ * Required string with custom field name
24
+ */
25
+ export const requiredString = (fieldName = "This field") => z.string().min(1, `${fieldName} is required`);
26
+ /**
27
+ * Optional string that transforms empty strings to undefined
28
+ */
29
+ export const optionalString = z
30
+ .string()
31
+ .optional()
32
+ .transform((val) => (val === "" ? undefined : val));
33
+ /**
34
+ * Email schema
35
+ */
36
+ export const emailSchema = z
37
+ .string()
38
+ .min(1, "Email is required")
39
+ .email("Invalid email address");
40
+ /**
41
+ * Password schema with minimum length
42
+ */
43
+ export const passwordSchema = (minLength = 8) => z
44
+ .string()
45
+ .min(1, "Password is required")
46
+ .min(minLength, `Password must be at least ${minLength} characters`);
47
+ /**
48
+ * URL schema
49
+ */
50
+ export const urlSchema = z
51
+ .string()
52
+ .url("Invalid URL")
53
+ .or(z.literal(""))
54
+ .optional();
55
+ /**
56
+ * Slug schema (lowercase, hyphens, no spaces)
57
+ */
58
+ export const slugSchema = z
59
+ .string()
60
+ .min(1, "Slug is required")
61
+ .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Slug must be lowercase with hyphens only");
62
+ // ============================================================================
63
+ // Number Schemas
64
+ // ============================================================================
65
+ /**
66
+ * Required number
67
+ */
68
+ export const requiredNumber = (fieldName = "This field") => z.number({ message: `${fieldName} is required` });
69
+ /**
70
+ * Positive number
71
+ */
72
+ export const positiveNumber = (fieldName = "This field") => z
73
+ .number({ message: `${fieldName} is required` })
74
+ .positive(`${fieldName} must be positive`);
75
+ /**
76
+ * Integer schema
77
+ */
78
+ export const integerSchema = (fieldName = "This field") => z
79
+ .number({ message: `${fieldName} is required` })
80
+ .int(`${fieldName} must be a whole number`);
81
+ /**
82
+ * File schema with size and type validation
83
+ */
84
+ export const fileSchema = (options = {}) => {
85
+ const { maxSize = 10 * 1024 * 1024, // 10MB default
86
+ acceptedTypes, required = false, } = options;
87
+ const formatSize = (bytes) => {
88
+ if (bytes >= 1024 * 1024) {
89
+ return `${Math.round(bytes / 1024 / 1024)}MB`;
90
+ }
91
+ return `${Math.round(bytes / 1024)}KB`;
92
+ };
93
+ const baseSchema = z
94
+ .instanceof(File)
95
+ .refine((file) => file.size <= maxSize, `File size must be less than ${formatSize(maxSize)}`);
96
+ const withTypeCheck = acceptedTypes
97
+ ? baseSchema.refine((file) => acceptedTypes.includes(file.type), `File must be one of: ${acceptedTypes.join(", ")}`)
98
+ : baseSchema;
99
+ return required ? withTypeCheck : withTypeCheck.optional().nullable();
100
+ };
101
+ /**
102
+ * Image file schema
103
+ */
104
+ export const imageSchema = (options = {}) => fileSchema({
105
+ ...options,
106
+ acceptedTypes: ["image/jpeg", "image/png", "image/gif", "image/webp"],
107
+ });
108
+ // ============================================================================
109
+ // ID Schemas
110
+ // ============================================================================
111
+ /**
112
+ * Required ID (string or number)
113
+ */
114
+ export const requiredId = (fieldName = "Selection") => z
115
+ .union([z.string(), z.number()])
116
+ .refine((val) => val !== "" && val !== null && val !== undefined, {
117
+ message: `${fieldName} is required`,
118
+ });
119
+ /**
120
+ * Optional ID
121
+ */
122
+ export const optionalId = z
123
+ .union([z.string(), z.number()])
124
+ .optional()
125
+ .nullable();
126
+ // ============================================================================
127
+ // Date Schemas
128
+ // ============================================================================
129
+ /**
130
+ * Required date
131
+ */
132
+ export const requiredDate = (fieldName = "Date") => z.date({ message: `${fieldName} is required` });
133
+ /**
134
+ * Date string schema (ISO format)
135
+ */
136
+ export const dateStringSchema = z
137
+ .string()
138
+ .regex(/^\d{4}-\d{2}-\d{2}$/, "Invalid date format (YYYY-MM-DD)");
139
+ // ============================================================================
140
+ // Boolean Schemas
141
+ // ============================================================================
142
+ /**
143
+ * Required checkbox (must be true)
144
+ */
145
+ export const requiredCheckbox = (message = "This field is required") => z.boolean().refine((val) => val === true, { message });
146
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,YAAoB,YAAY,EAAE,EAAE,CACjE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,SAAS,cAAc,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,QAAQ,EAAE;KACV,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,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C,UAAkB,wBAAwB,EAAE,EAAE,CAC7E,CAAC,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { type ReactNode } from "react";
2
+ export { clsx } from "clsx";
3
+ import { type ClassValue } from "clsx";
4
+ export declare const cn: (...values: ClassValue[]) => string;
5
+ export interface ErrorRecord {
6
+ id: string;
7
+ at: string;
8
+ message: string;
9
+ context?: string;
10
+ }
11
+ export declare function createErrorHistory(limit?: number): {
12
+ add(error: unknown, context?: string): void;
13
+ getAll: () => ErrorRecord[];
14
+ clear: () => void;
15
+ };
16
+ export declare const createLogger: (sink?: (level: string, message: string, data?: unknown) => void) => {
17
+ info: (message: string, data?: unknown) => void;
18
+ warn: (message: string, data?: unknown) => void;
19
+ error: (message: string, data?: unknown) => void;
20
+ };
21
+ export declare function LoadingProvider({ children }: {
22
+ children: ReactNode;
23
+ }): import("react").JSX.Element;
24
+ export declare function useLoading(): {
25
+ isLoading: boolean;
26
+ start: () => () => void;
27
+ };
28
+ export { toast } from "sonner";
29
+ export declare function SidebarProvider({ children }: {
30
+ children: ReactNode;
31
+ }): import("react").JSX.Element;
32
+ export declare function useSidebar(): {
33
+ isOpen: boolean;
34
+ setOpen: (open: boolean) => void;
35
+ };
@@ -0,0 +1,65 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useState } from "react";
3
+ export { clsx } from "clsx";
4
+ import { clsx } from "clsx";
5
+ import { twMerge } from "tailwind-merge";
6
+ export const cn = (...values) => twMerge(clsx(values));
7
+ export function createErrorHistory(limit = 50) {
8
+ const entries = [];
9
+ return {
10
+ add(error, context) {
11
+ entries.unshift({
12
+ id: crypto.randomUUID(),
13
+ at: new Date().toISOString(),
14
+ message: error instanceof Error ? error.message : String(error),
15
+ context,
16
+ });
17
+ entries.splice(limit);
18
+ },
19
+ getAll: () => [...entries],
20
+ clear: () => {
21
+ entries.length = 0;
22
+ },
23
+ };
24
+ }
25
+ export const createLogger = (sink = (level, message) => console.log(`[${level}] ${message}`)) => ({
26
+ info: (message, data) => sink("info", message, data),
27
+ warn: (message, data) => sink("warn", message, data),
28
+ error: (message, data) => sink("error", message, data),
29
+ });
30
+ const LoadingContext = createContext(null);
31
+ export function LoadingProvider({ children }) {
32
+ const [count, setCount] = useState(0);
33
+ return (_jsx(LoadingContext.Provider, { value: {
34
+ isLoading: count > 0,
35
+ start() {
36
+ setCount((c) => c + 1);
37
+ let done = false;
38
+ return () => {
39
+ if (!done) {
40
+ done = true;
41
+ setCount((c) => Math.max(0, c - 1));
42
+ }
43
+ };
44
+ },
45
+ }, children: children }));
46
+ }
47
+ export function useLoading() {
48
+ const value = useContext(LoadingContext);
49
+ if (!value)
50
+ throw new Error("LoadingProvider is missing.");
51
+ return value;
52
+ }
53
+ export { toast } from "sonner";
54
+ const SidebarContext = createContext(null);
55
+ export function SidebarProvider({ children }) {
56
+ const [isOpen, setOpen] = useState(false);
57
+ return (_jsx(SidebarContext.Provider, { value: { isOpen, setOpen }, children: children }));
58
+ }
59
+ export function useSidebar() {
60
+ const value = useContext(SidebarContext);
61
+ if (!value)
62
+ throw new Error("SidebarProvider is missing.");
63
+ return value;
64
+ }
65
+ //# sourceMappingURL=services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.js","sourceRoot":"","sources":["../src/services.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAoB,EAAE,EAAE,CAAC,OAAO,C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AAC;AACD,MAAM,UAAU,UAAU;IACxB,MAAM,KAAK,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC3D,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface AttachmentFile {
2
+ id: number;
3
+ fileUrl: string;
4
+ fileName: string;
5
+ fileSize: number;
6
+ fileType: string;
7
+ url: string;
8
+ name: string;
9
+ mimeType: string;
10
+ size: number;
11
+ extension: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=file.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.types.js","sourceRoot":"","sources":["../../src/shared-types/file.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ export interface GalleryImage {
2
+ id: number;
3
+ model_type: string;
4
+ model_id: number;
5
+ uuid: string;
6
+ collection_name: string;
7
+ name: string;
8
+ file_name: string;
9
+ mime_type: string;
10
+ disk: string;
11
+ conversions_disk: string;
12
+ size: number;
13
+ manipulations: unknown[];
14
+ custom_properties: Record<string, unknown>;
15
+ generated_conversions: unknown[];
16
+ responsive_images: unknown[];
17
+ order_column: number;
18
+ created_at: string;
19
+ updated_at: string;
20
+ original_url: string;
21
+ preview_url: string;
22
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gallery.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gallery.types.js","sourceRoot":"","sources":["../../src/shared-types/gallery.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ export type Governorate = {
2
+ id: string;
3
+ name: string;
4
+ code: string;
5
+ isActive: boolean;
6
+ createdAt?: string;
7
+ updatedAt?: string;
8
+ };
9
+ export type GovernorateUpsertPayload = {
10
+ name: string;
11
+ code: string;
12
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=governorates.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governorates.types.js","sourceRoot":"","sources":["../../src/shared-types/governorates.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export type Grade = {
2
+ id: string;
3
+ name: string;
4
+ code?: string;
5
+ createdAt?: string;
6
+ updatedAt?: string;
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=grade.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grade.types.js","sourceRoot":"","sources":["../../src/shared-types/grade.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Shared Types
3
+ *
4
+ * Re-exports shared types that are used across multiple features.
5
+ * Feature-specific types should stay in their feature module.
6
+ */
7
+ export * from "./table.types";
8
+ export * from "./metadata.types";
9
+ export * from "./file.types";
10
+ export * from "./governorates.types";
11
+ export * from "./grade.types";
12
+ export * from "./viewCard.types";
13
+ export * from "./gallery.types";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Shared Types
3
+ *
4
+ * Re-exports shared types that are used across multiple features.
5
+ * Feature-specific types should stay in their feature module.
6
+ */
7
+ export * from "./table.types.js";
8
+ export * from "./metadata.types.js";
9
+ export * from "./file.types.js";
10
+ export * from "./governorates.types.js";
11
+ export * from "./grade.types.js";
12
+ export * from "./viewCard.types.js";
13
+ export * from "./gallery.types.js";
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared-types/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,61 @@
1
+ export type FieldType = "text" | "select" | "date" | "number" | "boolean";
2
+ export type FilterOperator = "=" | "!=" | "<>" | ">" | "<" | ">=" | "<=" | "like" | "notLike" | "in" | "notIn" | "between" | "notBetween" | "isNull" | "isNotNull";
3
+ export interface FilterMetadata {
4
+ column: string;
5
+ label: string;
6
+ type: FieldType;
7
+ operators: FilterOperator[];
8
+ searchable: boolean;
9
+ options?: string[] | number[];
10
+ }
11
+ export interface SearchMetadata {
12
+ column: string;
13
+ label: string;
14
+ type: FieldType;
15
+ weight: number;
16
+ }
17
+ export interface SortMetadata {
18
+ column: string;
19
+ label: string;
20
+ defaultDirection: "asc" | "desc";
21
+ }
22
+ export interface FieldTypeMetadata {
23
+ label: string;
24
+ component: string;
25
+ validation: string;
26
+ }
27
+ export interface TableMetadata {
28
+ filters: FilterMetadata[];
29
+ searches: SearchMetadata[];
30
+ sorts: SortMetadata[];
31
+ operators: Record<FilterOperator, string>;
32
+ fieldTypes: Record<FieldType, FieldTypeMetadata>;
33
+ }
34
+ export interface MetadataResponse {
35
+ success: boolean;
36
+ message: string;
37
+ data: TableMetadata;
38
+ }
39
+ export interface ActiveFilter {
40
+ id: string;
41
+ column: string;
42
+ operator: FilterOperator;
43
+ value: string | number | boolean | (string | number)[];
44
+ label?: string;
45
+ }
46
+ export interface SearchQuery {
47
+ term: string;
48
+ columns?: string[];
49
+ }
50
+ export interface SortState {
51
+ column: string;
52
+ direction: "asc" | "desc";
53
+ }
54
+ export interface TableQueryParams {
55
+ page?: number;
56
+ perPage?: number;
57
+ search?: string;
58
+ searchColumns?: string[];
59
+ filters?: ActiveFilter[];
60
+ sort?: SortState;
61
+ }
@@ -0,0 +1,3 @@
1
+ // Metadata types for dynamic search, filter, and sort functionality
2
+ export {};
3
+ //# sourceMappingURL=metadata.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.types.js","sourceRoot":"","sources":["../../src/shared-types/metadata.types.ts"],"names":[],"mappings":"AAAA,oEAAoE"}
@@ -0,0 +1,33 @@
1
+ export interface TableData {
2
+ id: string;
3
+ avatar?: string;
4
+ columns: Record<string, string | number | boolean>;
5
+ group?: string;
6
+ selected?: boolean;
7
+ }
8
+ export type ViewMode = "grid" | "cards" | "group";
9
+ export interface TableColumn {
10
+ id: string;
11
+ header: string;
12
+ accessorKey: string;
13
+ sortable?: boolean;
14
+ cell?: (props: {
15
+ row: any;
16
+ }) => React.ReactNode;
17
+ }
18
+ export interface FilterOption {
19
+ id: string;
20
+ label: string;
21
+ value: string;
22
+ }
23
+ export type LegacyFilterOperator = "equals" | "contains" | "startsWith" | "endsWith" | "greaterThan" | "lessThan";
24
+ export interface FilterConfig {
25
+ column: string;
26
+ operator: LegacyFilterOperator;
27
+ value: string;
28
+ }
29
+ export type SortDirection = "asc" | "desc" | null;
30
+ export interface SortConfig {
31
+ column: string;
32
+ direction: SortDirection;
33
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=table.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.types.js","sourceRoot":"","sources":["../../src/shared-types/table.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,78 @@
1
+ export interface ViewCardFieldItem {
2
+ label: string;
3
+ value: string | number | null | React.ReactNode | undefined;
4
+ colSpan?: number;
5
+ type?: "file" | "image";
6
+ }
7
+ export interface ViewCardRow {
8
+ mainTitle?: string;
9
+ title?: string;
10
+ fields?: ViewCardFieldItem[];
11
+ customRender?: () => React.ReactNode;
12
+ }
13
+ export interface ViewCardData {
14
+ rows: ViewCardRow[];
15
+ }
16
+ export type ViewCardVariant = "user" | "vessel" | "tabs" | "default";
17
+ export interface ViewCardProps {
18
+ headerTitle?: string;
19
+ hideHeaderTitle?: boolean;
20
+ title?: string;
21
+ subtitle?: string;
22
+ variant?: ViewCardVariant;
23
+ image?: string;
24
+ data?: ViewCardData;
25
+ buttons?: boolean;
26
+ ticketButton?: boolean;
27
+ hideBorder?: boolean;
28
+ tabs?: ViewCardTabItem[];
29
+ gridCols?: number;
30
+ onEdit?: () => void;
31
+ onDelete?: () => void;
32
+ onTicket?: () => void;
33
+ customButtonLabel?: string;
34
+ onCustomButton?: (() => void) | (() => React.ReactNode);
35
+ }
36
+ export interface ViewCardSectionProps {
37
+ label?: string;
38
+ children: React.ReactNode;
39
+ }
40
+ export interface ViewCardFieldProps {
41
+ label: string;
42
+ value?: string | number | React.ReactNode | null;
43
+ type?: "file" | "image";
44
+ }
45
+ export interface ViewCardButtonsProps {
46
+ customButtonLabel?: string;
47
+ ticketButton?: boolean;
48
+ onEdit?: () => void;
49
+ onDelete?: () => void;
50
+ onTicket?: () => void;
51
+ onCustomButton?: (() => void) | (() => React.ReactNode);
52
+ }
53
+ export interface ViewCardHeaderProps {
54
+ headerTitle?: string;
55
+ hideHeaderTitle?: boolean;
56
+ buttons?: boolean;
57
+ ticketButton?: boolean;
58
+ onEdit?: () => void;
59
+ onDelete?: () => void;
60
+ onTicket?: () => void;
61
+ customButtonLabel?: string;
62
+ onCustomButton?: (() => void) | (() => React.ReactNode);
63
+ }
64
+ export interface ViewCardTabItem {
65
+ label: string;
66
+ value: string;
67
+ buttonLabel?: string;
68
+ buttonHref?: string;
69
+ entity?: string | string[];
70
+ role?: string | string[];
71
+ children: React.ReactNode;
72
+ buttons?: boolean;
73
+ onEdit?: () => void;
74
+ onDelete?: () => void;
75
+ onTicket?: () => void;
76
+ customButtonLabel?: string;
77
+ onCustomButton?: (() => void) | (() => React.ReactNode);
78
+ }
@@ -0,0 +1,3 @@
1
+ // ViewCard types
2
+ export {};
3
+ //# sourceMappingURL=viewCard.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewCard.types.js","sourceRoot":"","sources":["../../src/shared-types/viewCard.types.ts"],"names":[],"mappings":"AAAA,iBAAiB"}