From 9b09cd904c58e7efb2d91049568e09269a260e8b Mon Sep 17 00:00:00 2001 From: gucal Date: Wed, 13 Mar 2024 10:38:30 +0300 Subject: [PATCH 1/4] #6139 - New invalid properties --- components/lib/autocomplete/AutoCompleteBase.js | 2 ++ components/lib/autocomplete/autocomplete.d.ts | 5 +++++ components/lib/calendar/CalendarBase.js | 2 ++ components/lib/calendar/calendar.d.ts | 5 +++++ components/lib/cascadeselect/CascadeSelectBase.js | 2 ++ components/lib/cascadeselect/cascadeselect.d.ts | 5 +++++ components/lib/checkbox/CheckboxBase.js | 2 ++ components/lib/checkbox/checkbox.d.ts | 5 +++++ components/lib/chips/ChipsBase.js | 2 ++ components/lib/chips/chips.d.ts | 5 +++++ components/lib/dropdown/DropdownBase.js | 2 ++ components/lib/dropdown/dropdown.d.ts | 5 +++++ components/lib/inputnumber/InputNumberBase.js | 4 +++- components/lib/inputnumber/inputnumber.d.ts | 5 +++++ components/lib/inputswitch/InputSwitchBase.js | 2 ++ components/lib/inputswitch/inputswitch.d.ts | 9 +++++++-- components/lib/inputtext/InputTextBase.js | 4 +++- components/lib/inputtext/inputtext.d.ts | 5 +++++ components/lib/inputtextarea/InputTextareaBase.js | 4 +++- components/lib/inputtextarea/inputtextarea.d.ts | 5 +++++ components/lib/listbox/ListBoxBase.js | 4 +++- components/lib/listbox/listbox.d.ts | 5 +++++ components/lib/multiselect/MultiSelectBase.js | 2 ++ components/lib/multiselect/multiselect.d.ts | 5 +++++ components/lib/password/PasswordBase.js | 4 +++- components/lib/password/password.d.ts | 5 +++++ components/lib/radiobutton/RadioButtonBase.js | 4 +++- components/lib/radiobutton/radiobutton.d.ts | 5 +++++ components/lib/selectbutton/SelectButtonBase.js | 3 ++- components/lib/selectbutton/selectbutton.d.ts | 5 +++++ components/lib/togglebutton/ToggleButtonBase.js | 4 +++- components/lib/togglebutton/togglebutton.d.ts | 5 +++++ components/lib/treeselect/TreeSelectBase.js | 2 ++ components/lib/treeselect/treeselect.d.ts | 5 +++++ components/lib/tristatecheckbox/TriStateCheckboxBase.js | 2 ++ components/lib/tristatecheckbox/tristatecheckbox.d.ts | 5 +++++ 36 files changed, 135 insertions(+), 10 deletions(-) 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 da565f89f4..921db8271a 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 993a0ae489..45b5aacea5 100644 --- a/components/lib/checkbox/CheckboxBase.js +++ b/components/lib/checkbox/CheckboxBase.js @@ -7,6 +7,7 @@ const classes = { classNames('p-checkbox-box', { 'p-highlight': checked, 'p-disabled': props.disabled, + 'p-invalid': props.invalid, 'p-focus': focusedState }), root: ({ props, checked, focusedState }) => @@ -49,6 +50,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 80d64edd8d..807039146e 100644 --- a/components/lib/checkbox/checkbox.d.ts +++ b/components/lib/checkbox/checkbox.d.ts @@ -159,6 +159,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), @@ -176,6 +177,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 b15b721823..d0e0ff2ab8 100644 --- a/components/lib/dropdown/dropdown.d.ts +++ b/components/lib/dropdown/dropdown.d.ts @@ -246,6 +246,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 ef19e8b7a8..32d5775cd4 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; @@ -130,6 +130,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 5704c26fc6..0e8bd3fe38 100644 --- a/components/lib/radiobutton/RadioButtonBase.js +++ b/components/lib/radiobutton/RadioButtonBase.js @@ -6,7 +6,8 @@ const classes = { classNames('p-radiobutton p-component', { 'p-radiobutton-checked': props.checked, 'p-radiobutton-disabled': props.disabled, - 'p-radiobutton-focused': focusedState + 'p-radiobutton-focused': focusedState, + 'p-invalid': props.invalid }), input: ({ props, focusedState }) => classNames('p-radiobutton-box', { @@ -57,6 +58,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/radiobutton/radiobutton.d.ts b/components/lib/radiobutton/radiobutton.d.ts index bbb0700b54..adb80a3870 100644 --- a/components/lib/radiobutton/radiobutton.d.ts +++ b/components/lib/radiobutton/radiobutton.d.ts @@ -120,6 +120,11 @@ export interface RadioButtonProps extends Omit 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 Date: Wed, 13 Mar 2024 10:55:31 +0300 Subject: [PATCH 2/4] Remove invalid class from password --- components/lib/password/Password.js | 1 + components/lib/password/PasswordBase.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/lib/password/Password.js b/components/lib/password/Password.js index 854a26f20f..630de75b0b 100644 --- a/components/lib/password/Password.js +++ b/components/lib/password/Password.js @@ -431,6 +431,7 @@ export const Password = React.memo( onFocus: onFocus, onInput: onInput, onKeyUp: onKeyup, + invalid: props.invalid, style: props.inputStyle, tabIndex: props.tabIndex, tooltip: props.tooltip, diff --git a/components/lib/password/PasswordBase.js b/components/lib/password/PasswordBase.js index 036855868c..18734fd12d 100644 --- a/components/lib/password/PasswordBase.js +++ b/components/lib/password/PasswordBase.js @@ -9,8 +9,7 @@ const classes = { { 'p-inputwrapper-filled': isFilled, 'p-inputwrapper-focus': focusedState, - 'p-input-icon-right': props.toggleMask, - 'p-invalid': props.invalid + 'p-input-icon-right': props.toggleMask }, props.className ), From d9cdcbc7df6967c961d59821a23a294b3ddbfe40 Mon Sep 17 00:00:00 2001 From: Tarik1700 Date: Sat, 16 Mar 2024 14:05:08 +0100 Subject: [PATCH 3/4] bugfix: fixed animations not working correctly on TRANSITION.toggleable with tailwind preset --- components/lib/passthrough/tailwind/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/lib/passthrough/tailwind/index.js b/components/lib/passthrough/tailwind/index.js index c6f1262b3a..798ee70dd7 100644 --- a/components/lib/passthrough/tailwind/index.js +++ b/components/lib/passthrough/tailwind/index.js @@ -5,9 +5,9 @@ export const TRANSITIONS = { timeout: 500, classNames: { enter: 'max-h-0', - enterActive: '!max-h-40 overflow-hidden transition-all duration-500 ease-in-out', - exit: 'max-h-40', - exitActive: '!max-h-0 overflow-hidden transition-all duration-500 ease-in' + enterActive: '!max-h-[1000px] overflow-hidden transition-[max-height] duration-500 ease-in', + exit: 'max-h-[1000px]', + exitActive: '!max-h-0 overflow-hidden transition-[max-height] duration-500 ease-out' } }, overlay: { From 7c7b8a8b8c9af291ffc3e5585d19658978075271 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot <> Date: Mon, 18 Mar 2024 07:01:18 +0000 Subject: [PATCH 4/4] Update API doc --- components/doc/common/apidoc/index.json | 155 ++++++++++++++++++++++-- 1 file changed, 142 insertions(+), 13 deletions(-) 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,