feat: добавить min/max в TextInput (ограничение диапазона дат в календаре) (0.9.0)

This commit is contained in:
Тимур Городецкий
2026-08-25 11:33:01 +05:00
parent 4bdaca7b8f
commit 2958ab7320
2 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@tnsu/ui-kit",
"version": "0.8.0",
"version": "0.9.0",
"description": "TNSU shared UI components for SPFx web parts",
"author": "Timur Gorodetskiy",
"license": "ISC",
+12 -1
View File
@@ -12,6 +12,13 @@ interface ITextInputProps {
placeholder?: string;
/** Только чтение (режим согласующего). */
readOnly?: boolean;
/**
* Границы значения — для type='date' YYYY-MM-DD (native min/max), для
* type='number' числовая граница. Браузер сам блокирует недоступные даты в
* календаре при type='date'.
*/
min?: string | number;
max?: string | number;
}
/** Однострочный ввод. type='number'|'date' — для числовых полей и дат. */
@@ -21,7 +28,9 @@ export const TextInput: React.FC<ITextInputProps> = ({
value,
onChange,
placeholder,
readOnly
readOnly,
min,
max
}) => {
const contextReadOnly = useFormReadOnly();
const effectiveReadOnly = readOnly ?? contextReadOnly;
@@ -33,6 +42,8 @@ export const TextInput: React.FC<ITextInputProps> = ({
value={value}
placeholder={placeholder}
readOnly={effectiveReadOnly}
min={min}
max={max}
onChange={(e) => onChange(e.target.value)}
/>
);