diff --git a/components/doc/common/apidoc/index.json b/components/doc/common/apidoc/index.json index daa1de6c7b..435ec2f04d 100644 --- a/components/doc/common/apidoc/index.json +++ b/components/doc/common/apidoc/index.json @@ -3638,6 +3638,14 @@ "default": "", "description": "Inline style of the input field." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemTemplate", "optional": true, @@ -5930,6 +5938,14 @@ "default": "", "description": "Inline style of the input field." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keepInvalid", "optional": true, @@ -7449,6 +7465,13 @@ "type": "IconType", "description": "Icon to show in each of the decrement buttons." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "disabled", "optional": true, @@ -8950,6 +8973,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemTemplate", "optional": true, @@ -9972,6 +10003,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "name", "optional": true, @@ -10612,6 +10651,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keyfilter", "optional": true, @@ -22845,6 +22892,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemTemplate", "optional": true, @@ -29617,6 +29672,14 @@ "default": "false", "description": "When present, it specifies that the element value cannot be altered." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keyfilter", "optional": true, @@ -30038,6 +30101,14 @@ "default": "", "description": "Inline style of the input field." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "locale", "optional": true, @@ -30319,19 +30390,6 @@ "returnType": "void", "description": "Callback to invoke when the key pressed down." }, - { - "name": "onKeyUp", - "parameters": [ - { - "name": "event", - "optional": false, - "type": "KeyboardEvent", - "description": "Browser event" - } - ], - "returnType": "void", - "description": "Callback to invoke when the key released." - }, { "name": "onValueChange", "parameters": [ @@ -30613,6 +30671,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "name", "optional": true, @@ -30856,6 +30922,14 @@ "default": "", "description": "Used to get the child elements of the component." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keyfilter", "optional": true, @@ -31065,6 +31139,14 @@ "default": "", "description": "Used to get the child elements of the component." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "keyfilter", "optional": true, @@ -31670,6 +31752,14 @@ "default": "", "description": "When specified, filter displays with this value." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemTemplate", "optional": true, @@ -35098,6 +35188,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "itemCheckboxIcon", "optional": true, @@ -40521,6 +40619,13 @@ "type": "PasswordPassThroughType | SVGProps>", "description": "Uses to pass attributes to the show icon's DOM element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "panel", "optional": true, @@ -43107,6 +43212,14 @@ "default": "false", "description": "When present, it specifies that the element should be disabled." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "multiple", "optional": true, @@ -51806,6 +51919,14 @@ "default": "", "description": "Reference of the input element." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "metaKeySelection", "optional": true, @@ -54420,6 +54541,14 @@ "default": "false", "description": "When present, it specifies that the element value cannot be altered." }, + { + "name": "invalid", + "optional": true, + "readonly": false, + "type": "boolean", + "default": "false", + "description": "When present, it specifies that the component should have invalid state style." + }, { "name": "pt", "optional": true, diff --git a/components/lib/autocomplete/AutoCompleteBase.js b/components/lib/autocomplete/AutoCompleteBase.js index 1a47a9d608..4235241dd4 100644 --- a/components/lib/autocomplete/AutoCompleteBase.js +++ b/components/lib/autocomplete/AutoCompleteBase.js @@ -8,6 +8,7 @@ const classes = { 'p-autocomplete-dd': props.dropdown, 'p-autocomplete-multiple': props.multiple, 'p-inputwrapper-filled': props.value, + 'p-invalid': props.invalid, 'p-inputwrapper-focus': focusedState }), container: ({ props }) => @@ -165,6 +166,7 @@ export const AutoCompleteBase = ComponentBase.extend({ inputId: null, inputRef: null, inputStyle: null, + invalid: false, itemTemplate: null, loadingIcon: null, maxLength: null, diff --git a/components/lib/autocomplete/autocomplete.d.ts b/components/lib/autocomplete/autocomplete.d.ts index 2341456751..8322f651e9 100755 --- a/components/lib/autocomplete/autocomplete.d.ts +++ b/components/lib/autocomplete/autocomplete.d.ts @@ -256,6 +256,11 @@ export interface AutoCompleteProps extends Omit | undefined; + /** + * When present, it specifies that the component should have invalid state style. + * @defaultValue false + */ + invalid?: boolean | undefined; /** * When specified, disables the component. * @defaultValue false diff --git a/components/lib/cascadeselect/CascadeSelectBase.js b/components/lib/cascadeselect/CascadeSelectBase.js index c23d22c390..0a90ae7803 100644 --- a/components/lib/cascadeselect/CascadeSelectBase.js +++ b/components/lib/cascadeselect/CascadeSelectBase.js @@ -8,6 +8,7 @@ const classes = { 'p-cascadeselect p-component p-inputwrapper', { 'p-disabled': props.disabled, + 'p-invalid': props.invalid, 'p-focus': focusedState, 'p-inputwrapper-filled': props.value, 'p-inputwrapper-focus': focusedState || overlayVisibleState @@ -149,6 +150,7 @@ export const CascadeSelectBase = ComponentBase.extend({ id: null, inputId: null, inputRef: null, + invalid: false, itemTemplate: null, name: null, onBeforeHide: null, diff --git a/components/lib/cascadeselect/cascadeselect.d.ts b/components/lib/cascadeselect/cascadeselect.d.ts index 373ea08edb..87187f16e5 100644 --- a/components/lib/cascadeselect/cascadeselect.d.ts +++ b/components/lib/cascadeselect/cascadeselect.d.ts @@ -227,6 +227,11 @@ export interface CascadeSelectProps extends Omit React.ReactNode) | undefined; + /** + * When present, it specifies that the component should have invalid state style. + * @defaultValue false + */ + invalid?: boolean | undefined; /** * When present, it specifies that the component should be disabled. * @defaultValue false diff --git a/components/lib/checkbox/CheckboxBase.js b/components/lib/checkbox/CheckboxBase.js index 4eb62ff033..de4a4e57cc 100644 --- a/components/lib/checkbox/CheckboxBase.js +++ b/components/lib/checkbox/CheckboxBase.js @@ -26,6 +26,7 @@ export const CheckboxBase = ComponentBase.extend({ id: null, inputId: null, inputRef: null, + invalid: false, name: null, onChange: null, onClick: null, diff --git a/components/lib/checkbox/checkbox.d.ts b/components/lib/checkbox/checkbox.d.ts index 27466145af..077e348105 100644 --- a/components/lib/checkbox/checkbox.d.ts +++ b/components/lib/checkbox/checkbox.d.ts @@ -135,6 +135,11 @@ export interface CheckboxProps extends Omit classNames('p-dropdown p-component p-inputwrapper', { 'p-disabled': props.disabled, + 'p-invalid': props.invalid, 'p-focus': focusedState, 'p-dropdown-clearable': props.showClear && !props.disabled, 'p-inputwrapper-filled': ObjectUtils.isNotEmpty(props.value), @@ -182,6 +183,7 @@ export const DropdownBase = ComponentBase.extend({ id: null, inputId: null, inputRef: null, + invalid: false, itemTemplate: null, loading: false, loadingIcon: null, diff --git a/components/lib/dropdown/dropdown.d.ts b/components/lib/dropdown/dropdown.d.ts index 7bfc6e81bc..66e705448e 100644 --- a/components/lib/dropdown/dropdown.d.ts +++ b/components/lib/dropdown/dropdown.d.ts @@ -262,6 +262,11 @@ export interface DropdownProps extends Omit @@ -151,6 +152,7 @@ export const InputNumberBase = ComponentBase.extend({ inputMode: null, inputRef: null, inputStyle: null, + invalid: false, locale: undefined, localeMatcher: undefined, max: null, diff --git a/components/lib/inputnumber/inputnumber.d.ts b/components/lib/inputnumber/inputnumber.d.ts index a9e2330e55..4d6bff60a4 100644 --- a/components/lib/inputnumber/inputnumber.d.ts +++ b/components/lib/inputnumber/inputnumber.d.ts @@ -228,6 +228,11 @@ export interface InputNumberProps extends Omit = PassThroughType; @@ -114,6 +114,11 @@ export interface InputSwitchProps extends Omit | React.HTMLAttributes>; + /** + * When present, it specifies that the component should have invalid state style. + * @defaultValue false + */ + invalid?: boolean | undefined; /** * Uses to pass attributes to the panel's DOM element. */ diff --git a/components/lib/radiobutton/RadioButtonBase.js b/components/lib/radiobutton/RadioButtonBase.js index 52793a3681..f1a50200bb 100644 --- a/components/lib/radiobutton/RadioButtonBase.js +++ b/components/lib/radiobutton/RadioButtonBase.js @@ -23,6 +23,7 @@ export const RadioButtonBase = ComponentBase.extend({ id: null, inputId: null, inputRef: null, + invalid: false, name: null, onChange: null, onClick: null, diff --git a/components/lib/selectbutton/SelectButtonBase.js b/components/lib/selectbutton/SelectButtonBase.js index 96f336a298..265573a881 100644 --- a/components/lib/selectbutton/SelectButtonBase.js +++ b/components/lib/selectbutton/SelectButtonBase.js @@ -2,7 +2,7 @@ import { ComponentBase } from '../componentbase/ComponentBase'; import { classNames } from '../utils/Utils'; const classes = { - root: ({ props }) => classNames('p-selectbutton p-buttonset p-component', props.className), + root: ({ props }) => classNames('p-selectbutton p-buttonset p-component', props.className, { 'p-invalid': props.invalid }), button: ({ itemProps: props, focusedState }) => classNames('p-button p-component', { 'p-highlight': props.selected, @@ -23,6 +23,7 @@ export const SelectButtonBase = ComponentBase.extend({ optionDisabled: null, tabIndex: null, multiple: false, + invalid: false, unselectable: true, allowEmpty: true, disabled: false, diff --git a/components/lib/selectbutton/selectbutton.d.ts b/components/lib/selectbutton/selectbutton.d.ts index 31219be908..b63e1a31ad 100644 --- a/components/lib/selectbutton/selectbutton.d.ts +++ b/components/lib/selectbutton/selectbutton.d.ts @@ -117,6 +117,11 @@ export interface SelectButtonProps extends Omit