@v1nt1248/3nclient-lib 0.2.22 → 0.2.23

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@v1nt1248/3nclient-lib",
3
3
  "license": "AGPL-3.0-or-later",
4
4
  "author": "v1nt1248",
5
- "version": "0.2.22",
5
+ "version": "0.2.23",
6
6
  "description": "Library for 3NWeb clients",
7
7
  "type": "module",
8
8
  "files": [
@@ -17,6 +17,7 @@ export type Ui3nTooltipPlacement =
17
17
  export interface Ui3nTooltipProps {
18
18
  modelValue?: boolean;
19
19
  content?: string;
20
+ maxContentWidth?: number | string;
20
21
  color?: string;
21
22
  textColor?: string;
22
23
  placement?: Ui3nTooltipPlacement;
@@ -8,6 +8,7 @@
8
8
  const baseOffset = 5;
9
9
 
10
10
  const props = withDefaults(defineProps<Ui3nTooltipProps>(), {
11
+ maxContentWidth: 400,
11
12
  color: 'var(--color-bg-block-tritery-default)',
12
13
  textColor: 'var(--color-text-block-darkery-default)',
13
14
  placement: 'top',
@@ -24,6 +25,7 @@
24
25
  const floatingEl = ref<Nullable<HTMLElement>>(null);
25
26
  const floatingArrowEl = ref<Nullable<HTMLElement>>(null);
26
27
 
28
+ const maxContentWidthCssValue = computed(() => `${props.maxContentWidth}px`);
27
29
  const baseOffsetCssValue = computed(() => `${-baseOffset}px`);
28
30
  const arrowSizeCssValue = computed(() => `${baseOffset}px`);
29
31
  const mainPlacement = computed(() => {
@@ -66,18 +68,24 @@
66
68
  });
67
69
 
68
70
  function onMouseenter() {
71
+ if (props.disabled) return;
72
+
69
73
  showTooltip.value = true;
70
74
  emits('open');
71
75
  emits('update:modelValue', true);
72
76
  }
73
77
 
74
78
  function onMouseleave() {
79
+ if (props.disabled) return;
80
+
75
81
  showTooltip.value = false;
76
82
  emits('close');
77
83
  emits('update:modelValue', false);
78
84
  }
79
85
 
80
86
  function onClick() {
87
+ if (props.disabled) return;
88
+
81
89
  if (showTooltip.value) {
82
90
  onMouseleave();
83
91
  } else {
@@ -86,8 +94,6 @@
86
94
  }
87
95
 
88
96
  onMounted(() => {
89
- if (props.disabled) return;
90
-
91
97
  const inst = getCurrentInstance();
92
98
  const el = inst?.vnode?.el;
93
99
  if (!el) {
@@ -204,7 +210,7 @@
204
210
 
205
211
  .content {
206
212
  position: relative;
207
- max-width: 400px;
213
+ max-width: v-bind(maxContentWidthCssValue);
208
214
  padding: 6px var(--spacing-s);
209
215
  border-radius: 6px;
210
216
  font-size: var(--font-11);