Fixed #5176 - variant added

pull/5189/head
tugcekucukoglu 2024-01-31 11:02:53 +03:00
parent d43ea02957
commit ff22cfe15e
45 changed files with 182 additions and 22 deletions

View File

@ -360,6 +360,11 @@ export interface AutoCompleteProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* A property to uniquely identify an option. * A property to uniquely identify an option.
*/ */

View File

@ -45,6 +45,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -111,6 +111,7 @@ const classes = {
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid, 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled',
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-autocomplete-dd': props.dropdown, 'p-autocomplete-dd': props.dropdown,
'p-autocomplete-multiple': props.multiple, 'p-autocomplete-multiple': props.multiple,
@ -127,10 +128,10 @@ const classes = {
inputToken: 'p-autocomplete-input-token', inputToken: 'p-autocomplete-input-token',
loadingIcon: 'p-autocomplete-loader', loadingIcon: 'p-autocomplete-loader',
dropdownButton: 'p-autocomplete-dropdown', dropdownButton: 'p-autocomplete-dropdown',
panel: ({ instance }) => [ panel: ({ props, instance }) => [
'p-autocomplete-panel p-component', 'p-autocomplete-panel p-component',
{ {
'p-input-filled': instance.$primevue.config.inputStyle === 'filled', 'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled',
'p-ripple-disabled': instance.$primevue.config.ripple === false 'p-ripple-disabled': instance.$primevue.config.ripple === false
} }
], ],

View File

@ -176,6 +176,10 @@ export default {
type: [String, Object], type: [String, Object],
default: 'body' default: 'body'
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -721,6 +721,11 @@ export interface CalendarProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* When present, it specifies that an input field is read-only. * When present, it specifies that an input field is read-only.
* @defaultValue false * @defaultValue false

View File

@ -167,6 +167,7 @@ const classes = {
'p-calendar-timeonly': props.timeOnly, 'p-calendar-timeonly': props.timeOnly,
'p-calendar-disabled': props.disabled, 'p-calendar-disabled': props.disabled,
'p-invalid': props.invalid, 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled',
'p-inputwrapper-filled': props.modelValue, 'p-inputwrapper-filled': props.modelValue,
'p-inputwrapper-focus': state.focused, 'p-inputwrapper-focus': state.focused,
'p-focus': state.focused || state.overlayVisible 'p-focus': state.focused || state.overlayVisible
@ -186,7 +187,7 @@ const classes = {
'p-datepicker-monthpicker': state.currentView === 'month', 'p-datepicker-monthpicker': state.currentView === 'month',
'p-datepicker-yearpicker': state.currentView === 'year', 'p-datepicker-yearpicker': state.currentView === 'year',
'p-datepicker-touch-ui': props.touchUI, 'p-datepicker-touch-ui': props.touchUI,
'p-input-filled': instance.$primevue.config.inputStyle === 'filled', 'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled',
'p-ripple-disabled': instance.$primevue.config.ripple === false 'p-ripple-disabled': instance.$primevue.config.ripple === false
} }
], ],

View File

@ -14,6 +14,10 @@ export default {
optionGroupLabel: null, optionGroupLabel: null,
optionGroupChildren: null, optionGroupChildren: null,
placeholder: String, placeholder: String,
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -281,6 +281,11 @@ export interface CascadeSelectProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* A property to uniquely identify an option. * A property to uniquely identify an option.
*/ */

View File

@ -104,6 +104,7 @@ const classes = {
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid, 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled',
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-inputwrapper-filled': props.modelValue, 'p-inputwrapper-filled': props.modelValue,
'p-inputwrapper-focus': instance.focused || instance.overlayVisible, 'p-inputwrapper-focus': instance.focused || instance.overlayVisible,
@ -120,10 +121,10 @@ const classes = {
dropdownButton: 'p-cascadeselect-trigger', dropdownButton: 'p-cascadeselect-trigger',
loadingIcon: 'p-cascadeselect-trigger-icon', loadingIcon: 'p-cascadeselect-trigger-icon',
dropdownIcon: 'p-cascadeselect-trigger-icon', dropdownIcon: 'p-cascadeselect-trigger-icon',
panel: ({ instance }) => [ panel: ({ props, instance }) => [
'p-cascadeselect-panel p-component', 'p-cascadeselect-panel p-component',
{ {
'p-input-filled': instance.$primevue.config.inputStyle === 'filled', 'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled',
'p-ripple-disabled': instance.$primevue.config.ripple === false 'p-ripple-disabled': instance.$primevue.config.ripple === false
} }
], ],

View File

@ -21,6 +21,10 @@ export default {
type: null, type: null,
default: false default: false
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -121,6 +121,11 @@ export interface CheckboxProps {
* @default false * @default false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* When present, it specifies that an input field is read-only. * When present, it specifies that an input field is read-only.
* @default false * @default false

View File

@ -27,7 +27,8 @@ const classes = {
{ {
'p-highlight': instance.checked, 'p-highlight': instance.checked,
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled'
} }
], ],
box: 'p-checkbox-box', box: 'p-checkbox-box',

View File

@ -30,6 +30,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -194,6 +194,11 @@ export interface ChipsProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* Placeholder text for the input. * Placeholder text for the input.
*/ */

View File

@ -56,6 +56,7 @@ const classes = {
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid, 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled',
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-inputwrapper-filled': (props.modelValue && props.modelValue.length) || (instance.inputValue && instance.inputValue.length), 'p-inputwrapper-filled': (props.modelValue && props.modelValue.length) || (instance.inputValue && instance.inputValue.length),
'p-inputwrapper-focus': instance.focused 'p-inputwrapper-focus': instance.focused

View File

@ -33,6 +33,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -329,6 +329,11 @@ export interface DropdownProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* A property to uniquely identify an option. * A property to uniquely identify an option.
*/ */

View File

@ -105,6 +105,7 @@ const classes = {
{ {
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid, 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled',
'p-dropdown-clearable': props.showClear, 'p-dropdown-clearable': props.showClear,
'p-focus': state.focused, 'p-focus': state.focused,
'p-inputwrapper-filled': instance.hasSelectedOption, 'p-inputwrapper-filled': instance.hasSelectedOption,
@ -123,10 +124,10 @@ const classes = {
trigger: 'p-dropdown-trigger', trigger: 'p-dropdown-trigger',
loadingicon: 'p-dropdown-trigger-icon', loadingicon: 'p-dropdown-trigger-icon',
dropdownIcon: 'p-dropdown-trigger-icon', dropdownIcon: 'p-dropdown-trigger-icon',
panel: ({ instance }) => [ panel: ({ props, instance }) => [
'p-dropdown-panel p-component', 'p-dropdown-panel p-component',
{ {
'p-input-filled': instance.$primevue.config.inputStyle === 'filled', 'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled',
'p-ripple-disabled': instance.$primevue.config.ripple === false 'p-ripple-disabled': instance.$primevue.config.ripple === false
} }
], ],

View File

@ -26,6 +26,14 @@ export default {
readonly: { readonly: {
type: Boolean, type: Boolean,
default: false default: false
},
invalid: {
type: Boolean,
default: false
},
variant: {
type: String,
default: 'outlined'
} }
}, },
style: InputMaskStyle style: InputMaskStyle

View File

@ -114,6 +114,16 @@ export interface InputMaskProps {
* @defaultValue false * @defaultValue false
*/ */
readonly?: boolean | undefined; readonly?: boolean | undefined;
/**
* When present, it specifies that the component should have invalid state style.
* @defaultValue false
*/
invalid?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* Used to pass attributes to DOM elements inside the component. * Used to pass attributes to DOM elements inside the component.
* @type {InputMaskPassThroughOptions} * @type {InputMaskPassThroughOptions}

View File

@ -1,10 +1,12 @@
import BaseStyle from 'primevue/base/style'; import BaseStyle from 'primevue/base/style';
const classes = { const classes = {
root: ({ instance }) => [ root: ({ props, instance }) => [
'p-inputmask p-inputtext p-component', 'p-inputmask p-inputtext p-component',
{ {
'p-filled': instance.filled 'p-filled': instance.filled,
'p-invalid': props.invalid,
'p-variant': props.variant === 'filled'
} }
] ]
}; };

View File

@ -109,6 +109,10 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -272,6 +272,11 @@ export interface InputNumberProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* When present, it specifies that an input field is read-only. * When present, it specifies that an input field is read-only.
* @defaultValue false * @defaultValue false

View File

@ -114,7 +114,8 @@ const classes = {
'p-inputnumber-buttons-stacked': props.showButtons && props.buttonLayout === 'stacked', 'p-inputnumber-buttons-stacked': props.showButtons && props.buttonLayout === 'stacked',
'p-inputnumber-buttons-horizontal': props.showButtons && props.buttonLayout === 'horizontal', 'p-inputnumber-buttons-horizontal': props.showButtons && props.buttonLayout === 'horizontal',
'p-inputnumber-buttons-vertical': props.showButtons && props.buttonLayout === 'vertical', 'p-inputnumber-buttons-vertical': props.showButtons && props.buttonLayout === 'vertical',
'p-invalid': props.invalid 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled'
} }
], ],
input: 'p-inputnumber-input', input: 'p-inputnumber-input',

View File

@ -14,6 +14,10 @@ export default {
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false
},
variant: {
type: String,
default: 'outlined'
} }
}, },
style: InputTextStyle, style: InputTextStyle,

View File

@ -96,6 +96,11 @@ export interface InputTextProps extends InputHTMLAttributes {
* @defaultValue false * @defaultValue false
*/ */
invalid?: boolean | undefined; invalid?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* Used to pass attributes to DOM elements inside the component. * Used to pass attributes to DOM elements inside the component.
* @type {InputTextPassThroughOptions} * @type {InputTextPassThroughOptions}

View File

@ -7,7 +7,8 @@ const classes = {
'p-filled': instance.filled, 'p-filled': instance.filled,
'p-inputtext-sm': props.size === 'small', 'p-inputtext-sm': props.size === 'small',
'p-inputtext-lg': props.size === 'large', 'p-inputtext-lg': props.size === 'large',
'p-invalid': props.invalid 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled'
} }
] ]
}; };

