@v1nt1248/3nclient-lib 0.3.51 → 0.4.0
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 +2 -0
- package/dist/chunks/{ui3n-notification-o0tuhTpO.js → ui3n-notification-CTYQV3nR.js} +38 -37
- 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/ui3n-tooltip.d.ts +0 -3
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +1697 -1748
- package/dist/ui3n-plugins.js +2 -1
- 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/ui3n-tooltip-old.vue +14 -11
- package/src/components/ui3n-tooltip/ui3n-tooltip.vue +38 -27
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
>
|
|
133
133
|
<div
|
|
134
134
|
ref="tableEl"
|
|
135
|
+
data-ui3n="table"
|
|
135
136
|
:style="tableStyle"
|
|
136
137
|
:class="[$style.ui3nTable, $style.ui3nTableInsideScrollbar, stickyColumnsActive && $style.stickyColumns]"
|
|
137
138
|
>
|
|
@@ -316,6 +317,7 @@
|
|
|
316
317
|
<div
|
|
317
318
|
v-else
|
|
318
319
|
ref="tableEl"
|
|
320
|
+
data-ui3n="table"
|
|
319
321
|
:style="tableStyle"
|
|
320
322
|
:class="[$style.ui3nTable, stickyColumnsActive && $style.stickyColumns]"
|
|
321
323
|
>
|
|
@@ -505,21 +507,21 @@
|
|
|
505
507
|
}
|
|
506
508
|
|
|
507
509
|
.ui3nTable {
|
|
508
|
-
--ui3n-table-columns-width
|
|
509
|
-
--ui3n-table-base-head-height
|
|
510
|
-
--ui3n-table-group-actions-height
|
|
511
|
-
--ui3n-table-body-row-height
|
|
512
|
-
--ui3n-table-group-actions-bg-color
|
|
513
|
-
--ui3n-table-header-bg-color
|
|
514
|
-
--ui3n-table-header-color
|
|
515
|
-
--ui3n-table-header-font-size
|
|
516
|
-
--ui3n-table-padding-inline
|
|
517
|
-
--ui3n-table-row-color
|
|
518
|
-
--ui3n-table-row-bg-color-selected
|
|
519
|
-
--ui3n-table-row-checkbox-width
|
|
520
|
-
--ui3n-table-cell-font-size
|
|
521
|
-
--ui3n-table-nodata-height
|
|
522
|
-
--ui3n-table-nodata-color
|
|
510
|
+
--_table-columns-width: var(--ui3n-table-columns-width, auto);
|
|
511
|
+
--_table-base-head-height: var(--ui3n-table-base-head-height, 36px);
|
|
512
|
+
--_table-group-actions-height: var(--ui3n-table-group-actions-height, 48px);
|
|
513
|
+
--_table-body-row-height: var(--ui3n-table-body-row-height, 28px);
|
|
514
|
+
--_table-group-actions-bg-color: var(--ui3n-table-group-actions-bg-color, var(--color-bg-block-primary-default));
|
|
515
|
+
--_table-header-bg-color: var(--ui3n-table-header-bg-color, var(--color-bg-table-header-default));
|
|
516
|
+
--_table-header-color: var(--ui3n-table-header-color, var(--color-text-table-primary-default));
|
|
517
|
+
--_table-header-font-size: var(--ui3n-table-header-font-size, 14px);
|
|
518
|
+
--_table-padding-inline: var(--ui3n-table-padding-inline, 16px);
|
|
519
|
+
--_table-row-color: var(--ui3n-table-row-color, var(--color-text-table-primary-default));
|
|
520
|
+
--_table-row-bg-color-selected: var(--ui3n-table-row-bg-color-selected, var(--color-bg-control-primary-hover));
|
|
521
|
+
--_table-row-checkbox-width: var(--ui3n-table-row-checkbox-width, 16px);
|
|
522
|
+
--_table-cell-font-size: var(--ui3n-table-cell-font-size, 12px);
|
|
523
|
+
--_table-nodata-height: var(--ui3n-table-nodata-height, 48px);
|
|
524
|
+
--_table-nodata-color: var(--ui3n-table-nodata-color, var(--color-text-control-secondary-default));
|
|
523
525
|
|
|
524
526
|
position: relative;
|
|
525
527
|
width: 100%;
|
|
@@ -561,22 +563,22 @@
|
|
|
561
563
|
position: sticky;
|
|
562
564
|
top: 0;
|
|
563
565
|
width: 100%;
|
|
564
|
-
min-height: var(--
|
|
565
|
-
height: var(--
|
|
566
|
+
min-height: var(--_table-base-head-height);
|
|
567
|
+
height: var(--_table-base-head-height);
|
|
566
568
|
display: grid;
|
|
567
|
-
grid-template-columns: var(--
|
|
568
|
-
background-color: var(--
|
|
569
|
-
padding-left: var(--
|
|
569
|
+
grid-template-columns: var(--_table-columns-width);
|
|
570
|
+
background-color: var(--_table-header-bg-color);
|
|
571
|
+
padding-left: var(--_table-padding-inline);
|
|
570
572
|
z-index: 5;
|
|
571
573
|
|
|
572
574
|
&.withGroupActions {
|
|
573
|
-
height: calc(var(--
|
|
574
|
-
min-height: calc(var(--
|
|
575
|
-
padding-top: var(--
|
|
575
|
+
height: calc(var(--_table-base-head-height) + var(--_table-group-actions-height));
|
|
576
|
+
min-height: calc(var(--_table-base-head-height) + var(--_table-group-actions-height));
|
|
577
|
+
padding-top: var(--_table-group-actions-height);
|
|
576
578
|
}
|
|
577
579
|
|
|
578
580
|
.headerItemWrapper:not(:first-child) {
|
|
579
|
-
padding: 0 calc(var(--
|
|
581
|
+
padding: 0 calc(var(--_table-padding-inline) / 4);
|
|
580
582
|
}
|
|
581
583
|
}
|
|
582
584
|
|
|
@@ -605,9 +607,9 @@
|
|
|
605
607
|
|
|
606
608
|
.headerText {
|
|
607
609
|
display: block;
|
|
608
|
-
font-size: var(--
|
|
610
|
+
font-size: var(--_table-header-font-size);
|
|
609
611
|
font-weight: 500;
|
|
610
|
-
color: var(--
|
|
612
|
+
color: var(--_table-header-color);
|
|
611
613
|
@include mixins.text-overflow-ellipsis();
|
|
612
614
|
}
|
|
613
615
|
|
|
@@ -623,11 +625,11 @@
|
|
|
623
625
|
left: 0;
|
|
624
626
|
display: flex;
|
|
625
627
|
width: 100%;
|
|
626
|
-
height: var(--
|
|
627
|
-
padding: 0 var(--
|
|
628
|
+
height: var(--_table-group-actions-height);
|
|
629
|
+
padding: 0 var(--_table-padding-inline);
|
|
628
630
|
justify-content: space-between;
|
|
629
631
|
align-items: center;
|
|
630
|
-
background-color: var(--
|
|
632
|
+
background-color: var(--_table-group-actions-bg-color);
|
|
631
633
|
border-left: 1px solid var(--color-border-block-primary-default);
|
|
632
634
|
border-top: 1px solid var(--color-border-block-primary-default);
|
|
633
635
|
border-right: 1px solid var(--color-border-block-primary-default);
|
|
@@ -636,7 +638,7 @@
|
|
|
636
638
|
.groupActionsBody {
|
|
637
639
|
display: flex;
|
|
638
640
|
height: 100%;
|
|
639
|
-
padding: 0 calc(var(--
|
|
641
|
+
padding: 0 calc(var(--_table-padding-inline) / 2);
|
|
640
642
|
flex-grow: 1;
|
|
641
643
|
}
|
|
642
644
|
|
|
@@ -649,16 +651,16 @@
|
|
|
649
651
|
.row {
|
|
650
652
|
position: relative;
|
|
651
653
|
width: 100%;
|
|
652
|
-
min-height: var(--
|
|
654
|
+
min-height: var(--_table-body-row-height);
|
|
653
655
|
border-left: 1px solid var(--color-border-table-primary-default);
|
|
654
656
|
border-right: 1px solid var(--color-border-table-primary-default);
|
|
655
657
|
border-bottom: 1px solid var(--color-border-block-primary-default);
|
|
656
658
|
background-color: transparent;
|
|
657
659
|
|
|
658
660
|
&:not(.customRow) {
|
|
659
|
-
padding-left: var(--
|
|
661
|
+
padding-left: var(--_table-padding-inline);
|
|
660
662
|
display: grid;
|
|
661
|
-
grid-template-columns: var(--
|
|
663
|
+
grid-template-columns: var(--_table-columns-width);
|
|
662
664
|
}
|
|
663
665
|
|
|
664
666
|
&.selectable {
|
|
@@ -671,14 +673,14 @@
|
|
|
671
673
|
}
|
|
672
674
|
|
|
673
675
|
.selected {
|
|
674
|
-
background-color: var(--
|
|
676
|
+
background-color: var(--_table-row-bg-color-selected);
|
|
675
677
|
}
|
|
676
678
|
|
|
677
679
|
.rowCheckbox {
|
|
678
680
|
position: absolute;
|
|
679
681
|
top: 0;
|
|
680
682
|
left: 16px;
|
|
681
|
-
width: var(--
|
|
683
|
+
width: var(--_table-row-checkbox-width);
|
|
682
684
|
height: 100%;
|
|
683
685
|
display: flex;
|
|
684
686
|
justify-content: flex-start;
|
|
@@ -694,27 +696,27 @@
|
|
|
694
696
|
align-items: center;
|
|
695
697
|
|
|
696
698
|
&.bodyItemFirst {
|
|
697
|
-
padding-left: calc(var(--
|
|
699
|
+
padding-left: calc(var(--_table-padding-inline) * 1.5);
|
|
698
700
|
}
|
|
699
701
|
}
|
|
700
702
|
|
|
701
703
|
.cell {
|
|
702
|
-
font-size: var(--
|
|
704
|
+
font-size: var(--_table-cell-font-size);
|
|
703
705
|
font-weight: 400;
|
|
704
|
-
color: var(--
|
|
706
|
+
color: var(--_table-row-color);
|
|
705
707
|
}
|
|
706
708
|
|
|
707
709
|
.noData {
|
|
708
710
|
position: relative;
|
|
709
711
|
width: 100%;
|
|
710
|
-
height: var(--
|
|
712
|
+
height: var(--_table-nodata-height);
|
|
711
713
|
padding-top: 24px;
|
|
712
714
|
display: flex;
|
|
713
715
|
justify-content: center;
|
|
714
716
|
align-items: center;
|
|
715
|
-
font-size: var(--
|
|
717
|
+
font-size: var(--_table-cell-font-size);
|
|
716
718
|
font-weight: 600;
|
|
717
|
-
color: var(--
|
|
719
|
+
color: var(--_table-nodata-color);
|
|
718
720
|
}
|
|
719
721
|
|
|
720
722
|
.unusedPlace {
|
|
@@ -729,7 +731,7 @@
|
|
|
729
731
|
width: max-content;
|
|
730
732
|
min-width: 100%;
|
|
731
733
|
display: grid;
|
|
732
|
-
grid-template-columns: var(--
|
|
734
|
+
grid-template-columns: var(--_table-columns-width);
|
|
733
735
|
}
|
|
734
736
|
|
|
735
737
|
.header {
|
|
@@ -746,15 +748,15 @@
|
|
|
746
748
|
|
|
747
749
|
.headerItemSticky {
|
|
748
750
|
position: sticky;
|
|
749
|
-
background-color: var(--
|
|
751
|
+
background-color: var(--_table-header-bg-color);
|
|
750
752
|
}
|
|
751
753
|
|
|
752
754
|
.headerItemFirst.headerItemSticky {
|
|
753
|
-
padding-left: var(--
|
|
755
|
+
padding-left: var(--_table-padding-inline);
|
|
754
756
|
}
|
|
755
757
|
|
|
756
758
|
.headerItemWrapper:not(.headerItemFirst) {
|
|
757
|
-
padding: 0 calc(var(--
|
|
759
|
+
padding: 0 calc(var(--_table-padding-inline) / 4);
|
|
758
760
|
}
|
|
759
761
|
|
|
760
762
|
.bodyItemSticky {
|
|
@@ -763,7 +765,7 @@
|
|
|
763
765
|
}
|
|
764
766
|
|
|
765
767
|
.bodyItemFirst.bodyItemSticky {
|
|
766
|
-
padding-left: calc(var(--
|
|
768
|
+
padding-left: calc(var(--_table-padding-inline) + var(--_table-padding-inline) * 1.5);
|
|
767
769
|
}
|
|
768
770
|
|
|
769
771
|
.row:hover .bodyItemSticky {
|
|
@@ -771,12 +773,12 @@
|
|
|
771
773
|
}
|
|
772
774
|
|
|
773
775
|
.row.selected .bodyItemSticky {
|
|
774
|
-
background-color: var(--
|
|
776
|
+
background-color: var(--_table-row-bg-color-selected);
|
|
775
777
|
}
|
|
776
778
|
|
|
777
779
|
.rowCheckbox {
|
|
778
780
|
position: sticky;
|
|
779
|
-
left: var(--
|
|
781
|
+
left: var(--_table-padding-inline);
|
|
780
782
|
z-index: 3;
|
|
781
783
|
}
|
|
782
784
|
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
import { computed, nextTick, onMounted, ref, watch, useCssModule } from 'vue';
|
|
3
3
|
import type { Ui3nTabsEmits, Ui3nTabsProps, Ui3nTabsSlots } from './types';
|
|
4
4
|
|
|
5
|
+
/* colours and the indicator size keep their defaults in CSS */
|
|
5
6
|
const props = withDefaults(defineProps<Ui3nTabsProps>(), {
|
|
6
7
|
modelValue: 0,
|
|
7
8
|
itemDirection: 'horizontal',
|
|
8
|
-
activeColor: 'var(--color-text-control-accent-default)',
|
|
9
|
-
inactiveColor: 'var(--color-text-control-primary-default)',
|
|
10
|
-
indicatorColor: 'var(--color-border-control-accent-default)',
|
|
11
|
-
indicatorSize: 2,
|
|
12
9
|
indicatorPosition: 'normal',
|
|
13
10
|
});
|
|
14
11
|
const emits = defineEmits<Ui3nTabsEmits>();
|
|
@@ -19,13 +16,29 @@
|
|
|
19
16
|
const tabs = ref<HTMLDivElement | null>(null);
|
|
20
17
|
const activeIndex = ref(props.modelValue);
|
|
21
18
|
|
|
22
|
-
const tabsStyle = computed(() =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
const tabsStyle = computed(() => {
|
|
20
|
+
const styles: Record<string, string> = {
|
|
21
|
+
'--ui3n-tabs-indicator-position': props.indicatorPosition === 'reverse' ? '100%' : '0',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
if (props.activeColor) {
|
|
25
|
+
styles['--ui3n-tabs-active-color'] = props.activeColor;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (props.inactiveColor) {
|
|
29
|
+
styles['--ui3n-tabs-inactive-color'] = props.inactiveColor;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (props.indicatorColor) {
|
|
33
|
+
styles['--ui3n-tabs-indicator-color'] = props.indicatorColor;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (props.indicatorSize !== undefined) {
|
|
37
|
+
styles['--ui3n-tabs-indicator-size'] = `${props.indicatorSize}px`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return styles;
|
|
41
|
+
});
|
|
29
42
|
|
|
30
43
|
function updateChildrenAttributes(): void {
|
|
31
44
|
if (tabs.value?.children) {
|
|
@@ -89,6 +102,7 @@
|
|
|
89
102
|
<div
|
|
90
103
|
ref="tabs"
|
|
91
104
|
:id="id"
|
|
105
|
+
data-ui3n="tabs"
|
|
92
106
|
:style="tabsStyle"
|
|
93
107
|
:class="[$style.ui3nTabs, itemDirection === 'vertical' && $style.vertical]"
|
|
94
108
|
@click="onClick"
|
|
@@ -99,10 +113,14 @@
|
|
|
99
113
|
|
|
100
114
|
<style lang="scss" module>
|
|
101
115
|
.ui3nTabs {
|
|
102
|
-
--ui3n-tabs-height
|
|
116
|
+
--_tabs-height: var(--ui3n-tabs-height, 48px);
|
|
117
|
+
--_tabs-active-color: var(--ui3n-tabs-active-color, var(--color-text-control-accent-default));
|
|
118
|
+
--_tabs-inactive-color: var(--ui3n-tabs-inactive-color, var(--color-text-control-primary-default));
|
|
119
|
+
--_tabs-indicator-color: var(--ui3n-tabs-indicator-color, var(--color-border-control-accent-default));
|
|
120
|
+
--_tabs-indicator-size: var(--ui3n-tabs-indicator-size, 2px);
|
|
103
121
|
|
|
104
122
|
position: relative;
|
|
105
|
-
height: var(--
|
|
123
|
+
height: var(--_tabs-height);
|
|
106
124
|
display: flex;
|
|
107
125
|
justify-content: center;
|
|
108
126
|
align-items: stretch;
|
|
@@ -113,7 +131,7 @@
|
|
|
113
131
|
cursor: pointer;
|
|
114
132
|
position: relative;
|
|
115
133
|
user-select: none;
|
|
116
|
-
color: var(--
|
|
134
|
+
color: var(--_tabs-inactive-color);
|
|
117
135
|
|
|
118
136
|
&:hover {
|
|
119
137
|
background-color: var(--color-bg-control-secondary-default);
|
|
@@ -124,8 +142,8 @@
|
|
|
124
142
|
content: '';
|
|
125
143
|
left: 0;
|
|
126
144
|
width: 100%;
|
|
127
|
-
bottom: var(--ui3n-tabs-indicator-position);
|
|
128
|
-
height: var(--
|
|
145
|
+
bottom: var(--ui3n-tabs-indicator-position, 0);
|
|
146
|
+
height: var(--_tabs-indicator-size);
|
|
129
147
|
background-color: transparent;
|
|
130
148
|
transition: background-color 250ms ease-in-out;
|
|
131
149
|
}
|
|
@@ -138,10 +156,10 @@
|
|
|
138
156
|
}
|
|
139
157
|
|
|
140
158
|
.active {
|
|
141
|
-
color: var(--
|
|
159
|
+
color: var(--_tabs-active-color);
|
|
142
160
|
|
|
143
161
|
&::after {
|
|
144
|
-
background-color: var(--
|
|
162
|
+
background-color: var(--_tabs-indicator-color);
|
|
145
163
|
transition: background-color 250ms ease-in-out;
|
|
146
164
|
}
|
|
147
165
|
}
|
|
@@ -152,8 +170,8 @@
|
|
|
152
170
|
|
|
153
171
|
.item {
|
|
154
172
|
&::after {
|
|
155
|
-
left: var(--ui3n-tabs-indicator-position);
|
|
156
|
-
width: var(--
|
|
173
|
+
left: var(--ui3n-tabs-indicator-position, 0);
|
|
174
|
+
width: var(--_tabs-indicator-size);
|
|
157
175
|
bottom: 0;
|
|
158
176
|
height: 100%;
|
|
159
177
|
}
|
|
@@ -141,6 +141,7 @@
|
|
|
141
141
|
<template>
|
|
142
142
|
<div
|
|
143
143
|
:id="id"
|
|
144
|
+
data-ui3n="text"
|
|
144
145
|
:class="[
|
|
145
146
|
$style.ui3nText,
|
|
146
147
|
disabled && $style.disabled,
|
|
@@ -187,22 +188,22 @@
|
|
|
187
188
|
|
|
188
189
|
<style lang="scss" module>
|
|
189
190
|
.ui3nText {
|
|
190
|
-
--ui3n-text-border-radius
|
|
191
|
-
--ui3n-text-label-font-size
|
|
192
|
-
--ui3n-text-font-size
|
|
193
|
-
--ui3n-text-padding-inline
|
|
194
|
-
--ui3n-text-padding-block
|
|
191
|
+
--_text-border-radius: var(--ui3n-text-border-radius, 4px);
|
|
192
|
+
--_text-label-font-size: var(--ui3n-text-label-font-size, 12px);
|
|
193
|
+
--_text-font-size: var(--ui3n-text-font-size, 13px);
|
|
194
|
+
--_text-padding-inline: var(--ui3n-text-padding-inline, 8px);
|
|
195
|
+
--_text-padding-block: var(--ui3n-text-padding-block, 8px);
|
|
195
196
|
|
|
196
197
|
position: relative;
|
|
197
198
|
width: 100%;
|
|
198
|
-
border-radius: var(--
|
|
199
|
+
border-radius: var(--_text-border-radius);
|
|
199
200
|
padding: 1px;
|
|
200
201
|
}
|
|
201
202
|
|
|
202
203
|
.label {
|
|
203
204
|
display: block;
|
|
204
205
|
width: 100%;
|
|
205
|
-
font-size: var(--
|
|
206
|
+
font-size: var(--_text-label-font-size);
|
|
206
207
|
line-height: 1.33;
|
|
207
208
|
font-weight: 600;
|
|
208
209
|
color: var(--color-text-control-primary-default);
|
|
@@ -212,9 +213,9 @@
|
|
|
212
213
|
.body {
|
|
213
214
|
position: relative;
|
|
214
215
|
width: 100%;
|
|
215
|
-
padding: var(--
|
|
216
|
+
padding: var(--_text-padding-block) 0;
|
|
216
217
|
background-color: var(--color-bg-control-secondary-default);
|
|
217
|
-
border-radius: var(--
|
|
218
|
+
border-radius: var(--_text-border-radius);
|
|
218
219
|
transition: all 0.2s ease-in-out;
|
|
219
220
|
|
|
220
221
|
&:hover {
|
|
@@ -239,11 +240,11 @@
|
|
|
239
240
|
box-sizing: border-box;
|
|
240
241
|
position: relative;
|
|
241
242
|
width: 100%;
|
|
242
|
-
border-radius: var(--
|
|
243
|
+
border-radius: var(--_text-border-radius);
|
|
243
244
|
background-color: var(--color-bg-control-secondary-default);
|
|
244
|
-
padding: 0 var(--
|
|
245
|
-
font-family:
|
|
246
|
-
font-size: var(--
|
|
245
|
+
padding: 0 var(--_text-padding-inline);
|
|
246
|
+
font-family: inherit;
|
|
247
|
+
font-size: var(--_text-font-size);
|
|
247
248
|
line-height: 1.23;
|
|
248
249
|
font-weight: 400;
|
|
249
250
|
color: var(--color-text-control-primary-default);
|
|
@@ -252,7 +253,7 @@
|
|
|
252
253
|
&::placeholder {
|
|
253
254
|
color: var(--color-text-control-secondary-default);
|
|
254
255
|
font-style: italic;
|
|
255
|
-
font-size: var(--
|
|
256
|
+
font-size: var(--_text-font-size);
|
|
256
257
|
line-height: 1.23;
|
|
257
258
|
font-weight: 400;
|
|
258
259
|
}
|
|
@@ -94,7 +94,10 @@ watch(isPositioned, val => {
|
|
|
94
94
|
</script>
|
|
95
95
|
|
|
96
96
|
<template>
|
|
97
|
-
<div
|
|
97
|
+
<div
|
|
98
|
+
data-ui3n="tooltip-old"
|
|
99
|
+
:class="$style.ui3nTooltip"
|
|
100
|
+
>
|
|
98
101
|
<div
|
|
99
102
|
ref="referenceEl"
|
|
100
103
|
:class="$style.reference"
|
|
@@ -128,8 +131,8 @@ watch(isPositioned, val => {
|
|
|
128
131
|
|
|
129
132
|
<style lang="scss" module>
|
|
130
133
|
.ui3nTooltip {
|
|
131
|
-
--ui3n-tooltip-bg-color
|
|
132
|
-
--ui3n-tooltip-text-color
|
|
134
|
+
--_tooltip-bg-color: var(--ui3n-tooltip-bg-color, v-bind(color));
|
|
135
|
+
--_tooltip-text-color: var(--ui3n-tooltip-text-color, v-bind(textColor));
|
|
133
136
|
|
|
134
137
|
position: relative;
|
|
135
138
|
width: max-content;
|
|
@@ -153,7 +156,7 @@ watch(isPositioned, val => {
|
|
|
153
156
|
&-bottom {
|
|
154
157
|
border-style: solid;
|
|
155
158
|
border-width: 0 v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue);
|
|
156
|
-
border-color: transparent transparent var(--
|
|
159
|
+
border-color: transparent transparent var(--_tooltip-bg-color) transparent;
|
|
157
160
|
}
|
|
158
161
|
|
|
159
162
|
&-top {
|
|
@@ -170,7 +173,7 @@ watch(isPositioned, val => {
|
|
|
170
173
|
&-right {
|
|
171
174
|
border-style: solid;
|
|
172
175
|
border-width: v-bind(arrowSizeCssValue) 0 v-bind(arrowSizeCssValue) v-bind(arrowSizeCssValue);
|
|
173
|
-
border-color: transparent transparent transparent var(--
|
|
176
|
+
border-color: transparent transparent transparent var(--_tooltip-bg-color);
|
|
174
177
|
}
|
|
175
178
|
|
|
176
179
|
&-left {
|
|
@@ -187,12 +190,12 @@ watch(isPositioned, val => {
|
|
|
187
190
|
.content {
|
|
188
191
|
position: relative;
|
|
189
192
|
max-width: 400px;
|
|
190
|
-
padding: var(--
|
|
191
|
-
border-radius: var(--
|
|
192
|
-
font-size: var(--font-
|
|
193
|
-
line-height: var(--
|
|
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);
|
|
194
197
|
font-weight: 400;
|
|
195
|
-
background-color: var(--
|
|
196
|
-
color: var(--
|
|
198
|
+
background-color: var(--_tooltip-bg-color);
|
|
199
|
+
color: var(--_tooltip-text-color);
|
|
197
200
|
}
|
|
198
201
|
</style>
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
|
3
3
|
import { arrow, autoUpdate, offset, useFloating } from '@floating-ui/vue';
|
|
4
|
+
import { toCssLength } from '../../utils/ui/to-css-length';
|
|
4
5
|
import type { Nullable } from '../../types';
|
|
5
6
|
import type { Ui3nTooltipProps, Ui3nTooltipEmits, Ui3nTooltipSlots } from './types';
|
|
6
7
|
|
|
7
8
|
const baseOffset = 5;
|
|
8
9
|
|
|
9
10
|
const props = withDefaults(defineProps<Ui3nTooltipProps>(), {
|
|
10
|
-
maxContentWidth: 400,
|
|
11
|
-
color: 'var(--color-bg-block-tritery-default)',
|
|
12
|
-
textColor: 'var(--color-text-block-darkery-default)',
|
|
13
11
|
placement: 'top',
|
|
14
12
|
positionStrategy: 'absolute',
|
|
15
13
|
offsetX: 0,
|
|
@@ -68,20 +66,27 @@
|
|
|
68
66
|
whileElementsMounted: props.positionStrategy === 'fixed' ? autoUpdate : undefined,
|
|
69
67
|
});
|
|
70
68
|
|
|
69
|
+
/* colours and the maximum width default in CSS, so a stylesheet can change them */
|
|
71
70
|
const tooltipStylesComputed = computed(() => {
|
|
72
|
-
const
|
|
73
|
-
typeof props.maxContentWidth === 'number' || !isNaN(Number(props.maxContentWidth))
|
|
74
|
-
? `${props.maxContentWidth}px`
|
|
75
|
-
: String(props.maxContentWidth);
|
|
76
|
-
|
|
77
|
-
return {
|
|
71
|
+
const styles: Record<string, string> = {
|
|
78
72
|
...floatingStyles.value,
|
|
79
|
-
'--ui3n-tooltip-bg-color': props.color,
|
|
80
|
-
'--ui3n-tooltip-text-color': props.textColor,
|
|
81
|
-
'--ui3n-tooltip-max-width': maxWidth,
|
|
82
73
|
'--ui3n-tooltip-arrow-size': `${baseOffset}px`,
|
|
83
74
|
'--ui3n-tooltip-base-offset': `${-baseOffset}px`,
|
|
84
75
|
};
|
|
76
|
+
|
|
77
|
+
if (props.color) {
|
|
78
|
+
styles['--ui3n-tooltip-bg-color'] = props.color;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (props.textColor) {
|
|
82
|
+
styles['--ui3n-tooltip-text-color'] = props.textColor;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (props.maxContentWidth !== undefined) {
|
|
86
|
+
styles['--ui3n-tooltip-max-width'] = toCssLength(props.maxContentWidth);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return styles;
|
|
85
90
|
});
|
|
86
91
|
|
|
87
92
|
function onMouseenter() {
|
|
@@ -167,6 +172,7 @@
|
|
|
167
172
|
<template>
|
|
168
173
|
<div
|
|
169
174
|
ref="referenceContainer"
|
|
175
|
+
data-ui3n="tooltip"
|
|
170
176
|
:class="$style.container"
|
|
171
177
|
>
|
|
172
178
|
<slot />
|
|
@@ -175,6 +181,7 @@
|
|
|
175
181
|
<div
|
|
176
182
|
v-if="showTooltip"
|
|
177
183
|
ref="floatingEl"
|
|
184
|
+
data-ui3n="tooltip-content"
|
|
178
185
|
:class="$style.floating"
|
|
179
186
|
:style="tooltipStylesComputed"
|
|
180
187
|
>
|
|
@@ -202,6 +209,10 @@
|
|
|
202
209
|
}
|
|
203
210
|
|
|
204
211
|
.floating {
|
|
212
|
+
--_tooltip-bg-color: var(--ui3n-tooltip-bg-color, var(--color-bg-block-tritery-default));
|
|
213
|
+
--_tooltip-text-color: var(--ui3n-tooltip-text-color, var(--color-text-block-darkery-default));
|
|
214
|
+
--_tooltip-max-width: var(--ui3n-tooltip-max-width, 400px);
|
|
215
|
+
|
|
205
216
|
width: max-content;
|
|
206
217
|
z-index: 5;
|
|
207
218
|
}
|
|
@@ -214,47 +225,47 @@
|
|
|
214
225
|
&-top,
|
|
215
226
|
&-bottom {
|
|
216
227
|
border-style: solid;
|
|
217
|
-
border-width: 0 var(--ui3n-tooltip-arrow-size) var(--ui3n-tooltip-arrow-size) var(--ui3n-tooltip-arrow-size);
|
|
218
|
-
border-color: transparent transparent var(--
|
|
228
|
+
border-width: 0 var(--ui3n-tooltip-arrow-size, 5px) var(--ui3n-tooltip-arrow-size, 5px) var(--ui3n-tooltip-arrow-size, 5px);
|
|
229
|
+
border-color: transparent transparent var(--_tooltip-bg-color) transparent;
|
|
219
230
|
}
|
|
220
231
|
|
|
221
232
|
&-top {
|
|
222
|
-
bottom: var(--ui3n-tooltip-base-offset);
|
|
233
|
+
bottom: var(--ui3n-tooltip-base-offset, -5px);
|
|
223
234
|
transform: rotate(180deg);
|
|
224
235
|
}
|
|
225
236
|
|
|
226
237
|
&-bottom {
|
|
227
|
-
top: var(--ui3n-tooltip-base-offset);
|
|
238
|
+
top: var(--ui3n-tooltip-base-offset, -5px);
|
|
228
239
|
transform: rotate(0deg);
|
|
229
240
|
}
|
|
230
241
|
|
|
231
242
|
&-left,
|
|
232
243
|
&-right {
|
|
233
244
|
border-style: solid;
|
|
234
|
-
border-width: var(--ui3n-tooltip-arrow-size) 0 var(--ui3n-tooltip-arrow-size) var(--ui3n-tooltip-arrow-size);
|
|
235
|
-
border-color: transparent transparent transparent var(--
|
|
245
|
+
border-width: var(--ui3n-tooltip-arrow-size, 5px) 0 var(--ui3n-tooltip-arrow-size, 5px) var(--ui3n-tooltip-arrow-size, 5px);
|
|
246
|
+
border-color: transparent transparent transparent var(--_tooltip-bg-color);
|
|
236
247
|
}
|
|
237
248
|
|
|
238
249
|
&-left {
|
|
239
|
-
right: var(--ui3n-tooltip-base-offset);
|
|
250
|
+
right: var(--ui3n-tooltip-base-offset, -5px);
|
|
240
251
|
transform: rotate(0deg);
|
|
241
252
|
}
|
|
242
253
|
|
|
243
254
|
&-right {
|
|
244
|
-
left: var(--ui3n-tooltip-base-offset);
|
|
255
|
+
left: var(--ui3n-tooltip-base-offset, -5px);
|
|
245
256
|
transform: rotate(180deg);
|
|
246
257
|
}
|
|
247
258
|
}
|
|
248
259
|
|
|
249
260
|
.content {
|
|
250
261
|
position: relative;
|
|
251
|
-
max-width: var(--
|
|
252
|
-
padding:
|
|
253
|
-
border-radius: 6px;
|
|
254
|
-
font-size: var(--font-
|
|
255
|
-
line-height: var(--
|
|
262
|
+
max-width: var(--_tooltip-max-width);
|
|
263
|
+
padding: var(--ui3n-tooltip-padding, 6px 8px);
|
|
264
|
+
border-radius: var(--ui3n-tooltip-border-radius, 6px);
|
|
265
|
+
font-size: var(--ui3n-tooltip-font-size, 11px);
|
|
266
|
+
line-height: var(--ui3n-tooltip-line-height, 12px);
|
|
256
267
|
font-weight: 400;
|
|
257
|
-
background-color: var(--
|
|
258
|
-
color: var(--
|
|
268
|
+
background-color: var(--_tooltip-bg-color);
|
|
269
|
+
color: var(--_tooltip-text-color);
|
|
259
270
|
}
|
|
260
271
|
</style>
|