Skip to content

Commit

Permalink
Merge 8395f38 into bd98009
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterliu1003 committed May 16, 2021
2 parents bd98009 + 8395f38 commit 2e74977
Show file tree
Hide file tree
Showing 99 changed files with 3,419 additions and 1,972 deletions.
8 changes: 5 additions & 3 deletions README.md
Expand Up @@ -28,7 +28,7 @@

## 🎉 [Documentation](https://vue-final-modal.org)

## 🙌 [Examples](https://vue-final-modal.org/examples/manual)
## 🙌 [Examples](https://vue-final-modal.org/examples/liveDemo)

## Introduction

Expand All @@ -42,7 +42,7 @@ You can create a [higher-order component](https://vue-final-modal.org/examples/r
- [Tailwind CSS](https://vue-final-modal.org/examples/tailwind) friendly
- Renderless component
- [Tiny bundle size](https://bundlephobia.com/result?p=vue-final-modal)
- Support `stackable`, `detachable`, `scrollable`, `transition`, `accessibility`, `focusTrap`, `dynamic modal`
- Support `stackable`, `detachable`, `scrollable`, `draggable`, `resizable`, `transition`, `accessibility`, `focusTrap`, `dynamic modal`

## **Development**

Expand All @@ -63,7 +63,7 @@ yarn build
# Run examples
cd examples
yarn
yarn serve
yarn dev

# Run docs
cd docs
Expand Down Expand Up @@ -95,6 +95,8 @@ To develop `vue-final-modal`, I learn a lot from these awesome libraries:
- focusTrap for A11y
- [Bootstrap Vue](https://bootstrap-vue.org/)
- lockScroll
- [vue-resizable](https://github.com/nikitasnv/vue-resizable)
- drag & resize

> There is no perfect library even the `final` of vue modal.
Expand Down
2 changes: 1 addition & 1 deletion dist/VueFinalModal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueFinalModal.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueFinalModal.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/VueFinalModal.umd.js.map

Large diffs are not rendered by default.

105 changes: 91 additions & 14 deletions docs/components/examples/basic/BasicOptions.vue
Expand Up @@ -16,20 +16,31 @@
:attach="attach ? '#attach' : false"
:focus-retain="focusRetain"
:focus-trap="focusTrap"
:drag="drag"
:fit-parent="fitParent"
:keep-changed-style="keepChangedStyle"
:resize="resize"
:resize-directions="resizeDirections"
:drag-selector="allowDragSelector ? dragSelector : ''"
:min-width="minWidth"
:max-width="maxWidth"
:min-height="minHeight"
:max-height="maxHeight"
@confirm="showModal = false"
@cancel="showModal = false"
>
<template v-slot:title># Hello, world!</template>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</p>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
</v-modal>

<button class="vfm-btn" @click="showModal = true">Open Modal</button>
<div class="flex space-x-2">
<v-button highlight @click="showModal = true">Open Modal</v-button>
<v-button @click="reset">reset</v-button>
</div>

<h3>Prop Options:</h3>
<h3 class="py-2">Basic:</h3>

<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 p-4 border rounded">
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-y-4 p-4 border rounded select-none">
<label class="flex items-center space-x-2">
<span>value:</span>
<input v-model="showModal" type="checkbox" />
Expand All @@ -38,7 +49,6 @@
<span>ssr:</span>
<input v-model="ssr" type="checkbox" />
</label>

<label class="flex items-center space-x-2">
<span>lockScroll:</span>
<input v-model="lockScroll" type="checkbox" />
Expand Down Expand Up @@ -101,13 +111,69 @@
<span>focusTrap:</span>
<input v-model="focusTrap" type="checkbox" />
</label>
<button class="vfm-btn" @click="reset">reset</button>
</div>
<h4>Attach area:</h4>
<div id="attach" class="relative w-full h-64 mt-8 p-4 border rounded dark:bg-gray-700">
<button class="vfm-btn" @click="openAttach">
Attach to here and open modal
</button>
<h3 class="py-2">Drag & Resize:</h3>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 p-4 border rounded select-none">
<label class="flex items-center space-x-2">
<span>drag:</span>
<input v-model="drag" type="checkbox" />
</label>
<div class="flex flex-col">
<label class="flex items-center space-x-2">
<input v-model="allowDragSelector" type="checkbox" />
<span>dragSelector:</span>
</label>
<label>
<input
v-model="dragSelector"
:disabled="!allowDragSelector"
class="pl-2 dark:text-black rounded focus:outline-none"
/>
</label>
</div>
<label class="flex items-center space-x-2">
<span>fitParent:</span>
<input v-model="fitParent" type="checkbox" />
</label>
<label class="flex items-center space-x-2">
<span>keepChangedStyle:</span>
<input v-model="keepChangedStyle" type="checkbox" />
</label>
<label class="flex items-center space-x-2">
<span>resize:</span>
<input v-model="resize" type="checkbox" />
</label>
<div class="flex flex-col">
<span>resizeDirections:</span>
<div class="flex space-x-1">
<div v-for="direction in ['t', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl']" :key="direction">
<label>
{{ direction }}:
<input type="checkbox" v-model="resizeDirections" :value="direction" />
</label>
</div>
</div>
</div>
<label class="flex items-center space-x-2">
<span>minWidth:</span>
<input v-model.number="minWidth" type="number" class="w-20 pl-2 dark:text-black rounded focus:outline-none" />
</label>
<label class="flex items-center space-x-2">
<span>maxWidth:</span>
<input v-model.number="maxWidth" type="number" class="w-20 pl-2 dark:text-black rounded focus:outline-none" />
</label>
<label class="flex items-center space-x-2">
<span>minHeight:</span>
<input v-model.number="minHeight" type="number" class="w-20 pl-2 dark:text-black rounded focus:outline-none" />
</label>
<label class="flex items-center space-x-2">
<span>maxHeight:</span>
<input v-model.number="maxHeight" type="number" class="w-20 pl-2 dark:text-black rounded focus:outline-none" />
</label>
</div>
<h3 class="py-2">Attach:</h3>
<div id="attach" class="relative w-full h-64 p-4 border rounded dark:bg-gray-900 overflow-hidden">
<v-button highlight @click="openAttach">Attach to here and open modal</v-button>
<p>click will:</p>
<ul>
<li>set "attach" to "true"</li>
Expand All @@ -134,7 +200,18 @@ const initData = () => ({
zIndex: 0,
attach: false,
focusRetain: true,
focusTrap: false
focusTrap: false,
drag: false,
fitParent: true,
keepChangedStyle: false,
resize: false,
resizeDirections: ['t', 'tr', 'r', 'br', 'b', 'bl', 'l', 'tl'],
allowDragSelector: false,
dragSelector: '.modal__title',
minWidth: 0,
maxWidth: 2000,
minHeight: 0,
maxHeight: 2000
})
export default {
Expand Down
18 changes: 0 additions & 18 deletions docs/components/examples/basic/BasicPlainStyleCodepen.vue

This file was deleted.

6 changes: 2 additions & 4 deletions docs/components/examples/basic/VAccessibility.vue
Expand Up @@ -2,12 +2,10 @@
<div>
<v-modal v-model="show" @confirm="show = false" @cancel="show = false" focus-trap>
<template v-slot:title>Hello, vue-final-modal</template>
<p>
Vue Final Modal is a renderless, stackable, detachable and lightweight modal component.
</p>
<p>Vue Final Modal is a renderless, stackable, detachable and lightweight modal component.</p>
</v-modal>

<button class="vfm-btn" @click="show = true">Open modal</button>
<v-button highlight @click="show = true">Open modal</v-button>
</div>
</template>

Expand Down
6 changes: 3 additions & 3 deletions docs/components/examples/basic/VActionButtons.vue
Expand Up @@ -11,11 +11,11 @@
</p>
</div>
<div class="modal__action">
<button class="vfm-btn" @click="showModal = false">confirm</button>
<button class="vfm-btn" @click="showModal = false">cancel</button>
<v-button @click="showModal = false">confirm</v-button>
<v-button @click="showModal = false">cancel</v-button>
</div>
</vue-final-modal>
<button class="vfm-btn" @click="showModal = true">Open modal</button>
<v-button highlight @click="showModal = true">Open modal</v-button>
</div>
</template>

Expand Down
6 changes: 2 additions & 4 deletions docs/components/examples/basic/VApiShow.vue
@@ -1,12 +1,10 @@
<template>
<div>
<v-modal v-model="showModal" name="VApiShow" @confirm="showModal = false" @cancel="showModal = false">
<template v-slot="{ params }"> Hi {{ params.userName }} </template>
<template v-slot="{ params }">Hi {{ params.userName }} </template>
<template v-slot:title>$vfm.show</template>
</v-modal>
<button class="vfm-btn" @click="$vfm.show('VApiShow', { userName: 'vue-final-modal' })">
Open modal
</button>
<v-button highlight @click="$vfm.show('VApiShow', { userName: 'vue-final-modal' })">Open modal</v-button>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion docs/components/examples/basic/VBackground.vue
Expand Up @@ -3,7 +3,7 @@
<vue-final-modal v-model="showModal" content-class="modal-content">
<span class="modal__title">Hello, vue-final-modal</span>
</vue-final-modal>
<button class="vfm-btn" @click="showModal = true">Open modal</button>
<v-button highlight @click="showModal = true">Open modal</v-button>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion docs/components/examples/basic/VBasic.vue
Expand Up @@ -3,7 +3,7 @@
<vue-final-modal v-model="showModal">
<span class="modal__title">Hello, vue-final-modal</span>
</vue-final-modal>
<button class="vfm-btn" @click="showModal = true">Open modal</button>
<v-button highlight @click="showModal = true">Open modal</v-button>
</div>
</template>

Expand Down
22 changes: 22 additions & 0 deletions docs/components/examples/basic/VButton.vue
@@ -0,0 +1,22 @@
<template>
<button class="v-btn" v-on="$listeners"><span v-if="highlight">👉 </span><slot></slot></button>
</template>

<script>
export default {
props: {
highlight: {
type: Boolean,
default: false
}
}
}
</script>
<style scoped>
button.v-btn {
@apply px-2 py-1 border rounded;
}
button.v-btn + button.v-btn {
margin: 0 0 0 1rem;
}
</style>
2 changes: 1 addition & 1 deletion docs/components/examples/basic/VCentered.vue
Expand Up @@ -3,7 +3,7 @@
<vue-final-modal v-model="showModal" classes="modal-container" content-class="modal-content">
<span class="modal__title">Hello, vue-final-modal</span>
</vue-final-modal>
<button class="vfm-btn" @click="showModal = true">Open modal</button>
<v-button highlight @click="showModal = true">Open modal</v-button>
</div>
</template>

Expand Down
6 changes: 2 additions & 4 deletions docs/components/examples/basic/VCloseButton.vue
Expand Up @@ -6,12 +6,10 @@
</button>
<span class="modal__title">Hello, vue-final-modal</span>
<div class="modal__content">
<p>
Vue Final Modal is a renderless, stackable, detachable and lightweight modal component.
</p>
<p>Vue Final Modal is a renderless, stackable, detachable and lightweight modal component.</p>
</div>
</vue-final-modal>
<button class="vfm-btn" @click="showModal = true">Open modal</button>
<v-button highlight @click="showModal = true">Open modal</v-button>
</div>
</template>

Expand Down
6 changes: 2 additions & 4 deletions docs/components/examples/basic/VContent.vue
Expand Up @@ -3,12 +3,10 @@
<vue-final-modal v-model="showModal" classes="modal-container" content-class="modal-content">
<span class="modal__title">Hello, vue-final-modal</span>
<div class="modal__content">
<p>
Vue Final Modal is a renderless, stackable, detachable and lightweight modal component.
</p>
<p>Vue Final Modal is a renderless, stackable, detachable and lightweight modal component.</p>
</div>
</vue-final-modal>
<button class="vfm-btn" @click="showModal = true">Open modal</button>
<v-button highlight @click="showModal = true">Open modal</v-button>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion docs/components/examples/basic/VDynamic.vue
@@ -1,5 +1,5 @@
<template>
<button class="vfm-btn mb-4" @click="dynamic">Open Dynamic Modal</button>
<v-button class="mb-4" highlight @click="dynamic">Open Dynamic Modal</v-button>
</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion docs/components/examples/basic/VDynamicAdvanced.vue
@@ -1,5 +1,5 @@
<template>
<button class="vfm-btn mb-4" @click="dynamic">Open Dynamic Modal</button>
<v-button class="mb-4" highlight @click="dynamic">Open Dynamic Modal</v-button>
</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion docs/components/examples/basic/VEvents.vue
Expand Up @@ -11,7 +11,7 @@
>
<template v-slot:title>Events Example!</template>
</v-modal>
<button class="vfm-btn" @click="showModal = true">Open modal</button>
<v-button highlight @click="showModal = true">Open modal</v-button>
</div>
</template>

Expand Down
24 changes: 6 additions & 18 deletions docs/components/examples/basic/VParams.vue
Expand Up @@ -19,27 +19,15 @@
</p>
</div>
<div class="modal__action">
<button class="vfm-btn" @click="$vfm.hide('stackable')">
confirm
</button>
<button class="vfm-btn" @click="$vfm.hide('stackable')">
cancel
</button>
<v-button @click="$vfm.hide('stackable')">confirm</v-button>
<v-button @click="$vfm.hide('stackable')">cancel</v-button>
</div>
</template>
</vue-final-modal>
<button class="vfm-btn" @click="$vfm.show('stackable', { test: 123 })">
Show modal with params
</button>
<button class="vfm-btn" @click="$vfm.toggle('stackable', null, { test: 321 })">
Toggle modal with params
</button>
<button class="vfm-btn" @click="$vfm.show('stackable')">
Show modal
</button>
<button class="vfm-btn" @click="$vfm.hide('stackable')">
Hide modal
</button>
<v-button @click="$vfm.show('stackable', { test: 123 })">Show modal with params</v-button>
<v-button @click="$vfm.toggle('stackable', null, { test: 321 })">Toggle modal with params</v-button>
<v-button @click="$vfm.show('stackable')">Show modal</v-button>
<v-button @click="$vfm.hide('stackable')">Hide modal</v-button>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion docs/components/examples/basic/VScrollable.vue
Expand Up @@ -11,7 +11,7 @@
</p>
</div>
</vue-final-modal>
<button class="vfm-btn" @click="showModal = true">Open modal</button>
<v-button highlight @click="showModal = true">Open modal</v-button>
</div>
</template>

Expand Down

0 comments on commit 2e74977

Please sign in to comment.