Skip to content

Commit

Permalink
Refactor #5437 - For OverlayPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Mar 18, 2024
1 parent 6ef3c46 commit 88c2e63
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 42 deletions.
8 changes: 0 additions & 8 deletions components/lib/overlaypanel/BaseOverlayPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ export default {
type: Boolean,
default: true
},
showCloseIcon: {
type: Boolean,
default: false
},
appendTo: {
type: [String, Object],
default: 'body'
Expand All @@ -30,10 +26,6 @@ export default {
type: Object,
default: null
},
closeIcon: {
type: String,
default: undefined
},
closeOnEscape: {
type: Boolean,
default: true
Expand Down
24 changes: 1 addition & 23 deletions components/lib/overlaypanel/OverlayPanel.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, HintedString, PassThrough } from '../ts-helpers';

export declare type OverlayPanelPassThroughOptionType = OverlayPanelPassThroughAttributes | ((options: OverlayPanelPassThroughMethodOptions) => OverlayPanelPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -59,14 +59,6 @@ export interface OverlayPanelPassThroughOptions {
* Used to pass attributes to the content's DOM element.
*/
content?: OverlayPanelPassThroughOptionType;
/**
* Used to pass attributes to the close button's DOM element.
*/
closeButton?: OverlayPanelPassThroughOptionType;
/**
* Used to pass attributes to the close icon's DOM element.
*/
closeIcon?: OverlayPanelPassThroughOptionType;
/**
* Used to manage all lifecycle hooks.
* @see {@link BaseComponent.ComponentHooks}
Expand Down Expand Up @@ -127,11 +119,6 @@ export interface OverlayPanelProps {
* @defaultValue true
*/
dismissable?: boolean;
/**
* When enabled, displays a close icon at top right corner.
* @defaultValue false
*/
showCloseIcon?: boolean;
/**
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
* @defaultValue body
Expand All @@ -151,11 +138,6 @@ export interface OverlayPanelProps {
* Object literal to define widths per screen size.
*/
breakpoints?: OverlayPanelBreakpoints;
/**
* Icon to display in the overlaypanel close button.
* @deprecated since v3.27.0. Use 'closeicon' slot.
*/
closeIcon?: string | undefined;
/**
* Used to pass attributes to DOM elements inside the component.
* @type {OverlayPanelPassThroughOptions}
Expand Down Expand Up @@ -186,10 +168,6 @@ export interface OverlayPanelSlots {
* Custom content template.
*/
default(): VNode[];
/**
* Custom close icon template.
*/
closeicon(): VNode[];
/**
* Custom container slot.
* @param {Object} scope - container slot's params.
Expand Down
12 changes: 1 addition & 11 deletions components/lib/overlaypanel/OverlayPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
<div :class="cx('content')" @click="onContentClick" @mousedown="onContentClick" @keydown="onContentKeydown" v-bind="ptm('content')">
<slot></slot>
</div>
<button v-if="showCloseIcon" v-ripple :class="cx('closeButton')" :aria-label="closeAriaLabel" type="button" autofocus @click="hide" @keydown="onButtonKeydown" v-bind="ptm('closeButton')">
<slot name="closeicon">
<component :is="closeIcon ? 'span' : 'TimesIcon'" :class="[cx('closeIcon'), closeIcon]" v-bind="ptm('closeIcon')"></component>
</slot>
</button>
</template>
</div>
</transition>
Expand All @@ -20,7 +15,6 @@

<script>
import FocusTrap from 'primevue/focustrap';
import TimesIcon from 'primevue/icons/times';
import OverlayEventBus from 'primevue/overlayeventbus';
import Portal from 'primevue/portal';
import Ripple from 'primevue/ripple';
Expand Down Expand Up @@ -306,18 +300,14 @@ export default {
computed: {
attributeSelector() {
return UniqueComponentId();
},
closeAriaLabel() {
return this.$primevue.config.locale.aria ? this.$primevue.config.locale.aria.close : undefined;
}
},
directives: {
focustrap: FocusTrap,
ripple: Ripple
},
components: {
Portal: Portal,
TimesIcon
Portal
}
};
</script>

0 comments on commit 88c2e63

Please sign in to comment.