@tak-ps/vue-tabler 4.26.1 → 4.29.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/CHANGELOG.md CHANGED
@@ -10,6 +10,18 @@
10
10
 
11
11
  ## Version History
12
12
 
13
+ ### v4.29.1
14
+
15
+ - :bug: Fix tests
16
+
17
+ ### v4.29.0
18
+
19
+ - :rocket: Introduce additional TablerBadge props including hover
20
+
21
+ ### v4.27.0
22
+
23
+ - :tada: Introduce `TablerUploadLogo` component
24
+
13
25
  ### v4.26.1
14
26
 
15
27
  - :bug: Fix Lint Errors
@@ -13,13 +13,25 @@ import { computed } from 'vue';
13
13
  export interface BadgeProps {
14
14
  backgroundColor?: string;
15
15
  borderColor?: string;
16
+ borderStyle?: string;
17
+ borderWidth?: string;
16
18
  textColor?: string;
19
+ hoverBackgroundColor?: string;
20
+ hoverBorderColor?: string;
21
+ hoverBorderStyle?: string;
22
+ hoverTextColor?: string;
17
23
  }
18
24
 
19
25
  const props = withDefaults(defineProps<BadgeProps>(), {
20
26
  backgroundColor: 'rgba(34, 197, 94, 0.2)',
21
27
  borderColor: undefined,
28
+ borderStyle: 'solid',
29
+ borderWidth: '1px',
22
30
  textColor: '#ffffff',
31
+ hoverBackgroundColor: undefined,
32
+ hoverBorderColor: undefined,
33
+ hoverBorderStyle: undefined,
34
+ hoverTextColor: undefined,
23
35
  });
24
36
 
25
37
  type ParsedColor = {
@@ -123,14 +135,26 @@ const badgeStyle = computed(() => {
123
135
  return {
124
136
  backgroundColor: props.backgroundColor,
125
137
  borderColor: resolvedBorderColor.value,
138
+ borderStyle: props.borderStyle,
139
+ borderWidth: props.borderWidth,
126
140
  color: props.textColor,
141
+ '--badge-hover-bg': props.hoverBackgroundColor ?? props.backgroundColor,
142
+ '--badge-hover-border': props.hoverBorderColor ?? resolvedBorderColor.value,
143
+ '--badge-hover-border-style': props.hoverBorderStyle ?? props.borderStyle,
144
+ '--badge-hover-text': props.hoverTextColor ?? props.textColor,
127
145
  };
128
146
  });
129
147
  </script>
130
148
 
131
149
  <style scoped>
132
150
  .tabler-badge {
133
- border-style: solid;
134
- border-width: 1px;
151
+ transition: background-color 0.15s, border-color 0.15s, color 0.15s;
135
152
  }
136
- </style>
153
+
154
+ .tabler-badge:hover {
155
+ background-color: var(--badge-hover-bg) !important;
156
+ border-color: var(--badge-hover-border) !important;
157
+ border-style: var(--badge-hover-border-style) !important;
158
+ color: var(--badge-hover-text) !important;
159
+ }
160
+ </style>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <div class='mb-3'>
3
+ <TablerInput
4
+ :id='props.inputId || "logoUpload"'
5
+ :label='props.label || "Upload PNG/SVG Logo"'
6
+ type='file'
7
+ accept='image/png, image/svg+xml'
8
+ :disabled='props.disabled'
9
+ :error='error'
10
+ @change='onFileChange'
11
+ />
12
+ </div>
13
+ <div
14
+ v-if='base64Data'
15
+ class='mt-3 row d-flex align-items-center justify-content-center'
16
+ >
17
+ <img
18
+ :src='base64Data'
19
+ alt='Logo Preview'
20
+ class='img-thumbnail'
21
+ style='max-width: 200px;'
22
+ >
23
+ </div>
24
+ </template>
25
+
26
+ <script setup lang='ts'>
27
+ import { ref, watch } from 'vue';
28
+ import TablerInput from './input/Input.vue';
29
+
30
+ const emit = defineEmits(['update:modelValue', 'file-name']);
31
+
32
+ const props = defineProps<{
33
+ modelValue?: string | null;
34
+ label?: string;
35
+ disabled?: boolean;
36
+ inputId?: string;
37
+ }>();
38
+
39
+ const base64Data = ref<string | undefined | null>(props.modelValue);
40
+ const error = ref('');
41
+
42
+ watch(() => props.modelValue, () => {
43
+ base64Data.value = props.modelValue;
44
+ });
45
+
46
+ watch(base64Data, () => {
47
+ emit('update:modelValue', base64Data.value);
48
+ });
49
+
50
+ function onFileChange(event: Event) {
51
+ const target = event.target as HTMLInputElement;
52
+
53
+ error.value = '';
54
+
55
+ if (!target.files || target.files.length === 0) {
56
+ throw new Error('Could not read file from input');
57
+ }
58
+
59
+ const file = target.files[0];
60
+ if (!file) return;
61
+
62
+ emit('file-name', file.name);
63
+
64
+ if (!['image/png', 'image/svg+xml'].includes(file.type)) {
65
+ error.value = 'Please upload a PNG or SVG file.';
66
+ base64Data.value = '';
67
+ return;
68
+ }
69
+
70
+ const reader = new FileReader();
71
+ reader.onload = (e) => {
72
+ base64Data.value = (e.target && e.target.result) ? String(e.target.result) : undefined;
73
+ };
74
+ reader.onerror = () => {
75
+ error.value = 'Failed to read file.';
76
+ base64Data.value = '';
77
+ };
78
+
79
+ reader.readAsDataURL(file);
80
+ }
81
+ </script>
package/lib.ts CHANGED
@@ -34,3 +34,4 @@ export { default as TablerDelete } from './components/Delete.vue';
34
34
  export { default as TablerPillGroup } from './components/PillGroup.vue';
35
35
  export { default as TablerSchema } from './components/Schema.vue';
36
36
  export { default as TablerSchemaBuilder } from './components/SchemaBuilder.vue';
37
+ export { default as TablerUploadLogo } from './components/TablerUploadLogo.vue';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/vue-tabler",
3
3
  "type": "module",
4
- "version": "4.26.1",
4
+ "version": "4.29.1",
5
5
  "lib": "lib.ts",
6
6
  "main": "lib.ts",
7
7
  "module": "lib.ts",