sprintify-ui 0.10.56 → 0.10.58

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.
@@ -37,6 +37,7 @@ type __VLS_Props = {
37
37
  align?: 'center' | 'between';
38
38
  color?: keyof typeof colors | string;
39
39
  to?: RouteLocationRaw;
40
+ tooltip?: string | null | undefined;
40
41
  };
41
42
  declare const classes: import("vue").ComputedRef<string>;
42
43
  declare const styles: import("vue").ComputedRef<{
@@ -56,10 +57,26 @@ declare const containerClass: import("vue").ComputedRef<string[]>;
56
57
  declare const iconClass: import("vue").ComputedRef<string[]>;
57
58
  declare const buttonRef: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
58
59
  declare function focus(): void;
60
+ declare const tooltipRef: import("vue").Ref<HTMLElement | undefined, HTMLElement | undefined>;
61
+ declare const floatingStyles: Readonly<import("vue").Ref<{
62
+ position: import("@floating-ui/utils").Strategy;
63
+ top: string;
64
+ left: string;
65
+ transform?: string;
66
+ willChange?: string;
67
+ }, {
68
+ position: import("@floating-ui/utils").Strategy;
69
+ top: string;
70
+ left: string;
71
+ transform?: string;
72
+ willChange?: string;
73
+ }>>, showTooltip: import("vue").Ref<boolean, boolean>;
59
74
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
60
- declare var __VLS_18: {};
75
+ declare var __VLS_18: {}, __VLS_32: {};
61
76
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
62
77
  default?: (props: typeof __VLS_18) => any;
78
+ } & {
79
+ tooltip?: (props: typeof __VLS_32) => any;
63
80
  }>;
64
81
  declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
65
82
  BaseIcon: typeof BaseIcon;
@@ -68,6 +85,9 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
68
85
  containerClass: typeof containerClass;
69
86
  iconClass: typeof iconClass;
70
87
  buttonRef: typeof buttonRef;
88
+ tooltipRef: typeof tooltipRef;
89
+ floatingStyles: typeof floatingStyles;
90
+ showTooltip: typeof showTooltip;
71
91
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
72
92
  click: (...args: any[]) => void;
73
93
  mouseenter: (...args: any[]) => void;
@@ -88,6 +108,7 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
88
108
  color: keyof typeof colors | string;
89
109
  disabled: boolean;
90
110
  as: string;
111
+ tooltip: string | null;
91
112
  loading: boolean;
92
113
  iconPosition: "start" | "end";
93
114
  sizeBehavior: SizeBehavior;
@@ -115,6 +136,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
115
136
  color: keyof typeof colors | string;
116
137
  disabled: boolean;
117
138
  as: string;
139
+ tooltip: string | null;
118
140
  loading: boolean;
119
141
  iconPosition: "start" | "end";
120
142
  sizeBehavior: SizeBehavior;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.10.56",
3
+ "version": "0.10.58",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "rimraf dist && vue-tsc && vite build",
@@ -245,7 +245,7 @@ const emit = defineEmits([
245
245
  'select',
246
246
  ]);
247
247
 
