4.1.1 • Published 2 years ago

@odyzeo/popup v4.1.1

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

@odyzeo/popup

Simple popup component plugin with global triggers and renderless logic.

Demo

Installation

Usage

import Popup from '@odyzeo/popup';

Vue.use(Popup, {
    parentSelector: '#see-props'
});

In your template:

<button
    type="button"
    @click.prevent="$popup.show('example')"
>
    Example
</button>

Anywhere else in your project:

<popup name="example">
    <template #default="{ close, ok }">
        <div class="placeholder">
            Some kind of content!
            <br><br>
            <button
                type="button"
                @click.prevent="ok"
            >
                Accept
            </button>
            <button
                type="button"
                @click.prevent="close"
            >
                Close
            </button>
        </div>
    </template>
</popup>

Props

Property nameTypeDefault valueDescription
namestringSet global selector for your popup
typestringfixedChange behaviour inside document: fixed - prevents document scrolling, absolute - enable document scrolling
disable-escbooleanfalseDisable closing popup on 'Esc' key
disable-off-clickbooleanfalseDisable closing popup on click outside the popup
inlinebooleanfalseAppend popup inside its original parent
parentSelectorstringnullApply styles and popup inside this element not the body. Useful when you scroll inside different element than body.
transitionstringfadeChange or remove opening and closing transitions. Available transitions: fade slide-top slide-right slide-bottom slide-left null - no transition You can even use your own transition name with styles. It will be transpiled to popup-transition--${transition}
menustringnullWill adjust popup inner container to behave as menu wrapper based on direction. Directions: top right bottom left
v-modelbooleanfalsev-model property is always automatically synced with visible state and you can show/hide using v-model

Scope props

Event nameDescription
closeCloses popup with emitting event 'close'
okCloses popup without emitting event 'close'

Events

EventArgumentsDescription
closepopupName - Name of closed popupEvent emitted when popup is closed
showpopupName - Name of opened popupEvent emitted when popup is opened

Import styles

<script>
import '@odyzeo/popup/dist/popup.css';

export default {
    name: 'App',
};
</script>

Methods

Methods can be invoked globally via plugin command:

Show specific popup

this.$popup.show('name');

Hide specific popup - when no param provided hide all current popups

this.$popup.hide('name');

Get currently opened popups names - returns Set

this.$popup.currentPopups

Check if popup is open

this.$popup.currentPopups.has('name')

Development

npm run serve

Publishing

# Assuming all tested, committed and works like a charm!
npm version {patch|minor|major} # See semantic version
npm run build-lib
npm run publish
git push
git push --tags # Add release on GitHub

TODO

  • drag and drop
  • tests
4.1.1

2 years ago

4.1.0-0

3 years ago

4.1.0

3 years ago

4.0.7

3 years ago

4.0.6

4 years ago

4.0.5

4 years ago

4.0.4

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.1.0

6 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.1

6 years ago

1.0.0

7 years ago