@v1nt1248/3nclient-lib 0.4.0 → 0.4.2

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.
Files changed (28) hide show
  1. package/README.md +2 -0
  2. package/dist/chunks/{plugins-keys-DdadrIAg.js → plugins-keys-DY2USp8H.js} +550 -536
  3. package/dist/chunks/ui3n-tooltip-6Z-sRX7U.js +409 -0
  4. package/dist/src/components/ui3n-tooltip/types.d.ts +8 -2
  5. package/dist/src/components/ui3n-tooltip/ui3n-tooltip-container.d.ts +16 -0
  6. package/dist/src/components/ui3n-tooltip/ui3n-tooltip.d.ts +1 -2
  7. package/dist/src/constants/plugins-keys.d.ts +2 -0
  8. package/dist/src/index.d.ts +3 -0
  9. package/dist/src/plugins/index.d.ts +4 -1
  10. package/dist/src/plugins/tooltips/store-tooltips.d.ts +4 -0
  11. package/dist/src/plugins/tooltips/tooltips.d.ts +8 -0
  12. package/dist/src/plugins/tooltips/types.d.ts +34 -0
  13. package/dist/src/ui3n-plugins.d.ts +5 -3
  14. package/dist/src/utils/ui/has-slot-content.d.ts +8 -2
  15. package/dist/src/utils/ui/mark-search.d.ts +8 -0
  16. package/dist/style.css +1 -1
  17. package/dist/ui3n-components.js +1345 -1466
  18. package/dist/ui3n-plugins.js +168 -50
  19. package/dist/ui3n-utils.js +4 -4
  20. package/package.json +1 -1
  21. package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +24 -8
  22. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +3 -1
  23. package/src/components/ui3n-editable/useContentEditable.ts +5 -1
  24. package/src/components/ui3n-tooltip/types.ts +8 -2
  25. package/src/components/ui3n-tooltip/ui3n-tooltip-container.vue +79 -0
  26. package/src/components/ui3n-tooltip/ui3n-tooltip.vue +112 -62
  27. package/dist/chunks/ui3n-notification-CTYQV3nR.js +0 -273
  28. package/src/components/ui3n-tooltip/ui3n-tooltip-old.vue +0 -201
@@ -1,201 +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
98
- data-ui3n="tooltip-old"
99
- :class="$style.ui3nTooltip"
100
- >
101
- <div
102
- ref="referenceEl"
103
- :class="$style.reference"
104
- v-on="referenceElEventHandler"
105
- >
106
- <slot name="default" />
107
- </div>
108
-
109
- <div
110
- v-if="showTooltip"
111
- ref="floatingEl"
112
- :class="$style.floating"
113
- :style="floatingStyles"
114
- >
115
- <slot name="content">
116
- <div :class="$style.content">
117
- {{ content }}
118
- <div
119
- ref="floatingArrowEl"
120
- :class="[$style.arrow, $style[`arrow-${mainPlacement}`]]"
121
- :style="{
122
- left: middlewareData.arrow?.x != null ? `${middlewareData.arrow?.x}px` : '',
123
- top: middlewareData.arrow?.y != null ? `${middlewareData.arrow?.y}px` : '',
124
- }"
125
- />
126
- </div>
127
- </slot>
128
- </div>
129
- </div>
130
- </template>
131
-
132
- <style lang="scss" module>
133
- .ui3nTooltip {
134
- --_tooltip-bg-color: var(--ui3n-tooltip-bg-color, v-bind(color));
135
- --_tooltip-text-color: var(--ui3n-tooltip-text-color, v-bind(textColor));
136
-
137
- position: relative;
138
- width: max-content;
139
- }
140
-
141
- .reference {
142
- position: relative;
143
- }
144
-
145
- .floating {
146
- width: max-content;
147
- z-index: 5;
148
- }
149
-
150
- .arrow {
151
- position: absolute;
152
- width: 0;
153
- height: 0;
154
-
155
- &-top,
156
- &-bottom {
157
- border-style: solid;
158
- border-width: 0 v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue);
159
- border-color: transparent transparent var(--_tooltip-bg-color) transparent;
160
- }
161
-
162
- &-top {
163
- bottom: v-bind(baseOffsetCssValue);
164
- transform: rotate(180deg);
165
- }
166
-
167
- &-bottom {
168
- top: v-bind(baseOffsetCssValue);
169
- transform: rotate(0deg);
170
- }
171
-
172
- &-left,
173
- &-right {
174
- border-style: solid;
175
- border-width: v-bind(arrowSizeCssValue) 0 v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue);
176
- border-color: transparent transparent transparent var(--_tooltip-bg-color);
177
- }
178
-
179
- &-left {
180
- right: v-bind(baseOffsetCssValue);
181
- transform: rotate(0deg);
182
- }
183
-
184
- &-right {
185
- left: v-bind(baseOffsetCssValue);
186
- transform: rotate(180deg);
187
- }
188
- }
189
-
190
- .content {
191
- position: relative;
192
- max-width: 400px;
193
- padding: var(--ui3n-tooltip-padding, 4px 8px);
194
- border-radius: var(--ui3n-tooltip-border-radius, 4px);
195
- font-size: var(--ui3n-tooltip-font-size, 11px);
196
- line-height: var(--ui3n-tooltip-line-height, 12px);
197
- font-weight: 400;
198
- background-color: var(--_tooltip-bg-color);
199
- color: var(--_tooltip-text-color);
200
- }
201
- </style>