@cloudron/pankow 3.5.1 → 3.5.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.
@@ -0,0 +1,40 @@
1
+ <script setup>
2
+
3
+ import { computed } from 'vue';
4
+
5
+ const props = defineProps({
6
+ values: Array,
7
+ });
8
+
9
+ // const normalizedValue = computed(() => {
10
+ // if (props.value < 0) return 0;
11
+ // if (props.value > 100) return 100;
12
+ // return props.value;
13
+ // });
14
+
15
+ // we want 100 to be the circumverence so we can neatly use percentage: radius = 100 / ( 3,14159 * 2 ) = 15,9155
16
+ const radius = 15.9155;
17
+ const stroke = 10;
18
+
19
+ function calculateViewbox() {
20
+ return `0 0 ${radius*2+stroke} ${radius*2+stroke}`;
21
+ }
22
+
23
+ function calculateArcPath() {
24
+ return `M${radius+stroke/2} ${stroke/2} a ${radius} ${radius} 0 0 1 0 ${radius*2} a ${radius} ${radius} 0 0 1 0 -${radius*2}`;
25
+ }
26
+
27
+ </script>
28
+
29
+ <template>
30
+ <div class="pankow-circle-chart">
31
+ <svg :viewBox="calculateViewbox()" xmlns="http://www.w3.org/2000/svg">
32
+ <path :d="calculateArcPath()" fill="none" stroke="red" :stroke-width="stroke" stroke-dasharray="75, 100" @click.stop="onClick('red')" />
33
+ <path :d="calculateArcPath()" fill="none" stroke="green" :stroke-width="stroke" stroke-dasharray="30, 100" @click.stop="onClick('green') "/>
34
+ </svg>
35
+ </div>
36
+ </template>
37
+
38
+ <style>
39
+
40
+ </style>
@@ -1,7 +1,6 @@
1
1
  <script setup>
2
2
 
3
3
  import { ref, useTemplateRef, onMounted, computed, watch } from 'vue';
4
- import Button from './Button.vue';
5
4
  import Menu from './Menu.vue';
6
5
  import Icon from './Icon.vue';
7
6
 
@@ -40,7 +39,7 @@ const props = defineProps({
40
39
  },
41
40
  });
42
41
 
43
- const emits = defineEmits(['select']);
42
+ const emits = defineEmits(['select', 'close']);
44
43
 
45
44
  const model = defineModel();
46
45
 
