@cloudron/pankow 3.1.8

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.
Files changed (62) hide show
  1. package/.gitlab-ci.yml +30 -0
  2. package/.jshintrc +8 -0
  3. package/LICENSE +21 -0
  4. package/README.md +20 -0
  5. package/components/BottomBar.vue +22 -0
  6. package/components/Breadcrumb.vue +64 -0
  7. package/components/Button.vue +243 -0
  8. package/components/ButtonGroup.vue +37 -0
  9. package/components/Checkbox.vue +112 -0
  10. package/components/Dialog.vue +178 -0
  11. package/components/DirectoryView.vue +772 -0
  12. package/components/DirectoryViewListItem.vue +412 -0
  13. package/components/EmailInput.vue +22 -0
  14. package/components/FileUploader.vue +204 -0
  15. package/components/FormGroup.vue +26 -0
  16. package/components/Icon.vue +12 -0
  17. package/components/InputDialog.vue +170 -0
  18. package/components/InputGroup.vue +32 -0
  19. package/components/MainLayout.vue +63 -0
  20. package/components/Menu.vue +284 -0
  21. package/components/MenuItem.vue +106 -0
  22. package/components/MenuItemLink.vue +52 -0
  23. package/components/MultiSelect.vue +202 -0
  24. package/components/Notification.vue +163 -0
  25. package/components/NumberInput.vue +31 -0
  26. package/components/OfflineBanner.vue +47 -0
  27. package/components/PasswordInput.vue +86 -0
  28. package/components/Popover.vue +185 -0
  29. package/components/ProgressBar.vue +75 -0
  30. package/components/Radiobutton.vue +128 -0
  31. package/components/SideBar.vue +104 -0
  32. package/components/SingleSelect.vue +190 -0
  33. package/components/Spinner.vue +67 -0
  34. package/components/Switch.vue +94 -0
  35. package/components/TabView.vue +161 -0
  36. package/components/TableView.vue +187 -0
  37. package/components/TagInput.vue +104 -0
  38. package/components/TextInput.vue +58 -0
  39. package/components/TopBar.vue +88 -0
  40. package/fallbackImage.js +29 -0
  41. package/fetcher.js +81 -0
  42. package/gallery/CustomMenuItem.vue +40 -0
  43. package/gallery/DirectoryViewDemo.vue +73 -0
  44. package/gallery/Index.vue +790 -0
  45. package/gallery/folder.svg +151 -0
  46. package/gallery/index.html +25 -0
  47. package/gallery/index.js +10 -0
  48. package/gallery/logo.png +0 -0
  49. package/gallery/vite.config.mjs +9 -0
  50. package/gestures.js +60 -0
  51. package/index.js +86 -0
  52. package/logo.png +0 -0
  53. package/logo.svg +78 -0
  54. package/package.json +26 -0
  55. package/style.css +351 -0
  56. package/tooltip.js +83 -0
  57. package/utils.js +383 -0
  58. package/viewers/GenericViewer.vue +84 -0
  59. package/viewers/ImageViewer.vue +239 -0
  60. package/viewers/PdfViewer.vue +82 -0
  61. package/viewers/TextViewer.vue +221 -0
  62. package/viewers.js +11 -0
