@indielayer/ui 1.12.0 → 1.12.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.
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.12.0";
1
+ declare const _default: "1.12.1";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const e = "1.12.0";
1
+ const e = "1.12.1";
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.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
5
5
  "author": {
6
6
  "name": "João Teixeira",
@@ -143,6 +143,8 @@ const shouldIgnoreEvent = (event: KeyboardEvent) => {
143
143
  return Array.from(window.document.querySelectorAll(target))
144
144
  .some((el) => el === event.target || event.composedPath().includes(el))
145
145
  }
146
+
147
+ return false
146
148
  })
147
149
  }
148
150
 
@@ -3,9 +3,10 @@ import type { TabTheme } from '../Tab.vue'
3
3
  const theme: TabTheme = {
4
4
  classes: {
5
5
  wrapper: ({ props, data }) => {
6
- const c = ['py-2 transition-colors duration-150 ease-in-out whitespace-nowrap text-center']
6
+ const c = ['transition-colors duration-150 ease-in-out whitespace-nowrap text-center']
7
7
 
8
- if (data.variant === 'block') c.push('px-8')
8
+ if (data.variant === 'line') c.push('py-2')
9
+ if (data.variant === 'block') c.push('py-1.5 px-8')
9
10
 
10
11
  if (props.size === 'xs') c.push('text-xs')
11
12
  else if (props.size === 'sm') c.push('text-sm')
@@ -8,7 +8,7 @@ const theme: TabGroupTheme = {
8
8
  const c = ['']
9
9
 
10
10
  if (!props.fullWidth) c.push('!w-fit')
11
- if (props.variant === 'block') c.push('rounded-md')
11
+ if (props.variant === 'block') c.push('rounded-lg')
12
12
  if (props.variant === 'block' && !props.ghost) c.push('bg-secondary-100 dark:bg-secondary-800 p-1')
13
13
 
14
14
  return c
@@ -25,6 +25,10 @@ const uploadProps = {
25
25
  default: 'POST',
26
26
  },
27
27
  withCredentials: Boolean,
28
+ fileFormDataName: {
29
+ type: String,
30
+ default: 'file',
31
+ },
28
32
  }
29
33
 
30
34
  export type UploadFile = {
@@ -65,7 +69,7 @@ const props = defineProps(uploadProps)
65
69
 
66
70
  const emit = defineEmits([...useInputtable.emits(), 'upload', 'remove'])
67
71
 
68
- const elRef = ref<HTMLElement | null>(null)
72
+ const elRef = ref<HTMLInputElement | null>(null)
69
73
 
70
74
  const isUploadMode = computed(() => !!props.action)
71
75
 
@@ -202,7 +206,7 @@ async function uploadFileRequest(uploadFile: UploadFile) {
202
206
  const xhr = new XMLHttpRequest()
203
207
  const formData = new FormData()
204
208
 
205
- formData.append('file', uploadFile.file)
209
+ formData.append(props.fileFormDataName, uploadFile.file)
206
210
 
207
211
  xhr.open(props.method, props.action, true)
208
212
 
@@ -219,14 +223,12 @@ async function uploadFileRequest(uploadFile: UploadFile) {
219
223
  const percentComplete = (event.loaded / event.total) * 100
220
224
 
221
225
  uploadFile.progress = percentComplete
222
-
223
- console.log(`Upload progress: ${percentComplete}%`)
224
226
  }
225
227
  })
226
228
 
227
229
  // Event listener when upload is complete
228
230
  xhr.addEventListener('load', () => {
229
- if (xhr.status === 200) {
231
+ if (xhr.status >= 200 && xhr.status < 300) {
230
232
  uploadFile.completed = true
231
233
  try {
232
234
  uploadFile.response = JSON.parse(xhr.responseText)
@@ -267,13 +269,20 @@ async function upload() {
267
269
  validate(modelValue.value)
268
270
  }
269
271
 
272
+ function reset() {
273
+ errorInternal.value = ''
274
+ isFirstValidation.value = true
275
+ modelValue.value = []
276
+
277
+ if (elRef.value) elRef.value.value = ''
278
+ }
279
+
270
280
  const {
271
281
  errorInternal,
272
282
  hideFooterInternal,
273
283
  isInsideForm,
274
284
  inputListeners,
275
285
  isFirstValidation,
276
- reset,
277
286
  validate,
278
287
  setError,
279
288
  } = useInputtable(props, { focus, emit })
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '1.12.0'
1
+ export default '1.12.1'