@@ -117,6 +116,7 @@ const menuModel = computed(() => {
117
116
 
118
117
  function onMenuClosed() {
119
118
  elem.value.focus();
119
+ emits('close');
120
120
  }
121
121
 
122
122
  function onClick(event) {
@@ -134,11 +134,7 @@ function onOpen(event) {
134
134
 
135
135
  function onClose(event) {
136
136
  menu.value.close();
137
- }
138
-
139
- function onClosed() {
140
- // restores the focus
141
- elem.value.focus();
137
+ emits('close');
142
138
  }
143
139
 
144
140
  onMounted(() => {
@@ -169,7 +169,7 @@ onMounted(() => {
169
169
  </select>
170
170
 
171
171
  <Menu ref="menu" :model="menuModel" :search-threshold="searchThreshold" :close-on-activation="true" @close="onMenuClosed"/>
172
- <span>
172
+ <span class="pankow-singleselect-label">
173
173
  <Icon v-if="selected ? selected.icon : false" :icon="selected.icon" style="margin-right: 6px" />
174
174
  {{ selected ? selected[optionLabel] : placeholder }}
175
175
  </span>
@@ -199,6 +199,7 @@ onMounted(() => {
199
199
  transition: background-color 250ms;
200
200
  min-width: 100px;
201
201
  white-space: nowrap;
202
+ overflow: hidden;
202
203
  }
203
204
 
204
205
  @media (prefers-color-scheme: dark) {
@@ -222,4 +223,9 @@ onMounted(() => {
222
223
  border-color: var(--pankow-input-border-color);
223
224
  }
224
225
 
226
+ .pankow-singleselect-label {
227
+ overflow: hidden;
228
+ text-overflow: ellipsis;
229
+ }
230
+
225
231
  </style>
@@ -56,8 +56,6 @@ defineExpose({ focus });
56
56
 
57
57
  .pankow-text-input[readonly] {
58
58
  cursor: not-allowed;
59
- border-color: var(--pankow-input-border-color) !important;
60
- background-color: #f5f5f5;
61
59
  }
62
60
 
63
61
  .pankow-text-input:disabled {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudron/pankow",
3
3
  "private": false,
4
- "version": "3.5.1",
4
+ "version": "3.5.3",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "types": "types/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "devDependencies": {
25
25
  "@vitejs/plugin-vue": "^6.0.1",
26
26
  "typescript": "^5.9.3",
27
- "vite": "^7.1.9",
27
+ "vite": "^7.1.10",
28
28
  "vue": "^3.5.22"
29
29
  }
30
30
  }
package/tooltip.js CHANGED
@@ -23,10 +23,30 @@ const RIGHT = 4;
23
23
  const padding = 10;
24
24
 
25
25
  const tooltips = {};
26
+ const intervals = {};
26
27
 
27
- function remove(key) {
28
+ function isElementHidden(element) {
29
+ if (!element) return true;
30
+
31
+ var rect = element.getBoundingClientRect();
32
+ var centerX = (rect.left + rect.right) / 2;
33
+ var centerY = (rect.top + rect.bottom) / 2;
34
+
35
+ const hit = document.elementFromPoint(centerX, centerY);
36
+
37
+ return hit !== element && !element.contains(hit);
38
+ }
39
+
40
+ function remove(key, target) {
28
41
  if (tooltips[key]) tooltips[key].remove();
42
+
29
43
  delete tooltips[key];
44
+ clearInterval(intervals[key]);
45
+
46
+ if (target) {
47
+ target.removeAttribute('aria-expanded');
48
+ target.removeAttribute('aria-describedby');
49
+ }
30
50
  }
31
51
 
32
52
  function update(target, value, modifiers, tooltip) {
@@ -50,28 +70,43 @@ function update(target, value, modifiers, tooltip) {
50
70
  }
51
71
 
52
72
  function mounted(el, binding, vnode) {
73
+ const key = vnode.ctx.uid;
74
+
53
75
  el.addEventListener('mouseenter', () => {
54
- if (!binding.value) return remove(vnode.ctx.uid);
76
+ if (!binding.value) return remove(key);
77
+
78
+ const tooltip = document.createElement('div');
79
+ tooltips[key] = tooltip;
55
80
 
56
- tooltips[vnode.ctx.uid] = document.createElement('div');
57
- tooltips[vnode.ctx.uid].classList.add('pankow-tooltip');
58
- window.document.body.appendChild(tooltips[vnode.ctx.uid]);
81
+ tooltip.setAttribute('id', key);
82
+ tooltip.setAttribute('role', 'tooltip');
83
+ tooltip.setAttribute('aria-hidden', 'false');
84
+ tooltip.classList.add('pankow-tooltip');
85
+ window.document.body.appendChild(tooltip);
59
86
 
60
- update(el, binding.value, binding.modifiers, tooltips[vnode.ctx.uid]);
87
+ el.setAttribute('aria-expanded', 'true');
88
+ el.setAttribute('aria-describedby', key);
89
+
90
+ update(el, binding.value, binding.modifiers, tooltip);
91
+
92
+ intervals[key] = setInterval(() => {
93
+ if (isElementHidden(el)) remove(key, el)
94
+ }, 1000);
61
95
  });
62
96
 
63
97
  el.addEventListener('mouseleave', () => {
64
- remove(vnode.ctx.uid);
98
+ remove(key, el);
65
99
  });
100
+
66
101
  }
67
102
 
68
103
  function updated(el, binding, vnode) {
69
- if (!binding.value) return remove(vnode.ctx.uid);
104
+ if (!binding.value) return remove(vnode.ctx.uid, el);
70
105
  update(el, binding.value, binding.modifiers, tooltips[vnode.ctx.uid]);
71
106
  }
72
107
 
73
108
  function beforeUnmount(el, binding, vnode) {
74
- remove(vnode.ctx.uid);
109
+ remove(vnode.ctx.uid, el);
75
110
  }
76
111
 
77
112
  const tooltip = {