@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
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
const props = withDefaults(defineProps<Ui3nProgressLinearProps>(), {
|
|
9
9
|
value: 0,
|
|
10
10
|
height: 2,
|
|
11
|
-
bgColor: 'var(--color-bg-control-primary-default)',
|
|
12
|
-
color: 'var(--color-bg-control-accent-default)',
|
|
13
11
|
indeterminate: false,
|
|
14
12
|
withText: false,
|
|
15
13
|
});
|
|
@@ -28,16 +26,28 @@
|
|
|
28
26
|
const isValueShown = computed(() => props.withText && !props.indeterminate);
|
|
29
27
|
const displayValue = computed(() => `${innerValue.value}%`);
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
/* the geometry is computed here; the colours default in CSS */
|
|
30
|
+
const progressStyle = computed(() => {
|
|
31
|
+
const styles: Record<string, string> = {
|
|
32
|
+
'--ui3n-progress-linear-height': `${innerHeight.value}px`,
|
|
33
|
+
'--ui3n-progress-linear-font-size': `${Math.max(innerHeight.value - 2, 10)}px`,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
if (props.bgColor) {
|
|
37
|
+
styles['--ui3n-progress-linear-bg'] = props.bgColor;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (props.color) {
|
|
41
|
+
styles['--ui3n-progress-linear-color'] = props.color;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return styles;
|
|
45
|
+
});
|
|
37
46
|
</script>
|
|
38
47
|
|
|
39
48
|
<template>
|
|
40
49
|
<div
|
|
50
|
+
data-ui3n="progress-linear"
|
|
41
51
|
:style="progressStyle"
|
|
42
52
|
:class="[$style.ui3nProgressLinear, indeterminate && $style.indeterminate]"
|
|
43
53
|
>
|
|
@@ -66,6 +76,9 @@
|
|
|
66
76
|
|
|
67
77
|
<style lang="scss" module>
|
|
68
78
|
.ui3nProgressLinear {
|
|
79
|
+
--_progress-linear-bg: var(--ui3n-progress-linear-bg, var(--color-bg-control-primary-default));
|
|
80
|
+
--_progress-linear-color: var(--ui3n-progress-linear-color, var(--color-bg-control-accent-default));
|
|
81
|
+
|
|
69
82
|
position: relative;
|
|
70
83
|
width: 100%;
|
|
71
84
|
user-select: none;
|
|
@@ -74,9 +87,9 @@
|
|
|
74
87
|
.body {
|
|
75
88
|
position: relative;
|
|
76
89
|
width: 100%;
|
|
77
|
-
height: var(--ui3n-progress-linear-height);
|
|
78
|
-
border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
|
|
79
|
-
background-color: var(--
|
|
90
|
+
height: var(--ui3n-progress-linear-height, 2px);
|
|
91
|
+
border-radius: calc(var(--ui3n-progress-linear-height, 2px) - 2px);
|
|
92
|
+
background-color: var(--_progress-linear-bg);
|
|
80
93
|
overflow: hidden;
|
|
81
94
|
}
|
|
82
95
|
|
|
@@ -88,16 +101,16 @@
|
|
|
88
101
|
left: 0;
|
|
89
102
|
top: 0;
|
|
90
103
|
height: 100%;
|
|
91
|
-
border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
|
|
92
|
-
background-color: var(--
|
|
104
|
+
border-radius: calc(var(--ui3n-progress-linear-height, 2px) - 2px);
|
|
105
|
+
background-color: var(--_progress-linear-color);
|
|
93
106
|
transition: width 0.2s ease-in-out;
|
|
94
107
|
}
|
|
95
108
|
|
|
96
109
|
.text {
|
|
97
|
-
font-size: var(--ui3n-progress-linear-font-size);
|
|
110
|
+
font-size: var(--ui3n-progress-linear-font-size, 10px);
|
|
98
111
|
font-weight: 600;
|
|
99
|
-
line-height: var(--ui3n-progress-linear-height);
|
|
100
|
-
color: var(--
|
|
112
|
+
line-height: var(--ui3n-progress-linear-height, 2px);
|
|
113
|
+
color: var(--_progress-linear-bg);
|
|
101
114
|
white-space: nowrap;
|
|
102
115
|
}
|
|
103
116
|
|
|
@@ -105,8 +118,8 @@
|
|
|
105
118
|
position: relative;
|
|
106
119
|
width: 100%;
|
|
107
120
|
text-align: center;
|
|
108
|
-
font-size: var(--font-
|
|
109
|
-
line-height: var(--
|
|
121
|
+
font-size: var(--ui3n-progress-linear-label-font-size, 14px);
|
|
122
|
+
line-height: var(--ui3n-progress-linear-label-line-height, 16px);
|
|
110
123
|
color: var(--color-bg-control-accent-default);
|
|
111
124
|
margin-bottom: 4px;
|
|
112
125
|
}
|
|
@@ -57,7 +57,10 @@
|
|
|
57
57
|
</script>
|
|
58
58
|
|
|
59
59
|
<template>
|
|
60
|
-
<div
|
|
60
|
+
<div
|
|
61
|
+
data-ui3n="radio-group"
|
|
62
|
+
:class="[$style.ui3nRadioGroup, direction === 'horizontal' && $style.horizontal]"
|
|
63
|
+
>
|
|
61
64
|
<slot />
|
|
62
65
|
</div>
|
|
63
66
|
</template>
|
|
@@ -111,6 +111,7 @@
|
|
|
111
111
|
<template>
|
|
112
112
|
<!-- eslint-disable max-len -->
|
|
113
113
|
<div
|
|
114
|
+
data-ui3n="radio"
|
|
114
115
|
:style="radioStyle"
|
|
115
116
|
:class="[$style.ui3nRadio, disabled && $style.disabled, !slots.default && $style.noLabel]"
|
|
116
117
|
>
|
|
@@ -174,17 +175,17 @@
|
|
|
174
175
|
|
|
175
176
|
<style lang="scss" module>
|
|
176
177
|
.ui3nRadio {
|
|
177
|
-
--ui3n-radio-min-height
|
|
178
|
+
--_radio-min-height: var(--ui3n-radio-min-height, 24px);
|
|
178
179
|
|
|
179
180
|
position: relative;
|
|
180
181
|
display: flex;
|
|
181
182
|
justify-content: flex-start;
|
|
182
183
|
align-items: center;
|
|
183
|
-
min-height: var(--
|
|
184
|
+
min-height: var(--_radio-min-height);
|
|
184
185
|
gap: 8px;
|
|
185
186
|
|
|
186
187
|
&.disabled {
|
|
187
|
-
--ui3n-radio-color
|
|
188
|
+
--_radio-color: var(--ui3n-radio-color-disabled, var(--color-icon-control-primary-disabled)) !important;
|
|
188
189
|
|
|
189
190
|
pointer-events: none;
|
|
190
191
|
cursor: default;
|
|
@@ -213,7 +214,7 @@
|
|
|
213
214
|
|
|
214
215
|
&:hover {
|
|
215
216
|
cursor: pointer;
|
|
216
|
-
background-color: color-mix(in oklch, var(--
|
|
217
|
+
background-color: color-mix(in oklch, var(--_radio-color) 16%, transparent);
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
220
|
|
|
@@ -225,7 +226,7 @@
|
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
.icon {
|
|
228
|
-
color: var(--
|
|
229
|
+
color: var(--_radio-color);
|
|
229
230
|
min-height: calc(var(--ui3n-radio-size, 16px) - 2px);
|
|
230
231
|
height: calc(var(--ui3n-radio-size, 16px) - 2px);
|
|
231
232
|
min-width: calc(var(--ui3n-radio-size, 16px) - 2px);
|
|
@@ -10,31 +10,12 @@
|
|
|
10
10
|
Ui3nScrollbarAxes,
|
|
11
11
|
Ui3nScrollbarScrollPayload,
|
|
12
12
|
} from './types';
|
|
13
|
+
import { toCssLength } from '../../utils/ui/to-css-length';
|
|
13
14
|
|
|
14
15
|
const props = withDefaults(defineProps<Ui3nScrollbarProps>(), {
|
|
15
16
|
axes: 'both',
|
|
16
|
-
vertical: () => ({
|
|
17
|
-
|
|
18
|
-
thumbHeight: 'auto',
|
|
19
|
-
thumbRadius: 4,
|
|
20
|
-
thumbColor: 'var(--color-bg-control-accent-default)',
|
|
21
|
-
thumbHoverColor: 'var(--color-bg-control-accent-hover)',
|
|
22
|
-
thumbActiveColor: 'var(--color-bg-control-accent-focused)',
|
|
23
|
-
trackWidth: 6,
|
|
24
|
-
trackRadius: 4,
|
|
25
|
-
trackColor: 'transparent',
|
|
26
|
-
}),
|
|
27
|
-
horizontal: () => ({
|
|
28
|
-
thumbMinWidth: 32,
|
|
29
|
-
thumbWidth: 'auto',
|
|
30
|
-
thumbRadius: 4,
|
|
31
|
-
thumbColor: 'var(--color-bg-control-accent-default)',
|
|
32
|
-
thumbHoverColor: 'var(--color-bg-control-accent-hover)',
|
|
33
|
-
thumbActiveColor: 'var(--color-bg-control-accent-focused)',
|
|
34
|
-
trackHeight: 6,
|
|
35
|
-
trackRadius: 4,
|
|
36
|
-
trackColor: 'transparent',
|
|
37
|
-
}),
|
|
17
|
+
vertical: () => ({ thumbMinHeight: 32, thumbHeight: 'auto' }),
|
|
18
|
+
horizontal: () => ({ thumbMinWidth: 32, thumbWidth: 'auto' }),
|
|
38
19
|
autoUpdate: true,
|
|
39
20
|
});
|
|
40
21
|
const emits = defineEmits<Ui3nScrollbarEmits>();
|
|
@@ -198,38 +179,67 @@
|
|
|
198
179
|
return (scrollLeft.value / maxScrollLeft) * maxThumbLeft;
|
|
199
180
|
});
|
|
200
181
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
});
|
|
205
|
-
const trackColorVCss = computed(() => vOpts.value.trackColor ?? 'transparent');
|
|
206
|
-
const thumbRadiusVCss = computed(() => {
|
|
207
|
-
const num = Number(vOpts.value.thumbRadius);
|
|
208
|
-
return isNaN(num) ? String(vOpts.value.thumbRadius ?? 4) : `${num}px`;
|
|
209
|
-
});
|
|
210
|
-
const thumbColorVCss = computed(() => vOpts.value.thumbColor ?? 'var(--color-bg-control-accent-default)');
|
|
211
|
-
const thumbHoverColorVCss = computed(() => vOpts.value.thumbHoverColor ?? 'var(--color-bg-control-accent-hover)');
|
|
212
|
-
const thumbActiveColorVCss = computed(() => vOpts.value.thumbActiveColor ?? 'var(--color-bg-control-accent-focused)');
|
|
213
|
-
const trackWidthVCss = computed(() => {
|
|
214
|
-
const num = Number(vOpts.value.trackWidth);
|
|
215
|
-
return isNaN(num) ? String(vOpts.value.trackWidth ?? 6) : `${num}px`;
|
|
216
|
-
});
|
|
182
|
+
/* sizes and colours default in CSS; an option, when given, wins as an inline variable */
|
|
183
|
+
const scrollbarStyle = computed(() => {
|
|
184
|
+
const styles: Record<string, string> = {};
|
|
217
185
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
186
|
+
if (vOpts.value.trackRadius !== undefined) {
|
|
187
|
+
styles['--ui3n-scrollbar-vertical-track-radius'] = toCssLength(vOpts.value.trackRadius);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
if (vOpts.value.trackColor) {
|
|
191
|
+
styles['--ui3n-scrollbar-vertical-track-color'] = vOpts.value.trackColor;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (vOpts.value.thumbRadius !== undefined) {
|
|
195
|
+
styles['--ui3n-scrollbar-vertical-thumb-radius'] = toCssLength(vOpts.value.thumbRadius);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (vOpts.value.thumbColor) {
|
|
199
|
+
styles['--ui3n-scrollbar-vertical-thumb-color'] = vOpts.value.thumbColor;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (vOpts.value.thumbHoverColor) {
|
|
203
|
+
styles['--ui3n-scrollbar-vertical-thumb-hover-color'] = vOpts.value.thumbHoverColor;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
if (vOpts.value.thumbActiveColor) {
|
|
207
|
+
styles['--ui3n-scrollbar-vertical-thumb-active-color'] = vOpts.value.thumbActiveColor;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (vOpts.value.trackWidth !== undefined) {
|
|
211
|
+
styles['--ui3n-scrollbar-vertical-track-width'] = toCssLength(vOpts.value.trackWidth);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (hOpts.value.trackRadius !== undefined) {
|
|
215
|
+
styles['--ui3n-scrollbar-horizontal-track-radius'] = toCssLength(hOpts.value.trackRadius);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (hOpts.value.trackColor) {
|
|
219
|
+
styles['--ui3n-scrollbar-horizontal-track-color'] = hOpts.value.trackColor;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (hOpts.value.thumbRadius !== undefined) {
|
|
223
|
+
styles['--ui3n-scrollbar-horizontal-thumb-radius'] = toCssLength(hOpts.value.thumbRadius);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (hOpts.value.thumbColor) {
|
|
227
|
+
styles['--ui3n-scrollbar-horizontal-thumb-color'] = hOpts.value.thumbColor;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (hOpts.value.thumbHoverColor) {
|
|
231
|
+
styles['--ui3n-scrollbar-horizontal-thumb-hover-color'] = hOpts.value.thumbHoverColor;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (hOpts.value.thumbActiveColor) {
|
|
235
|
+
styles['--ui3n-scrollbar-horizontal-thumb-active-color'] = hOpts.value.thumbActiveColor;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (hOpts.value.trackHeight !== undefined) {
|
|
239
|
+
styles['--ui3n-scrollbar-horizontal-track-height'] = toCssLength(hOpts.value.trackHeight);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return styles;
|
|
233
243
|
});
|
|
234
244
|
|
|
235
245
|
function updateMetrics() {
|
|
@@ -513,23 +523,9 @@
|
|
|
513
523
|
|
|
514
524
|
<template>
|
|
515
525
|
<div
|
|
526
|
+
data-ui3n="scrollbar"
|
|
516
527
|
:class="$style.ui3nScrollbar"
|
|
517
|
-
:style="
|
|
518
|
-
'--ui3n-scrollbar-vertical-thumb-radius': thumbRadiusVCss,
|
|
519
|
-
'--ui3n-scrollbar-vertical-thumb-color': thumbColorVCss,
|
|
520
|
-
'--ui3n-scrollbar-vertical-thumb-hover-color': thumbHoverColorVCss,
|
|
521
|
-
'--ui3n-scrollbar-vertical-thumb-active-color': thumbActiveColorVCss,
|
|
522
|
-
'--ui3n-scrollbar-vertical-track-width': trackWidthVCss,
|
|
523
|
-
'--ui3n-scrollbar-vertical-track-radius': trackRadiusVCss,
|
|
524
|
-
'--ui3n-scrollbar-vertical-track-color': trackColorVCss,
|
|
525
|
-
'--ui3n-scrollbar-horizontal-thumb-radius': thumbRadiusHCss,
|
|
526
|
-
'--ui3n-scrollbar-horizontal-thumb-color': thumbColorHCss,
|
|
527
|
-
'--ui3n-scrollbar-horizontal-thumb-hover-color': thumbHoverColorHCss,
|
|
528
|
-
'--ui3n-scrollbar-horizontal-thumb-active-color': thumbActiveColorHCss,
|
|
529
|
-
'--ui3n-scrollbar-horizontal-track-height': trackHeightHCss,
|
|
530
|
-
'--ui3n-scrollbar-horizontal-track-radius': trackRadiusHCss,
|
|
531
|
-
'--ui3n-scrollbar-horizontal-track-color': trackColorHCss,
|
|
532
|
-
}"
|
|
528
|
+
:style="scrollbarStyle"
|
|
533
529
|
@mouseenter="isHovered = true"
|
|
534
530
|
@mouseleave="isHovered = false"
|
|
535
531
|
>
|
|
@@ -585,6 +581,21 @@
|
|
|
585
581
|
|
|
586
582
|
<style lang="scss" module>
|
|
587
583
|
.ui3nScrollbar {
|
|
584
|
+
--_scrollbar-vertical-thumb-radius: var(--ui3n-scrollbar-vertical-thumb-radius, 4px);
|
|
585
|
+
--_scrollbar-vertical-thumb-color: var(--ui3n-scrollbar-vertical-thumb-color, var(--color-bg-control-accent-default));
|
|
586
|
+
--_scrollbar-vertical-thumb-hover-color: var(--ui3n-scrollbar-vertical-thumb-hover-color, var(--color-bg-control-accent-hover));
|
|
587
|
+
--_scrollbar-vertical-thumb-active-color: var(--ui3n-scrollbar-vertical-thumb-active-color, var(--color-bg-control-accent-focused));
|
|
588
|
+
--_scrollbar-vertical-track-width: var(--ui3n-scrollbar-vertical-track-width, 6px);
|
|
589
|
+
--_scrollbar-vertical-track-radius: var(--ui3n-scrollbar-vertical-track-radius, 4px);
|
|
590
|
+
--_scrollbar-vertical-track-color: var(--ui3n-scrollbar-vertical-track-color, transparent);
|
|
591
|
+
--_scrollbar-horizontal-thumb-radius: var(--ui3n-scrollbar-horizontal-thumb-radius, 4px);
|
|
592
|
+
--_scrollbar-horizontal-thumb-color: var(--ui3n-scrollbar-horizontal-thumb-color, var(--color-bg-control-accent-default));
|
|
593
|
+
--_scrollbar-horizontal-thumb-hover-color: var(--ui3n-scrollbar-horizontal-thumb-hover-color, var(--color-bg-control-accent-hover));
|
|
594
|
+
--_scrollbar-horizontal-thumb-active-color: var(--ui3n-scrollbar-horizontal-thumb-active-color, var(--color-bg-control-accent-focused));
|
|
595
|
+
--_scrollbar-horizontal-track-height: var(--ui3n-scrollbar-horizontal-track-height, 6px);
|
|
596
|
+
--_scrollbar-horizontal-track-radius: var(--ui3n-scrollbar-horizontal-track-radius, 4px);
|
|
597
|
+
--_scrollbar-horizontal-track-color: var(--ui3n-scrollbar-horizontal-track-color, transparent);
|
|
598
|
+
|
|
588
599
|
position: relative;
|
|
589
600
|
width: 100%;
|
|
590
601
|
height: 100%;
|
|
@@ -618,9 +629,9 @@
|
|
|
618
629
|
top: 2px;
|
|
619
630
|
right: 2px;
|
|
620
631
|
bottom: 2px;
|
|
621
|
-
width: var(--
|
|
622
|
-
background: var(--
|
|
623
|
-
border-radius: var(--
|
|
632
|
+
width: var(--_scrollbar-vertical-track-width);
|
|
633
|
+
background: var(--_scrollbar-vertical-track-color);
|
|
634
|
+
border-radius: var(--_scrollbar-vertical-track-radius);
|
|
624
635
|
z-index: 10;
|
|
625
636
|
visibility: hidden;
|
|
626
637
|
opacity: 0;
|
|
@@ -635,9 +646,9 @@
|
|
|
635
646
|
left: 2px;
|
|
636
647
|
right: 2px;
|
|
637
648
|
bottom: 2px;
|
|
638
|
-
height: var(--
|
|
639
|
-
background: var(--
|
|
640
|
-
border-radius: var(--
|
|
649
|
+
height: var(--_scrollbar-horizontal-track-height);
|
|
650
|
+
background: var(--_scrollbar-horizontal-track-color);
|
|
651
|
+
border-radius: var(--_scrollbar-horizontal-track-radius);
|
|
641
652
|
z-index: 10;
|
|
642
653
|
visibility: hidden;
|
|
643
654
|
opacity: 0;
|
|
@@ -658,19 +669,19 @@
|
|
|
658
669
|
top: 0;
|
|
659
670
|
left: 0;
|
|
660
671
|
width: 100%;
|
|
661
|
-
border-radius: var(--
|
|
662
|
-
background-color: var(--
|
|
672
|
+
border-radius: var(--_scrollbar-vertical-thumb-radius);
|
|
673
|
+
background-color: var(--_scrollbar-vertical-thumb-color);
|
|
663
674
|
cursor: pointer;
|
|
664
675
|
transition: background-color 0.15s ease;
|
|
665
676
|
touch-action: none;
|
|
666
677
|
|
|
667
678
|
&:hover {
|
|
668
|
-
background-color: var(--
|
|
679
|
+
background-color: var(--_scrollbar-vertical-thumb-hover-color);
|
|
669
680
|
}
|
|
670
681
|
|
|
671
682
|
&:active,
|
|
672
683
|
&.active {
|
|
673
|
-
background-color: var(--
|
|
684
|
+
background-color: var(--_scrollbar-vertical-thumb-active-color);
|
|
674
685
|
}
|
|
675
686
|
}
|
|
676
687
|
|
|
@@ -679,19 +690,19 @@
|
|
|
679
690
|
top: 0;
|
|
680
691
|
left: 0;
|
|
681
692
|
height: 100%;
|
|
682
|
-
border-radius: var(--
|
|
683
|
-
background-color: var(--
|
|
693
|
+
border-radius: var(--_scrollbar-horizontal-thumb-radius);
|
|
694
|
+
background-color: var(--_scrollbar-horizontal-thumb-color);
|
|
684
695
|
cursor: pointer;
|
|
685
696
|
transition: background-color 0.15s ease;
|
|
686
697
|
touch-action: none;
|
|
687
698
|
|
|
688
699
|
&:hover {
|
|
689
|
-
background-color: var(--
|
|
700
|
+
background-color: var(--_scrollbar-horizontal-thumb-hover-color);
|
|
690
701
|
}
|
|
691
702
|
|
|
692
703
|
&:active,
|
|
693
704
|
&.active {
|
|
694
|
-
background-color: var(--
|
|
705
|
+
background-color: var(--_scrollbar-horizontal-thumb-active-color);
|
|
695
706
|
}
|
|
696
707
|
}
|
|
697
708
|
</style>
|
|
@@ -6,19 +6,13 @@
|
|
|
6
6
|
Ui3nScrollbarHorizontalSlots,
|
|
7
7
|
Ui3nScrollbarHorizontalExpose,
|
|
8
8
|
} from './types';
|
|
9
|
+
import { toCssLength } from '../../utils/ui/to-css-length';
|
|
9
10
|
|
|
10
11
|
const MIN_WIDTH = 32;
|
|
11
12
|
|
|
12
13
|
const props = withDefaults(defineProps<Ui3nScrollbarHorizontalProps>(), {
|
|
13
14
|
thumbMinWidth: MIN_WIDTH,
|
|
14
15
|
thumbWidth: 'auto',
|
|
15
|
-
thumbRadius: 4,
|
|
16
|
-
thumbColor: 'var(--color-bg-control-accent-default)',
|
|
17
|
-
thumbHoverColor: 'var(--color-bg-control-accent-hover)',
|
|
18
|
-
thumbActiveColor: 'var(--color-bg-control-accent-focused)',
|
|
19
|
-
trackHeight: 6,
|
|
20
|
-
trackRadius: 4,
|
|
21
|
-
trackColor: 'transparent',
|
|
22
16
|
});
|
|
23
17
|
|
|
24
18
|
const emits = defineEmits<Ui3nScrollbarHorizontalEmits>();
|
|
@@ -81,23 +75,40 @@
|
|
|
81
75
|
return (scrollLeft.value / maxScrollLeft) * maxThumbLeft;
|
|
82
76
|
});
|
|
83
77
|
|
|
84
|
-
const thumbRadiusCss = computed(() => {
|
|
85
|
-
const num = Number(props.thumbRadius);
|
|
86
|
-
return isNaN(num) ? String(props.thumbRadius) : `${num}px`;
|
|
87
|
-
});
|
|
88
|
-
const thumbColorCss = computed(() => props.thumbColor);
|
|
89
|
-
const thumbHoverColorCss = computed(() => props.thumbHoverColor);
|
|
90
|
-
const thumbActiveColorCss = computed(() => props.thumbActiveColor);
|
|
91
|
-
const trackHeightCss = computed(() => {
|
|
92
|
-
const num = Number(props.trackHeight);
|
|
93
|
-
return isNaN(num) ? String(props.trackHeight) : `${num}px`;
|
|
94
|
-
});
|
|
95
|
-
const trackRadiusCss = computed(() => {
|
|
96
|
-
const num = Number(props.trackRadius);
|
|
97
|
-
return isNaN(num) ? String(props.trackRadius) : `${num}px`;
|
|
98
|
-
});
|
|
99
|
-
const trackColorCss = computed(() => props.trackColor);
|
|
100
78
|
|
|
79
|
+
const scrollbarStyle = computed(() => {
|
|
80
|
+
const styles: Record<string, string> = {};
|
|
81
|
+
|
|
82
|
+
if (props.thumbRadius !== undefined) {
|
|
83
|
+
styles['--ui3n-scrollbar-horizontal-thumb-radius'] = toCssLength(props.thumbRadius);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (props.thumbColor) {
|
|
87
|
+
styles['--ui3n-scrollbar-horizontal-thumb-color'] = props.thumbColor;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (props.thumbHoverColor) {
|
|
91
|
+
styles['--ui3n-scrollbar-horizontal-thumb-hover-color'] = props.thumbHoverColor;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (props.thumbActiveColor) {
|
|
95
|
+
styles['--ui3n-scrollbar-horizontal-thumb-active-color'] = props.thumbActiveColor;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (props.trackHeight !== undefined) {
|
|
99
|
+
styles['--ui3n-scrollbar-horizontal-track-height'] = toCssLength(props.trackHeight);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (props.trackRadius !== undefined) {
|
|
103
|
+
styles['--ui3n-scrollbar-horizontal-track-radius'] = toCssLength(props.trackRadius);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (props.trackColor) {
|
|
107
|
+
styles['--ui3n-scrollbar-horizontal-track-color'] = props.trackColor;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return styles;
|
|
111
|
+
});
|
|
101
112
|
function updateMetrics() {
|
|
102
113
|
if (!containerRef.value) {
|
|
103
114
|
return;
|
|
@@ -230,16 +241,9 @@
|
|
|
230
241
|
|
|
231
242
|
<template>
|
|
232
243
|
<div
|
|
244
|
+
data-ui3n="scrollbar-horizontal"
|
|
233
245
|
:class="$style.ui3nScrollbarHorizontal"
|
|
234
|
-
:style="
|
|
235
|
-
'--ui3n-scrollbar-horizontal-thumb-radius': thumbRadiusCss,
|
|
236
|
-
'--ui3n-scrollbar-horizontal-thumb-color': thumbColorCss,
|
|
237
|
-
'--ui3n-scrollbar-horizontal-thumb-hover-color': thumbHoverColorCss,
|
|
238
|
-
'--ui3n-scrollbar-horizontal-thumb-active-color': thumbActiveColorCss,
|
|
239
|
-
'--ui3n-scrollbar-horizontal-track-height': trackHeightCss,
|
|
240
|
-
'--ui3n-scrollbar-horizontal-track-radius': trackRadiusCss,
|
|
241
|
-
'--ui3n-scrollbar-horizontal-track-color': trackColorCss,
|
|
242
|
-
}"
|
|
246
|
+
:style="scrollbarStyle"
|
|
243
247
|
@mouseenter="isHovered = true"
|
|
244
248
|
@mouseleave="isHovered = false"
|
|
245
249
|
>
|
|
@@ -271,6 +275,14 @@
|
|
|
271
275
|
|
|
272
276
|
<style lang="scss" module>
|
|
273
277
|
.ui3nScrollbarHorizontal {
|
|
278
|
+
--_scrollbar-horizontal-thumb-radius: var(--ui3n-scrollbar-horizontal-thumb-radius, 4px);
|
|
279
|
+
--_scrollbar-horizontal-thumb-color: var(--ui3n-scrollbar-horizontal-thumb-color, var(--color-bg-control-accent-default));
|
|
280
|
+
--_scrollbar-horizontal-thumb-hover-color: var(--ui3n-scrollbar-horizontal-thumb-hover-color, var(--color-bg-control-accent-hover));
|
|
281
|
+
--_scrollbar-horizontal-thumb-active-color: var(--ui3n-scrollbar-horizontal-thumb-active-color, var(--color-bg-control-accent-focused));
|
|
282
|
+
--_scrollbar-horizontal-track-height: var(--ui3n-scrollbar-horizontal-track-height, 6px);
|
|
283
|
+
--_scrollbar-horizontal-track-radius: var(--ui3n-scrollbar-horizontal-track-radius, 4px);
|
|
284
|
+
--_scrollbar-horizontal-track-color: var(--ui3n-scrollbar-horizontal-track-color, transparent);
|
|
285
|
+
|
|
274
286
|
position: relative;
|
|
275
287
|
width: 100%;
|
|
276
288
|
overflow: visible;
|
|
@@ -295,9 +307,9 @@
|
|
|
295
307
|
left: 0;
|
|
296
308
|
right: 0;
|
|
297
309
|
bottom: 2px;
|
|
298
|
-
height: var(--
|
|
299
|
-
background: var(--
|
|
300
|
-
border-radius: var(--
|
|
310
|
+
height: var(--_scrollbar-horizontal-track-height);
|
|
311
|
+
background: var(--_scrollbar-horizontal-track-color);
|
|
312
|
+
border-radius: var(--_scrollbar-horizontal-track-radius);
|
|
301
313
|
z-index: 10;
|
|
302
314
|
visibility: hidden;
|
|
303
315
|
opacity: 0;
|
|
@@ -317,19 +329,19 @@
|
|
|
317
329
|
position: absolute;
|
|
318
330
|
top: 0;
|
|
319
331
|
height: 100%;
|
|
320
|
-
border-radius: var(--
|
|
321
|
-
background-color: var(--
|
|
332
|
+
border-radius: var(--_scrollbar-horizontal-thumb-radius);
|
|
333
|
+
background-color: var(--_scrollbar-horizontal-thumb-color);
|
|
322
334
|
cursor: pointer;
|
|
323
335
|
transition: background-color 0.15s ease;
|
|
324
336
|
touch-action: none;
|
|
325
337
|
|
|
326
338
|
&:hover {
|
|
327
|
-
background-color: var(--
|
|
339
|
+
background-color: var(--_scrollbar-horizontal-thumb-hover-color);
|
|
328
340
|
}
|
|
329
341
|
|
|
330
342
|
&:active,
|
|
331
343
|
&.active {
|
|
332
|
-
background-color: var(--
|
|
344
|
+
background-color: var(--_scrollbar-horizontal-thumb-active-color);
|
|
333
345
|
}
|
|
334
346
|
}
|
|
335
347
|
</style>
|