feat: Refactor TextArea component and styles for improved usability and consistency
- Updated textarea styles to utilize CSS variables for dimensions and padding. - Enhanced placeholder styling and added disabled state styles. - Refactored TextArea component to use forwardRef and updated status handling. - Changed input statuses from 'normal' to 'default' for better clarity. - Introduced global decimal separator management in CurrencyService. - Updated tests to cover new decimal separator functionality. - Cleaned up global CSS for better organization and readability. - Removed deprecated rc-component dependencies in favor of @rc-component packages.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import FormShowcase from './form-showcase/form-showcase';
|
||||
import InputShowCase from './input-showcase';
|
||||
|
||||
export default function ExamplePage() {
|
||||
return (
|
||||
<div>
|
||||
<InputShowCase />
|
||||
<FormShowcase />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
import { Form, Input, InputPassword } from '@repo/ui';
|
||||
import React from 'react';
|
||||
// --- 2. Main Showcase Component ---
|
||||
export default function FormShowcase() {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const handleFinish = (values: any) => {
|
||||
console.log('Success - Form Values:', values);
|
||||
alert(JSON.stringify(values, null, 2));
|
||||
};
|
||||
|
||||
const handleFinishFailed = (errorInfo: any) => {
|
||||
console.log('Failed:', errorInfo);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="max-w-md mx-auto mt-10 p-6 bg-white rounded-lg shadow-md border border-gray-200">
|
||||
<h2 className="text-xl font-bold mb-6 text-gray-800">Test Migrasi @rc-component/form</h2>
|
||||
|
||||
<Form
|
||||
form={form}
|
||||
onFinish={handleFinish}
|
||||
onFinishFailed={handleFinishFailed}
|
||||
initialValues={{ role: 'user', agree: false }}
|
||||
>
|
||||
{/* Case 1: Text Input Biasa + Validasi Required */}
|
||||
<Form.Item name="username" label="Username" rules={[{ required: true, message: 'Username wajib diisi!' }]}>
|
||||
<Input placeholder="Masukkan username" />
|
||||
</Form.Item>
|
||||
|
||||
{/* Case 2: Email + Validasi Format */}
|
||||
<Form.Item
|
||||
name="email"
|
||||
label="Email"
|
||||
rules={[
|
||||
{ required: true, message: 'Email wajib diisi!' },
|
||||
{ type: 'email', message: 'Format email tidak valid!' },
|
||||
]}
|
||||
>
|
||||
<Input type="email" placeholder="contoh@email.com" />
|
||||
</Form.Item>
|
||||
|
||||
{/* Case 3: Password + Validasi Panjang */}
|
||||
<Form.Item
|
||||
name="password"
|
||||
label="Password"
|
||||
rules={[
|
||||
{ required: true, message: 'Password wajib diisi!' },
|
||||
{ min: 6, message: 'Password minimal 6 karakter!' },
|
||||
]}
|
||||
>
|
||||
<InputPassword placeholder="Masukkan password" />
|
||||
</Form.Item>
|
||||
|
||||
{/* Tombol Aksi */}
|
||||
<div className="flex gap-3 mt-6">
|
||||
<button
|
||||
type="submit"
|
||||
className="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 font-medium transition"
|
||||
>
|
||||
Submit
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => form.resetFields()}
|
||||
className="px-4 py-2 bg-gray-100 text-gray-700 rounded hover:bg-gray-200 font-medium transition"
|
||||
>
|
||||
Reset
|
||||
</button>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user