diff --git a/package.json b/package.json index 25a23de..778141a 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/TextInput/TextInput.tsx b/src/TextInput/TextInput.tsx index 7efeeab..a8b307c 100644 --- a/src/TextInput/TextInput.tsx +++ b/src/TextInput/TextInput.tsx @@ -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 = ({ value, onChange, placeholder, - readOnly + readOnly, + min, + max }) => { const contextReadOnly = useFormReadOnly(); const effectiveReadOnly = readOnly ?? contextReadOnly; @@ -33,6 +42,8 @@ export const TextInput: React.FC = ({ value={value} placeholder={placeholder} readOnly={effectiveReadOnly} + min={min} + max={max} onChange={(e) => onChange(e.target.value)} /> );