nexstruct 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.
Files changed (229) hide show
  1. package/AGENTS.md +122 -0
  2. package/LICENSE +21 -0
  3. package/README.md +103 -0
  4. package/package.json +99 -0
  5. package/scaffold/generator.js +409 -0
  6. package/scaffold/index.js +20 -0
  7. package/scaffold/prompts.js +108 -0
  8. package/templates/api/axios/src/api/axios/client.api.ts +30 -0
  9. package/templates/api/axios/src/api/axios/users.api.ts +15 -0
  10. package/templates/api/fetch/src/api/fetch/client.api.ts +68 -0
  11. package/templates/api/fetch/src/api/fetch/users.api.ts +15 -0
  12. package/templates/api/trpc/src/api/trpc/client.api.ts +4 -0
  13. package/templates/api/trpc/src/api/trpc/router.api.ts +15 -0
  14. package/templates/api/trpc/src/api/trpc/server.client.api.ts +4 -0
  15. package/templates/api/trpc/src/providers/trpc.provider.tsx +24 -0
  16. package/templates/auth/clerk/src/auth/clerk/auth.service.ts +4 -0
  17. package/templates/auth/clerk/src/hooks/use-auth.hook.ts +13 -0
  18. package/templates/auth/clerk/src/middleware.ts +7 -0
  19. package/templates/auth/clerk/src/providers/auth.provider.tsx +6 -0
  20. package/templates/auth/next-auth/src/app/api/auth/[...nextauth]/route.ts +5 -0
  21. package/templates/auth/next-auth/src/auth/next-auth/auth.service.ts +45 -0
  22. package/templates/auth/next-auth/src/hooks/use-session.hook.ts +13 -0
  23. package/templates/auth/next-auth/src/providers/session.provider.tsx +6 -0
  24. package/templates/forms/formik/src/components/forms/login-form.component.tsx +30 -0
  25. package/templates/forms/formik/src/forms/formik/hooks/use-form-config.hook.ts +7 -0
  26. package/templates/forms/formik/src/forms/formik/schemas/example.schema.ts +8 -0
  27. package/templates/forms/react-hook-form/src/components/forms/login-form.component.tsx +27 -0
  28. package/templates/forms/react-hook-form/src/forms/react-hook-form/hooks/use-form.hook.ts +13 -0
  29. package/templates/forms/react-hook-form/src/forms/react-hook-form/schemas/example.schema.ts +15 -0
  30. package/templates/nextjs-base/next.config.ts +5 -0
  31. package/templates/nextjs-base/postcss.config.mjs +9 -0
  32. package/templates/nextjs-base/src/app/_components/navbar.tsx +88 -0
  33. package/templates/nextjs-base/src/app/_components/sidebar.tsx +223 -0
  34. package/templates/nextjs-base/src/app/error.tsx +39 -0
  35. package/templates/nextjs-base/src/app/globals.css +71 -0
  36. package/templates/nextjs-base/src/app/layout.tsx +21 -0
  37. package/templates/nextjs-base/src/app/loading.tsx +13 -0
  38. package/templates/nextjs-base/src/app/not-found.tsx +22 -0
  39. package/templates/nextjs-base/src/app/page.tsx +10 -0
  40. package/templates/nextjs-base/tailwind.config.ts +69 -0
  41. package/templates/shared/src/components/common/theme-toggle.component.tsx +31 -0
  42. package/templates/shared/src/components/common/toast/custom-message.component.tsx +18 -0
  43. package/templates/shared/src/components/common/toast/index.ts +8 -0
  44. package/templates/shared/src/components/common/toast/toast-message.component.tsx +112 -0
  45. package/templates/shared/src/hooks/use-debounce.hook.ts +12 -0
  46. package/templates/shared/src/hooks/use-fetch.hook.ts +42 -0
  47. package/templates/shared/src/hooks/use-intersection-observer.hook.ts +39 -0
  48. package/templates/shared/src/hooks/use-local-storage.hook.ts +30 -0
  49. package/templates/shared/src/hooks/use-media-query.hook.ts +26 -0
  50. package/templates/shared/src/hooks/use-toggle.hook.ts +12 -0
  51. package/templates/shared/src/lib/utils.util.ts +361 -0
  52. package/templates/shared/src/providers/theme.provider.tsx +17 -0
  53. package/templates/shared/src/providers/toast.provider.tsx +32 -0
  54. package/templates/shared/src/types/common.type.ts +34 -0
  55. package/templates/state/context/src/store/context/auth.context.tsx +47 -0
  56. package/templates/state/context/src/store/context/counter.context.tsx +41 -0
  57. package/templates/state/context/src/store/context/index.ts +2 -0
  58. package/templates/state/redux/src/providers/redux.provider.tsx +7 -0
  59. package/templates/state/redux/src/store/redux/hooks.store.ts +5 -0
  60. package/templates/state/redux/src/store/redux/index.ts +4 -0
  61. package/templates/state/redux/src/store/redux/slices/api.slice.ts +8 -0
  62. package/templates/state/redux/src/store/redux/slices/counter.slice.ts +24 -0
  63. package/templates/state/redux/src/store/redux/store.store.ts +13 -0
  64. package/templates/state/zustand/src/store/zustand/counter.store.ts +15 -0
  65. package/templates/state/zustand/src/store/zustand/index.ts +2 -0
  66. package/templates/state/zustand/src/store/zustand/user.store.ts +32 -0
  67. package/templates/ui/antd/COMPONENT_GUIDE.md +326 -0
  68. package/templates/ui/antd/src/app/examples/dialog/page.tsx +205 -0
  69. package/templates/ui/antd/src/app/examples/form/page.tsx +160 -0
  70. package/templates/ui/antd/src/app/examples/layout.tsx +125 -0
  71. package/templates/ui/antd/src/app/examples/page.tsx +64 -0
  72. package/templates/ui/antd/src/app/examples/table/page.tsx +118 -0
  73. package/templates/ui/antd/src/app/page.tsx +283 -0
  74. package/templates/ui/antd/src/components/common/DynamicTable/dynamic-table.component.tsx +79 -0
  75. package/templates/ui/antd/src/components/common/button/action-button.component.tsx +63 -0
  76. package/templates/ui/antd/src/components/common/dialog/dialog-wrapper.component.tsx +63 -0
  77. package/templates/ui/antd/src/components/common/fields/assets/components/check-field.component.tsx +55 -0
  78. package/templates/ui/antd/src/components/common/fields/assets/components/date-picker-field.component.tsx +80 -0
  79. package/templates/ui/antd/src/components/common/fields/assets/components/limit-field.component.tsx +26 -0
  80. package/templates/ui/antd/src/components/common/fields/assets/components/multi-check-field.component.tsx +56 -0
  81. package/templates/ui/antd/src/components/common/fields/assets/components/number-field.component.tsx +100 -0
  82. package/templates/ui/antd/src/components/common/fields/assets/components/otp-field.component.tsx +63 -0
  83. package/templates/ui/antd/src/components/common/fields/assets/components/password-field.component.tsx +106 -0
  84. package/templates/ui/antd/src/components/common/fields/assets/components/phone-number-field.component.tsx +78 -0
  85. package/templates/ui/antd/src/components/common/fields/assets/components/radio-field.component.tsx +55 -0
  86. package/templates/ui/antd/src/components/common/fields/assets/components/range-date-picker.component.tsx +66 -0
  87. package/templates/ui/antd/src/components/common/fields/assets/components/search-field.component.tsx +24 -0
  88. package/templates/ui/antd/src/components/common/fields/assets/components/select-field.component.tsx +82 -0
  89. package/templates/ui/antd/src/components/common/fields/assets/components/single-check-field.component.tsx +50 -0
  90. package/templates/ui/antd/src/components/common/fields/assets/components/single-select-field.component.tsx +86 -0
  91. package/templates/ui/antd/src/components/common/fields/assets/components/string-number-field.component.tsx +80 -0
  92. package/templates/ui/antd/src/components/common/fields/assets/components/switch-field.component.tsx +62 -0
  93. package/templates/ui/antd/src/components/common/fields/assets/components/text-area-field.component.tsx +85 -0
  94. package/templates/ui/antd/src/components/common/fields/assets/components/text-field.component.tsx +88 -0
  95. package/templates/ui/antd/src/components/common/fields/assets/interface/input-props.type.ts +233 -0
  96. package/templates/ui/antd/src/components/common/fields/cusInputField.component.tsx +40 -0
  97. package/templates/ui/antd/src/components/common/pagination/pagination.component.tsx +27 -0
  98. package/templates/ui/antd/src/components/ui/avatar.component.tsx +8 -0
  99. package/templates/ui/antd/src/components/ui/badge.component.tsx +8 -0
  100. package/templates/ui/antd/src/components/ui/button.component.tsx +8 -0
  101. package/templates/ui/antd/src/components/ui/card.component.tsx +8 -0
  102. package/templates/ui/antd/src/components/ui/checkbox.component.tsx +8 -0
  103. package/templates/ui/antd/src/components/ui/dialog.component.tsx +9 -0
  104. package/templates/ui/antd/src/components/ui/dropdown-menu.component.tsx +10 -0
  105. package/templates/ui/antd/src/components/ui/form.component.tsx +12 -0
  106. package/templates/ui/antd/src/components/ui/input.component.tsx +13 -0
  107. package/templates/ui/antd/src/components/ui/label.component.tsx +18 -0
  108. package/templates/ui/antd/src/components/ui/popover.component.tsx +8 -0
  109. package/templates/ui/antd/src/components/ui/progress.component.tsx +8 -0
  110. package/templates/ui/antd/src/components/ui/radio-group.component.tsx +10 -0
  111. package/templates/ui/antd/src/components/ui/scroll-area.component.tsx +25 -0
  112. package/templates/ui/antd/src/components/ui/select.component.tsx +8 -0
  113. package/templates/ui/antd/src/components/ui/separator.component.tsx +8 -0
  114. package/templates/ui/antd/src/components/ui/sheet.component.tsx +8 -0
  115. package/templates/ui/antd/src/components/ui/switch.component.tsx +8 -0
  116. package/templates/ui/antd/src/components/ui/table.component.tsx +8 -0
  117. package/templates/ui/antd/src/components/ui/tabs.component.tsx +8 -0
  118. package/templates/ui/antd/src/components/ui/textarea.component.tsx +9 -0
  119. package/templates/ui/antd/src/components/ui/tooltip.component.tsx +8 -0
  120. package/templates/ui/antd/src/lib/theme.util.ts +40 -0
  121. package/templates/ui/antd/src/providers/antd.provider.tsx +13 -0
  122. package/templates/ui/mui/src/app/examples/layout.tsx +113 -0
  123. package/templates/ui/mui/src/app/examples/page.tsx +716 -0
  124. package/templates/ui/mui/src/app/page.tsx +298 -0
  125. package/templates/ui/mui/src/components/common/DynamicTable/dynamic-table.component.tsx +131 -0
  126. package/templates/ui/mui/src/components/common/button/action-button.component.tsx +57 -0
  127. package/templates/ui/mui/src/components/common/dialog/dialog-wrapper.component.tsx +55 -0
  128. package/templates/ui/mui/src/components/common/fields/assets/components/check-field.component.tsx +51 -0
  129. package/templates/ui/mui/src/components/common/fields/assets/components/date-picker-field.component.tsx +50 -0
  130. package/templates/ui/mui/src/components/common/fields/assets/components/multi-check-field.component.tsx +14 -0
  131. package/templates/ui/mui/src/components/common/fields/assets/components/number-field.component.tsx +59 -0
  132. package/templates/ui/mui/src/components/common/fields/assets/components/password-field.component.tsx +87 -0
  133. package/templates/ui/mui/src/components/common/fields/assets/components/phone-number-field.component.tsx +48 -0
  134. package/templates/ui/mui/src/components/common/fields/assets/components/radio-field.component.tsx +37 -0
  135. package/templates/ui/mui/src/components/common/fields/assets/components/search-field.component.tsx +41 -0
  136. package/templates/ui/mui/src/components/common/fields/assets/components/select-field.component.tsx +77 -0
  137. package/templates/ui/mui/src/components/common/fields/assets/components/single-check-field.component.tsx +39 -0
  138. package/templates/ui/mui/src/components/common/fields/assets/components/single-select-field.component.tsx +56 -0
  139. package/templates/ui/mui/src/components/common/fields/assets/components/string-number-field.component.tsx +52 -0
  140. package/templates/ui/mui/src/components/common/fields/assets/components/switch-field.component.tsx +35 -0
  141. package/templates/ui/mui/src/components/common/fields/assets/components/text-area-field.component.tsx +46 -0
  142. package/templates/ui/mui/src/components/common/fields/assets/components/text-field.component.tsx +51 -0
  143. package/templates/ui/mui/src/components/common/fields/assets/interface/input-props.type.ts +193 -0
  144. package/templates/ui/mui/src/components/common/fields/cusInputField.component.tsx +34 -0
  145. package/templates/ui/mui/src/components/common/pagination/pagination.component.tsx +59 -0
  146. package/templates/ui/mui/src/components/ui/avatar.component.tsx +19 -0
  147. package/templates/ui/mui/src/components/ui/badge.component.tsx +18 -0
  148. package/templates/ui/mui/src/components/ui/button.component.tsx +22 -0
  149. package/templates/ui/mui/src/components/ui/card.component.tsx +39 -0
  150. package/templates/ui/mui/src/components/ui/checkbox.component.tsx +21 -0
  151. package/templates/ui/mui/src/components/ui/dialog.component.tsx +38 -0
  152. package/templates/ui/mui/src/components/ui/dropdown-menu.component.tsx +43 -0
  153. package/templates/ui/mui/src/components/ui/form.component.tsx +98 -0
  154. package/templates/ui/mui/src/components/ui/input.component.tsx +15 -0
  155. package/templates/ui/mui/src/components/ui/label.component.tsx +15 -0
  156. package/templates/ui/mui/src/components/ui/popover.component.tsx +20 -0
  157. package/templates/ui/mui/src/components/ui/progress.component.tsx +19 -0
  158. package/templates/ui/mui/src/components/ui/radio-group.component.tsx +25 -0
  159. package/templates/ui/mui/src/components/ui/scroll-area.component.tsx +27 -0
  160. package/templates/ui/mui/src/components/ui/select.component.tsx +26 -0
  161. package/templates/ui/mui/src/components/ui/separator.component.tsx +11 -0
  162. package/templates/ui/mui/src/components/ui/sheet.component.tsx +44 -0
  163. package/templates/ui/mui/src/components/ui/switch.component.tsx +23 -0
  164. package/templates/ui/mui/src/components/ui/table.component.tsx +34 -0
  165. package/templates/ui/mui/src/components/ui/tabs.component.tsx +38 -0
  166. package/templates/ui/mui/src/components/ui/textarea.component.tsx +18 -0
  167. package/templates/ui/mui/src/components/ui/tooltip.component.tsx +24 -0
  168. package/templates/ui/mui/src/lib/theme.util.ts +73 -0
  169. package/templates/ui/mui/src/providers/mui.provider.tsx +13 -0
  170. package/templates/ui/shadcn/COMPONENT_GUIDE.md +306 -0
  171. package/templates/ui/shadcn/src/app/examples/dialog/page.tsx +122 -0
  172. package/templates/ui/shadcn/src/app/examples/form/page.tsx +107 -0
  173. package/templates/ui/shadcn/src/app/examples/layout.tsx +24 -0
  174. package/templates/ui/shadcn/src/app/examples/page.tsx +30 -0
  175. package/templates/ui/shadcn/src/app/examples/table/page.tsx +77 -0
  176. package/templates/ui/shadcn/src/app/page.tsx +20 -0
  177. package/templates/ui/shadcn/src/components/common/DynamicTable/dynamic-table.component.tsx +136 -0
  178. package/templates/ui/shadcn/src/components/common/button/action-button.component.tsx +68 -0
  179. package/templates/ui/shadcn/src/components/common/dialog/dialog-wrapper.component.tsx +58 -0
  180. package/templates/ui/shadcn/src/components/common/fields/assets/components/check-field.component.tsx +52 -0
  181. package/templates/ui/shadcn/src/components/common/fields/assets/components/date-picker-field.component.tsx +62 -0
  182. package/templates/ui/shadcn/src/components/common/fields/assets/components/dynamic-file-upload-field.component.tsx +152 -0
  183. package/templates/ui/shadcn/src/components/common/fields/assets/components/limit-field.component.tsx +73 -0
  184. package/templates/ui/shadcn/src/components/common/fields/assets/components/multi-check-field.component.tsx +46 -0
  185. package/templates/ui/shadcn/src/components/common/fields/assets/components/number-field.component.tsx +124 -0
  186. package/templates/ui/shadcn/src/components/common/fields/assets/components/otp-field.component.tsx +61 -0
  187. package/templates/ui/shadcn/src/components/common/fields/assets/components/password-field.component.tsx +110 -0
  188. package/templates/ui/shadcn/src/components/common/fields/assets/components/phone-number-field.component.tsx +90 -0
  189. package/templates/ui/shadcn/src/components/common/fields/assets/components/radio-field.component.tsx +41 -0
  190. package/templates/ui/shadcn/src/components/common/fields/assets/components/range-date-picker.component.tsx +71 -0
  191. package/templates/ui/shadcn/src/components/common/fields/assets/components/rich-text-editor.component.tsx +91 -0
  192. package/templates/ui/shadcn/src/components/common/fields/assets/components/search-field.component.tsx +34 -0
  193. package/templates/ui/shadcn/src/components/common/fields/assets/components/select-field.component.tsx +231 -0
  194. package/templates/ui/shadcn/src/components/common/fields/assets/components/single-check-field.component.tsx +42 -0
  195. package/templates/ui/shadcn/src/components/common/fields/assets/components/single-select-field.component.tsx +82 -0
  196. package/templates/ui/shadcn/src/components/common/fields/assets/components/string-number-field.component.tsx +68 -0
  197. package/templates/ui/shadcn/src/components/common/fields/assets/components/switch-field.component.tsx +61 -0
  198. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-area-field.component.tsx +62 -0
  199. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-area-with-file.component.tsx +142 -0
  200. package/templates/ui/shadcn/src/components/common/fields/assets/components/text-field.component.tsx +80 -0
  201. package/templates/ui/shadcn/src/components/common/fields/assets/components/tiny-editor.component.tsx +51 -0
  202. package/templates/ui/shadcn/src/components/common/fields/assets/components/upload-profile-picture.component.tsx +103 -0
  203. package/templates/ui/shadcn/src/components/common/fields/assets/components/upload-video-file.component.tsx +86 -0
  204. package/templates/ui/shadcn/src/components/common/fields/assets/interface/input-props.type.ts +198 -0
  205. package/templates/ui/shadcn/src/components/common/fields/cusInputField.component.tsx +52 -0
  206. package/templates/ui/shadcn/src/components/common/pagination/pagination.component.tsx +68 -0
  207. package/templates/ui/shadcn/src/components/ui/avatar.component.tsx +37 -0
  208. package/templates/ui/shadcn/src/components/ui/badge.component.tsx +28 -0
  209. package/templates/ui/shadcn/src/components/ui/button.component.tsx +52 -0
  210. package/templates/ui/shadcn/src/components/ui/card.component.tsx +46 -0
  211. package/templates/ui/shadcn/src/components/ui/checkbox.component.tsx +25 -0
  212. package/templates/ui/shadcn/src/components/ui/dialog.component.tsx +98 -0
  213. package/templates/ui/shadcn/src/components/ui/dropdown-menu.component.tsx +163 -0
  214. package/templates/ui/shadcn/src/components/ui/form.component.tsx +110 -0
  215. package/templates/ui/shadcn/src/components/ui/input-otp.component.tsx +64 -0
  216. package/templates/ui/shadcn/src/components/ui/input.component.tsx +23 -0
  217. package/templates/ui/shadcn/src/components/ui/label.component.tsx +23 -0
  218. package/templates/ui/shadcn/src/components/ui/popover.component.tsx +27 -0
  219. package/templates/ui/shadcn/src/components/ui/progress.component.tsx +22 -0
  220. package/templates/ui/shadcn/src/components/ui/radio-group.component.tsx +33 -0
  221. package/templates/ui/shadcn/src/components/ui/scroll-area.component.tsx +37 -0
  222. package/templates/ui/shadcn/src/components/ui/select.component.tsx +139 -0
  223. package/templates/ui/shadcn/src/components/ui/separator.component.tsx +23 -0
  224. package/templates/ui/shadcn/src/components/ui/sheet.component.tsx +89 -0
  225. package/templates/ui/shadcn/src/components/ui/switch.component.tsx +26 -0
  226. package/templates/ui/shadcn/src/components/ui/table.component.tsx +71 -0
  227. package/templates/ui/shadcn/src/components/ui/tabs.component.tsx +52 -0
  228. package/templates/ui/shadcn/src/components/ui/textarea.component.tsx +20 -0
  229. package/templates/ui/shadcn/src/components/ui/tooltip.component.tsx +25 -0
