@exakt/ui 0.0.54 → 0.0.56

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/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "exakt-ui",
3
3
  "configKey": "exakt",
4
- "version": "0.0.54"
4
+ "version": "0.0.56"
5
5
  }
@@ -1,62 +1,64 @@
1
1
  <template>
2
- <div
3
- v-if="label"
4
- class="mb-3 mt-6"
5
- >
6
- <label :for="id">
7
- {{ label }} </label>
8
- </div>
9
-
10
- <div
11
- class="wrapper fullwidth"
12
- :style="inputState.overtakeStyle"
13
- :class="{ rounded: rounded == undefined ? solid : rounded, solid }"
14
- @click="focus"
15
- >
16
- <e-icon
17
- v-if="icon"
18
- class="mr-2"
19
- size="19"
20
- fill="true"
2
+ <div>
3
+ <div
4
+ v-if="label"
5
+ class="mb-3 mt-6"
21
6
  >
22
- {{ icon }}
23
- </e-icon>
24
- <textarea
25
- v-if="type === 'textarea'"
26
- ref="input"
27
- v-model="currentText"
28
- class="input"
29
- :name="name"
30
- :placeholder="placeholder"
31
- autocomplete="off"
32
- auto-grow
33
- rows="5"
34
- @focus="inputState.focused = true"
35
- @blur="inputState.focused = false"
36
- />
37
- <input
38
- v-else
39
- :id="id"
40
- ref="input"
41
- v-model="currentText"
42
- :disabled="disabled"
43
- :type="type"
44
- :name="name"
45
- :autocomplete="autocomplete"
46
- :spellcheck="spellcheck"
47
- class="input"
48
- :required="required"
49
- :placeholder="placeholder"
50
- @click.stop=""
51
- @focus="inputState.focused = true"
52
- @blur="inputState.focused = false"
53
- @transitionend="transitionEnd"
7
+ <label :for="id">
8
+ {{ label }} </label>
9
+ </div>
10
+
11
+ <div
12
+ class="wrapper fullwidth"
13
+ :style="inputState.overtakeStyle"
14
+ :class="{ rounded: rounded == undefined ? solid : rounded, solid }"
15
+ @click="focus"
54
16
  >
55
- <slot />
17
+ <e-icon
18
+ v-if="icon"
19
+ class="mr-2"
20
+ size="19"
21
+ fill="true"
22
+ >
23
+ {{ icon }}
24
+ </e-icon>
25
+ <textarea
26
+ v-if="type === 'textarea'"
27
+ ref="input"
28
+ v-model="currentText"
29
+ class="input"
30
+ :name="name"
31
+ :placeholder="placeholder"
32
+ autocomplete="off"
33
+ auto-grow
34
+ rows="5"
35
+ @focus="inputState.focused = true"
36
+ @blur="inputState.focused = false"
37
+ />
38
+ <input
39
+ v-else
40
+ :id="id"
41
+ ref="input"
42
+ v-model="currentText"
43
+ :disabled="disabled"
44
+ :type="type"
45
+ :name="name"
46
+ :autocomplete="autocomplete"
47
+ :spellcheck="spellcheck"
48
+ class="input"
49
+ :required="required"
50
+ :placeholder="placeholder"
51
+ @click.stop=""
52
+ @focus="inputState.focused = true"
53
+ @blur="inputState.focused = false"
54
+ @transitionend="transitionEnd"
55
+ >
56
+ <slot />
57
+ </div>
56
58
  </div>
57
59
  </template>
58
60
  <script setup lang="ts">
59
- import { ref, watch, reactive, computed, useId } from "#imports";
61
+ import { ref, watch, reactive, computed, useId, onMounted } from "#imports";
60
62
 
61
63
  const inputState = reactive({
62
64
  overtakeStyle: "",
@@ -88,10 +90,24 @@ const focus = () => {
88
90
  const internalText = ref('')
89
91
 
90
92
  const currentText = computed({
91
- get: () => props.modelValue ? props.modelValue : internalText.value,
93
+ get: () => {
94
+ const setValue = props.modelValue ? props.modelValue : internalText.value
95
+
96
+ if (!setValue || !setValue.length) {
97
+ return props.defaultValue || ''
98
+ }
99
+
100
+ return setValue
101
+ },
92
102
  set: (value) => { if (props.modelValue) { emit("update:modelValue", value) } else { internalText.value = value } },
93
103
  });
94
104
 
105
+ onMounted(() => {
106
+ if (props.defaultValue) {
107
+ currentText.value = props.defaultValue
108
+ }
109
+ })
110
+
95
111
  const props = withDefaults(
96
112
  defineProps<{
97
113
  icon?: string;
@@ -99,6 +115,7 @@ const props = withDefaults(
99
115
  placeholder?: string;
100
116
  name?: string;
101
117
  modelValue?: string;
118
+ defaultValue?: string;
102
119
  solid?: boolean;
103
120
  rounded?: boolean;
104
121
  type?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exakt/ui",
3
- "version": "0.0.54",
3
+ "version": "0.0.56",
4
4
  "description": "A UI library for Nuxt.js",
5
5
  "license": "MIT",
6
6
  "type": "module",