View File

@ -18,6 +18,10 @@ export default {
default: '200px' default: '200px'
}, },
placeholder: String, placeholder: String,
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -341,6 +341,11 @@ export interface MultiSelectProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* Identifier of the underlying input element. * Identifier of the underlying input element.
*/ */

View File

@ -121,6 +121,7 @@ const classes = {
'p-multiselect-chip': props.display === 'chip', 'p-multiselect-chip': props.display === 'chip',
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid, 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled',
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-inputwrapper-filled': props.modelValue && props.modelValue.length, 'p-inputwrapper-filled': props.modelValue && props.modelValue.length,
'p-inputwrapper-focus': instance.focused || instance.overlayVisible, 'p-inputwrapper-focus': instance.focused || instance.overlayVisible,
@ -141,10 +142,10 @@ const classes = {
trigger: 'p-multiselect-trigger', trigger: 'p-multiselect-trigger',
loadingIcon: 'p-multiselect-trigger-icon', loadingIcon: 'p-multiselect-trigger-icon',
dropdownIcon: 'p-multiselect-trigger-icon', dropdownIcon: 'p-multiselect-trigger-icon',
panel: ({ instance }) => [ panel: ({ props, instance }) => [
'p-multiselect-panel p-component', 'p-multiselect-panel p-component',
{ {
'p-input-filled': instance.$primevue.config.inputStyle === 'filled', 'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled',
'p-ripple-disabled': instance.$primevue.config.ripple === false 'p-ripple-disabled': instance.$primevue.config.ripple === false
} }
], ],

View File

@ -51,6 +51,10 @@ export default {
type: String, type: String,
default: undefined default: undefined
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -231,6 +231,11 @@ export interface PasswordProps extends InputHTMLAttributes {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* Placeholder text for the input. * Placeholder text for the input.
*/ */

View File

@ -42,7 +42,8 @@ const classes = {
'p-inputwrapper-filled': instance.filled, 'p-inputwrapper-filled': instance.filled,
'p-inputwrapper-focus': instance.focused, 'p-inputwrapper-focus': instance.focused,
'p-input-icon-right': props.toggleMask, 'p-input-icon-right': props.toggleMask,
'p-invalid': props.invalid 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled'
} }
], ],
input: ({ props }) => [ input: ({ props }) => [
@ -51,10 +52,10 @@ const classes = {
'p-disabled': props.disabled 'p-disabled': props.disabled
} }
], ],
panel: ({ instance }) => [ panel: ({ props, instance }) => [
'p-password-panel p-component', 'p-password-panel p-component',
{ {
'p-input-filled': instance.$primevue.config.inputStyle === 'filled', 'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled',
'p-ripple-disabled': instance.$primevue.config.ripple === false 'p-ripple-disabled': instance.$primevue.config.ripple === false
} }
], ],