248
- const { hasErrorInternal, emitUpdate, sizeInternal } = useField({
248
+ const { hasErrorInternal, emitUpdate, sizeInternal, requiredInternal } = useField({
249
249
  name: computed(() => props.name),
250
250
  required: computed(() => props.required),
251
251
  hasError: computed(() => props.hasError),
@@ -407,7 +407,7 @@ const onTextInput = (text: string) => {
407
407
  emit('typing', keywords.value);
408
408
 
409
409
  // If keywords is empty, emit null
410
- if (keywords.value == '' && !props.showEmptyOption) {
410
+ if (keywords.value == '' && !props.showEmptyOption && !requiredInternal.value) {
411
411
  update(null);
412
412
  }
413
413
  };
@@ -118,3 +118,9 @@ Icon.args = {
118
118
  icon: "mdi:plus",
119
119
  color: "primary",
120
120
  };
121
+
122
+ export const Tooltip = Template.bind({});
123
+ Tooltip.args = {
124
+ color: "primary",
125
+ tooltip: "This is a tooltip",
126
+ };
@@ -45,6 +45,36 @@
45
45
  </svg>
46
46
  </div>
47
47
  </component>
48
+
49
+ <Teleport
50
+ v-if="tooltip"
51
+ to="body"
52
+ >
53
+ <div
54
+ ref="tooltipRef"
55
+ class="fixed top-0 left-0 z-tooltip pointer-events-none"
56
+ :style="floatingStyles"
57
+ >
58
+ <transition
59
+ enter-active-class="transition duration-200 ease-out"
60
+ enter-from-class="transform scale-90 opacity-0"
61
+ enter-to-class="transform scale-100 opacity-100"
62
+ leave-active-class="transition duration-75 ease-in"
63
+ leave-from-class="transform scale-100 opacity-100"
64
+ leave-to-class="transform scale-90 opacity-0"
65
+ >
66
+ <slot
67
+ v-if="showTooltip"
68
+ name="tooltip"
69
+ >
70
+ <div
71
+ class="text-xs max-w-xs leading-snug rounded-md pt-1.5 pb-2 px-3 bg-slate-900 text-white"
72
+ v-html="tooltip"
73
+ />
74
+ </slot>
75
+ </transition>
76
+ </div>
77
+ </Teleport>
48
78
  </template>
49
79
 
50
80
  <script lang="ts" setup>
@@ -56,6 +86,7 @@ import { isSlotEmpty } from '@/utils/slots';
56
86
  import { Size, sizes } from '@/utils/sizes';
57
87
  import { SizeBehavior } from '@/utils/sizeBehaviors';
58
88
  import { useInputSize } from '@/composables/inputSize';
89
+ import { useTooltip } from '@/composables/tooltip';
59
90
 
60
91
  defineOptions({
61
92
  inheritAttrs: false,
@@ -98,6 +129,7 @@ const props = withDefaults(defineProps<{
98
129
  align?: 'center' | 'between';
99
130
  color?: keyof typeof colors | string;
100
131
  to?: RouteLocationRaw;
132
+ tooltip?: string | null | undefined;
101
133
  }>(), {
102
134
  as: 'button',
103
135
  disabled: false,
@@ -112,6 +144,7 @@ const props = withDefaults(defineProps<{
112
144
  color: '',
113
145
  align: 'center',
114
146
  to: undefined,
147
+ tooltip: undefined,
115
148
  });
116
149
 
117
150
  defineEmits(['click', 'mouseover', 'mouseleave', 'mouseenter']);
@@ -235,6 +268,10 @@ function focus() {
235
268
  }
236
269
  }
237
270
 
271
+ const tooltipRef = ref<HTMLElement | undefined>(undefined);
272
+
273
+ const { floatingStyles, showTooltip } = useTooltip(buttonRef, tooltipRef, true, 0, {}, 2);
274
+
238
275
  defineExpose({
239
276
  focus,
240
277
  });
@@ -5,6 +5,7 @@
5
5
  :loading="loading"
6
6
  :size="sizeInternal"
7
7
  :icon="rowAction.icon"
8
+ :tooltip="rowAction.label"
8
9
  :disabled="rowAction.disabled && rowAction.disabled(row)"
9
10
  @click="completeAction()"
10
11
  />
@@ -14,6 +15,7 @@
14
15
  :href="rowAction.href(row)"
15
16
  :size="sizeInternal"
16
17
  :icon="rowAction.icon"
18
+ :tooltip="rowAction.label"
17
19
  :disabled="rowAction.disabled && rowAction.disabled(row)"
18
20
  />
19
21
  <BaseButton
@@ -22,6 +24,7 @@
22
24
  :to="rowAction.to(row)"
23
25
  :size="sizeInternal"
24
26
  :icon="rowAction.icon"
27
+ :tooltip="rowAction.label"
25
28
  :disabled="rowAction.disabled && rowAction.disabled(row)"
26
29
  />
27
30
  </template>