@v1nt1248/3nclient-lib 0.3.51 → 0.4.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/README.md +4 -0
- package/dist/chunks/{plugins-keys-DdadrIAg.js → plugins-keys-CjKqZeyH.js} +2 -2
- package/dist/chunks/ui3n-tooltip-BbbM2459.js +409 -0
- package/dist/src/components/ui3n-chip/ui3n-chip.d.ts +0 -5
- package/dist/src/components/ui3n-icon/ui3n-icon.d.ts +0 -1
- package/dist/src/components/ui3n-progress/ui3n-progress-circular.d.ts +0 -2
- package/dist/src/components/ui3n-progress/ui3n-progress-linear.d.ts +0 -2
- package/dist/src/components/ui3n-scrollbar-horizontal/ui3n-scrollbar-horizontal.d.ts +0 -7
- package/dist/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +0 -7
- package/dist/src/components/ui3n-slider/ui3n-slider.d.ts +0 -5
- package/dist/src/components/ui3n-tabs/ui3n-tabs.d.ts +0 -4
- package/dist/src/components/ui3n-tooltip/types.d.ts +8 -2
- package/dist/src/components/ui3n-tooltip/ui3n-tooltip-container.d.ts +16 -0
- package/dist/src/components/ui3n-tooltip/ui3n-tooltip.d.ts +1 -5
- package/dist/src/constants/plugins-keys.d.ts +2 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/plugins/index.d.ts +4 -1
- package/dist/src/plugins/tooltips/store-tooltips.d.ts +4 -0
- package/dist/src/plugins/tooltips/tooltips.d.ts +8 -0
- package/dist/src/plugins/tooltips/types.d.ts +34 -0
- package/dist/src/ui3n-plugins.d.ts +5 -3
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +1011 -1183
- package/dist/ui3n-plugins.js +169 -50
- package/dist/ui3n-utils.js +4 -4
- package/package.json +11 -4
- package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +28 -25
- package/src/components/ui3n-badge/ui3n-badge-simple.vue +18 -17
- package/src/components/ui3n-badge/ui3n-badge.vue +3 -2
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +11 -10
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +4 -1
- package/src/components/ui3n-button/ui3n-button.vue +244 -158
- package/src/components/ui3n-checkbox/ui3n-checkbox.vue +22 -21
- package/src/components/ui3n-chip/ui3n-chip.vue +56 -40
- package/src/components/ui3n-dialog/ui3n-dialog-provider.vue +1 -0
- package/src/components/ui3n-dialog/ui3n-dialog.vue +19 -18
- package/src/components/ui3n-drop-files/ui3n-drop-files.vue +8 -7
- package/src/components/ui3n-editable/ui3n-content-editable.vue +11 -10
- package/src/components/ui3n-editable/ui3n-editable.vue +26 -25
- package/src/components/ui3n-emoji/ui3n-emoji.vue +7 -6
- package/src/components/ui3n-icon/ui3n-icon.vue +26 -16
- package/src/components/ui3n-input/ui3n-input.vue +36 -32
- package/src/components/ui3n-input-file/ui3n-input-file.vue +8 -5
- package/src/components/ui3n-list/ui3n-list.vue +8 -7
- package/src/components/ui3n-menu/ui3n-menu.vue +6 -5
- package/src/components/ui3n-mobile-menu/ui3n-mobile-menu.vue +4 -3
- package/src/components/ui3n-mobile-menu-item/ui3n-mobile-menu-item.vue +7 -6
- package/src/components/ui3n-notification/ui3n-notification-container.vue +1 -0
- package/src/components/ui3n-notification/ui3n-notification.vue +28 -26
- package/src/components/ui3n-progress/ui3n-progress-circular.vue +32 -19
- package/src/components/ui3n-progress/ui3n-progress-linear.vue +31 -18
- package/src/components/ui3n-radio-group/ui3n-radio-group.vue +4 -1
- package/src/components/ui3n-radio-group/ui3n-radio.vue +6 -5
- package/src/components/ui3n-scrollbar/ui3n-scrollbar.vue +94 -83
- package/src/components/ui3n-scrollbar-horizontal/ui3n-scrollbar-horizontal.vue +51 -39
- package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +51 -39
- package/src/components/ui3n-selector/ui3n-selector.vue +33 -28
- package/src/components/ui3n-slider/ui3n-slider.vue +53 -34
- package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +10 -6
- package/src/components/ui3n-switch/ui3n-switch.vue +23 -22
- package/src/components/ui3n-table/ui3n-table.vue +50 -48
- package/src/components/ui3n-tabs/ui3n-tabs.vue +38 -20
- package/src/components/ui3n-text/ui3n-text.vue +15 -14
- package/src/components/ui3n-tooltip/types.ts +8 -2
- package/src/components/ui3n-tooltip/ui3n-tooltip-container.vue +79 -0
- package/src/components/ui3n-tooltip/ui3n-tooltip.vue +140 -79
- package/dist/chunks/ui3n-notification-o0tuhTpO.js +0 -272
- package/src/components/ui3n-tooltip/ui3n-tooltip-old.vue +0 -198
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { computed, ref, watch } from 'vue';
|
|
3
|
-
import { useFloating, offset, autoUpdate, arrow } from '@floating-ui/vue';
|
|
4
|
-
import type { Ui3nTooltipEmits, Ui3nTooltipProps, Ui3nTooltipSlots } from './types';
|
|
5
|
-
|
|
6
|
-
const baseOffset = 5;
|
|
7
|
-
|
|
8
|
-
const props = withDefaults(defineProps<Ui3nTooltipProps>(), {
|
|
9
|
-
color: 'var(--color-bg-control-secondary-default)',
|
|
10
|
-
textColor: 'var(--color-text-control-primary-default)',
|
|
11
|
-
placement: 'top',
|
|
12
|
-
positionStrategy: 'absolute',
|
|
13
|
-
offsetX: 0,
|
|
14
|
-
offsetY: 0,
|
|
15
|
-
trigger: 'hover',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const emits = defineEmits<Ui3nTooltipEmits>();
|
|
19
|
-
defineSlots<Ui3nTooltipSlots>();
|
|
20
|
-
|
|
21
|
-
const referenceElEventHandler = {
|
|
22
|
-
...(props.trigger === 'hover' &&
|
|
23
|
-
!props.disabled && {
|
|
24
|
-
mouseenter: () => handleMouseEvents(true),
|
|
25
|
-
mouseleave: () => handleMouseEvents(false),
|
|
26
|
-
}),
|
|
27
|
-
...(props.trigger === 'click' &&
|
|
28
|
-
!props.disabled && {
|
|
29
|
-
click: () => handleMouseEvents(!showTooltip.value),
|
|
30
|
-
}),
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const showTooltip = ref(false);
|
|
34
|
-
const referenceEl = ref(null);
|
|
35
|
-
const floatingEl = ref(null);
|
|
36
|
-
const floatingArrowEl = ref(null);
|
|
37
|
-
|
|
38
|
-
const baseOffsetCssValue = computed(() => `${-baseOffset}px`);
|
|
39
|
-
const arrowSizeCssValue = computed(() => `${baseOffset}px`);
|
|
40
|
-
const mainPlacement = computed(() => {
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
|
-
const [part1, _] = props.placement.split('-');
|
|
43
|
-
return part1;
|
|
44
|
-
});
|
|
45
|
-
const offsetOptions = computed(() => {
|
|
46
|
-
const options = {
|
|
47
|
-
mainAxis: 0,
|
|
48
|
-
crossAxis: 0,
|
|
49
|
-
};
|
|
50
|
-
switch (mainPlacement.value) {
|
|
51
|
-
case 'top':
|
|
52
|
-
options.mainAxis = -1 * Number(props.offsetY) + baseOffset;
|
|
53
|
-
options.crossAxis = Number(props.offsetX);
|
|
54
|
-
break;
|
|
55
|
-
case 'bottom':
|
|
56
|
-
options.mainAxis = Number(props.offsetY) + baseOffset;
|
|
57
|
-
options.crossAxis = Number(props.offsetX);
|
|
58
|
-
break;
|
|
59
|
-
case 'left':
|
|
60
|
-
options.mainAxis = -1 * Number(props.offsetX) + baseOffset;
|
|
61
|
-
options.crossAxis = Number(props.offsetY);
|
|
62
|
-
break;
|
|
63
|
-
case 'right':
|
|
64
|
-
options.mainAxis = Number(props.offsetX) + baseOffset;
|
|
65
|
-
options.crossAxis = Number(props.offsetY);
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
return options;
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const { floatingStyles, isPositioned, middlewareData } = useFloating(referenceEl, floatingEl, {
|
|
72
|
-
open: showTooltip,
|
|
73
|
-
placement: props.placement,
|
|
74
|
-
strategy: props.positionStrategy,
|
|
75
|
-
middleware: [offset(offsetOptions.value), arrow({ element: floatingArrowEl, padding: 8 })],
|
|
76
|
-
whileElementsMounted: props.positionStrategy === 'fixed' ? autoUpdate : undefined,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
function handleMouseEvents(val: boolean) {
|
|
80
|
-
showTooltip.value = val;
|
|
81
|
-
val ? emits('open') : emits('close');
|
|
82
|
-
emits('update:modelValue', val);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
watch(
|
|
86
|
-
() => props.modelValue,
|
|
87
|
-
val => props.trigger === 'manual' && (showTooltip.value = val),
|
|
88
|
-
{ immediate: true },
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
watch(isPositioned, val => {
|
|
92
|
-
val ? emits('opened') : emits('closed');
|
|
93
|
-
});
|
|
94
|
-
</script>
|
|
95
|
-
|
|
96
|
-
<template>
|
|
97
|
-
<div :class="$style.ui3nTooltip">
|
|
98
|
-
<div
|
|
99
|
-
ref="referenceEl"
|
|
100
|
-
:class="$style.reference"
|
|
101
|
-
v-on="referenceElEventHandler"
|
|
102
|
-
>
|
|
103
|
-
<slot name="default" />
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<div
|
|
107
|
-
v-if="showTooltip"
|
|
108
|
-
ref="floatingEl"
|
|
109
|
-
:class="$style.floating"
|
|
110
|
-
:style="floatingStyles"
|
|
111
|
-
>
|
|
112
|
-
<slot name="content">
|
|
113
|
-
<div :class="$style.content">
|
|
114
|
-
{{ content }}
|
|
115
|
-
<div
|
|
116
|
-
ref="floatingArrowEl"
|
|
117
|
-
:class="[$style.arrow, $style[`arrow-${mainPlacement}`]]"
|
|
118
|
-
:style="{
|
|
119
|
-
left: middlewareData.arrow?.x != null ? `${middlewareData.arrow?.x}px` : '',
|
|
120
|
-
top: middlewareData.arrow?.y != null ? `${middlewareData.arrow?.y}px` : '',
|
|
121
|
-
}"
|
|
122
|
-
/>
|
|
123
|
-
</div>
|
|
124
|
-
</slot>
|
|
125
|
-
</div>
|
|
126
|
-
</div>
|
|
127
|
-
</template>
|
|
128
|
-
|
|
129
|
-
<style lang="scss" module>
|
|
130
|
-
.ui3nTooltip {
|
|
131
|
-
--ui3n-tooltip-bg-color: v-bind(color);
|
|
132
|
-
--ui3n-tooltip-text-color: v-bind(textColor);
|
|
133
|
-
|
|
134
|
-
position: relative;
|
|
135
|
-
width: max-content;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.reference {
|
|
139
|
-
position: relative;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.floating {
|
|
143
|
-
width: max-content;
|
|
144
|
-
z-index: 5;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.arrow {
|
|
148
|
-
position: absolute;
|
|
149
|
-
width: 0;
|
|
150
|
-
height: 0;
|
|
151
|
-
|
|
152
|
-
&-top,
|
|
153
|
-
&-bottom {
|
|
154
|
-
border-style: solid;
|
|
155
|
-
border-width: 0 v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue);
|
|
156
|
-
border-color: transparent transparent var(--ui3n-tooltip-bg-color) transparent;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
&-top {
|
|
160
|
-
bottom: v-bind(baseOffsetCssValue);
|
|
161
|
-
transform: rotate(180deg);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
&-bottom {
|
|
165
|
-
top: v-bind(baseOffsetCssValue);
|
|
166
|
-
transform: rotate(0deg);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
&-left,
|
|
170
|
-
&-right {
|
|
171
|
-
border-style: solid;
|
|
172
|
-
border-width: v-bind(arrowSizeCssValue) 0 v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue);
|
|
173
|
-
border-color: transparent transparent transparent var(--ui3n-tooltip-bg-color);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
&-left {
|
|
177
|
-
right: v-bind(baseOffsetCssValue);
|
|
178
|
-
transform: rotate(0deg);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
&-right {
|
|
182
|
-
left: v-bind(baseOffsetCssValue);
|
|
183
|
-
transform: rotate(180deg);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.content {
|
|
188
|
-
position: relative;
|
|
189
|
-
max-width: 400px;
|
|
190
|
-
padding: var(--spacing-xs) var(--spacing-s);
|
|
191
|
-
border-radius: var(--spacing-xs);
|
|
192
|
-
font-size: var(--font-11);
|
|
193
|
-
line-height: var(--font-12);
|
|
194
|
-
font-weight: 400;
|
|
195
|
-
background-color: var(--ui3n-tooltip-bg-color);
|
|
196
|
-
color: var(--ui3n-tooltip-text-color);
|
|
197
|
-
}
|
|
198
|
-
</style>
|