@indielayer/ui 1.7.3 → 1.7.5

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/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.7.3";
1
+ declare const _default: "1.7.5";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const e = "1.7.3";
1
+ const e = "1.7.5";
2
2
  export {
3
3
  e as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indielayer/ui",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
5
5
  "author": {
6
6
  "name": "João Teixeira",
@@ -42,7 +42,7 @@ export default {
42
42
  </script>
43
43
 
44
44
  <script setup lang="ts">
45
- import { ref, type PropType, type ExtractPublicPropTypes, watch } from 'vue'
45
+ import { ref, type PropType, type ExtractPublicPropTypes, watch, useAttrs, computed } from 'vue'
46
46
  import { useTheme, type ThemeComponent } from '../../composables/useTheme'
47
47
  import { useColors } from '../../composables/useColors'
48
48
  import { useCommon } from '../../composables/useCommon'
@@ -58,6 +58,15 @@ const props = defineProps(inputProps)
58
58
 
59
59
  const emit = defineEmits(useInputtable.emits())
60
60
 
61
+ const attrs = useAttrs()
62
+ const dataAttrs = computed(() => {
63
+ return Object.keys(attrs).reduce((acc, key) => {
64
+ if (key.startsWith('data-')) acc[key] = attrs[key]
65
+
66
+ return acc
67
+ }, {} as Record<string, any>)
68
+ })
69
+
61
70
  const elRef = ref<HTMLInputElement | null>(null)
62
71
  const currentType = ref(props.type)
63
72
 
@@ -153,6 +162,7 @@ defineExpose({ focus, blur, reset, validate, setError })
153
162
  :readonly="readonly"
154
163
  :type="currentType"
155
164
  :value="typeof modelValue !== 'undefined' ? modelValue : ''"
165
+ v-bind="dataAttrs"
156
166
  v-on="inputListeners"
157
167
  @change="onChange"
158
168
  />
@@ -32,7 +32,7 @@ export default {
32
32
  </script>
33
33
 
34
34
  <script setup lang="ts">
35
- import { computed, ref, watch, type PropType, type ExtractPublicPropTypes, type Ref, nextTick, unref } from 'vue'
35
+ import { computed, ref, watch, type PropType, type ExtractPublicPropTypes, type Ref, nextTick, unref, onUnmounted } from 'vue'
36
36
  import { useEventListener } from '@vueuse/core'
37
37
  import { useColors } from '../../composables/useColors'
38
38
  import { useCommon } from '../../composables/useCommon'
@@ -190,8 +190,7 @@ function handleOptionClick(value: string | number) {
190
190
 
191
191
  if (!props.native) {
192
192
  nextTick(() => {
193
- elRef.value?.dispatchEvent(new Event('input'))
194
- elRef.value?.dispatchEvent(new Event('change'))
193
+ validate()
195
194
  labelRef.value?.$el.focus()
196
195
  })
197
196
  }
@@ -263,6 +262,10 @@ watch([isFocused, isOpen], ([isFocusedValue, isOpenValue]) => {
263
262
  immediate: true,
264
263
  })
265
264
 
265
+ onUnmounted(() => {
266
+ if (keyNavigationListener) keyNavigationListener()
267
+ })
268
+
266
269
  function handleKeyNavigation(e: KeyboardEvent) {
267
270
  if (internalOptions.value.length === 0) return
268
271
 
@@ -38,7 +38,7 @@ export default {
38
38
  </script>
39
39
 
40
40
  <script setup lang="ts">
41
- import { ref, watch, type ExtractPublicPropTypes, type Ref } from 'vue'
41
+ import { ref, watch, type ExtractPublicPropTypes, type Ref, useAttrs, computed } from 'vue'
42
42
  import { useResizeObserver, useEventListener } from '@vueuse/core'
43
43
  import { useCSS } from '../../composables/useCSS'
44
44
  import { useTheme, type ThemeComponent } from '../../composables/useTheme'
@@ -54,6 +54,15 @@ const props = defineProps(textareaProps)
54
54
 
55
55
  const emit = defineEmits(useInputtable.emits())
56
56
 
57
+ const attrs = useAttrs()
58
+ const dataAttrs = computed(() => {
59
+ return Object.keys(attrs).reduce((acc, key) => {
60
+ if (key.startsWith('data-')) acc[key] = attrs[key]
61
+
62
+ return acc
63
+ }, {} as Record<string, any>)
64
+ })
65
+
57
66
  const elRef = ref<HTMLTextAreaElement | null>(null)
58
67
 
59
68
  useResizeObserver(elRef, resize)
@@ -139,6 +148,7 @@ defineExpose({ focus, blur, reset, validate, setError })
139
148
  :placeholder="placeholder"
140
149
  :readonly="readonly"
141
150
  :value="typeof modelValue !== 'undefined' ? String(modelValue) : ''"
151
+ v-bind="dataAttrs"
142
152
  v-on="inputListeners"
143
153
  @keydown.enter="onEnter"
144
154
  @input="onInput"
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '1.7.3'
1
+ export default '1.7.5'