Revert Toast button updates

pull/5677/head
tugcekucukoglu 2024-05-02 13:35:32 +03:00
parent cf8f24d097
commit 9b95710cf6
3 changed files with 13 additions and 38 deletions

View File

@ -47,10 +47,8 @@ export default {
default: undefined default: undefined
}, },
closeButtonProps: { closeButtonProps: {
type: Object, type: null,
default: () => { default: null
return {};
}
} }
}, },
style: ToastStyle, style: ToastStyle,

View File

@ -7,9 +7,7 @@
* @module toast * @module toast
* *
*/ */
import { TransitionProps, VNode } from 'vue'; import { ButtonHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptions } from '../button';
import { PassThroughOptions } from '../passthrough'; import { PassThroughOptions } from '../passthrough';
import { ClassComponent, DesignToken, GlobalComponentConstructor, PassThrough } from '../ts-helpers'; import { ClassComponent, DesignToken, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
@ -47,20 +45,6 @@ export interface ToastPassThroughMethodOptions {
global: object | undefined; global: object | undefined;
} }
/**
* Custom shared passthrough(pt) option method.
*/
export interface ToastSharedPassThroughMethodOptions {
/**
* Defines valid properties.
*/
props: ToastProps;
/**
* Defines current inline state.
*/
state: ToastState;
}
/** /**
* Custom passthrough(pt) options. * Custom passthrough(pt) options.
* @see {@link ToastProps.pt} * @see {@link ToastProps.pt}
@ -99,17 +83,14 @@ export interface ToastPassThroughOptions {
*/ */
buttonContainer?: ToastPassThroughOptionType; buttonContainer?: ToastPassThroughOptionType;
/** /**
* /**
* Used to pass attributes to the button's DOM element. * Used to pass attributes to the button's DOM element.
* @see {@link ButtonPassThroughOptions} * @deprecated since v3.30.2. Use 'closeButton' option.
*/ */
button?: ButtonPassThroughOptions<ToastSharedPassThroughMethodOptions>; button?: ToastPassThroughOptionType;
/** /**
* /** * Used to pass attributes to the button's DOM element.
* Used to pass attributes to the close button's DOM element.
* @see {@link ButtonPassThroughOptions}
*/ */
closeButton?: ButtonPassThroughOptions<ToastSharedPassThroughMethodOptions>; closeButton?: ToastPassThroughOptionType;
/** /**
* Used to pass attributes to the button icon's DOM element. * Used to pass attributes to the button icon's DOM element.
*/ */
@ -251,10 +232,10 @@ export interface ToastProps {
*/ */
successIcon?: string | undefined; successIcon?: string | undefined;
/** /**
* Used to pass attributes to the close Button component. * Used to pass all properties of the HTMLButtonElement to the close button.
* @defaultValue {} * @deprecated since v3.26.0. Use 'pt' property.
*/ */
closeButtonProps?: object | undefined; closeButtonProps?: ButtonHTMLAttributes | undefined;
/** /**
* Used to access message options. * Used to access message options.
* @type {ToastMessageOptions} * @type {ToastMessageOptions}

View File

@ -11,11 +11,9 @@
</template> </template>
<component v-else :is="templates.message" :message="message"></component> <component v-else :is="templates.message" :message="message"></component>
<div v-if="message.closable !== false" v-bind="ptm('buttonContainer')"> <div v-if="message.closable !== false" v-bind="ptm('buttonContainer')">
<Button :class="cx('closeButton')" :aria-label="closeAriaLabel" @click="onCloseClick" autofocus :unstyled="unstyled" v-bind="closeButtonProps" :pt="{ ...ptm('button'), ...ptm('closeButton') }"> <button v-ripple :class="cx('closeButton')" type="button" :aria-label="closeAriaLabel" @click="onCloseClick" autofocus v-bind="{ ...closeButtonProps, ...ptm('button'), ...ptm('closeButton') }">
<template #icon="slotProps"> <component :is="templates.closeicon || 'TimesIcon'" :class="[cx('closeIcon'), closeIcon]" v-bind="{ ...ptm('buttonIcon'), ...ptm('closeIcon') }" />
<component :is="templates.closeicon || 'TimesIcon'" :class="[cx('closeIcon'), closeIcon, slotProps.class]" v-bind="{ ...ptm('buttonIcon')['icon'], ...ptm('closeIcon')['icon'] }" /> </button>
</template>
</Button>
</div> </div>
</div> </div>
</div> </div>
@ -23,7 +21,6 @@
<script> <script>
import BaseComponent from 'primevue/basecomponent'; import BaseComponent from 'primevue/basecomponent';
import Button from 'primevue/button';
import CheckIcon from 'primevue/icons/check'; import CheckIcon from 'primevue/icons/check';
import ExclamationTriangleIcon from 'primevue/icons/exclamationtriangle'; import ExclamationTriangleIcon from 'primevue/icons/exclamationtriangle';
import InfoCircleIcon from 'primevue/icons/infocircle'; import InfoCircleIcon from 'primevue/icons/infocircle';
@ -110,7 +107,6 @@ export default {
} }
}, },
components: { components: {
Button,
TimesIcon: TimesIcon, TimesIcon: TimesIcon,
InfoCircleIcon: InfoCircleIcon, InfoCircleIcon: InfoCircleIcon,
CheckIcon: CheckIcon, CheckIcon: CheckIcon,