View File

@ -13,6 +13,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -120,6 +120,11 @@ export interface RadioButtonProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* When present, it specifies that an input field is read-only. * When present, it specifies that an input field is read-only.
* @default false * @default false

View File

@ -40,7 +40,8 @@ const classes = {
{ {
'p-highlight': instance.checked, 'p-highlight': instance.checked,
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled'
} }
], ],
box: 'p-radiobutton-box', box: 'p-radiobutton-box',

View File

@ -11,6 +11,10 @@ export default {
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false
},
variant: {
type: String,
default: 'outlined'
} }
}, },
style: TextareaStyle, style: TextareaStyle,

View File

@ -102,6 +102,11 @@ export interface TextareaProps extends TextareaHTMLAttributes {
* @defaultValue false * @defaultValue false
*/ */
invalid?: boolean | undefined; invalid?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* Used to pass attributes to DOM elements inside the component. * Used to pass attributes to DOM elements inside the component.
* @type {TextareaPassThroughOptions} * @type {TextareaPassThroughOptions}

View File

@ -19,7 +19,8 @@ const classes = {
{ {
'p-filled': instance.filled, 'p-filled': instance.filled,
'p-inputtextarea-resizable ': props.autoResize, 'p-inputtextarea-resizable ': props.autoResize,
'p-invalid': props.invalid 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled'
} }
] ]
}; };