@@ -0,0 +1,88 @@
1
+ 'use client';
2
+
3
+ import { Controller } from 'react-hook-form';
4
+ import { Input } from 'antd';
5
+ import type { TextInputProps } from '../../assets/interface/input-props.type';
6
+
7
+ export function Text({
8
+ form, name, placeholder, labelName, required = false, disabled = false,
9
+ viewOnly = false, customMessage, isArray = false, leftIcon, rightIcon,
10
+ value, setValue,
11
+ }: TextInputProps) {
12
+ const fieldName = name || labelName?.toLowerCase().replace(/\s+/g, '_') || 'text';
13
+
14
+ const labelEl = labelName ? (
15
+ <label className="font-semibold leading-6 text-[14px] tracking-[0.02em]" style={{ display: 'block', marginBottom: 4 }}>
16
+ {labelName}
17
+ {required && <span style={{ color: '#ff4d4f', marginLeft: 2 }}>*</span>}
18
+ </label>
19
+ ) : null;
20
+
21
+ if (form) {
22
+ return (
23
+ <div style={{ marginBottom: 16 }}>
24
+ {labelEl}
25
+ {viewOnly ? (
26
+ <div style={{ padding: '4px 11px', border: '1px solid #d9d9d9', borderRadius: 6, minHeight: 32, background: '#fafafa' }}>
27
+ {form.watch(fieldName) || ''}
28
+ </div>
29
+ ) : (
30
+ <Controller
31
+ name={fieldName}
32
+ control={form.control}
33
+ render={({ field, fieldState }) => {
34
+ const isError = !!fieldState.error;
35
+ return (
36
+ <div>
37
+ <Input
38
+ {...field}
39
+ placeholder={placeholder || labelName}
40
+ disabled={disabled}
41
+ status={isError ? 'error' : undefined}
42
+ prefix={leftIcon}
43
+ suffix={rightIcon}
44
+ onChange={(e) => {
45
+ if (isArray) {
46
+ const arr = e.target.value.split(/[\s,]+/).map((v: string) => v.trim()).filter(Boolean);
47
+ form.setValue(fieldName, arr, { shouldValidate: true, shouldDirty: true });
48
+ }
49
+ field.onChange(e);
50
+ }}
51
+ />
52
+ {isError && (
53
+ <div style={{ color: '#ff4d4f', fontSize: 12, marginTop: 4 }}>
54
+ {String(fieldState.error?.message || '')}
55
+ </div>
56
+ )}
57
+ {!isError && customMessage && (
58
+ <div style={{ color: '#999', fontSize: 12, marginTop: 4 }}>{customMessage}</div>
59
+ )}
60
+ </div>
61
+ );
62
+ }}
63
+ />
64
+ )}
65
+ </div>
66
+ );
67
+ }
68
+
69
+ return (
70
+ <div style={{ marginBottom: 16 }}>
71
+ {labelEl}
72
+ {viewOnly ? (
73
+ <div style={{ padding: '4px 11px', border: '1px solid #d9d9d9', borderRadius: 6, minHeight: 32, background: '#fafafa' }}>
74
+ {value || ''}
75
+ </div>
76
+ ) : (
77
+ <Input
78
+ placeholder={placeholder || labelName}
79
+ value={value}
80
+ onChange={(e) => setValue?.(e.target.value)}
81
+ prefix={leftIcon}
82
+ suffix={rightIcon}
83
+ />
84
+ )}
85
+ {customMessage && <div style={{ color: '#999', fontSize: 12, marginTop: 4 }}>{customMessage}</div>}
86
+ </div>
87
+ );
88
+ }
@@ -0,0 +1,233 @@
1
+ import type { ReactNode } from 'react';
2
+
3
+ export interface TextInputProps {
4
+ form?: any;
5
+ name?: string;
6
+ placeholder?: string;
7
+ labelName?: string;
8
+ required?: boolean;
9
+ disabled?: boolean;
10
+ viewOnly?: boolean;
11
+ disableLabelFormatting?: boolean;
12
+ customMessage?: ReactNode;
13
+ isArray?: boolean;
14
+ leftIcon?: ReactNode;
15
+ rightIcon?: ReactNode;
16
+ value?: string;
17
+ setValue?: (value: string) => void;
18
+ }
19
+
20
+ export interface TextAreaInputProps {
21
+ form?: any;
22
+ name?: string;
23
+ labelName?: string;
24
+ placeholder?: string;
25
+ required?: boolean;
26
+ disabled?: boolean;
27
+ viewOnly?: boolean;
28
+ rows?: number;
29
+ disableLabelFormatting?: boolean;
30
+ customMessage?: ReactNode;
31
+ value?: string;
32
+ setValue?: (value: string) => void;
33
+ maxLength?: number;
34
+ showCount?: boolean;
35
+ }
36
+
37
+ export interface NumberInputProps {
38
+ form?: any;
39
+ name?: string;
40
+ labelName?: string;
41
+ placeholder?: string;
42
+ required?: boolean;
43
+ disabled?: boolean;
44
+ viewOnly?: boolean;
45
+ disableLabelFormatting?: boolean;
46
+ numberType?: 'float' | 'integer';
47
+ customMessage?: ReactNode;
48
+ min?: number;
49
+ max?: number;
50
+ step?: number;
51
+ prefix?: ReactNode;
52
+ suffix?: ReactNode;
53
+ }
54
+
55
+ export interface PasswordInputProps {
56
+ form?: any;
57
+ name?: string;
58
+ labelName?: string;
59
+ placeholder?: string;
60
+ required?: boolean;
61
+ disabled?: boolean;
62
+ disableLabelFormatting?: boolean;
63
+ mode?: 'normal' | 'validate';
64
+ customMessage?: ReactNode;
65
+ }
66
+
67
+ export interface SingleSelectProps {
68
+ form?: any;
69
+ name?: string;
70
+ labelName?: string;
71
+ placeholder?: string;
72
+ required?: boolean;
73
+ disabled?: boolean;
74
+ options?: string[];
75
+ viewOnly?: boolean;
76
+ isLoading?: boolean;
77
+ defaultValue?: any;
78
+ onValueChange?: (value: any) => void;
79
+ disableLabelFormatting?: boolean;
80
+ customMessage?: string;
81
+ }
82
+
83
+ export interface SelectFieldProps {
84
+ form: any;
85
+ name: string;
86
+ labelName?: string;
87
+ required?: boolean;
88
+ disabled?: boolean;
89
+ options?: { value: string; label: string; image?: string; flag?: string; disabled?: boolean }[] | string[];
90
+ placeholder?: string;
91
+ showSearch?: boolean;
92
+ type?: 'single' | 'multiple';
93
+ viewOnly?: boolean;
94
+ onValueChange?: (value: string | string[]) => void;
95
+ isLoading?: boolean;
96
+ onSearch?: (query: string) => void;
97
+ customMessage?: string;
98
+ }
99
+
100
+ export interface SwitchProps {
101
+ form?: any;
102
+ name?: string;
103
+ labelName?: string;
104
+ required?: boolean;
105
+ disabled?: boolean;
106
+ viewOnly?: boolean;
107
+ disableLabelFormatting?: boolean;
108
+ customMessage?: ReactNode;
109
+ description?: string;
110
+ border?: boolean;
111
+ value?: boolean;
112
+ setValue?: (value: boolean) => void;
113
+ onCheckedChange?: (checked: boolean) => void;
114
+ }
115
+
116
+ export interface CheckboxProps {
117
+ form?: any;
118
+ name: string;
119
+ labelName?: string;
120
+ required?: boolean;
121
+ disabled?: boolean;
122
+ options?: { label: string; value: string }[];
123
+ }
124
+
125
+ export interface RadioProps {
126
+ form?: any;
127
+ name: string;
128
+ labelName?: string;
129
+ required?: boolean;
130
+ disabled?: boolean;
131
+ options?: { label: string; value: string }[];
132
+ }
133
+
134
+ export interface DatePickerProps {
135
+ form?: any;
136
+ name?: string;
137
+ labelName?: string;
138
+ placeholder?: string;
139
+ required?: boolean;
140
+ disabled?: boolean;
141
+ viewOnly?: boolean;
142
+ disableLabelFormatting?: boolean;
143
+ customMessage?: string;
144
+ picker?: 'date' | 'week' | 'month' | 'quarter' | 'year';
145
+ }
146
+
147
+ export interface PhoneNumberProps {
148
+ form?: any;
149
+ name?: string;
150
+ labelName?: string;
151
+ placeholder?: string;
152
+ required?: boolean;
153
+ disabled?: boolean;
154
+ viewOnly?: boolean;
155
+ disableLabelFormatting?: boolean;
156
+ customMessage?: string;
157
+ onValueChange?: (value: string) => void;
158
+ hasPhone?: boolean;
159
+ }
160
+
161
+ export interface SearchFieldProps {
162
+ form?: any;
163
+ name?: string;
164
+ placeholder?: string;
165
+ onSearch?: (value: string) => void;
166
+ value?: string;
167
+ setValue?: (value: string) => void;
168
+ loading?: boolean;
169
+ }
170
+
171
+ export interface OTPProps {
172
+ form?: any;
173
+ name?: string;
174
+ labelName?: string;
175
+ required?: boolean;
176
+ disabled?: boolean;
177
+ length?: number;
178
+ customMessage?: string;
179
+ }
180
+
181
+ export interface RangeDatePickerProps {
182
+ form?: any;
183
+ name?: string;
184
+ labelName?: string;
185
+ required?: boolean;
186
+ disabled?: boolean;
187
+ customMessage?: string;
188
+ }
189
+
190
+ export interface LimitFieldProps {
191
+ limit: string;
192
+ setLimit: (limit: string) => void;
193
+ totalItems?: number;
194
+ options?: number[];
195
+ }
196
+
197
+ export interface InputInterface {
198
+ Text: TextInputProps;
199
+ TextArea: TextAreaInputProps;
200
+ Number: NumberInputProps;
201
+ Password: PasswordInputProps;
202
+ SingleSelect: SingleSelectProps;
203
+ PhoneNumber: PhoneNumberProps;
204
+ Switch: SwitchProps;
205
+ DatePicker: DatePickerProps;
206
+ Search: SearchFieldProps;
207
+ OTP: OTPProps;
208
+ RangeDatePicker: RangeDatePickerProps;
209
+ }
210
+
211
+ export interface FieldPropsInterface {
212
+ form?: any;
213
+ name: string;
214
+ placeholder?: string;
215
+ labelName?: string;
216
+ description?: string;
217
+ border?: boolean;
218
+ options?: string[];
219
+ required?: boolean;
220
+ disabled?: boolean;
221
+ isArray?: boolean;
222
+ style?: string;
223
+ defaultValue?: any;
224
+ viewOnly?: boolean;
225
+ rows?: number;
226
+ disableLabelFormatting?: boolean;
227
+ maxLength?: number;
228
+ suffix?: string;
229
+ mode?: 'normal' | 'validate';
230
+ customMessage?: ReactNode;
231
+ onValueChange?: (value: any) => void;
232
+ isLoading?: boolean;
233
+ }
@@ -0,0 +1,40 @@
1
+ import { Text } from './assets/components/text-field.component';
2
+ import { TextArea } from './assets/components/text-area-field.component';
3
+ import { Number } from './assets/components/number-field.component';
4
+ import { StringNumber } from './assets/components/string-number-field.component';
5
+ import { Password } from './assets/components/password-field.component';
6
+ import { SingleSelectField } from './assets/components/single-select-field.component';
7
+ import { SelectField } from './assets/components/select-field.component';
8
+ import { SwitchField } from './assets/components/switch-field.component';
9
+ import { RadioField } from './assets/components/radio-field.component';
10
+ import { CheckField } from './assets/components/check-field.component';
11
+ import { MultiCheckField } from './assets/components/multi-check-field.component';
12
+ import { SingleCheckField } from './assets/components/single-check-field.component';
13
+ import { SearchField } from './assets/components/search-field.component';
14
+ import { DatePickerField } from './assets/components/date-picker-field.component';
15
+ import { PhoneNumber } from './assets/components/phone-number-field.component';
16
+ import { OTP } from './assets/components/otp-field.component';
17
+ import { RangeDatePicker } from './assets/components/range-date-picker.component';
18
+ import { LimitField } from './assets/components/limit-field.component';
19
+
20
+ export const CustomField = {
21
+ Text,
22
+ TextArea,
23
+ Number,
24
+ StringNumber,
25
+ Password,
26
+ SingleSelectField,
27
+ SelectField,
28
+ SwitchField,
29
+ RadioField,
30
+ CheckField,
31
+ MultiCheckField,
32
+ SingleCheckField,
33
+ SearchField,
34
+ CommonSearch: SearchField,
35
+ DatePickerField,
36
+ RangeDatePicker,
37
+ PhoneNumber,
38
+ OTP,
39
+ LimitField,
40
+ };
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+
3
+ import { Pagination as AntPagination } from 'antd';
4
+
5
+ interface PaginationProps {
6
+ currentPage: number;
7
+ totalPages: number;
8
+ setCurrentPage: (page: number) => void;
9
+ total?: number;
10
+ }
11
+
12
+ export function Pagination({ currentPage, totalPages, setCurrentPage, total }: PaginationProps) {
13
+ if (totalPages <= 1) return null;
14
+
15
+ return (
16
+ <div style={{ display: 'flex', justifyContent: 'center', marginTop: 16 }}>
17
+ <AntPagination
18
+ current={currentPage}
19
+ total={total ?? (totalPages * 10)}
20
+ pageSize={1}
21
+ onChange={(page) => setCurrentPage(page)}
22
+ showSizeChanger={false}
23
+ showQuickJumper={false}
24
+ />
25
+ </div>
26
+ );
27
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Avatar as AntAvatar, type AvatarProps as AntAvatarProps } from 'antd';
3
+
4
+ export type AvatarProps = AntAvatarProps;
5
+
6
+ export function Avatar(props: AvatarProps) {
7
+ return <AntAvatar {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Badge as AntBadge, type BadgeProps as AntBadgeProps } from 'antd';
3
+
4
+ export type BadgeProps = AntBadgeProps;
5
+
6
+ export function Badge(props: BadgeProps) {
7
+ return <AntBadge {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Button as AntButton, type ButtonProps as AntButtonProps } from 'antd';
3
+
4
+ export type ButtonProps = AntButtonProps;
5
+
6
+ export function Button(props: ButtonProps) {
7
+ return <AntButton {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Card as AntCard, type CardProps as AntCardProps } from 'antd';
3
+
4
+ export type CardProps = AntCardProps;
5
+
6
+ export function Card(props: CardProps) {
7
+ return <AntCard {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Checkbox as AntCheckbox, type CheckboxProps as AntCheckboxProps } from 'antd';
3
+
4
+ export type CheckboxProps = AntCheckboxProps;
5
+
6
+ export function Checkbox(props: CheckboxProps) {
7
+ return <AntCheckbox {...props} />;
8
+ }
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { Modal } from 'antd';
3
+ import type { ModalProps } from 'antd';
4
+
5
+ export type DialogProps = ModalProps;
6
+
7
+ export function Dialog({ children, ...props }: DialogProps) {
8
+ return <Modal {...props}>{children}</Modal>;
9
+ }
@@ -0,0 +1,10 @@
1
+ 'use client';
2
+ import { Dropdown as AntDropdown, type DropdownProps as AntDropdownProps } from 'antd';
3
+
4
+ export type DropdownMenuProps = AntDropdownProps;
5
+
6
+ export function DropdownMenu(props: DropdownMenuProps) {
7
+ return <AntDropdown {...props} />;
8
+ }
9
+
10
+ export { AntDropdown as Dropdown };
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ import { Form as AntForm, type FormProps as AntFormProps } from 'antd';
3
+
4
+ export type FormProps = AntFormProps;
5
+ export const FormItem = AntForm.Item;
6
+ export const useForm = AntForm.useForm;
7
+ export const FormList = AntForm.List;
8
+ export const FormProvider = AntForm.Provider;
9
+
10
+ export function Form(props: FormProps) {
11
+ return <AntForm {...props} />;
12
+ }
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ import { Input as AntInput, type InputProps as AntInputProps } from 'antd';
3
+
4
+ export type InputProps = AntInputProps;
5
+
6
+ export function Input(props: InputProps) {
7
+ return <AntInput {...props} />;
8
+ }
9
+
10
+ export const TextArea = AntInput.TextArea;
11
+ export const InputOTP = AntInput.OTP;
12
+ export const InputPassword = AntInput.Password;
13
+ export const InputSearch = AntInput.Search;
@@ -0,0 +1,18 @@
1
+ 'use client';
2
+ import { Typography } from 'antd';
3
+ import type { TextProps } from 'antd/es/typography/Text';
4
+
5
+ const { Text } = Typography;
6
+
7
+ export type LabelProps = TextProps & { required?: boolean };
8
+
9
+ export function Label({ children, required, ...props }: LabelProps) {
10
+ return (
11
+ <label>
12
+ <Text strong {...props}>
13
+ {children}
14
+ {required && <span style={{ color: '#ff4d4f', marginLeft: 2 }}>*</span>}
15
+ </Text>
16
+ </label>
17
+ );
18
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Popover as AntPopover, type PopoverProps as AntPopoverProps } from 'antd';
3
+
4
+ export type PopoverProps = AntPopoverProps;
5
+
6
+ export function Popover(props: PopoverProps) {
7
+ return <AntPopover {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Progress as AntProgress, type ProgressProps as AntProgressProps } from 'antd';
3
+
4
+ export type ProgressProps = AntProgressProps;
5
+
6
+ export function Progress(props: ProgressProps) {
7
+ return <AntProgress {...props} />;
8
+ }
@@ -0,0 +1,10 @@
1
+ 'use client';
2
+ import { Radio as AntRadio, type RadioGroupProps as AntRadioGroupProps } from 'antd';
3
+
4
+ export type RadioGroupProps = AntRadioGroupProps;
5
+
6
+ export function RadioGroup(props: RadioGroupProps) {
7
+ return <AntRadio.Group {...props} />;
8
+ }
9
+
10
+ export { AntRadio as Radio };
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ import type { ReactNode, CSSProperties } from 'react';
3
+
4
+ interface ScrollAreaProps {
5
+ children: ReactNode;
6
+ style?: CSSProperties;
7
+ className?: string;
8
+ maxHeight?: number | string;
9
+ }
10
+
11
+ export function ScrollArea({ children, style, className, maxHeight }: ScrollAreaProps) {
12
+ return (
13
+ <div
14
+ className={className}
15
+ style={{
16
+ overflowY: 'auto',
17
+ maxHeight: maxHeight || '100%',
18
+ scrollbarWidth: 'thin',
19
+ ...style,
20
+ }}
21
+ >
22
+ {children}
23
+ </div>
24
+ );
25
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Select as AntSelect, type SelectProps as AntSelectProps } from 'antd';
3
+
4
+ export type SelectProps = AntSelectProps;
5
+
6
+ export function Select(props: SelectProps) {
7
+ return <AntSelect {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Divider as AntDivider, type DividerProps as AntDividerProps } from 'antd';
3
+
4
+ export type SeparatorProps = AntDividerProps;
5
+
6
+ export function Separator(props: SeparatorProps) {
7
+ return <AntDivider {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Drawer as AntDrawer, type DrawerProps as AntDrawerProps } from 'antd';
3
+
4
+ export type SheetProps = AntDrawerProps;
5
+
6
+ export function Sheet(props: SheetProps) {
7
+ return <AntDrawer {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Switch as AntSwitch, type SwitchProps as AntSwitchProps } from 'antd';
3
+
4
+ export type SwitchProps = AntSwitchProps;
5
+
6
+ export function Switch(props: SwitchProps) {
7
+ return <AntSwitch {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Table as AntTable, type TableProps as AntTableProps } from 'antd';
3
+
4
+ export type TableProps = AntTableProps;
5
+
6
+ export function Table(props: TableProps) {
7
+ return <AntTable {...props} />;
8
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Tabs as AntTabs, type TabsProps as AntTabsProps } from 'antd';
3
+
4
+ export type TabsProps = AntTabsProps;
5
+
6
+ export function Tabs(props: TabsProps) {
7
+ return <AntTabs {...props} />;
8
+ }
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ import { Input } from 'antd';
3
+ import type { TextAreaProps as AntTextAreaProps } from 'antd/es/input';
4
+
5
+ export type TextareaProps = AntTextAreaProps;
6
+
7
+ export function Textarea(props: TextareaProps) {
8
+ return <Input.TextArea {...props} />;
9
+ }
@@ -0,0 +1,8 @@
1
+ 'use client';
2
+ import { Tooltip as AntTooltip, type TooltipProps as AntTooltipProps } from 'antd';
3
+
4
+ export type TooltipProps = AntTooltipProps;
5
+
6
+ export function Tooltip(props: TooltipProps) {
7
+ return <AntTooltip {...props} />;
8
+ }