@wecodesolutions/shared-react-components-ts 0.3.0 → 0.4.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.
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ interface ButtonProps {
3
+ label: string;
4
+ onClick?: () => void;
5
+ type?: 'button' | 'submit' | 'reset';
6
+ disabled?: boolean;
7
+ className?: string;
8
+ }
9
+ export declare const Button: React.FC<ButtonProps>;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface FormContainerProps {
3
+ children: React.ReactNode;
4
+ title: string;
5
+ }
6
+ export declare const FormContainer: React.FC<FormContainerProps>;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ interface InputFieldProps {
3
+ label: string;
4
+ type: string;
5
+ name: string;
6
+ value: string;
7
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
+ placeholder?: string;
9
+ error?: string;
10
+ }
11
+ export declare const InputField: React.FC<InputFieldProps>;
12
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface ValidationMessageProps {
3
+ message: string;
4
+ type: 'error' | 'success' | 'info';
5
+ }
6
+ export declare const ValidationMessage: React.FC<ValidationMessageProps>;
7
+ export {};
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.0",
2
+ "version": "0.4.0",
3
3
  "name": "@wecodesolutions/shared-react-components-ts",
4
4
  "publishConfig": {
5
5
  "access": "public"
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+
3
+ interface ButtonProps {
4
+ label: string;
5
+ onClick?: () => void;
6
+ type?: 'button' | 'submit' | 'reset';
7
+ disabled?: boolean;
8
+ className?: string;
9
+ }
10
+
11
+ export const Button: React.FC<ButtonProps> = ({
12
+ label,
13
+ onClick,
14
+ type = 'button',
15
+ disabled = false,
16
+ className = '',
17
+ }) => (
18
+ <button type={type} onClick={onClick} disabled={disabled} className={className}>
19
+ {label}
20
+ </button>
21
+ );
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+
3
+ interface FormContainerProps {
4
+ children: React.ReactNode;
5
+ title: string;
6
+ }
7
+
8
+ export const FormContainer: React.FC<FormContainerProps> = ({ children, title }) => (
9
+ <div className="form-container">
10
+ <h2>{title}</h2>
11
+ {children}
12
+ </div>
13
+ );
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { ValidationMessage } from '../validationMessage/ValidationMessage';
3
+
4
+ interface InputFieldProps {
5
+ label: string;
6
+ type: string;
7
+ name: string;
8
+ value: string;
9
+ onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
10
+ placeholder?: string;
11
+ error?: string;
12
+ }
13
+
14
+ export const InputField: React.FC<InputFieldProps> = ({
15
+ label,
16
+ type,
17
+ name,
18
+ value,
19
+ onChange,
20
+ placeholder,
21
+ error,
22
+ }) => (
23
+ <div className="input-field">
24
+ <label htmlFor={name}>{label}</label>
25
+ <input
26
+ id={name}
27
+ type={type}
28
+ name={name}
29
+ value={value}
30
+ onChange={onChange}
31
+ placeholder={placeholder}
32
+ />
33
+ {error && <ValidationMessage message={error} type="error" />}
34
+ </div>
35
+ );
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ interface ValidationMessageProps {
4
+ message: string;
5
+ type: 'error' | 'success' | 'info';
6
+ }
7
+
8
+ export const ValidationMessage: React.FC<ValidationMessageProps> = ({ message, type }) => (
9
+ <span className={`validation-message ${type}`}>{message}</span>
10
+ );