@bagelink/vue 0.0.25 → 0.0.32

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 (82) hide show
  1. package/package.json +32 -9
  2. package/src/components/Btn.vue +221 -0
  3. package/src/components/Comments.vue +265 -0
  4. package/src/components/ContactArray.vue +127 -0
  5. package/src/components/ContactSubmissions.vue +42 -0
  6. package/src/components/DataPreview.vue +72 -0
  7. package/src/components/DropDown.vue +122 -0
  8. package/src/components/FileUploader.vue +344 -0
  9. package/src/components/FormKitTable.vue +250 -0
  10. package/src/components/FormSchema.vue +65 -0
  11. package/src/components/LangText.vue +30 -0
  12. package/src/components/ListItem.vue +16 -0
  13. package/src/components/ListView.vue +39 -0
  14. package/src/components/MaterialIcon.vue +16 -0
  15. package/src/components/Modal.vue +50 -0
  16. package/src/components/ModalForm.vue +94 -0
  17. package/src/components/NavBar.vue +343 -0
  18. package/src/components/PageTitle.vue +17 -0
  19. package/src/components/PersonPreview.vue +205 -0
  20. package/src/components/PersonPreviewFormkit.vue +205 -0
  21. package/src/components/RTXEditor.vue +147 -0
  22. package/src/components/RouterWrapper.vue +9 -0
  23. package/src/components/TabbedLayout.vue +80 -0
  24. package/src/components/TableSchema.vue +213 -0
  25. package/src/components/TopBar.vue +5 -0
  26. package/src/components/charts/BarChart.vue +290 -0
  27. package/src/components/dashboard/Lineart.vue +165 -0
  28. package/src/components/form/ItemRef.vue +38 -0
  29. package/src/components/form/MaterialIcon.vue +19 -0
  30. package/src/components/form/PlainInputField.vue +80 -0
  31. package/src/components/form/inputs/CheckInput.vue +143 -0
  32. package/src/components/form/inputs/Checkbox.vue +69 -0
  33. package/src/components/form/inputs/ColorPicker.vue +37 -0
  34. package/src/components/form/inputs/CurrencyInput.vue +133 -0
  35. package/src/components/form/inputs/DateInput.vue +49 -0
  36. package/src/components/form/inputs/DatetimeInput.vue +46 -0
  37. package/src/components/form/inputs/DurationInput.vue +51 -0
  38. package/src/components/form/inputs/DynamicLinkField.vue +140 -0
  39. package/src/components/form/inputs/EmailInput.vue +53 -0
  40. package/src/components/form/inputs/FloatInput.vue +48 -0
  41. package/src/components/form/inputs/IntInput.vue +49 -0
  42. package/src/components/form/inputs/JSONInput.vue +51 -0
  43. package/src/components/form/inputs/LinkField.vue +293 -0
  44. package/src/components/form/inputs/Password.vue +89 -0
  45. package/src/components/form/inputs/PasswordInput.vue +89 -0
  46. package/src/components/form/inputs/PlainText.vue +52 -0
  47. package/src/components/form/inputs/ReadOnlyInput.vue +24 -0
  48. package/src/components/form/inputs/RichTextEditor.vue +54 -0
  49. package/src/components/form/inputs/SelectField.vue +253 -0
  50. package/src/components/form/inputs/TableField.vue +321 -0
  51. package/src/components/form/inputs/TextArea.vue +70 -0
  52. package/src/components/form/inputs/TextInput.vue +53 -0
  53. package/src/components/form/inputs/index.ts +17 -0
  54. package/src/components/formkit/AddressArray.vue +240 -0
  55. package/src/components/formkit/BankDetailsArray.vue +265 -0
  56. package/src/components/formkit/ContactArrayFormKit.vue +151 -0
  57. package/src/components/formkit/FileUploader.vue +391 -0
  58. package/src/components/formkit/MiscFields.vue +69 -0
  59. package/src/components/formkit/Toggle.vue +160 -0
  60. package/src/components/formkit/index.ts +29 -0
  61. package/src/components/index.ts +20 -0
  62. package/src/components/whatsapp/form/MsgTemplate.vue +220 -0
  63. package/src/components/whatsapp/form/TextVariableExamples.vue +74 -0
  64. package/src/components/whatsapp/interfaces.ts +58 -0
  65. package/src/index.ts +1 -26
  66. package/src/plugins/bagel.ts +26 -0
  67. package/src/styles/modal.css +90 -0
  68. package/src/types/BagelField.ts +57 -0
  69. package/src/types/BtnOptions.ts +14 -0
  70. package/src/types/Person.ts +51 -0
  71. package/src/types/file.ts +12 -0
  72. package/src/types/index.ts +4 -0
  73. package/src/types/materialIcons.d.ts +3005 -0
  74. package/src/utils/index.ts +57 -0
  75. package/src/utils/modal.ts +95 -0
  76. package/src/utils/objects.ts +81 -0
  77. package/src/utils/strings.ts +29 -0
  78. package/dist/index.cjs +0 -23
  79. package/dist/index.d.cts +0 -12
  80. package/dist/index.d.mts +0 -12
  81. package/dist/index.d.ts +0 -12
  82. package/dist/index.mjs +0 -19