@@ -0,0 +1,75 @@
1
+ <script setup>
2
+
3
+ import { computed } from 'vue';
4
+
5
+ const props = defineProps({
6
+ value: {
7
+ type: Number,
8
+ default: 0
9
+ },
10
+ showLabel: {
11
+ type: Boolean,
12
+ default: true,
13
+ },
14
+ mode: String // only really "indeterminate" is supported
15
+ });
16
+
17
+ const normalizedValue = computed(() => {
18
+ if (props.value < 0) return 0;
19
+ if (props.value > 100) return 100;
20
+ return props.value;
21
+ });
22
+
23
+ </script>
24
+
25
+ <template>
26
+ <div class="pankow-progress-bar">
27
+ <div class="pankow-progress-bar-label" v-show="showLabel"><slot>{{ value + ' %' }}</slot></div>
28
+ <div v-show="mode !== 'indeterminate'" class="pankow-progress-bar-filled" :style="{ width: normalizedValue+'%' }">
29
+ </div>
30
+ <div v-show="mode === 'indeterminate'" class="pankow-progress-bar-indeterminate" :style="{ 'min-width': '30%' }"></div>
31
+ </div>
32
+ </template>
33
+
34
+ <style>
35
+
36
+ .pankow-progress-bar {
37
+ font-weight: 700;
38
+ min-height: 12px;
39
+ user-select: none;
40
+ border-radius: var(--pankow-border-radius);
41
+ display: block;
42
+ }
43
+
44
+ .pankow-progress-bar-label {
45
+ padding-bottom: 3px;
46
+ }
47
+
48
+ .pankow-progress-bar-filled {
49
+ background-color: var(--pankow-color-primary);
50
+ transition: width 250ms;
51
+ white-space: nowrap;
52
+ border-radius: calc(var(--pankow-border-radius) / 1.5);
53
+ height: 6px;
54
+ }
55
+
56
+ .pankow-progress-bar-indeterminate {
57
+ background-color: var(--pankow-color-primary);
58
+ height: 6px;
59
+ width: 100%;
60
+ background-image: linear-gradient(45deg,rgba(255,255,255,.35) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.35) 50%,rgba(255,255,255,.35) 75%,transparent 75%,transparent);
61
+ background-size: 30px 30px;
62
+ animation: progress-bar-stripes 1s linear infinite;
63
+ border-radius: calc(var(--pankow-border-radius) / 1.5);
64
+ }
65
+
66
+ @keyframes progress-bar-stripes {
67
+ from {
68
+ background-position: 30px 0;
69
+ }
70
+ to {
71
+ background-position: 0 0;
72
+ }
73
+ }
74
+
75
+ </style>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <span class="pankow-radio">
3
+ <input :name="name" :id="id || internalId" class="pankow-radio-input" type="radio" v-model="internalValue" :value="value" :disabled="disabled"/>
4
+ <slot>
5
+ <label :for="id || internalId" class="pankow-radio-input-label">{{ label }}</label>
6
+ </slot>
7
+ </span>
8
+ </template>
9
+
10
+ <script>
11
+
12
+ import { uuidv4 } from '../utils.js';
13
+
14
+ export default {
15
+ name: 'Radiobutton',
16
+ props: {
17
+ modelValue: String,
18
+ value: String,
19
+ label: String,
20
+ id: String,
21
+ name: String,
22
+ disabled: null
23
+ },
24
+ emits: ['update:modelValue'],
25
+ computed: {
26
+ internalValue: {
27
+ get() {
28
+ return this.modelValue
29
+ },
30
+ set(internalValue) {
31
+ this.$emit('update:modelValue', internalValue)
32
+ }
33
+ }
34
+ },
35
+ data () {
36
+ return {
37
+ internalId: uuidv4()
38
+ }
39
+ }
40
+ };
41
+
42
+ </script>
43
+
44
+ <style>
45
+
46
+ .pankow-radio {
47
+ display: flex;
48
+ white-space: nowrap;
49
+ align-items: center;
50
+ margin: 4px 0;
51
+ }
52
+
53
+ .pankow-radio-input-label {
54
+ display: inline-block;
55
+ cursor: pointer;
56
+ user-select: none;
57
+ margin: 0;
58
+ margin-left: 6px;
59
+ }
60
+
61
+ .pankow-radio-input {
62
+ appearance: none;
63
+ height: 19px;
64
+ width: 19px;
65
+ outline: none;
66
+ display: inline-block;
67
+ position: relative;
68
+ margin: 0;
69
+ cursor: pointer;
70
+ border: 1px solid #ced4da;
71
+ background: var(--state-background, white);
72
+ transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
73
+ border-radius: 20px;
74
+ }
75
+
76
+ @media (prefers-color-scheme: dark) {
77
+ .pankow-radio-input {
78
+ color: var(--pankow-color-light-dark);
79
+ background: var(--pankow-color-dark);
80
+ border: 1px solid var(--pankow-color-dark);
81
+ }
82
+ }
83
+
84
+ .pankow-radio-input:after {
85
+ content: "";
86
+ display: block;
87
+ position: absolute;
88
+ opacity: var(--state-opacity, 0);
89
+ width: 9px;
90
+ height: 9px;
91
+ background: white;
92
+ border-radius: 20px;
93
+ left: 4px;
94
+ top: 4px;
95
+ transform: rotate(43deg);
96
+ }
97
+
98
+ .pankow-radio-input:checked {
99
+ --state-background: var(--pankow-color-primary);
100
+ --state-opacity: 1;
101
+ border: 1px solid transparent;
102
+ }
103
+
104
+ .pankow-radio-input:disabled {
105
+ cursor: not-allowed;
106
+ opacity: 0.5;
107
+ }
108
+
109
+ .pankow-radio-input:disabled + label {
110
+ cursor: not-allowed;
111
+ opacity: 0.5;
112
+ }
113
+
114
+ .pankow-radio-input:hover {
115
+ border: 1px solid var(--pankow-color-dark);
116
+ }
117
+
118
+ @media (prefers-color-scheme: dark) {
119
+ .pankow-radio-input:hover {
120
+ border: 1px solid var(--pankow-color-light-dark);
121
+ }
122
+ }
123
+
124
+ .pankow-radio-input:focus {
125
+ border: 1px solid var(--pankow-color-primary);
126
+ }
127
+
128
+ </style>
@@ -0,0 +1,104 @@
1
+ <script setup>
2
+
3
+ import { ref, useTemplateRef, onMounted } from 'vue';
4
+ import { onSwipe } from '../gestures.js';
5
+
6
+ const sideBar = useTemplateRef('sideBar');
7
+ const isVisible = ref(false);
8
+
9
+ function open() {
10
+ isVisible.value = true;
11
+ }
12
+
13
+ function close() {
14
+ isVisible.value = false;
15
+ }
16
+
17
+ onMounted(() => {
18
+ onSwipe(sideBar.value, (direction) => {
19
+ if (direction === 'left') close();
20
+ });
21
+ });
22
+
23
+ defineExpose({ open, close });
24
+
25
+ </script>
26
+
27
+ <template>
28
+ <div class="pankow-sidebar" ref="sideBar" :class="{ 'pankow-sidebar-closed': !isVisible }">
29
+ <Transition name="pankow-scale">
30
+ <div class="pankow-sidebar-close-action" v-if="isVisible" @click="close()"><i class="fa-solid fa-xmark"></i></div>
31
+ <div class="pankow-sidebar-open-action" v-else @click="open()"><i class="fa-solid fa-bars"></i></div>
32
+ </Transition>
33
+ <div class="pankow-sidebar-inner">
34
+ <slot></slot>
35
+ </div>
36
+ </div>
37
+ </template>
38
+
39
+ <style>
40
+
41
+ .pankow-sidebar {
42
+ display: block;
43
+ height: 100%;
44
+ min-width: 220px;
45
+ overflow: auto;
46
+ }
47
+
48
+ .pankow-sidebar-inner {
49
+ display: flex;
50
+ flex-direction: column;
51
+ height: 100%;
52
+ }
53
+
54
+ .pankow-sidebar-open-action {
55
+ display: none;
56
+ position: fixed;
57
+ top: 0;
58
+ left: 0;
59
+ font-size: 24px;
60
+ padding: 8px 14px;
61
+ cursor: pointer;
62
+ color: var(--pankow-color-dark);
63
+ }
64
+
65
+ .pankow-sidebar-close-action {
66
+ display: none;
67
+ position: fixed;
68
+ top: 0;
69
+ right: 0;
70
+ font-size: 32px;
71
+ padding: 8px 20px;
72
+ cursor: pointer;
73
+ }
74
+
75
+ @media (max-width: 576px) {
76
+ .pankow-sidebar {
77
+ position: fixed;
78
+ left: 0;
79
+ top: 0;
80
+ width: 100%;
81
+ height: 100%;
82
+ z-index: 2000;
83
+ transition: left 250ms ease-in-out;
84
+ }
85
+
86
+ .pankow-sidebar-closed {
87
+ position: fixed;
88
+ left: -600px; /* depends on media query */
89
+ }
90
+
91
+ .pankow-sidebar-open-action {
92
+ display: block;
93
+ position: fixed;
94
+ left: 0;
95
+ top: 0;
96
+ z-index: 2000;
97
+ }
98
+
99
+ .pankow-sidebar-close-action {
100
+ display: block;
101
+ }
102
+ }
103
+
104
+ </style>
@@ -0,0 +1,190 @@
1
+ <script setup>
2
+
3
+ import { ref, useTemplateRef, onMounted, computed, watch } from 'vue';
4
+ import Button from './Button.vue';
5
+ import Menu from './Menu.vue';
6
+ import Icon from './Icon.vue';
7
+
8
+ const props = defineProps({
9
+ placeholder: {
10
+ type: String,
11
+ default: 'Select'
12
+ },
13
+ optionLabel: {
14
+ type: String,
15
+ default: 'label'
16
+ },
17
+ optionKey: {
18
+ type: String,
19
+ default: ''
20
+ },
21
+ options: {
22
+ type: Array,
23
+ default: []
24
+ },
25
+ disabled: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ searchThreshold: {
30
+ type: Number,
31
+ default: Infinity,
32
+ },
33
+ });
34
+
35
+ const emits = defineEmits(['select']);
36
+
37
+ const model = defineModel();
38
+ const selected = ref(null);
39
+ const selectedKey = ref(null);
40
+ const elem = useTemplateRef('elem');
41
+ const menu = useTemplateRef('menu');
42
+
43
+ watch(model, (newValue, oldValue) => {
44
+ if (props.optionKey) {
45
+ selectedKey.value = newValue;
46
+ selected.value = props.options.find((o) => o[props.optionKey] === newValue);
47
+ } else {
48
+ selectedKey.value = null;
49
+ selected.value = newValue;
50
+ }
51
+ });
52
+
53
+ const menuModel = computed(() => {
54
+ return props.options.map((item) => {
55
+ return {
56
+ label: item[props.optionLabel],
57
+ disabled: item.disabled,
58
+ action: () => {
59
+ if (selected.value === item) return;
60
+
61
+ let index;
62
+ if (props.optionKey) {
63
+ index = props.options.findIndex((o) => o[props.optionKey] === item[props.optionKey]);
64
+ } else {
65
+ index = props.options.indexOf(item);
66
+ }
67
+
68
+ selectIndex(index);
69
+ }
70
+ };
71
+ });
72
+ });
73
+
74
+ function selectIndex(index) {
75
+ const item = props.options[index];
76
+
77
+ selected.value = item;
78
+ selectedKey.value = props.optionKey ? item[props.optionKey] : null;
79
+
80
+ const newValue = props.optionKey ? item[props.optionKey] : item;
81
+
82
+ model.value = newValue;
83
+ emits('select', newValue);
84
+ }
85
+
86
+ function onMenuClosed() {
87
+ elem.value.focus();
88
+ }
89
+
90
+ function onClick(event) {
91
+ if (props.disabled) return;
92
+
93
+ if (menu.value.isOpen) menu.value.close();
94
+ else menu.value.open(event, elem.value);
95
+ }
96
+
97
+ function onOpen(event) {
98
+ if (props.disabled) return;
99
+
100
+ menu.value.open(event, elem.value);
101
+ }
102
+
103
+ function onClose(event) {
104
+ menu.value.close();
105
+ }
106
+
107
+ function onClosed() {
108
+ // restores the focus
109
+ elem.value.focus();
110
+ }
111
+
112
+ function onSelectNext() {
113
+ if (props.disabled) return;
114
+
115
+ let index = props.optionKey ? props.options.findIndex((o) => o[props.optionKey] === selectedKey.value) : props.options.indexOf(selected.value);
116
+ selectIndex(index+1 >= props.options.length ? 0 : index+1);
117
+ }
118
+
119
+ function onSelectPrev() {
120
+ if (props.disabled) return;
121
+
122
+ let index = props.optionKey ? props.options.findIndex((o) => o[props.optionKey] === selectedKey.value) : props.options.indexOf(selected.value);
123
+ selectIndex(index <= 0 ? props.options.length-1 : index-1);
124
+ }
125
+
126
+ onMounted(() => {
127
+ if (props.optionKey) {
128
+ selectedKey.value = model.value;
129
+ selected.value = props.options.find((o) => o[props.optionKey] === selectedKey.value);
130
+ } else {
131
+ selected.value = model.value;
132
+ }
133
+ });
134
+
135
+ </script>
136
+
137
+ <template>
138
+ <div class="pankow-singleselect" :class="{ 'pankow-singleselect-disabled': disabled }" ref="elem" tabindex="0" @click="onClick" @keydown.enter="onOpen" @keydown.down.stop.prevent="onSelectNext" @keydown.up.stop.prevent="onSelectPrev" @keydown.esc.stop="onClose">
139
+ <Menu ref="menu" :model="menuModel" :search-threshold="searchThreshold" :close-on-activation="true" @close="onMenuClosed"></Menu>
140
+ {{ selected ? selected[optionLabel] : placeholder }}
141
+ <Icon icon="fa-solid fa-chevron-down" class="pankow-button-icon-right-with-text" />
142
+ </div>
143
+ </template>
144
+
145
+ <style>
146
+
147
+ .pankow-singleselect {
148
+ display: inline-flex;
149
+ justify-content: space-between;
150
+ align-items: center;
151
+ font-weight: 400;
152
+ font-size: 14px;
153
+ color: var(--pankow-color-dark);
154
+ user-select: none;
155
+ text-align: center;
156
+ border-width: 1px;
157
+ border-style: solid;
158
+ border-color: var(--pankow-input-border-color);
159
+ padding: 5px 12px;
160
+ border-radius: var(--pankow-border-radius);
161
+ background-color: var(--pankow-input-background-color);
162
+ text-decoration: none;
163
+ cursor: pointer;
164
+ transition: background-color 250ms;
165
+ min-width: 100px;
166
+ white-space: nowrap;
167
+ }
168
+
169
+ @media (prefers-color-scheme: dark) {
170
+ .pankow-singleselect {
171
+ color: var(--pankow-color-light-dark);
172
+ }
173
+ }
174
+
175
+ .pankow-singleselect:focus {
176
+ outline: none;
177
+ border-color: var(--pankow-color-dark) !important;
178
+ }
179
+
180
+ .pankow-singleselect:hover {
181
+ border-color: var(--pankow-color-primary-hover);
182
+ }
183
+
184
+ .pankow-singleselect-disabled,
185
+ .pankow-singleselect-disabled:hover {
186
+ cursor: not-allowed;
187
+ border-color: var(--pankow-input-border-color);
188
+ }
189
+
190
+ </style>
@@ -0,0 +1,67 @@
1
+ <script setup>
2
+ </script>
3
+
4
+ <template>
5
+ <div class="pankow-spinner">
6
+ <div class="pankow-spinner-inner"></div>
7
+ </div>
8
+ </template>
9
+
10
+ <style>
11
+
12
+ .pankow-spinner {
13
+ display: inline-block;
14
+ position: relative;
15
+ width: 1em;
16
+ height: 1em;
17
+ }
18
+
19
+ .pankow-spinner.pankow-button-icon-with-text {
20
+ margin-right: 6px;
21
+ }
22
+
23
+ .pankow-spinner-inner {
24
+ position: absolute;
25
+ top: 1px;
26
+ left: 0px;
27
+ display: inline-block;
28
+ vertical-align: middle;
29
+ width: 14px;
30
+ height: 14px;
31
+ border: 1.5px solid rgba(255,255,255,.2);
32
+ border-radius: 50%;
33
+ border-top-color: var(--pankow-text-color);
34
+ border-right-color: var(--pankow-text-color);
35
+ animation: pankow-spinner-animation 0.8s linear infinite;
36
+ }
37
+
38
+ .pankow-button:not([plain]) .pankow-spinner-inner,
39
+ .pankow-button[plain]:hover .pankow-spinner-inner {
40
+ border-top-color: white;
41
+ border-right-color: white;
42
+ }
43
+
44
+ .pankow-spinner-large {
45
+ width: 48px;
46
+ height: 48px;
47
+ }
48
+
49
+ .pankow-spinner-large .pankow-spinner-inner {
50
+ position: absolute;
51
+ top: 4px;
52
+ left: 4px;
53
+ width: 40px;
54
+ height: 40px;
55
+ border-width: 2px;
56
+ }
57
+
58
+ @keyframes pankow-spinner-animation {
59
+ 0% {
60
+ transform: rotateZ(0deg);
61
+ }
62
+ 100% {
63
+ transform: rotateZ(360deg)
64
+ }
65
+ }
66
+
67
+ </style>
@@ -0,0 +1,94 @@
1
+ <script setup>
2
+
3
+ import { uuidv4 } from '../utils.js';
4
+
5
+ const props = defineProps({
6
+ label: String,
7
+ id: String,
8
+ disabled: null
9
+ });
10
+
11
+ const model = defineModel({ type: Boolean });
12
+
13
+ const internalId = uuidv4();
14
+
15
+ const emit = defineEmits(['change']);
16
+
17
+ function onChange() {
18
+ emit('change', model.value);
19
+ }
20
+
21
+ </script>
22
+
23
+ <template>
24
+ <label :for="id || internalId" class="pankow-switch" :class="{ 'pankow-switch-disabled': disabled }">
25
+ <input :id="id || internalId" class="pankow-switch-input" type="checkbox" v-model="model" :disabled="disabled" @change="onChange"/>
26
+ <span></span>
27
+ <div class="pankow-switch-input-label">
28
+ <slot>{{ label }}</slot>
29
+ </div>
30
+ </label>
31
+ </template>
32
+
33
+ <style>
34
+
35
+ .pankow-switch {
36
+ position: relative;
37
+ display: inline-flex;
38
+ align-items: center;
39
+ margin-bottom: 0;
40
+ }
41
+
42
+ .pankow-switch-disabled,
43
+ .pankow-switch-disabled span {
44
+ cursor: not-allowed !important;
45
+ }
46
+
47
+ .pankow-switch span {
48
+ position: relative;
49
+ background-color: var(--pankow-input-background-color);
50
+ border-radius: 17px;
51
+ border-style: solid;
52
+ border-width: 1px;
53
+ border-color: var(--pankow-input-border-color);
54
+ cursor: pointer;
55
+ width: 40px;
56
+ height: 20px;
57
+ transition: all 250ms;
58
+ }
59
+
60
+ .pankow-switch span::before {
61
+ background-color: var(--pankow-text-color);
62
+ border-radius: 50%;
63
+ content: "";
64
+ position: absolute;
65
+ left: 2px;
66
+ bottom: 2px;
67
+ height: calc(100% - 4px);
68
+ aspect-ratio: 1 / 1;
69
+ transition: all 250ms;
70
+ }
71
+
72
+ .pankow-switch-input-label {
73
+ margin-left: 8px;
74
+ cursor: pointer;
75
+ }
76
+
77
+ .pankow-switch-disabled .pankow-switch-input-label {
78
+ cursor: not-allowed;
79
+ }
80
+
81
+ input:checked + span {
82
+ background-color: var(--pankow-color-primary);
83
+ }
84
+
85
+ input:checked + span::before {
86
+ transform: translateX(20px);
87
+ background-color: white;
88
+ }
89
+
90
+ .pankow-switch input {
91
+ display: none;
92
+ }
93
+
94
+ </style>