@indielayer/ui 1.15.2 → 1.16.0

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.15.2";
1
+ declare const _default: "1.16.0";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const e = "1.15.2";
1
+ const e = "1.16.0";
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.15.2",
3
+ "version": "1.16.0",
4
4
  "description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
5
5
  "author": {
6
6
  "name": "João Teixeira",
@@ -76,7 +76,7 @@ export default { name: 'XTable' }
76
76
  </script>
77
77
 
78
78
  <script setup lang="ts" generic="T">
79
- import { ref, type ExtractPublicPropTypes, type PropType, watch, computed } from 'vue'
79
+ import { ref, type ExtractPublicPropTypes, type PropType, watch, computed, useSlots } from 'vue'
80
80
  import { useTheme, type ThemeComponent } from '../../composables/useTheme'
81
81
  import { useVirtualList } from '../../composables/useVirtualList'
82
82
 
@@ -375,6 +375,10 @@ watch(items, (newValue: T[]) => {
375
375
  }
376
376
  }, { immediate: true })
377
377
 
378
+ const slots = useSlots()
379
+
380
+ const hasFooter = computed(() => Object.keys(slots).some((key) => key.startsWith('footer-')))
381
+
378
382
  const { styles, classes, className } = useTheme('Table', {}, props)
379
383
  </script>
380
384
 
@@ -531,6 +535,23 @@ const { styles, classes, className } = useTheme('Table', {}, props)
531
535
  </tr>
532
536
  </template>
533
537
  </x-table-body>
538
+ <slot name="footer">
539
+ <tfoot v-if="hasFooter && !loading">
540
+ <x-table-row>
541
+ <x-table-cell v-if="props.selectable && !props.singleSelect" width="40" class="!pl-3.5 !pr-0.5" />
542
+ <x-table-cell v-if="expandable" width="48" class="!p-0" />
543
+ <x-table-cell
544
+ v-for="(header, index) in headers"
545
+ :key="index"
546
+ :text-align="header.align"
547
+ :width="header.width"
548
+ :dense="dense"
549
+ >
550
+ <slot :name="`footer-${header.value}`" :header="header"></slot>
551
+ </x-table-cell>
552
+ </x-table-row>
553
+ </tfoot>
554
+ </slot>
534
555
  </table>
535
556
  <div
536
557
  v-if="loading"
@@ -41,17 +41,21 @@ const hasTooltip = computed(() => props.tooltip || slots.tooltip)
41
41
  const computedDisabled = computed(() => props.disabled || !hasTooltip.value)
42
42
 
43
43
  const arrowPositionClasses = computed(() => {
44
+ if (computedDisabled.value) return ''
45
+
44
46
  const placements = {
45
- top: '-bottom-2.5 left-1/2 -translate-x-1/2 w-3.5',
46
- bottom: '-top-2.5 left-1/2 -translate-x-1/2 w-3.5',
47
- left: '-right-2.5 top-1/2 -translate-y-1/2 h-3.5',
48
- right: '-left-2.5 top-1/2 -translate-y-1/2 h-3.5',
47
+ top: '-bottom-2.5 w-3.5',
48
+ bottom: '-top-2.5 w-3.5',
49
+ left: '-right-2.5 h-3.5',
50
+ right: '-left-2.5 h-3.5',
49
51
  }
50
52
 
51
53
  return placements[actualPosition.value]
52
54
  })
53
55
 
