sprintify-ui 0.10.33 → 0.10.34

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.
@@ -174,6 +174,7 @@ declare const table: import("vue").Ref<({
174
174
  newColumns: import("vue").ComputedRef<{
175
175
  id: string;
176
176
  label: string;
177
+ tooltip?: string | undefined;
177
178
  field: string;
178
179
  meta: undefined | Record<string, any>;
179
180
  newKey: string;
@@ -363,6 +364,7 @@ declare const table: import("vue").Ref<({
363
364
  newColumns: import("vue").ComputedRef<{
364
365
  id: string;
365
366
  label: string;
367
+ tooltip?: string | undefined;
366
368
  field: string;
367
369
  meta: undefined | Record<string, any>;
368
370
  newKey: string;
@@ -552,6 +554,7 @@ declare const table: import("vue").Ref<({
552
554
  newColumns: import("vue").ComputedRef<{
553
555
  id: string;
554
556
  label: string;
557
+ tooltip?: string | undefined;
555
558
  field: string;
556
559
  meta: undefined | Record<string, any>;
557
560
  newKey: string;
@@ -741,6 +744,7 @@ declare const table: import("vue").Ref<({
741
744
  newColumns: import("vue").ComputedRef<{
742
745
  id: string;
743
746
  label: string;
747
+ tooltip?: string | undefined;
744
748
  field: string;
745
749
  meta: undefined | Record<string, any>;
746
750
  newKey: string;
@@ -13,6 +13,7 @@ declare const checkboxStyle = "disabled:bg-slate-100 group-hover:shadow-md disa
13
13
  declare const currentSortColumn: import("vue").Ref<{
14
14
  id: string;
15
15
  label: string;
16
+ tooltip?: string | undefined;
16
17
  field: string;
17
18
  meta: undefined | Record<string, any>;
18
19
  newKey: string;
@@ -35,6 +36,7 @@ declare const currentSortColumn: import("vue").Ref<{
35
36
  } | null, BaseTableColumnData | {
36
37
  id: string;
37
38
  label: string;
39
+ tooltip?: string | undefined;
38
40
  field: string;
39
41
  meta: undefined | Record<string, any>;
40
42
  newKey: string;
@@ -60,6 +62,7 @@ declare const slot: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
60
62
  declare const newColumns: import("vue").ComputedRef<{
61
63
  id: string;
62
64
  label: string;
65
+ tooltip?: string | undefined;
63
66
  field: string;
64
67
  meta: undefined | Record<string, any>;
65
68
  newKey: string;
@@ -83,6 +86,7 @@ declare const newColumns: import("vue").ComputedRef<{
83
86
  declare const visibleColumnsInternal: import("vue").ComputedRef<{
84
87
  id: string;
85
88
  label: string;
89
+ tooltip?: string | undefined;
86
90
  field: string;
87
91
  meta: undefined | Record<string, any>;
88
92
  newKey: string;
@@ -668,6 +672,7 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
668
672
  newColumns: import("vue").ComputedRef<{
669
673
  id: string;
670
674
  label: string;
675
+ tooltip?: string | undefined;
671
676
  field: string;
672
677
  meta: undefined | Record<string, any>;
673
678
  newKey: string;
@@ -6,6 +6,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
6
6
  default: string;
7
7
  type: StringConstructor;
8
8
  };
9
+ tooltip: {
10
+ default: undefined;
11
+ type: StringConstructor;
12
+ };
9
13
  customKey: {
10
14
  default: string;
11
15
  type: (NumberConstructor | StringConstructor)[];
@@ -97,6 +101,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
97
101
  default: string;
98
102
  type: StringConstructor;
99
103
  };
104
+ tooltip: {
105
+ default: undefined;
106
+ type: StringConstructor;
107
+ };
100
108
  customKey: {
101
109
  default: string;
102
110
  type: (NumberConstructor | StringConstructor)[];
@@ -184,6 +192,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
184
192
  meta: Record<string, any> | unknown[];
185
193
  width: number;
186
194
  padding: string;
195
+ tooltip: string;
187
196
  align: "left" | "center" | "right";
188
197
  field: string;
189
198
  searchable: boolean;
@@ -5,19 +5,39 @@ type __VLS_Props = {
5
5
  style?: StyleValue;
6
6
  align?: 'left' | 'center' | 'right';
7
7
  colspan?: number;
8
+ tooltip?: string;
8
9
  };
9
10
  declare function onClick(event: MouseEvent): void;
10
11
  declare const thRef: import("vue").Ref<HTMLTableCellElement | null, HTMLTableCellElement | null>;
11
12
  declare const classes: ComputedRef<string | string[]>;
13
+ declare const tooltipRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
14
+ declare const floatingStyles: Readonly<import("vue").Ref<{
15
+ position: import("@floating-ui/utils").Strategy;
16
+ top: string;
17
+ left: string;
18
+ transform?: string;
19
+ willChange?: string;
20
+ }, {
21
+ position: import("@floating-ui/utils").Strategy;
22
+ top: string;
23
+ left: string;
24
+ transform?: string;
25
+ willChange?: string;
26
+ }>>, showTooltip: import("vue").Ref<boolean, boolean>;
12
27
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
13
- declare var __VLS_1: {};
28
+ declare var __VLS_1: {}, __VLS_11: {};
14
29
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
15
30
  default?: (props: typeof __VLS_1) => any;
31
+ } & {
32
+ tooltip?: (props: typeof __VLS_11) => any;
16
33
  }>;
17
34
  declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
18
35
  onClick: typeof onClick;
19
36
  thRef: typeof thRef;
20
37
  classes: typeof classes;
38
+ tooltipRef: typeof tooltipRef;
39
+ floatingStyles: typeof floatingStyles;
40
+ showTooltip: typeof showTooltip;
21
41
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
22
42
  click: (...args: any[]) => void;
23
43
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
@@ -25,6 +45,7 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
25
45
  }>, {
26
46
  class: string | false | 0 | 0n | ClassNameValue[] | null;
27
47
  style: string | false | import("vue").CSSProperties | StyleValue[] | null;
48
+ tooltip: string;
28
49
  align: "left" | "center" | "right";
29
50
  colspan: number;
30
51
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -35,6 +56,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
35
56
  }>, {
36
57
  class: string | false | 0 | 0n | ClassNameValue[] | null;
37
58
  style: string | false | import("vue").CSSProperties | StyleValue[] | null;
59
+ tooltip: string;
38
60
  align: "left" | "center" | "right";
39
61
  colspan: number;
40
62
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -77,6 +77,7 @@ export type Row = Record<string, any>;
77
77
  export interface BaseTableColumnData {
78
78
  id: string;
79
79
  label: string;
80
+ tooltip?: string;
80
81
  field: string;
81
82
  meta: undefined | Record<string, any>;
82
83
  newKey: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.10.33",
3
+ "version": "0.10.34",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
@@ -28,6 +28,7 @@
28
28
  v-for="(column, index) in visibleColumnsInternal"
29
29
  :key="column.newKey + ':' + index + 'header'"
30
30
  :style="column.style"
31
+ :tooltip="column.tooltip"
31
32
  class="bg-slate-50"
32
33
  >
33
34
  <div class="flex gap-4">
@@ -67,9 +68,8 @@
67
68
  'text-[12px]': size == 'sm',
68
69
  'text-xs': size == 'md',
69
70
  }"
70
- >
71
- {{ column.label }}
72
- </span>
71
+ v-html="column.label"
72
+ />
73
73
  <div
74
74
  v-if="column.sortable"
75
75
  :class="[
@@ -28,7 +28,7 @@ export default {
28
28
 
29
29
  const headTemplate = `<BaseTableHead>
30
30
  <BaseTableRow>
31
- <BaseTableHeader sortable>Label</BaseTableHeader>
31
+ <BaseTableHeader tooltip="Lorem ipsum" sortable>Label</BaseTableHeader>
32
32
  <BaseTableHeader sortable>ID</BaseTableHeader>
33
33
  <BaseTableHeader>Type</BaseTableHeader>
34
34
  <BaseTableHeader>Description</BaseTableHeader>
@@ -11,6 +11,10 @@ export default defineComponent({
11
11
  default: '',
12
12
  type: String,
13
13
  },
14
+ tooltip: {
15
+ default: undefined,
16
+ type: String,
17
+ },
14
18
  customKey: {
15
19
  default: '',
16
20
  type: [String, Number],
@@ -8,10 +8,41 @@
8
8
  @click="onClick"
9
9
  >
10
10
  <slot />
11
- </th>
11
+ </th>
12
+
13
+ <Teleport
14
+ v-if="tooltip"
15
+ to="body"
16
+ >
17
+ <div
18
+ ref="tooltipRef"
19
+ class="fixed top-0 left-0 z-tooltip pointer-events-none"
20
+ :style="floatingStyles"
21
+ >
22
+ <transition
23
+ enter-active-class="transition duration-200 ease-out"
24
+ enter-from-class="transform scale-90 opacity-0"
25
+ enter-to-class="transform scale-100 opacity-100"
26
+ leave-active-class="transition duration-75 ease-in"
27
+ leave-from-class="transform scale-100 opacity-100"
28
+ leave-to-class="transform scale-90 opacity-0"
29
+ >
30
+ <slot
31
+ v-if="showTooltip"
32
+ name="tooltip"
33
+ >
34
+ <div
35
+ class="text-xs max-w-xs leading-snug rounded-md pt-1.5 pb-2 px-3 bg-slate-900 text-white"
36
+ v-html="tooltip"
37
+ />
38
+ </slot>
39
+ </transition>
40
+ </div>
41
+ </Teleport>
12
42
  </template>
13
43
 
14
44
  <script lang="ts" setup>
45
+ import { useTooltip } from '@/composables/tooltip';
15
46
  import { cellClasses } from '@/services/table/classes';
16
47
  import { CellConfig, TableProps } from '@/services/table/types';
17
48
  import { ClassNameValue, twMerge } from 'tailwind-merge';
@@ -36,11 +67,13 @@ const props = withDefaults(defineProps<{
36
67
  style?: StyleValue,
37
68
  align?: 'left' | 'center' | 'right',
38
69
  colspan?: number,
70
+ tooltip?: string,
39
71
  }>(), {
40
72
  class: undefined,
41
73
  style: undefined,
42
74
  align: 'left',
43
75
  colspan: undefined,
76
+ tooltip: undefined,
44
77
  });
45
78
 
46
79
  function onClick(event: MouseEvent) {
@@ -89,5 +122,19 @@ const classes = computed(() => {
89
122
  );
90
123
  });
91
124
 
125
+ // Tooltip
126
+
127
+ const tooltipRef = ref<HTMLElement | null>(null);
128
+
129
+ const { floatingStyles, showTooltip } = useTooltip(
130
+ thRef,
131
+ tooltipRef,
132
+ false,
133
+ 400,
134
+ {
135
+ placement: 'top-start',
136
+ },
137
+ 3
138
+ );
92
139
 
93
140
  </script>
@@ -103,6 +103,7 @@ export type Row = Record<string, any>;
103
103
  export interface BaseTableColumnData {
104
104
  id: string;
105
105
  label: string;
106
+ tooltip?: string;
106
107
  field: string;
107
108
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
108
109
  meta: undefined | Record<string, any>;