@signal24/vue-foundation 4.7.0 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@signal24/vue-foundation",
3
3
  "type": "module",
4
- "version": "4.7.0",
4
+ "version": "4.7.1",
5
5
  "description": "Common components, directives, and helpers for Vue 3 apps",
6
6
  "module": "./dist/vue-foundation.es.js",
7
7
  "bin": {
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :id="id" class="vf-overlay vf-modal-wrap" :class="props.class" ref="overlay">
2
+ <div :id="id" class="vf-overlay vf-modal-wrap" :class="classList" ref="overlay">
3
3
  <form action="." class="vf-modal" :class="{ scrolls }" @submit.prevent="$emit('formSubmit')" ref="form">
4
4
  <div v-if="$slots.header" class="vf-modal-header">
5
5
  <slot name="header" />
@@ -16,7 +16,8 @@
16
16
  </template>
17
17
 
18
18
  <script lang="ts" setup>
19
- import { getCurrentInstance, onBeforeUnmount, onMounted, ref } from 'vue';
19
+ import { compact } from 'lodash';
20
+ import { computed, getCurrentInstance, onBeforeUnmount, onMounted, ref } from 'vue';
20
21
 
21
22
  import { maskForm, unmaskForm } from '../helpers/mask';
22
23
  import { dismissOverlayInjectionByInternalInstance } from './overlay-container';
@@ -32,11 +33,17 @@ const props = defineProps<{
32
33
  }>();
33
34
 
34
35
  defineEmits(['formSubmit']);
35
- defineExpose({ mask, unmask });
36
+ defineExpose({ mask, unmask, hide, unhide });
36
37
 
37
38
  const overlay = ref<HTMLElement>();
38
39
  const form = ref<HTMLFormElement>();
39
40
 
41
+ const isHidden = ref(false);
42
+
43
+ const classList = computed(() => {
44
+ return compact([props.class, isHidden.value && 'hidden']);
45
+ });
46
+
40
47
  onMounted(() => {
41
48
  document.body.classList.add('vf-modal-open');
42
49
 
@@ -80,6 +87,14 @@ function mask() {
80
87
  function unmask() {
81
88
  unmaskForm(form.value!);
82
89
  }
90
+
91
+ function hide() {
92
+ isHidden.value = true;
93
+ }
94
+
95
+ function unhide() {
96
+ isHidden.value = false;
97
+ }
83
98
  </script>
84
99
 
85
100
  <style lang="scss">
@@ -90,6 +105,10 @@ function unmask() {
90
105
  width: 100%;
91
106
  height: 100%;
92
107
  z-index: 100;
108
+
109
+ &.hidden {
110
+ display: none;
111
+ }
93
112
  }
94
113
 
95
114
  .vf-modal-wrap {