@cloudron/pankow 3.4.2 → 3.5.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.
@@ -40,7 +40,6 @@ const internalId = uuidv4();
40
40
  display: inline-block;
41
41
  vertical-align: middle;
42
42
  cursor: pointer;
43
- user-select: none;
44
43
  margin: 0;
45
44
  margin-left: 6px;
46
45
  }
@@ -0,0 +1,84 @@
1
+ <script setup>
2
+
3
+ import { computed } from 'vue';
4
+
5
+ const model = defineModel({ type: [String, null], default: null });
6
+
7
+ const props = defineProps({
8
+ required: {
9
+ type: Boolean,
10
+ default: false,
11
+ },
12
+ multiline: {
13
+ type: Boolean,
14
+ default: false
15
+ }
16
+ });
17
+
18
+ const maskText = String.fromCharCode(0x25CF).repeat(8);
19
+
20
+ const displayValue = computed({
21
+ get() {
22
+ return model.value === null ? maskText : model.value;
23
+ },
24
+ set(v) {
25
+ if (model.value === null && v === maskText) return;
26
+ model.value = v;
27
+ },
28
+ });
29
+
30
+ const isValid = computed(() => {
31
+ if (!props.required) return false;
32
+ if (model.value === null) return true; // treat masked as satisfying "required"
33
+ return !!model.value;
34
+ });
35
+
36
+ </script>
37
+
38
+ <template>
39
+ <input v-if="!multiline" class="pankow-masked-input" :value="displayValue" :required="isValid" @input="displayValue = $event.target.value" @focus="$event.target.select()" />
40
+ <textarea v-else :rows="rows" :cols="cols" :required="isValid" :value="displayValue" @input="displayValue = $event.target.value" @focus="$event.target.select()"></textarea>
41
+ </template>
42
+
43
+ <style>
44
+
45
+ .pankow-masked-input {
46
+ display: inline-block;
47
+ font-size: 14px;
48
+ color: var(--pankow-text-color);
49
+ background-color: var(--pankow-input-background-color);
50
+ padding: var(--pankow-input-vertial-padding) var(--pankow-input-horizontal-padding);
51
+ border-radius: var(--pankow-border-radius);
52
+ border-style: solid;
53
+ border-width: 1px;
54
+ border-color: var(--pankow-input-border-color);
55
+ transition: border-color 250ms;
56
+ }
57
+
58
+ .pankow-form-group.has-error .pankow-masked-input,
59
+ .pankow-masked-input.has-error {
60
+ color: var(--pankow-text-color);
61
+ border-color: var(--pankow-color-danger) !important;
62
+ }
63
+
64
+ .pankow-masked-input:hover {
65
+ border-color: var(--pankow-input-border-color-hover);
66
+ }
67
+
68
+ .pankow-masked-input:focus {
69
+ border-color: var(--pankow-input-border-color-focus);
70
+ outline: none;
71
+ }
72
+
73
+ .pankow-masked-input[readonly] {
74
+ cursor: not-allowed;
75
+ border-color: var(--pankow-input-border-color) !important;
76
+ background-color: #f5f5f5;
77
+ }
78
+
79
+ .pankow-masked-input:disabled {
80
+ cursor: not-allowed;
81
+ opacity: 0.5;
82
+ }
83
+
84
+ </style>
@@ -149,6 +149,12 @@ onMounted(() => {
149
149
 
150
150
  <template>
151
151
  <div class="pankow-multiselect" :class="{ 'pankow-multiselect-disabled': disabled }" ref="elem" tabindex="0" @click="onClick" @keydown.enter="onOpen" @keydown.down.stop="onOpen" @keydown.up.stop="onOpen" @keydown.esc.stop="onClose">
152
+ <!-- native select for required and accessibility handling -->
153
+ <select v-model="selected" :required="$attrs['required']" style="display: none">
154
+ <option value=""></option>
155
+ <option v-for="item in options" :value="optionKey ? item[optionKey] : item">{{ optionKey }} - {{ item[optionLabel] }}</option>
156
+ </select>
157
+
152
158
  <Menu ref="menu" :model="menuModel" :close-on-activation="false" @close="onMenuClosed" :search-threshold="searchThreshold"></Menu>
153
159
  {{ buttonLabel }}
154
160
  <Icon icon="fa-solid fa-chevron-down" class="pankow-button-icon-right-with-text" />
@@ -53,7 +53,6 @@ export default {
53
53
  .pankow-radio-input-label {
54
54
  display: inline-block;
55
55
  cursor: pointer;
56
- user-select: none;
57
56
  margin: 0;
58
57
  margin-left: 6px;
59
58
  }
@@ -162,6 +162,12 @@ onMounted(() => {
162
162
 
163
163
  <template>
164
164
  <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" @keydown.stop="onKeyDown($event)">
165
+ <!-- native select for required and accessibility handling -->
166
+ <select v-model="selectedKey" :required="$attrs['required']" style="display: none">
167
+ <option value=""></option>
168
+ <option v-for="item in options" :value="optionKey ? item[optionKey] : item">{{ item[optionLabel] }}</option>
169
+ </select>
170
+
165
171
  <Menu ref="menu" :model="menuModel" :search-threshold="searchThreshold" :close-on-activation="true" @close="onMenuClosed"/>
166
172
  <span>
167
173
  <Icon v-if="selected ? selected.icon : false" :icon="selected.icon" style="margin-right: 6px" />
package/index.js CHANGED
@@ -18,6 +18,7 @@ import FormGroup from './components/FormGroup.vue';
18
18
  import Icon from './components/Icon.vue';
19
19
  import InputDialog from './components/InputDialog.vue';
20
20
  import MainLayout from './components/MainLayout.vue';
21
+ import MaskedInput from './components/MaskedInput.vue';
21
22
  import Menu from './components/Menu.vue';
22
23
  import MenuItem from './components/MenuItem.vue';
23
24
  import SingleSelect from './components/SingleSelect.vue';
@@ -63,6 +64,7 @@ export {
63
64
  Icon,
64
65
  InputDialog,
65
66
  MainLayout,
67
+ MaskedInput,
66
68
  Menu,
67
69
  MenuItem,
68
70
  SingleSelect,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudron/pankow",
3
3
  "private": false,
4
- "version": "3.4.2",
4
+ "version": "3.5.1",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -3,4 +3,4 @@ import gestures from './gestures.js';
3
3
  import tooltip from './tooltip.js';
4
4
  import fallbackImage from './fallbackImage.js';
5
5
  import utils from './utils.js';
6
- export { BottomBar, Breadcrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, Checkbox, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, MainLayout, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, Radiobutton, SideBar, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, fetcher, gestures, tooltip, fallbackImage, utils };
6
+ export { BottomBar, Breadcrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, Checkbox, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, MainLayout, MaskedInput, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, Radiobutton, SideBar, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, fetcher, gestures, tooltip, fallbackImage, utils };