proje-react-panel 1.7.0 → 1.8.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.
@@ -5,7 +5,7 @@
5
5
  "debug.console.fontSize": 15,
6
6
  "editor.defaultFormatter": "esbenp.prettier-vscode",
7
7
  "editor.formatOnSave": true,
8
- "folder-customization.folders": [
8
+ "folder-customizaation.folders": [
9
9
  {
10
10
  "path": "test-aletleri/src/client/"
11
11
  }
package/README.md CHANGED
@@ -26,6 +26,8 @@ The library provides several decorators for enhanced functionality:
26
26
  ### Form Decorators
27
27
 
28
28
  - `@Input`: Form input decorator
29
+ - `@SelectInput`: Select input decorator
30
+ - `@CustomInput`: Render your own component in place of a field
29
31
  - `@Crud`: CRUD operations decorator
30
32
 
31
33
  ## Installation
@@ -61,11 +63,48 @@ const panel = new Panel({
61
63
  </DashboardGrid>
62
64
  ```
63
65
 
66
+ ## Custom Form Fields
67
+
68
+ When a field needs a control the library does not ship, `@CustomInput` lets your app render
69
+ it. The library only wires the field into `react-hook-form` and renders the label and the
70
+ error message like any other field — everything inside is yours.
71
+
72
+ ```tsx
73
+ import { CustomInput, type CustomRenderProps } from 'proje-react-panel';
74
+
75
+ class Product {
76
+ @Input({ label: 'Name' })
77
+ name: string;
78
+
79
+ @CustomInput({
80
+ label: 'Cover image',
81
+ render: ({ value, onChange, error }: CustomRenderProps) => (
82
+ <MyImagePicker value={value as string} onSelect={onChange} invalid={!!error} />
83
+ ),
84
+ })
85
+ coverImage: string;
86
+ }
87
+ ```
88
+
89
+ The render function receives:
90
+
91
+ | Prop | Type | Description |
92
+ | ----------- | -------------------------- | --------------------------------------------------- |
93
+ | `fieldName` | `string` | Full form path of the field (nested paths included) |
94
+ | `value` | `unknown` | Current form value |
95
+ | `onChange` | `(value: unknown) => void` | Writes a new value into the form |
96
+ | `error` | `string \| undefined` | Validation message for this field, if any |
97
+
98
+ Because the value is whatever you pass to `onChange`, a custom field can hold an id, an
99
+ object or a file reference — validation and submit treat it like any other form value.
100
+
64
101
  ## Guides
65
102
 
66
- - **[Dashboard Guide](./DASHBOARD_GUIDE.md)** - Complete guide for using Dashboard components
67
- - **[Auth Layout Guide](./AUTH_LAYOUT_GUIDE.md)** - Guide for implementing authentication layouts with sidebar
68
- - **[Color System Guide](./COLOR_SYSTEM_GUIDE.md)** - Complete documentation of the color system, SCSS variables, and CSS custom properties
103
+ - **[Dashboard Guide](./guides/DASHBOARD_GUIDE.md)** - Complete guide for using Dashboard components
104
+ - **[Auth Layout Guide](./guides/AUTH_LAYOUT_GUIDE.md)** - Guide for implementing authentication layouts with sidebar
105
+ - **[Auth Layout Example](./guides/AUTH_LAYOUT_EXAMPLE.md)** - Complete working example of AuthLayout implementation
106
+ - **[Color System Guide](./guides/COLOR_SYSTEM_GUIDE.md)** - Complete documentation of the color system, SCSS variables, and CSS custom properties
107
+ - **[Implementation Guide](./guides/IMPLEMENTATION_GUIDE.md)** - Comprehensive guide for implementing the library in your React applications
69
108
 
70
109
  ## Type Definitions
71
110
 
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @jest-environment jsdom
3
+ */
4
+ import 'reflect-metadata';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { InputConfiguration } from '../../decorators/form/Input';
3
+ interface CustomFieldProps {
4
+ input: InputConfiguration;
5
+ fieldName: string;
6
+ error?: string;
7
+ }
8
+ export declare function CustomField({ input, fieldName, error }: CustomFieldProps): React.JSX.Element;
9
+ export {};
@@ -1,7 +1,7 @@
1
1
  import 'reflect-metadata';
2
2
  import { AnyClass, AnyClassConstructor } from '../../types/AnyClass';
3
3
  export type InputTypes = 'input' | 'textarea' | 'file-upload' | 'checkbox' | 'hidden' | 'nested';
4
- export type ExtendedInputTypes = InputTypes | 'select';
4
+ export type ExtendedInputTypes = InputTypes | 'select' | 'custom';
5
5
  export interface InputOptions {
6
6
  type?: InputTypes;
7
7
  inputType?: 'text' | 'email' | 'tel' | 'password' | 'number' | 'date';
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ import { InputConfiguration, InputOptions } from '../Input';
3
+ export interface CustomRenderProps {
4
+ fieldName: string;
5
+ value: unknown;
6
+ onChange: (value: unknown) => void;
7
+ error?: string;
8
+ }
9
+ export interface CustomInputOptions extends Omit<InputOptions, 'type'> {
10
+ render: (props: CustomRenderProps) => ReactNode;
11
+ }
12
+ export interface CustomInputConfiguration extends InputConfiguration {
13
+ type: 'custom';
14
+ render: (props: CustomRenderProps) => ReactNode;
15
+ }
16
+ export declare function CustomInput(options: CustomInputOptions): PropertyDecorator;