View File

@ -16,6 +16,10 @@ export default {
type: String, type: String,
default: null default: null
}, },
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -189,6 +189,11 @@ export interface TreeSelectProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* Index of the element in tabbing order. * Index of the element in tabbing order.
*/ */

View File

@ -66,6 +66,7 @@ const classes = {
'p-treeselect-chip': props.display === 'chip', 'p-treeselect-chip': props.display === 'chip',
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid, 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled',
'p-focus': instance.focused, 'p-focus': instance.focused,
'p-inputwrapper-filled': !instance.emptyValue, 'p-inputwrapper-filled': !instance.emptyValue,
'p-inputwrapper-focus': instance.focused || instance.overlayVisible 'p-inputwrapper-focus': instance.focused || instance.overlayVisible
@ -83,10 +84,10 @@ const classes = {
tokenLabel: 'p-treeselect-token-label', tokenLabel: 'p-treeselect-token-label',
trigger: 'p-treeselect-trigger', trigger: 'p-treeselect-trigger',
triggerIcon: 'p-treeselect-trigger-icon', triggerIcon: 'p-treeselect-trigger-icon',
panel: ({ instance }) => [ panel: ({ props, instance }) => [
'p-treeselect-panel p-component', 'p-treeselect-panel p-component',
{ {
'p-input-filled': instance.$primevue.config.inputStyle === 'filled', 'p-input-filled': props.variant === 'filled' || instance.$primevue.config.inputStyle === 'filled',
'p-ripple-disabled': instance.$primevue.config.ripple === false 'p-ripple-disabled': instance.$primevue.config.ripple === false
} }
], ],

View File

@ -7,6 +7,10 @@ export default {
extends: BaseComponent, extends: BaseComponent,
props: { props: {
modelValue: null, modelValue: null,
variant: {
type: String,
default: 'outlined'
},
invalid: { invalid: {
type: Boolean, type: Boolean,
default: false default: false

View File

@ -137,6 +137,11 @@ export interface TriStateCheckboxProps {
* @defaultValue false * @defaultValue false
*/ */
disabled?: boolean | undefined; disabled?: boolean | undefined;
/**
* Specifies the input variant of the component.
* @defaultValue outlined
*/
variant?: 'outlined' | 'filled' | undefined;
/** /**
* When present, it specifies that an input field is read-only. * When present, it specifies that an input field is read-only.
* @default false * @default false

View File

@ -27,7 +27,8 @@ const classes = {
{ {
'p-highlight': instance.active, 'p-highlight': instance.active,
'p-disabled': props.disabled, 'p-disabled': props.disabled,
'p-invalid': props.invalid 'p-invalid': props.invalid,
'p-variant': props.variant === 'filled'
} }
], ],
box: 'p-checkbox-box', box: 'p-checkbox-box',