diff --git a/components/lib/overlaypanel/OverlayPanel.d.ts b/components/lib/overlaypanel/OverlayPanel.d.ts old mode 100755 new mode 100644 index f50ab38b7..fe0bd8354 --- a/components/lib/overlaypanel/OverlayPanel.d.ts +++ b/components/lib/overlaypanel/OverlayPanel.d.ts @@ -2,224 +2,66 @@ * * OverlayPanel is a container component positioned as connected to its target. * - * [Live Demo](https://primevue.org/overlaypanel) + * [Live Demo](https://primevue.org/popover) * * @module overlaypanel * */ -import { TransitionProps, VNode } from 'vue'; -import { ComponentHooks } from '../basecomponent'; -import { PassThroughOptions } from '../passthrough'; -import { ClassComponent, DesignToken, GlobalComponentConstructor, HintedString, PassThrough } from '../ts-helpers'; - -export declare type OverlayPanelPassThroughOptionType = OverlayPanelPassThroughAttributes | ((options: OverlayPanelPassThroughMethodOptions) => OverlayPanelPassThroughAttributes | string) | string | null | undefined; - -export declare type OverlayPanelPassThroughTransitionType = TransitionProps | ((options: OverlayPanelPassThroughMethodOptions) => TransitionProps) | undefined; +import 'vue'; +import * as Popover from '../popover'; +import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; /** * Custom passthrough(pt) option method. */ -export interface OverlayPanelPassThroughMethodOptions { - /** - * Defines instance. - */ - instance: any; - /** - * Defines valid properties. - */ - props: OverlayPanelProps; - /** - * Defines current inline state. - */ - state: OverlayPanelState; - /** - * Defines valid attributes. - */ - attrs: any; - /** - * Defines parent options. - */ - parent: any; - /** - * Defines passthrough(pt) options in global config. - */ - global: object | undefined; -} +export interface OverlayPanelPassThroughMethodOptions extends Popover.PopoverPassThroughMethodOptions {} /** * Custom passthrough(pt) options. * @see {@link OverlayPanelProps.pt} */ -export interface OverlayPanelPassThroughOptions { - /** - * Used to pass attributes to the root's DOM element. - */ - root?: OverlayPanelPassThroughOptionType; - /** - * Used to pass attributes to the content's DOM element. - */ - content?: OverlayPanelPassThroughOptionType; - /** - * Used to manage all lifecycle hooks. - * @see {@link BaseComponent.ComponentHooks} - */ - hooks?: ComponentHooks; - /** - * Used to control Vue Transition API. - */ - transition?: OverlayPanelPassThroughTransitionType; -} +export interface OverlayPanelPassThroughOptions extends Popover.PopoverPassThroughOptions {} /** * Custom passthrough attributes for each DOM elements */ -export interface OverlayPanelPassThroughAttributes { +export interface OverlayPanelPassThroughAttributes extends Popover.PopoverPassThroughAttributes { [key: string]: any; } /** * Defines current inline state in OverlayPanel component. */ -export interface OverlayPanelState { - /** - * Current visible state as a boolean. - * @defaultValue false - */ - visible: boolean; -} +export interface OverlayPanelState extends Popover.PopoverState {} /** * OverlayPanel breakpoint metadata. */ -export interface OverlayPanelBreakpoints { - /** - * Breakpoint for responsive mode. - * - * Example: - * - * - * - * Result: - * - * @media screen and (max-width: ${breakpoint[key]}) { - * .p-overlaypanel[attributeSelector] { - * width: ${breakpoint[value]} !important; - * } - * } - */ - [key: string]: string; -} +export interface OverlayPanelBreakpoints extends Popover.PopoverBreakpoints {} /** * Defines valid properties in OverlayPanel component. */ -export interface OverlayPanelProps { - /** - * Enables to hide the overlay when outside is clicked. - * @defaultValue true - */ - dismissable?: boolean; - /** - * A valid query selector or an HTMLElement to specify where the overlay gets attached. - * @defaultValue body - */ - appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement; - /** - * Base zIndex value to use in layering. - * @defaultValue 0 - */ - baseZIndex?: number; - /** - * Whether to automatically manage layering. - * @defaultValue true - */ - autoZIndex?: boolean; - /** - * Object literal to define widths per screen size. - */ - breakpoints?: OverlayPanelBreakpoints; - /** - * It generates scoped CSS variables using design tokens for the component. - */ - dt?: DesignToken; - /** - * Used to pass attributes to DOM elements inside the component. - * @type {OverlayPanelPassThroughOptions} - */ - pt?: PassThrough; - /** - * Used to configure passthrough(pt) options of the component. - * @type {PassThroughOptions} - */ - ptOptions?: PassThroughOptions; - /** - * When enabled, it removes component related styles in the core. - * @defaultValue false - */ - unstyled?: boolean; - /** - * Specifies if pressing escape key should hide the dialog. - * @defaultValue true - */ - closeOnEscape?: boolean | undefined; -} +export interface OverlayPanelProps extends Popover.PopoverProps {} /** * Defines valid slots in OverlayPanel component. */ -export interface OverlayPanelSlots { - /** - * Custom content template. - */ - default(): VNode[]; - /** - * Custom container slot. - * @param {Object} scope - container slot's params. - */ - container(scope: { - /** - * Close overlay panel function. - * @deprecated since v3.39.0. Use 'closeCallback' property instead. - */ - onClose: () => void; - /** - * Close button keydown function. - * @param {Event} event - Browser event - * @deprecated since v3.39.0. Use 'keydownCallback' property instead. - */ - onKeydown: (event: Event) => void; - /** - * Close overlay panel function. - */ - closeCallback: () => void; - /** - * Close button keydown function. - * @param {Event} event - Browser event - */ - keydownCallback: (event: Event) => void; - }): VNode[]; -} +export interface OverlayPanelSlots extends Popover.PopoverSlots {} /** * Defines valid emits in OverlayPanel component. */ -export interface OverlayPanelEmits { - /** - * Callback to invoke when the overlay is shown. - */ - show(): void; - /** - * Callback to invoke when the overlay is hidden. - */ - hide(): void; -} +export interface OverlayPanelEmits extends Popover.PopoverEmits {} /** + * @deprecated Deprecated since v4. Use Popover component instead. + * * **PrimeVue - OverlayPanel** * * _OverlayPanel, also known as Popover, is a container component that can overlay other components on page._ * - * [Live Demo](https://www.primevue.org/overlaypanel/) + * [Live Demo](https://www.primevue.org/popover/) * --- --- * ![PrimeVue](https://primefaces.org/cdn/primevue/images/logo-100.png) * diff --git a/components/lib/overlaypanel/OverlayPanel.vue b/components/lib/overlaypanel/OverlayPanel.vue old mode 100755 new mode 100644 index 846fb1ac7..961c551c3 --- a/components/lib/overlaypanel/OverlayPanel.vue +++ b/components/lib/overlaypanel/OverlayPanel.vue @@ -1,314 +1,11 @@ - - diff --git a/components/lib/overlaypanel/style/OverlayPanelStyle.d.ts b/components/lib/overlaypanel/style/OverlayPanelStyle.d.ts index 00c07cea0..545a6dfd0 100644 --- a/components/lib/overlaypanel/style/OverlayPanelStyle.d.ts +++ b/components/lib/overlaypanel/style/OverlayPanelStyle.d.ts @@ -1,3 +1,3 @@ -import { BaseStyle } from '../../base/style'; +import { PopoverStyle } from '../../popover/style/PopoverStyle'; -export interface OverlayPanelStyle extends BaseStyle {} +export interface OverlayPanelStyle extends PopoverStyle {} diff --git a/components/lib/overlaypanel/style/OverlayPanelStyle.js b/components/lib/overlaypanel/style/OverlayPanelStyle.js index 5473da5f0..5f49164cb 100644 --- a/components/lib/overlaypanel/style/OverlayPanelStyle.js +++ b/components/lib/overlaypanel/style/OverlayPanelStyle.js @@ -1,16 +1,5 @@ import BaseStyle from 'primevue/base/style'; -const classes = { - root: ({ instance }) => [ - 'p-popover p-component', - { - 'p-ripple-disabled': instance.$primevue.config.ripple === false - } - ], - content: 'p-popover-content' -}; - export default BaseStyle.extend({ - name: 'overlaypanel', - classes + name: 'overlaypanel' }); diff --git a/components/lib/overlaypanel/BaseOverlayPanel.vue b/components/lib/popover/BasePopover.vue similarity index 86% rename from components/lib/overlaypanel/BaseOverlayPanel.vue rename to components/lib/popover/BasePopover.vue index f0f650885..b41a251fa 100644 --- a/components/lib/overlaypanel/BaseOverlayPanel.vue +++ b/components/lib/popover/BasePopover.vue @@ -1,9 +1,9 @@ diff --git a/components/lib/popover/package.json b/components/lib/popover/package.json new file mode 100644 index 000000000..f677be40a --- /dev/null +++ b/components/lib/popover/package.json @@ -0,0 +1,9 @@ +{ + "main": "./popover.cjs.js", + "module": "./popover.esm.js", + "unpkg": "./popover.min.js", + "types": "./Popover.d.ts", + "browser": { + "./sfc": "./Popover.vue" + } +} diff --git a/components/lib/popover/style/PopoverStyle.d.ts b/components/lib/popover/style/PopoverStyle.d.ts new file mode 100644 index 000000000..fa132056f --- /dev/null +++ b/components/lib/popover/style/PopoverStyle.d.ts @@ -0,0 +1,3 @@ +import { BaseStyle } from '../../base/style/BaseStyle'; + +export interface PopoverStyle extends BaseStyle {} diff --git a/components/lib/popover/style/PopoverStyle.js b/components/lib/popover/style/PopoverStyle.js new file mode 100644 index 000000000..8a2a66815 --- /dev/null +++ b/components/lib/popover/style/PopoverStyle.js @@ -0,0 +1,16 @@ +import BaseStyle from 'primevue/base/style'; + +const classes = { + root: ({ instance }) => [ + 'p-popover p-component', + { + 'p-ripple-disabled': instance.$primevue.config.ripple === false + } + ], + content: 'p-popover-content' +}; + +export default BaseStyle.extend({ + name: 'popover', + classes +}); diff --git a/components/lib/popover/style/package.json b/components/lib/popover/style/package.json new file mode 100644 index 000000000..e6d6e6bef --- /dev/null +++ b/components/lib/popover/style/package.json @@ -0,0 +1,6 @@ +{ + "main": "./popoverstyle.cjs.js", + "module": "./popoverstyle.esm.js", + "unpkg": "./popoverstyle.min.js", + "types": "./PopoverStyle.d.ts" +} diff --git a/components/lib/themes/primeone/base/overlaypanel/index.js b/components/lib/themes/primeone/base/popover/index.js similarity index 77% rename from components/lib/themes/primeone/base/overlaypanel/index.js rename to components/lib/themes/primeone/base/popover/index.js index 674db7988..d36aa1318 100644 --- a/components/lib/themes/primeone/base/overlaypanel/index.js +++ b/components/lib/themes/primeone/base/popover/index.js @@ -2,9 +2,9 @@ export default { css: ({ dt }) => ` .p-popover { margin-top: 10px; - background: ${dt('overlaypanel.background')}; - color: ${dt('overlaypanel.color')}; - border: 1px solid ${dt('overlaypanel.border.color')}; + background: ${dt('popover.background')}; + color: ${dt('popover.color')}; + border: 1px solid ${dt('popover.border.color')}; border-radius: ${dt('rounded.base')}; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); } @@ -51,7 +51,7 @@ export default { margin-left: -8px; border-style: solid; border-color: transparent; - border-bottom-color: ${dt('overlaypanel.background')}; + border-bottom-color: ${dt('popover.background')}; } .p-popover:before { @@ -59,7 +59,7 @@ export default { margin-left: -10px; border-style: solid; border-color: transparent; - border-bottom-color: ${dt('overlaypanel.border.color')}; + border-bottom-color: ${dt('popover.border.color')}; } .p-popover-flipped:after, @@ -70,12 +70,12 @@ export default { .p-popover.p-popover-flipped:after { border-bottom-color: transparent; - border-top-color: ${dt('overlaypanel.background')}; + border-top-color: ${dt('popover.background')}; } .p-popover.p-popover-flipped:before { border-bottom-color: transparent; - border-top-color: ${dt('overlaypanel.border.color')}; + border-top-color: ${dt('popover.border.color')}; } ` }; diff --git a/components/lib/themes/primeone/base/overlaypanel/package.json b/components/lib/themes/primeone/base/popover/package.json similarity index 100% rename from components/lib/themes/primeone/base/overlaypanel/package.json rename to components/lib/themes/primeone/base/popover/package.json diff --git a/components/lib/themes/primeone/presets/aura/overlaypanel/index.js b/components/lib/themes/primeone/presets/aura/popover/index.js similarity index 100% rename from components/lib/themes/primeone/presets/aura/overlaypanel/index.js rename to components/lib/themes/primeone/presets/aura/popover/index.js diff --git a/components/lib/themes/primeone/presets/aura/overlaypanel/package.json b/components/lib/themes/primeone/presets/aura/popover/package.json similarity index 100% rename from components/lib/themes/primeone/presets/aura/overlaypanel/package.json rename to components/lib/themes/primeone/presets/aura/popover/package.json