@rypen-dev/shared-components 8.1.1 → 8.1.3

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": "@rypen-dev/shared-components",
3
3
  "description": "Shared styles and Vuejs ui components for Rypen projects. Starting with version 8, this package is built with Vite 7 and Vue 3.",
4
- "version": "8.1.1",
4
+ "version": "8.1.3",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "scripts": {
@@ -1870,6 +1870,25 @@ body.hover-capable {
1870
1870
  }
1871
1871
  }
1872
1872
 
1873
+ &.tiny {
1874
+ .drop-target {
1875
+ padding: 1rem;
1876
+
1877
+ i {
1878
+ font-size: 1.5rem;
1879
+ margin-top: 0.25rem;
1880
+ }
1881
+
1882
+ .main-label {
1883
+ font-size: 0.875rem;
1884
+ }
1885
+
1886
+ &.over {
1887
+ outline-offset: -15px;
1888
+ }
1889
+ }
1890
+ }
1891
+
1873
1892
  &.no-margin {
1874
1893
  margin-bottom: 0 !important;
1875
1894
  }
@@ -1,20 +1,20 @@
1
1
  <template>
2
2
  <div class="file-upload-drop-wrapper">
3
- <div v-if="internalImage" class="current-image">
3
+ <div v-if="showImage && internalImage" class="current-image">
4
4
  <img :src="internalImage" />
5
5
  <a v-if="showRemove" class="color-callout remove" title="Remove image" @click="removeImage"><i class="fa-solid fa-xmark"></i></a>
6
6
  </div>
7
- <div class="file-upload-drop">
7
+ <div class="file-upload-drop" :class="computedCssClass">
8
8
  <div class="drop-target" :class="{over: isOver}" ref="droptargetref">
9
9
  <div><i class="fa-solid fa-download"></i></div>
10
- <input type="file" :id="id" class="show-for-sr" :disabled="disabled || updating" @change="uploadImage" accept="image/*" ref="fileuploadref" />
11
- <label :for="id" class="main-label"><strong>Choose a banner image</strong> or drag it here</label>
10
+ <input type="file" :id="id" class="show-for-sr" :disabled="disabled || updating" @change="uploadImage" :accept="accept" ref="fileuploadref" />
11
+ <label :for="id" class="main-label"><strong>{{ chooseText }}</strong> {{ dragDropCapable ? dragText : null }}</label>
12
12
  </div>
13
13
  </div>
14
14
  </div>
15
15
  </template>
16
16
  <script setup>
17
- import { ref, onBeforeMount, onMounted } from 'vue';
17
+ import { ref, computed, onBeforeMount, onMounted } from 'vue';
18
18
 
19
19
  const props = defineProps({
20
20
  imageBasePath: {
@@ -36,6 +36,23 @@
36
36
  type: Boolean,
37
37
  default: false,
38
38
  },
39
+ showImage: {
40
+ type: Boolean,
41
+ default: true,
42
+ },
43
+ cssClass: String,
44
+ accept: {
45
+ type: String,
46
+ default: 'image/*',
47
+ },
48
+ chooseText: {
49
+ type: String,
50
+ default: 'Choose an file',
51
+ },
52
+ dragText: {
53
+ type: String,
54
+ default: 'or drag it here',
55
+ },
39
56
  });
40
57
  const emit = defineEmits(['change', 'remove']);
41
58
 
@@ -47,6 +64,18 @@
47
64
  const droptargetref = ref(null);
48
65
  const fileuploadref = ref(null);
49
66
 
67
+ const computedCssClass = computed(() => {
68
+ let cssClass = '';
69
+ if (!props.showImage) {
70
+ cssClass += 'no-image';
71
+ }
72
+ if (props.cssClass) {
73
+ cssClass += ' ' + props.cssClass;
74
+ }
75
+
76
+ return cssClass;
77
+ });
78
+
50
79
  onBeforeMount(() => {
51
80
  if (props.image && props.image.ImageUrl) {
52
81
  // already have an image