54
56
  const arrowRotationClasses = computed(() => {
57
+ if (computedDisabled.value) return ''
58
+
55
59
  const placements = {
56
60
  top: '-rotate-45 origin-top-left',
57
61
  bottom: 'rotate-45 origin-bottom-left',
@@ -63,6 +67,8 @@ const arrowRotationClasses = computed(() => {
63
67
  })
64
68
 
65
69
  const animationOriginClasses = computed(() => {
70
+ if (computedDisabled.value) return ''
71
+
66
72
  const origins = {
67
73
  top: 'origin-bottom',
68
74
  bottom: 'origin-top',
@@ -142,10 +148,27 @@ const calculatePosition = () => {
142
148
  }
143
149
  }
144
150
 
151
+ // Calculate arrow offset relative to trigger element center
152
+ const arrowOffset: Record<string, string> = {}
153
+
154
+ if (position === 'top' || position === 'bottom') {
155
+ const triggerCenter = triggerRect.left + triggerRect.width / 2
156
+ const offsetFromTooltipLeft = triggerCenter - left
157
+
158
+ arrowOffset.left = `${offsetFromTooltipLeft}px`
159
+ } else if (position === 'left' || position === 'right') {
160
+ const triggerCenter = triggerRect.top + triggerRect.height / 2
161
+ const offsetFromTooltipTop = triggerCenter - top
162
+
163
+ arrowOffset.top = `${offsetFromTooltipTop}px`
164
+ }
165
+
145
166
  actualPosition.value = position
146
167
  tooltipStyle.value = {
147
168
  top: `${top}px`,
148
169
  left: `${left}px`,
170
+ '--arrow-offset-x': arrowOffset.left || '0px',
171
+ '--arrow-offset-y': arrowOffset.top || '0px',
149
172
  }
150
173
  }
151
174
 
@@ -176,32 +199,35 @@ const { classes, className } = useTheme('Tooltip', {}, props)
176
199
  @mouseleave="hideTooltip"
177
200
  >
178
201
  <slot></slot>
179
- </component>
180
202
 
181
- <teleport v-if="!computedDisabled" to="body">
182
- <transition
183
- enter-active-class="transition-opacity duration-150 ease-out"
184
- leave-active-class="transition-opacity duration-150 ease-in"
185
- enter-from-class="opacity-0"
186
- enter-to-class="opacity-100"
187
- leave-from-class="opacity-100"
188
- leave-to-class="opacity-0"
189
- >
190
- <div
191
- v-if="isVisible"
192
- ref="tooltipRef"
193
- :style="tooltipStyle"
194
- class="fixed z-[9999] pointer-events-none"
195
- :class="[
196
- classes.tooltip,
197
- animationOriginClasses
198
- ]"
203
+ <teleport v-if="!computedDisabled" to="body">
204
+ <transition
205
+ enter-active-class="transition-opacity duration-150 ease-out"
206
+ leave-active-class="transition-opacity duration-150 ease-in"
207
+ enter-from-class="opacity-0"
208
+ enter-to-class="opacity-100"
209
+ leave-from-class="opacity-100"
210
+ leave-to-class="opacity-0"
199
211
  >
200
- <slot name="tooltip">{{ tooltip }}</slot>
201
- <div :class="['absolute overflow-hidden shadow-lg z-10', arrowPositionClasses]">
202
- <div :class="['h-2.5 w-2.5 bg-secondary-700 transform border border-secondary-800', arrowRotationClasses]"></div>
212
+ <div
213
+ v-if="isVisible"
214
+ ref="tooltipRef"
215
+ :style="tooltipStyle"
216
+ class="fixed z-[10001] pointer-events-none"
217
+ :class="[
218
+ classes.tooltip,
219
+ animationOriginClasses
220
+ ]"
221
+ >
222
+ <slot name="tooltip">{{ tooltip }}</slot>
223
+ <div
224
+ :class="['absolute overflow-hidden shadow-lg z-10', arrowPositionClasses]"
225
+ :style="actualPosition === 'top' || actualPosition === 'bottom' ? { left: 'var(--arrow-offset-x)', transform: 'translateX(-50%)' } : { top: 'var(--arrow-offset-y)', transform: 'translateY(-50%)' }"
226
+ >
227
+ <div :class="['h-2.5 w-2.5 bg-secondary-700 transform border border-secondary-800', arrowRotationClasses]"></div>
228
+ </div>
203
229
  </div>
204
- </div>
205
- </transition>
206
- </teleport>
230
+ </transition>
231
+ </teleport>
232
+ </component>
207
233
  </template>
@@ -1,5 +1,5 @@
1
1
  export { default as XTooltip } from './Tooltip.vue'
2
- export type { TooltipProps, TooltipTheme } from './Tooltip.vue'
2
+ export type { TooltipProps, TooltipPosition, TooltipTheme } from './Tooltip.vue'
3
3
 
4
4
  export { default as XToggleTip } from './ToggleTip.vue'
5
5
  export type { ToggleTipProps } from './ToggleTip.vue'
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '1.15.2'
1
+ export default '1.16.0'