@@ -0,0 +1,53 @@
1
+ <template>
2
+ <div class="bagel-input" :title="description" :class="{ small: small }">
3
+ <label v-if="label">
4
+ <LangText :input="label" />
5
+ </label>
6
+ <input
7
+ :value="modelValue"
8
+ maxlength="140"
9
+ type="email"
10
+ @input="handleInput"
11
+ :placeholder="bagelApp.translate(placeholder, true)"
12
+ :class="{ 'no-edit': !editMode }"
13
+ >
14
+ </div>
15
+ </template>
16
+
17
+ <script setup lang="ts">
18
+ // @ts-ignore TODO: remove this
19
+ import { bagelApp } from '../../../index';
20
+
21
+ const emits = defineEmits(['update:modelValue']);
22
+ // @ts-ignore TODO: remove this
23
+ const props = withDefaults(
24
+ defineProps<{
25
+ description?: string;
26
+ label?: string;
27
+ modelValue: any;
28
+ placeholder?: string;
29
+ editMode?: boolean;
30
+ small?: boolean;
31
+ }>(),
32
+ {
33
+ description: '',
34
+ editMode: true,
35
+ placeholder: '',
36
+ label: '',
37
+ },
38
+ );
39
+ const handleInput = (e: Event) => {
40
+ const el = e.target as HTMLInputElement;
41
+ emits('update:modelValue', el.value);
42
+ };
43
+ </script>
44
+
45
+ <style scoped>
46
+ input[type='email'] {
47
+ direction: ltr;
48
+ }
49
+
50
+ [dir='rtl'] input[type='email'] {
51
+ text-align: end;
52
+ }
53
+ </style>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <div class="bagel-input" :title="description" :class="{ small: small }">
3
+ <label v-if="label">
4
+ <LangText :input="label" />
5
+ </label>
6
+ <input
7
+ :value="modelValue"
8
+ type="number"
9
+ @input="handleInput"
10
+ :placeholder="bagelApp.translate(placeholder, true)"
11
+ :class="{ 'no-edit': !editMode }"
12
+ >
13
+ </div>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ // @ts-ignore TODO: remove this
18
+ import { bagelApp } from '../../../index';
19
+
20
+ const emits = defineEmits(['update:modelValue']);
21
+ // @ts-ignore TODO: remove this
22
+ const props = withDefaults(
23
+ defineProps<{
24
+ description?: string;
25
+ label?: string;
26
+ modelValue: any;
27
+ placeholder?: string;
28
+ editMode?: boolean;
29
+ small?: boolean;
30
+ }>(),
31
+ {
32
+ description: '',
33
+ editMode: true,
34
+ placeholder: '',
35
+ label: '',
36
+ },
37
+ );
38
+ const handleInput = (e: Event) => {
39
+ const el = e.target as HTMLInputElement;
40
+ let value = parseFloat(el.value);
41
+ if (isNaN(value)) {
42
+ value = 0;
43
+ }
44
+ emits('update:modelValue', value);
45
+ };
46
+ </script>
47
+
48
+ <style scoped></style>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div class="bagel-input" :title="description" :class="{ small: small }">
3
+ <label v-if="label">
4
+ <LangText :input="label" />
5
+ </label>
6
+ <input
7
+ :value="modelValue"
8
+ type="number"
9
+ @input="handleInput"
10
+ :placeholder="bagelApp.translate(placeholder, true)"
11
+ :class="{ 'no-edit': !editMode }"
12
+ >
13
+ </div>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ // @ts-ignore TODO: remove this
18
+ import { bagelApp } from '../../../index';
19
+
20
+ // @ts-ignore TODO: remove this
21
+ const emits = defineEmits(['update:modelValue']);
22
+ // @ts-ignore TODO: remove this
23
+ const props = withDefaults(
24
+ defineProps<{
25
+ description?: string;
26
+ label?: string;
27
+ modelValue: any;
28
+ placeholder?: string;
29
+ editMode?: boolean;
30
+ small?: boolean;
31
+ }>(),
32
+ {
33
+ description: '',
34
+ editMode: true,
35
+ placeholder: '',
36
+ label: '',
37
+ },
38
+ );
39
+ const handleInput = (e: Event) => {
40
+ const el = e.target as HTMLInputElement;
41
+ let value = parseInt(el.value);
42
+ if (isNaN(value)) {
43
+ value = 0;
44
+ }
45
+ emits('update:modelValue', value);
46
+ };
47
+ </script>
48
+
49
+ <style scoped></style>
@@ -0,0 +1,51 @@
1
+ <template>
2
+ <div class="bagel-input" :title="description" :class="{ small: small }">
3
+ <label v-if="label">
4
+ <LangText :input="label" />
5
+ </label>
6
+ <textarea
7
+ :value="modelValue"
8
+ @input="handleInput"
9
+ :placeholder="bagelApp.translate(placeholder, true)"
10
+ :class="{ 'no-edit': !editMode }"
11
+ />
12
+ </div>
13
+ </template>
14
+
15
+ <script setup lang="ts">
16
+ // @ts-ignore TODO: remove this
17
+ import { bagelApp } from '../../../index';
18
+
19
+ const emits = defineEmits(['update:modelValue']);
20
+ // @ts-ignore TODO: remove this
21
+ const props = withDefaults(
22
+ defineProps<{
23
+ description?: string;
24
+ label?: string;
25
+ modelValue: any;
26
+ placeholder?: string;
27
+ editMode?: boolean;
28
+ small?: boolean;
29
+ }>(),
30
+ {
31
+ description: '',
32
+ editMode: true,
33
+ placeholder: '',
34
+ label: '',
35
+ },
36
+ );
37
+ const handleInput = (e: Event) => {
38
+ const el = e.target as HTMLInputElement;
39
+ emits('update:modelValue', el.value);
40
+ };
41
+ </script>
42
+
43
+ <style scoped>
44
+ .bagel-input textarea {
45
+ font-family: monospace;
46
+ }
47
+
48
+ [dir='rtl'] .bagel-input textarea {
49
+ direction: ltr;
50
+ }
51
+ </style>
@@ -0,0 +1,293 @@
1
+ <template>
2
+ <div class="bagel-input" :title="description" :class="{ small: small }">
3
+ <label v-if="label">
4
+ <LangText :input="label" />
5
+ </label>
6
+
7
+ <input
8
+ @keydown.enter="handleEnter"
9
+ autocomplete="off"
10
+ @click="openList"
11
+ name="link-input"
12
+ v-model="selectedItem"
13
+ @focus="initList"
14
+ @input="handleInput"
15
+ :disabled="!editMode"
16
+ >
17
+
18
+ <div
19
+ class="custom-select"
20
+ ref="selectEl"
21
+ name="link-input"
22
+ :class="{ 'open-select': showList && linkOptions.length > 0 }"
23
+ >
24
+ <Teleport to="#app">
25
+ <div
26
+ ref="dropdown"
27
+ :class="{ 'open-select': showList && linkOptions.length > 0 }"
28
+ class="custom-select-drop"
29
+ >
30
+ <div
31
+ v-for="option in linkOptions"
32
+ :key="formatString(option.value, 'pascal')"
33
+ @click.stop="handleSelect(option)"
34
+ >
35
+ <div class="option-label" v-if="option.label">
36
+ {{ option.label }}<span>ID: {{ option.value }}</span>
37
+ </div>
38
+ <div class="option-label" v-else>
39
+ ID: {{ option.value }}
40
+ </div>
41
+ <div class="option-description">
42
+ {{ option.description }}
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </Teleport>
47
+ </div>
48
+ </div>
49
+ </template>
50
+
51
+ <script lang="ts" setup>
52
+ import { onMounted, ref } from 'vue';
53
+ // @ts-ignore TODO: remove this
54
+ import { formatString } from '../../../composables';
55
+ // @ts-ignore TODO: remove this
56
+ import { bagelApp as api } from '../../../index';
57
+
58
+ const props = withDefaults(
59
+ defineProps<{
60
+ description?: string;
61
+ label?: string;
62
+ modelValue: any;
63
+ useId?: false;
64
+ bagelApp?: any;
65
+ entity: string;
66
+ editMode: boolean;
67
+ filters?: any;
68
+ small?: boolean;
69
+ }>(),
70
+ {
71
+ description: '',
72
+ label: '',
73
+ useId: false,
74
+ filters: {},
75
+ bagelApp: null,
76
+ },
77
+ );
78
+ const showList = ref(false);
79
+
80
+ const left = ref('0');
81
+ const top = ref(0);
82
+ const width = ref('0');
83
+ const selectEl = ref<HTMLElement>();
84
+ const dropdown = ref<HTMLElement>();
85
+ const linkOptions = ref<any>([]);
86
+ const item = ref<ListItem>();
87
+ const emits = defineEmits(['update:modelValue', 'selected']);
88
+ const selectedItem = ref<any>();
89
+ let bagel: any;
90
+
91
+ function handleSelect(item: ListItem) {
92
+ showList.value = false;
93
+ selectedItem.value = item;
94
+ if (props.useId || props.entity === 'Entity') {
95
+ selectedItem.value = item.value;
96
+ } else {
97
+ selectedItem.value = item.label || item.value;
98
+ }
99
+
100
+ emits('update:modelValue', item.value);
101
+ emits('selected', item.value);
102
+ }
103
+
104
+ async function getLinkOptions(inputString: string) {
105
+ linkOptions.value = await bagel.entity.getLinkedFieldList({
106
+ entity: props.entity,
107
+ txt: inputString,
108
+ reference_entity: '',
109
+ filters: props.filters,
110
+ });
111
+ }
112
+
113
+ function hideDrop(e: WheelEvent) {
114
+ const dropRect = dropdown.value?.getBoundingClientRect?.()
115
+ || ({
116
+ left: 0,
117
+ right: 0,
118
+ } as DOMRect);
119
+ if (e.clientX < dropRect.left || e.clientX > dropRect.right) {
120
+ showList.value = false;
121
+ }
122
+ }
123
+
124
+ function openList() {
125
+ setPosition();
126
+ showList.value = true;
127
+ }
128
+
129
+ // @ts-ignore TODO: remove this
130
+ function setPosition(e?: WheelEvent) {
131
+ const elInfo = selectEl.value?.getBoundingClientRect?.()
132
+ || ({
133
+ top: 0,
134
+ left: 0,
135
+ bottom: 0,
136
+ width: 0,
137
+ } as DOMRect);
138
+
139
+ top.value = elInfo.bottom;
140
+
141
+ left.value = `${elInfo.left}px`;
142
+ width.value = `${elInfo.width}px`;
143
+ const dropRect = dropdown.value?.getBoundingClientRect?.()
144
+ || ({
145
+ height: 0,
146
+ } as DOMRect);
147
+
148
+ if (window.innerHeight - elInfo.bottom < dropRect.height) {
149
+ top.value = elInfo.top - dropRect.height;
150
+ }
151
+ }
152
+
153
+ interface ListItem {
154
+ value: string;
155
+ label?: string;
156
+ description?: string;
157
+ }
158
+
159
+ // @ts-ignore TODO: remove this
160
+ const initialized = ref(false);
161
+
162
+ async function initList(e: Event) {
163
+ await getLinkOptions(getElValue(e));
164
+ showList.value = true;
165
+ }
166
+
167
+ function getElValue(e: Event) {
168
+ const el = e.target as HTMLInputElement;
169
+ return el.value.trim();
170
+ }
171
+
172
+ function handleEnter(e: Event) {
173
+ emits('update:modelValue', getElValue(e));
174
+ emits('selected');
175
+ showList.value = false;
176
+ }
177
+
178
+ function handleClick(e: any) {
179
+ const { target } = e;
180
+ if (target.name != 'link-input' && showList.value == true) {
181
+ showList.value = false;
182
+ emits('update:modelValue', item.value);
183
+ emits('selected');
184
+ }
185
+ // showList.value = false
186
+ }
187
+
188
+ const handleInput = async (e: Event) => {
189
+ showList.value = true;
190
+ const el = e.target as HTMLInputElement;
191
+ emits('update:modelValue', el.value);
192
+ await getLinkOptions(el.value);
193
+ };
194
+ onMounted(() => {
195
+ bagel = props.bagelApp || api;
196
+ setPosition();
197
+ window.addEventListener('wheel', hideDrop);
198
+ selectedItem.value = props.modelValue;
199
+ document.addEventListener('click', handleClick);
200
+ });
201
+ </script>
202
+
203
+ <style scoped>
204
+ .custom-select {
205
+ position: relative;
206
+ font-size: var(--input-font-size);
207
+ }
208
+
209
+ .custom-select .input {
210
+ width: 100%;
211
+ cursor: pointer;
212
+ background: var(--input-bg);
213
+ min-height: var(--input-height);
214
+ border: none;
215
+ border-radius: var(--input-border-radius);
216
+ color: var(--input-color);
217
+ position: relative;
218
+ display: flex;
219
+ flex-direction: column;
220
+ text-align: start;
221
+ margin-inline-end: 20px;
222
+ justify-content: center;
223
+ }
224
+
225
+ .custom-select .input:after {
226
+ content: 'keyboard_arrow_down';
227
+ font-family: 'Material Symbols Outlined', serif;
228
+ position: absolute;
229
+ top: calc(var(--input-height) / 2 - 10px);
230
+ font-size: calc(var(--input-font-size) * 1.5);
231
+ right: calc(var(--input-height) / 4);
232
+ height: 100%;
233
+ }
234
+
235
+ .option-label {
236
+ font-size: var(--input-font-size);
237
+ /*color: var(--input-color);*/
238
+ }
239
+
240
+ .option-description {
241
+ font-size: var(--input-font-size);
242
+ color: var(--input-color);
243
+ }
244
+
245
+ [dir='rtl'] .custom-select .input:after {
246
+ right: unset;
247
+ left: calc(var(--input-font-size) / 2);
248
+ }
249
+
250
+ /*[dir='rtl'] .custom-select-drop {*/
251
+ /* right: v-bind(left);*/
252
+ /* left: unset;*/
253
+ /*}*/
254
+ [dir='rtl'] .custom-select-drop {
255
+ inset-inline-end: v-bind(left);
256
+ inset-inline-start: unset;
257
+ }
258
+
259
+ .custom-select-drop {
260
+ position: fixed;
261
+ cursor: pointer;
262
+ inset-inline-start: v-bind(left);
263
+ top: v-bind('`${top}px`');
264
+ box-sizing: border-box;
265
+ width: v-bind(width);
266
+ background: var(--bgl-white);
267
+ box-shadow: 0 0 10px 0 var(--bgl-shadow);
268
+ border-radius: 10px;
269
+ z-index: 10000;
270
+ overflow-y: auto;
271
+ opacity: 0;
272
+ pointer-events: none;
273
+ max-height: 0;
274
+ }
275
+
276
+ .open-select.custom-select-drop {
277
+ opacity: 1;
278
+ max-height: 150px;
279
+ pointer-events: all;
280
+ }
281
+
282
+ .custom-select-drop > * {
283
+ padding: 0.5rem 0.75rem;
284
+ }
285
+
286
+ .custom-select-drop > *:hover {
287
+ background: var(--bgl-blue-light);
288
+ }
289
+
290
+ .custom-select-drop > *:active {
291
+ filter: var(--bgl-hover-filter);
292
+ }
293
+ </style>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div
3
+ class="bagel-input"
4
+ :class="{ small: small }"
5
+ :title="field.description"
6
+ v-if="field.id"
7
+ >
8
+ <label :for="field.id">
9
+ {{ field.label }}
10
+ <input
11
+ :id="field.id"
12
+ v-model="inputVal"
13
+ :type="inputType"
14
+ :placeholder="field.placeholder || field.label"
15
+ :class="{ 'no-edit': !editMode }"
16
+ :required="required"
17
+ :pattern="pattern"
18
+ v-bind="nativeInputAttrs"
19
+ >
20
+ </label>
21
+ <MaterialIcon
22
+ @click="showPassword()"
23
+ :icon="seePassword ? 'visibility' : 'visibility_off'"
24
+ />
25
+ </div>
26
+ </template>
27
+
28
+ <script setup lang="ts">
29
+ import { ref, watch, computed } from 'vue';
30
+ import { BagelField } from '@/types/BagelField';
31
+ import { MaterialIcon } from '@/components';
32
+
33
+ const emits = defineEmits(['update:modelValue']);
34
+ let seePassword = $ref<boolean>(false);
35
+ const inputType = computed(() => (seePassword ? 'text' : 'password'));
36
+
37
+ function showPassword() {
38
+ seePassword = !seePassword;
39
+ }
40
+ const props = withDefaults(
41
+ defineProps<{
42
+ field: BagelField;
43
+ modelValue: any;
44
+ editMode?: boolean;
45
+ small?: boolean;
46
+ required?: boolean;
47
+ pattern?: string;
48
+ nativeInputAttrs?: Record<string, any>;
49
+ }>(),
50
+ {
51
+ editMode: true,
52
+ },
53
+ );
54
+ const inputVal = ref<string>(props.modelValue);
55
+ // watch(
56
+ // () => props.modelValue,
57
+ // (newVal) => {
58
+ // if (inputVal.value !== newVal) inputVal.value = newVal;
59
+ // },
60
+ // );
61
+ watch(inputVal, (newVal) => emits('update:modelValue', newVal));
62
+ // onMounted(() => (inputVal.value = props.modelValue));
63
+ </script>
64
+
65
+ <style scoped>
66
+ .icon-font {
67
+ position: absolute;
68
+ cursor: pointer;
69
+ z-index: 2;
70
+ color: var(--bgl-gray);
71
+ inset-inline-end: 0.75rem;
72
+ inset-block-start: calc(var(--input-height) / 2 + 3px);
73
+ transition: var(--bgl-transition);
74
+ user-select: none;
75
+ border-radius: 100%;
76
+ height: 24px;
77
+ width: 24px;
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: center;
81
+ }
82
+ .icon-font:hover {
83
+ background: var(--bgl-white);
84
+ }
85
+ .icon-font:active {
86
+ background: var(--bgl-white);
87
+ filter: brightness(90%);
88
+ }
89
+ </style>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <div class="bagel-input" :title="description" :class="{ small: small }">
3
+ <label v-if="label">
4
+ <LangText :input="label" />
5
+ </label>
6
+ <div class="password-input-wrap">
7
+ <input
8
+ :value="modelValue"
9
+ :type="inputType"
10
+ @input="handleInput"
11
+ :placeholder="bagelApp.translate(placeholder, true)"
12
+ :class="{ 'no-edit': !editMode }"
13
+ >
14
+ <div class="icon-font password-icon" @mousedown="toggleInputType">
15
+ visibility
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </template>
20
+
21
+ <script setup lang="ts">
22
+ import { ref } from 'vue';
23
+ // @ts-ignore TODO: remove this
24
+ import { bagelApp } from '../../../index';
25
+
26
+ const emits = defineEmits(['update:modelValue']);
27
+ withDefaults(
28
+ defineProps<{
29
+ description?: string;
30
+ label?: string;
31
+ modelValue: any;
32
+ placeholder?: string;
33
+ editMode?: boolean;
34
+ small?: boolean;
35
+ }>(),
36
+ {
37
+ description: '',
38
+ editMode: true,
39
+ placeholder: '',
40
+ label: '',
41
+ },
42
+ );
43
+
44
+ const inputType = ref('password');
45
+ const handleInput = (e: Event) => {
46
+ const el = e.target as HTMLInputElement;
47
+ emits('update:modelValue', el.value);
48
+ };
49
+
50
+ function toggleInputType() {
51
+ inputType.value = 'text';
52
+ document.addEventListener(
53
+ 'mouseup',
54
+ () => {
55
+ inputType.value = 'password';
56
+ },
57
+ { once: true },
58
+ );
59
+ }
60
+ </script>
61
+
62
+ <style scoped>
63
+ .password-input-wrap {
64
+ position: relative;
65
+ }
66
+
67
+ .password-icon {
68
+ position: absolute;
69
+ top: calc(var(--input-height) / 2 - 10px);
70
+ right: calc(var(--input-height) / 2 - 10px);
71
+ cursor: pointer;
72
+ transition: var(--bgl-transition);
73
+ user-select: none;
74
+ }
75
+
76
+ .password-icon:hover {
77
+ filter: var(--bgl-hover-filter);
78
+ color: var(--bgl-blue);
79
+ }
80
+
81
+ .password-icon:active {
82
+ filter: var(--bgl-active-filter);
83
+ }
84
+
85
+ [dir='rtl'] .password-icon {
86
+ left: calc(var(--input-height) / 2 - 10px);
87
+ right: unset;
88
+ }
89
+ </style>