@indielayer/ui 1.11.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.11.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.11.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.11.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
 
@@ -16,7 +16,6 @@ const selectProps = {
16
16
  type: String,
17
17
  default: 'Filter by...',
18
18
  },
19
- filterInputProps: Object,
20
19
  virtualList: Boolean,
21
20
  virtualListOffsetTop: Number,
22
21
  virtualListOffsetBottom: Number,
@@ -248,12 +247,13 @@ function handleOptionClick(value: string | number) {
248
247
  if (index !== -1) selected.value.splice(index, 1)
249
248
  else {
250
249
  selected.value.push(value)
251
- emit('update:modelValue', selected.value)
252
250
  }
253
251
  } else {
254
252
  selected.value = [value]
255
253
  }
256
254
 
255
+ emit('update:modelValue', selected.value)
256
+
257
257
  if (props.filterable)
258
258
  setTimeout(() => {
259
259
  filterRef.value?.focus()
@@ -511,7 +511,12 @@ defineExpose({ focus, blur, reset, validate, setError, filterRef })
511
511
  :outlined="!(isDisabled || options?.find((i) => i.value === value)?.disabled)"
512
512
  :disabled="isDisabled || options?.find((i) => i.value === value)?.disabled"
513
513
  @remove="(e: Event) => { handleRemove(e, value) }"
514
- >{{ getLabel(value) }}</x-tag>
514
+ >
515
+ <template #prefix>
516
+ <slot name="tag-prefix" :item="options?.find((i) => i.value === value)"></slot>
517
+ </template>
518
+ {{ getLabel(value) }}
519
+ </x-tag>
515
520
 
516
521
  <div
517
522
  v-if="showCountTag"
@@ -549,7 +554,6 @@ defineExpose({ focus, blur, reset, validate, setError, filterRef })
549
554
  skip-form-registry
550
555
  data-1p-ignore
551
556
  size="sm"
552
- v-bind="filterInputProps"
553
557
  />
554
558
  </div>
555
559
  </slot>
@@ -599,7 +603,12 @@ defineExpose({ focus, blur, reset, validate, setError, filterRef })
599
603
  :outlined="!(isDisabled || options?.find((i) => i.value === value)?.disabled)"
600
604
  :disabled="isDisabled || options?.find((i) => i.value === value)?.disabled"
601
605
  @remove="(e: Event) => { handleRemove(e, value) }"
602
- >{{ getLabel(value) }}</x-tag>
606
+ >
607
+ <template #prefix>
608
+ <slot name="tag-prefix" :item="options?.find((i) => i.value === value)"></slot>
609
+ </template>
610
+ {{ getLabel(value) }}
611
+ </x-tag>
603
612
  </x-popover-container>
604
613
  </template>
605
614
  </x-popover>
@@ -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
@@ -67,11 +67,18 @@ const { styles, classes, className } = useTheme('Tag', {}, props)
67
67
  ]"
68
68
  >
69
69
  <span
70
- v-if="removable"
71
- class="max-w-full truncate pr-4"
70
+ class="max-w-full"
71
+ :class="{'pr-4': removable }"
72
72
  >
73
- <slot></slot>
74
- <div class="absolute right-1.5 top-0 h-full flex items-center">
73
+ <div class="flex items-center gap-2">
74
+ <slot name="prefix"></slot>
75
+
76
+ <div class="truncate">
77
+ <slot></slot>
78
+ </div>
79
+ </div>
80
+
81
+ <div v-if="removable" class="absolute right-1.5 top-0 h-full flex items-center">
75
82
  <x-icon
76
83
  :size="closeIconSize"
77
84
  :icon="closeIcon"
@@ -81,7 +88,5 @@ const { styles, classes, className } = useTheme('Tag', {}, props)
81
88
  />
82
89
  </div>
83
90
  </span>
84
-
85
- <slot v-else></slot>
86
91
  </component>
87
92
  </template>
@@ -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.11.0'
1
+ export default '1.12.1'