refactor: update pricing input handling to use PriceInput component
- Replaced raw input fields for pricing with PriceInput component across various forms and modals to ensure consistent formatting and accessibility. - Updated tests to reflect changes in pricing input handling, ensuring values are displayed in toman with proper formatting. - Enhanced accessibility by adding aria-labels and aria-invalid attributes to PriceInput components. - Adjusted UI elements to improve layout and user experience, particularly in forms related to service items and scheduling. - Changed labels from "نمایش در نوبتدهی" to "نمایش در نوبتدهی آنلاین" for clarity.
This commit is contained in:
@@ -14,6 +14,11 @@ interface PriceInputProps {
|
||||
latin?: boolean;
|
||||
/** واحد نمایشی داخل فیلد، مثلاً «تومان». */
|
||||
suffix?: string;
|
||||
/** وقتی برچسبِ کنار فیلد `<label>` واقعی نیست (span/div)، نامِ دسترسیپذیر. */
|
||||
ariaLabel?: string;
|
||||
/** حالت خطا برای صفحهخوان — معادل `aria-invalid` روی input خام. */
|
||||
ariaInvalid?: boolean;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
function formatDisplay(num: number, latin: boolean): string {
|
||||
@@ -44,6 +49,9 @@ export default function PriceInput({
|
||||
max,
|
||||
latin = false,
|
||||
suffix,
|
||||
ariaLabel,
|
||||
ariaInvalid,
|
||||
id,
|
||||
}: PriceInputProps) {
|
||||
const [text, setText] = useState(() => textFromValue(value, latin));
|
||||
const textRef = useRef(text);
|
||||
@@ -77,6 +85,9 @@ export default function PriceInput({
|
||||
<input
|
||||
type="text"
|
||||
inputMode="numeric"
|
||||
id={id}
|
||||
aria-label={ariaLabel}
|
||||
aria-invalid={ariaInvalid || undefined}
|
||||
value={text}
|
||||
onChange={handleChange}
|
||||
onBlur={handleBlur}
|
||||
|
||||
Reference in New Issue
Block a user