@v1nt1248/3nclient-lib 0.3.27 → 0.3.29
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/dist/chunks/ui3n-notification-Dr_3Td9N.js +279 -0
- package/dist/components/index.d.ts +12 -12
- package/dist/components/ui3n-autocomplete/types.d.ts +8 -0
- package/dist/components/ui3n-autocomplete/ui3n-autocomplete.d.ts +2 -2
- package/dist/components/ui3n-badge/types.d.ts +12 -0
- package/dist/components/ui3n-badge/ui3n-badge-simple.d.ts +1 -1
- package/dist/components/ui3n-badge/ui3n-badge.d.ts +1 -1
- package/dist/components/ui3n-breadcrumbs/types.d.ts +1 -1
- package/dist/components/ui3n-breadcrumbs/ui3n-breadcrumb.d.ts +2 -2
- package/dist/components/ui3n-button/types.d.ts +4 -2
- package/dist/components/ui3n-checkbox/types.d.ts +11 -0
- package/dist/components/ui3n-checkbox/ui3n-checkbox.d.ts +4 -1
- package/dist/components/ui3n-chip/types.d.ts +6 -1
- package/dist/components/ui3n-chip/ui3n-chip.d.ts +2 -0
- package/dist/components/ui3n-drop-files/types.d.ts +7 -0
- package/dist/components/ui3n-drop-files/ui3n-drop-files.d.ts +7 -1
- package/dist/components/ui3n-editable/types.d.ts +11 -0
- package/dist/components/ui3n-editable/ui3n-editable.d.ts +4 -2
- package/dist/components/ui3n-icon/types.d.ts +5 -1
- package/dist/components/ui3n-icon/ui3n-icon.d.ts +2 -2
- package/dist/components/ui3n-input/types.d.ts +4 -0
- package/dist/components/ui3n-input/ui3n-input.d.ts +4 -1
- package/dist/components/ui3n-input-file/types.d.ts +11 -0
- package/dist/components/ui3n-input-file/ui3n-input-file.d.ts +4 -1
- package/dist/components/ui3n-list/types.d.ts +4 -0
- package/dist/components/ui3n-menu/types.d.ts +4 -0
- package/dist/components/ui3n-menu/ui3n-menu.d.ts +1 -1
- package/dist/components/ui3n-notification/ui3n-notification.d.ts +2 -2
- package/dist/components/ui3n-progress/ui3n-progress-circular.d.ts +1 -1
- package/dist/components/ui3n-progress/ui3n-progress-linear.d.ts +1 -1
- package/dist/components/ui3n-radio-group/types.d.ts +18 -0
- package/dist/components/ui3n-radio-group/ui3n-radio-group.d.ts +3 -1
- package/dist/components/ui3n-radio-group/ui3n-radio.d.ts +6 -7
- package/dist/components/ui3n-scrollbar-horizontal/types.d.ts +1 -0
- package/dist/components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.d.ts +1 -0
- package/dist/components/ui3n-scrollbar-vertical/types.d.ts +3 -0
- package/dist/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +3 -0
- package/dist/components/ui3n-selector/types.d.ts +11 -0
- package/dist/components/ui3n-selector/ui3n-selector.d.ts +2 -2
- package/dist/components/ui3n-slider/types.d.ts +11 -0
- package/dist/components/ui3n-slider/ui3n-slider.d.ts +4 -1
- package/dist/components/ui3n-step-line-bar/types.d.ts +4 -0
- package/dist/components/ui3n-switch/types.d.ts +11 -0
- package/dist/components/ui3n-switch/ui3n-switch.d.ts +4 -1
- package/dist/components/ui3n-table/composables/useTable.d.ts +1 -0
- package/dist/components/ui3n-table/types.d.ts +4 -0
- package/dist/components/ui3n-table/ui3n-table-sort-icon.d.ts +4 -1
- package/dist/components/ui3n-tabs/types.d.ts +4 -0
- package/dist/components/ui3n-text/types.d.ts +11 -0
- package/dist/components/ui3n-text/ui3n-text.d.ts +4 -1
- package/dist/components/ui3n-tooltip/types.d.ts +4 -0
- package/dist/components/ui3n-tooltip/ui3n-tooltip.d.ts +4 -2
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +2083 -1697
- package/dist/ui3n-plugins.js +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +29 -7
- package/src/components/ui3n-autocomplete/types.ts +9 -1
- package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +182 -51
- package/src/components/ui3n-badge/types.ts +10 -0
- package/src/components/ui3n-badge/ui3n-badge-simple.vue +54 -55
- package/src/components/ui3n-badge/ui3n-badge.vue +4 -0
- package/src/components/ui3n-breadcrumbs/types.ts +1 -1
- package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +7 -5
- package/src/components/ui3n-button/types.ts +4 -2
- package/src/components/ui3n-button/ui3n-button.vue +24 -19
- package/src/components/ui3n-checkbox/types.ts +12 -0
- package/src/components/ui3n-checkbox/ui3n-checkbox.vue +79 -29
- package/src/components/ui3n-chip/types.ts +6 -1
- package/src/components/ui3n-chip/ui3n-chip.vue +64 -61
- package/src/components/ui3n-dialog/ui3n-dialog.vue +3 -3
- package/src/components/ui3n-drop-files/types.ts +8 -0
- package/src/components/ui3n-drop-files/ui3n-drop-files.vue +73 -29
- package/src/components/ui3n-editable/types.ts +12 -0
- package/src/components/ui3n-editable/ui3n-editable.vue +56 -24
- package/src/components/ui3n-icon/types.ts +5 -1
- package/src/components/ui3n-icon/ui3n-icon.vue +45 -50
- package/src/components/ui3n-input/types.ts +4 -0
- package/src/components/ui3n-input/ui3n-input.vue +14 -1
- package/src/components/ui3n-input-file/types.ts +12 -0
- package/src/components/ui3n-input-file/ui3n-input-file.vue +33 -16
- package/src/components/ui3n-list/types.ts +4 -0
- package/src/components/ui3n-list/ui3n-list.vue +3 -1
- package/src/components/ui3n-menu/types.ts +4 -0
- package/src/components/ui3n-menu/ui3n-menu.vue +43 -32
- package/src/components/ui3n-notification/ui3n-notification.vue +190 -175
- package/src/components/ui3n-progress/ui3n-progress-circular.vue +40 -22
- package/src/components/ui3n-progress/ui3n-progress-linear.vue +14 -7
- package/src/components/ui3n-radio-group/types.ts +20 -0
- package/src/components/ui3n-radio-group/ui3n-radio-group.vue +61 -48
- package/src/components/ui3n-radio-group/ui3n-radio.vue +60 -65
- package/src/components/ui3n-scrollbar-horizontal/types.ts +1 -0
- package/src/components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.vue +8 -1
- package/src/components/ui3n-scrollbar-vertical/types.ts +3 -0
- package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +12 -5
- package/src/components/ui3n-selector/types.ts +12 -0
- package/src/components/ui3n-selector/ui3n-selector.vue +63 -40
- package/src/components/ui3n-slider/types.ts +12 -0
- package/src/components/ui3n-slider/ui3n-slider.vue +88 -39
- package/src/components/ui3n-step-line-bar/types.ts +4 -0
- package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +8 -10
- package/src/components/ui3n-switch/types.ts +12 -0
- package/src/components/ui3n-switch/ui3n-switch.vue +57 -25
- package/src/components/ui3n-table/composables/useTable.ts +17 -0
- package/src/components/ui3n-table/types.ts +4 -0
- package/src/components/ui3n-table/ui3n-table-sort-icon.vue +9 -8
- package/src/components/ui3n-table/ui3n-table.vue +48 -17
- package/src/components/ui3n-tabs/types.ts +4 -0
- package/src/components/ui3n-tabs/ui3n-tabs.vue +146 -108
- package/src/components/ui3n-text/types.ts +12 -0
- package/src/components/ui3n-text/ui3n-text.vue +56 -15
- package/src/components/ui3n-tooltip/types.ts +4 -0
- package/src/components/ui3n-tooltip/ui3n-tooltip.vue +61 -43
- package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +201 -17
- package/dist/chunks/ui3n-notification-DlDM-u-R.js +0 -276
|
@@ -1,65 +1,78 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { provide, ref, watch } from 'vue';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { computed, provide, ref, watch } from 'vue';
|
|
3
|
+
import type {
|
|
4
|
+
Ui3nRadioGroupProps,
|
|
5
|
+
Ui3nRadioGroupEmits,
|
|
6
|
+
Ui3nRadioGroupSlots,
|
|
7
|
+
Ui3nRadioGroupExpose,
|
|
8
|
+
Ui3nRadioValue,
|
|
9
|
+
} from './types';
|
|
9
10
|
|
|
10
|
-
const props = withDefaults(defineProps<Ui3nRadioGroupProps>(), {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
const emits = defineEmits<Ui3nRadioGroupEmits>();
|
|
15
|
-
defineSlots<Ui3nRadioGroupSlots>();
|
|
11
|
+
const props = withDefaults(defineProps<Ui3nRadioGroupProps>(), {
|
|
12
|
+
direction: 'vertical',
|
|
13
|
+
disabled: false,
|
|
14
|
+
});
|
|
15
|
+
const emits = defineEmits<Ui3nRadioGroupEmits>();
|
|
16
|
+
defineSlots<Ui3nRadioGroupSlots>();
|
|
16
17
|
|
|
17
|
-
const groupValue = ref<Ui3nRadioValue>(props.modelValue);
|
|
18
|
+
const groupValue = ref<Ui3nRadioValue>(props.modelValue);
|
|
18
19
|
|
|
19
|
-
function updateGroupValue(value: Ui3nRadioValue): void {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
20
|
+
function updateGroupValue(value: Ui3nRadioValue): void {
|
|
21
|
+
groupValue.value = value;
|
|
22
|
+
emits('update:modelValue', value);
|
|
23
|
+
emits('change', value);
|
|
24
|
+
}
|
|
24
25
|
|
|
25
|
-
provide(`radio-group-${props.name}`, {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
26
|
+
provide(`radio-group-${props.name}`, {
|
|
27
|
+
groupValue: computed(() => groupValue.value),
|
|
28
|
+
updateGroupValue,
|
|
29
|
+
});
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
31
|
+
function clear() {
|
|
32
|
+
updateGroupValue('' as unknown as Ui3nRadioValue);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
defineExpose<Ui3nRadioGroupExpose>({
|
|
36
|
+
clear,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
watch(
|
|
40
|
+
() => props.modelValue,
|
|
41
|
+
(val: Ui3nRadioValue) => {
|
|
42
|
+
if (val !== groupValue.value) {
|
|
43
|
+
groupValue.value = val;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
watch(
|
|
49
|
+
() => props.name,
|
|
50
|
+
newName => {
|
|
51
|
+
if (!newName) {
|
|
52
|
+
clear();
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
);
|
|
38
56
|
</script>
|
|
39
57
|
|
|
40
58
|
<template>
|
|
41
|
-
<div
|
|
42
|
-
:class="[
|
|
43
|
-
$style.ui3nRadioGroup,
|
|
44
|
-
direction === 'horizontal' && $style.horizontal,
|
|
45
|
-
]"
|
|
46
|
-
>
|
|
59
|
+
<div :class="[$style.ui3nRadioGroup, direction === 'horizontal' && $style.horizontal]">
|
|
47
60
|
<slot />
|
|
48
61
|
</div>
|
|
49
62
|
</template>
|
|
50
63
|
|
|
51
64
|
<style lang="scss" module>
|
|
52
|
-
.ui3nRadioGroup {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
.ui3nRadioGroup {
|
|
66
|
+
position: relative;
|
|
67
|
+
display: flex;
|
|
68
|
+
flex-direction: column;
|
|
69
|
+
justify-content: flex-start;
|
|
70
|
+
align-items: flex-start;
|
|
71
|
+
gap: 4px;
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
&.horizontal {
|
|
74
|
+
flex-direction: row;
|
|
75
|
+
column-gap: 8px;
|
|
76
|
+
}
|
|
63
77
|
}
|
|
64
|
-
}
|
|
65
78
|
</style>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed, getCurrentInstance, inject, onBeforeMount,
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { Ui3nRadioEmits, Ui3nRadioProps, Ui3nRadioSlots, Ui3nRadioValue } from './types';
|
|
2
|
+
import { computed, getCurrentInstance, inject, onBeforeMount, ref, useSlots, watch } from 'vue';
|
|
3
|
+
import type { ComputedRef } from 'vue';
|
|
4
|
+
import type { Ui3nRadioEmits, Ui3nRadioProps, Ui3nRadioSlots, Ui3nRadioValue, Ui3nRadioExpose } from './types';
|
|
6
5
|
|
|
7
6
|
const props = withDefaults(defineProps<Ui3nRadioProps>(), {
|
|
7
|
+
name: undefined,
|
|
8
8
|
modelValue: false,
|
|
9
9
|
checkedValue: true,
|
|
10
10
|
uncheckedValue: false,
|
|
@@ -20,27 +20,30 @@
|
|
|
20
20
|
const instance = getCurrentInstance();
|
|
21
21
|
const isComponentPartOfGroup =
|
|
22
22
|
instance?.parent?.type.__name === 'Ui3nRadioGroup' || instance?.parent?.type.__name === 'ui3n-radio-group';
|
|
23
|
-
const groupName = isComponentPartOfGroup ? instance?.parent?.props.name : '';
|
|
24
|
-
|
|
25
|
-
const radioEl = ref<HTMLDivElement | null>(null);
|
|
23
|
+
const groupName = (isComponentPartOfGroup ? instance?.parent?.props.name : '') as string;
|
|
26
24
|
|
|
27
25
|
const {
|
|
28
26
|
groupValue,
|
|
29
27
|
updateGroupValue,
|
|
30
28
|
}: {
|
|
31
|
-
groupValue:
|
|
32
|
-
updateGroupValue:
|
|
29
|
+
groupValue: ComputedRef<Ui3nRadioValue> | null;
|
|
30
|
+
updateGroupValue: ((value: Ui3nRadioValue) => void) | null;
|
|
33
31
|
} = groupName
|
|
34
32
|
? inject(`radio-group-${groupName}`)!
|
|
35
33
|
: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
groupValue: null,
|
|
35
|
+
updateGroupValue: null,
|
|
36
|
+
};
|
|
39
37
|
|
|
40
38
|
const val = ref<Ui3nRadioValue>(groupName ? groupValue!.value : props.modelValue);
|
|
41
39
|
|
|
42
40
|
const isOn = computed(() => val.value === props.checkedValue);
|
|
43
41
|
|
|
42
|
+
const radioStyle = computed(() => ({
|
|
43
|
+
'--ui3n-radio-size': `${props.size}px`,
|
|
44
|
+
'--ui3n-radio-color': props.color,
|
|
45
|
+
}));
|
|
46
|
+
|
|
44
47
|
function change(ev: Event) {
|
|
45
48
|
ev.preventDefault();
|
|
46
49
|
|
|
@@ -57,15 +60,29 @@
|
|
|
57
60
|
|
|
58
61
|
val.value = props.checkedValue;
|
|
59
62
|
updateGroupValue!(val.value);
|
|
63
|
+
}
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
function clear() {
|
|
66
|
+
val.value = props.uncheckedValue;
|
|
67
|
+
if (!groupName) {
|
|
68
|
+
emits('change', val.value);
|
|
69
|
+
emits('update:modelValue', val.value);
|
|
70
|
+
}
|
|
67
71
|
}
|
|
68
72
|
|
|
73
|
+
defineExpose<Ui3nRadioExpose>({
|
|
74
|
+
clear,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
watch(
|
|
78
|
+
() => props.name,
|
|
79
|
+
newName => {
|
|
80
|
+
if (!newName && !groupName) {
|
|
81
|
+
clear();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
|
|
69
86
|
onBeforeMount(() => {
|
|
70
87
|
if (
|
|
71
88
|
// @ts-ignore
|
|
@@ -73,14 +90,7 @@
|
|
|
73
90
|
// @ts-ignore
|
|
74
91
|
(!slots.checkedIcon && slots.uncheckedIcon)
|
|
75
92
|
) {
|
|
76
|
-
throw Error('[Ui3nRadio] Both checkedIcon and uncheckedIcon slots must have values
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
onMounted(() => {
|
|
81
|
-
if (radioEl.value) {
|
|
82
|
-
radioEl.value.style.setProperty('--ui3n-radio-size', `${props.size}px`);
|
|
83
|
-
radioEl.value.style.setProperty('--ui3n-radio-color', props.color);
|
|
93
|
+
throw Error('[Ui3nRadio] Both checkedIcon and uncheckedIcon slots must have values defined.');
|
|
84
94
|
}
|
|
85
95
|
});
|
|
86
96
|
|
|
@@ -93,24 +103,6 @@
|
|
|
93
103
|
},
|
|
94
104
|
);
|
|
95
105
|
|
|
96
|
-
watch(
|
|
97
|
-
() => props.size,
|
|
98
|
-
newValue => {
|
|
99
|
-
if (radioEl.value) {
|
|
100
|
-
radioEl.value.style.setProperty('--ui3n-radio-size', `${newValue}px`);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
watch(
|
|
106
|
-
() => props.color,
|
|
107
|
-
newValue => {
|
|
108
|
-
if (radioEl.value) {
|
|
109
|
-
radioEl.value.style.setProperty('--ui3n-radio-color', newValue);
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
);
|
|
113
|
-
|
|
114
106
|
watch(
|
|
115
107
|
() => groupValue?.value,
|
|
116
108
|
newVal => {
|
|
@@ -124,9 +116,18 @@
|
|
|
124
116
|
<template>
|
|
125
117
|
<!-- eslint-disable max-len -->
|
|
126
118
|
<div
|
|
127
|
-
|
|
119
|
+
:style="radioStyle"
|
|
128
120
|
:class="[$style.ui3nRadio, disabled && $style.disabled, !slots.default && $style.noLabel]"
|
|
129
121
|
>
|
|
122
|
+
<input
|
|
123
|
+
type="radio"
|
|
124
|
+
hidden
|
|
125
|
+
:name="groupName || name"
|
|
126
|
+
:checked="isOn"
|
|
127
|
+
:value="String(checkedValue)"
|
|
128
|
+
:disabled="disabled"
|
|
129
|
+
/>
|
|
130
|
+
|
|
130
131
|
<div
|
|
131
132
|
:class="[$style.body, disabled && $style.bodyDisabled]"
|
|
132
133
|
:tabindex="disabled ? -1 : 0"
|
|
@@ -139,7 +140,6 @@
|
|
|
139
140
|
name="checkedIcon"
|
|
140
141
|
>
|
|
141
142
|
<svg
|
|
142
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
143
143
|
:width="Number(size) - 4"
|
|
144
144
|
:height="Number(size) - 4"
|
|
145
145
|
viewBox="0 0 24 24"
|
|
@@ -157,7 +157,6 @@
|
|
|
157
157
|
name="uncheckedIcon"
|
|
158
158
|
>
|
|
159
159
|
<svg
|
|
160
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
161
160
|
:width="Number(size) - 4"
|
|
162
161
|
:height="Number(size) - 4"
|
|
163
162
|
viewBox="0 0 24 24"
|
|
@@ -181,18 +180,14 @@
|
|
|
181
180
|
@use '../../assets/styles/mixins' as mixins;
|
|
182
181
|
|
|
183
182
|
.ui3nRadio {
|
|
184
|
-
--ui3n-radio-
|
|
185
|
-
--ui3n-radio-color: var(--color-icon-control-accent-default);
|
|
186
|
-
--ui3n-radio-text-size: 12px;
|
|
187
|
-
--ui3n-radio-text-color: var(--color-text-control-primary-default);
|
|
188
|
-
--ui3n-radio-text-weight: 500;
|
|
183
|
+
--ui3n-radio-min-height: 24px;
|
|
189
184
|
|
|
190
185
|
position: relative;
|
|
191
186
|
display: flex;
|
|
192
187
|
justify-content: flex-start;
|
|
193
188
|
align-items: center;
|
|
194
|
-
min-height: var(--
|
|
195
|
-
gap:
|
|
189
|
+
min-height: var(--ui3n-radio-min-height);
|
|
190
|
+
gap: 8px;
|
|
196
191
|
|
|
197
192
|
&.disabled {
|
|
198
193
|
--ui3n-radio-color: var(--color-icon-control-primary-disabled) !important;
|
|
@@ -213,10 +208,10 @@
|
|
|
213
208
|
.body {
|
|
214
209
|
position: relative;
|
|
215
210
|
display: flex;
|
|
216
|
-
width: var(--ui3n-radio-size);
|
|
217
|
-
min-width: var(--ui3n-radio-size);
|
|
218
|
-
height: var(--ui3n-radio-size);
|
|
219
|
-
min-height: var(--ui3n-radio-size);
|
|
211
|
+
width: var(--ui3n-radio-size, 16px);
|
|
212
|
+
min-width: var(--ui3n-radio-size, 16px);
|
|
213
|
+
height: var(--ui3n-radio-size, 16px);
|
|
214
|
+
min-height: var(--ui3n-radio-size, 16px);
|
|
220
215
|
justify-content: center;
|
|
221
216
|
align-items: center;
|
|
222
217
|
border-radius: 50%;
|
|
@@ -229,18 +224,18 @@
|
|
|
229
224
|
}
|
|
230
225
|
|
|
231
226
|
.label {
|
|
232
|
-
font-size:
|
|
233
|
-
font-weight:
|
|
234
|
-
color: var(--
|
|
227
|
+
font-size: 12px;
|
|
228
|
+
font-weight: 500;
|
|
229
|
+
color: var(--color-text-control-primary-default);
|
|
235
230
|
user-select: none;
|
|
236
231
|
}
|
|
237
232
|
|
|
238
233
|
.icon {
|
|
239
234
|
color: var(--ui3n-radio-color);
|
|
240
|
-
min-height: calc(var(--ui3n-
|
|
241
|
-
height: calc(var(--ui3n-
|
|
242
|
-
min-width: calc(var(--ui3n-
|
|
243
|
-
width: calc(var(--ui3n-
|
|
235
|
+
min-height: calc(var(--ui3n-radio-size, 16px) - 2px);
|
|
236
|
+
height: calc(var(--ui3n-radio-size, 16px) - 2px);
|
|
237
|
+
min-width: calc(var(--ui3n-radio-size, 16px) - 2px);
|
|
238
|
+
width: calc(var(--ui3n-radio-size, 16px) - 2px);
|
|
244
239
|
cursor: pointer;
|
|
245
240
|
}
|
|
246
241
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Ui3nScrollbarHorizontalExpose,
|
|
8
8
|
} from './types';
|
|
9
9
|
|
|
10
|
-
const MIN_WIDTH =
|
|
10
|
+
const MIN_WIDTH = 32;
|
|
11
11
|
|
|
12
12
|
const props = withDefaults(defineProps<Ui3nScrollbarHorizontalProps>(), {
|
|
13
13
|
thumbMinWidth: MIN_WIDTH,
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
thumbHoverColor: 'var(--color-bg-control-accent-hover)',
|
|
18
18
|
thumbActiveColor: 'var(--color-bg-control-accent-focused)',
|
|
19
19
|
trackHeight: 6,
|
|
20
|
+
trackRadius: 4,
|
|
20
21
|
trackColor: 'transparent',
|
|
21
22
|
});
|
|
22
23
|
|
|
@@ -91,6 +92,10 @@
|
|
|
91
92
|
const num = Number(props.trackHeight);
|
|
92
93
|
return isNaN(num) ? String(props.trackHeight) : `${num}px`;
|
|
93
94
|
});
|
|
95
|
+
const trackRadiusCss = computed(() => {
|
|
96
|
+
const num = Number(props.trackRadius);
|
|
97
|
+
return isNaN(num) ? String(props.trackRadius) : `${num}px`;
|
|
98
|
+
});
|
|
94
99
|
const trackColorCss = computed(() => props.trackColor);
|
|
95
100
|
|
|
96
101
|
function updateMetrics() {
|
|
@@ -232,6 +237,7 @@
|
|
|
232
237
|
'--ui3n-scrollbar-horizontal-thumb-hover-color': thumbHoverColorCss,
|
|
233
238
|
'--ui3n-scrollbar-horizontal-thumb-active-color': thumbActiveColorCss,
|
|
234
239
|
'--ui3n-scrollbar-horizontal-track-height': trackHeightCss,
|
|
240
|
+
'--ui3n-scrollbar-horizontal-track-radius': trackRadiusCss,
|
|
235
241
|
'--ui3n-scrollbar-horizontal-track-color': trackColorCss,
|
|
236
242
|
}"
|
|
237
243
|
@mouseenter="isHovered = true"
|
|
@@ -293,6 +299,7 @@
|
|
|
293
299
|
bottom: 2px;
|
|
294
300
|
height: var(--ui3n-scrollbar-horizontal-track-height);
|
|
295
301
|
background: var(--ui3n-scrollbar-horizontal-track-color);
|
|
302
|
+
border-radius: var(--ui3n-scrollbar-horizontal-track-radius);
|
|
296
303
|
z-index: 10;
|
|
297
304
|
visibility: hidden;
|
|
298
305
|
opacity: 0;
|
|
@@ -11,7 +11,9 @@ export interface Ui3nScrollbarVerticalProps {
|
|
|
11
11
|
thumbHoverColor?: string;
|
|
12
12
|
thumbActiveColor?: string;
|
|
13
13
|
trackWidth?: number;
|
|
14
|
+
trackRadius?: number | string;
|
|
14
15
|
trackColor?: string;
|
|
16
|
+
autoUpdate?: boolean;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -34,4 +36,5 @@ export interface Ui3nScrollbarVerticalSlots {
|
|
|
34
36
|
export interface Ui3nScrollbarVerticalExpose {
|
|
35
37
|
scrollTo(options: ScrollToOptions): void;
|
|
36
38
|
getContainer(): HTMLDivElement;
|
|
39
|
+
updateMetrics(): void;
|
|
37
40
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Ui3nScrollbarVerticalExpose,
|
|
8
8
|
} from './types';
|
|
9
9
|
|
|
10
|
-
const MIN_HEIGHT =
|
|
10
|
+
const MIN_HEIGHT = 32;
|
|
11
11
|
|
|
12
12
|
const props = withDefaults(defineProps<Ui3nScrollbarVerticalProps>(), {
|
|
13
13
|
thumbMinHeight: MIN_HEIGHT,
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
thumbHoverColor: 'var(--color-bg-control-accent-hover)',
|
|
18
18
|
thumbActiveColor: 'var(--color-bg-control-accent-focused)',
|
|
19
19
|
trackWidth: 6,
|
|
20
|
+
trackRadius: 4,
|
|
20
21
|
trackColor: 'transparent',
|
|
22
|
+
autoUpdate: true,
|
|
21
23
|
});
|
|
22
24
|
const emits = defineEmits<Ui3nScrollbarVerticalEmits>();
|
|
23
25
|
defineSlots<Ui3nScrollbarVerticalSlots>();
|
|
@@ -90,6 +92,10 @@
|
|
|
90
92
|
return isNaN(num) ? String(props.trackWidth) : `${num}px`;
|
|
91
93
|
});
|
|
92
94
|
const trackColorCss = computed(() => props.trackColor);
|
|
95
|
+
const trackRadiusCss = computed(() => {
|
|
96
|
+
const num = Number(props.trackRadius);
|
|
97
|
+
return isNaN(num) ? String(props.trackRadius) : `${num}px`;
|
|
98
|
+
});
|
|
93
99
|
|
|
94
100
|
function updateMetrics() {
|
|
95
101
|
if (!containerRef.value) {
|
|
@@ -132,7 +138,6 @@
|
|
|
132
138
|
|
|
133
139
|
containerRef.value.scrollTo({
|
|
134
140
|
top: targetScrollTop,
|
|
135
|
-
behavior: 'smooth',
|
|
136
141
|
});
|
|
137
142
|
}
|
|
138
143
|
|
|
@@ -196,7 +201,7 @@
|
|
|
196
201
|
resizeObserver = new ResizeObserver(updateMetrics);
|
|
197
202
|
resizeObserver.observe(containerRef.value);
|
|
198
203
|
|
|
199
|
-
if (containerRef.value.firstElementChild) {
|
|
204
|
+
if (props.autoUpdate && containerRef.value.firstElementChild) {
|
|
200
205
|
resizeObserver.observe(containerRef.value.firstElementChild);
|
|
201
206
|
}
|
|
202
207
|
}
|
|
@@ -219,8 +224,8 @@
|
|
|
219
224
|
scrollTo: (options: ScrollToOptions) => {
|
|
220
225
|
containerRef.value?.scrollTo(options);
|
|
221
226
|
},
|
|
222
|
-
|
|
223
227
|
getContainer: () => containerRef.value!,
|
|
228
|
+
updateMetrics,
|
|
224
229
|
});
|
|
225
230
|
</script>
|
|
226
231
|
|
|
@@ -233,6 +238,7 @@
|
|
|
233
238
|
'--ui3n-scrollbar-thumb-hover-color': thumbHoverColorCss,
|
|
234
239
|
'--ui3n-scrollbar-thumb-active-color': thumbActiveColorCss,
|
|
235
240
|
'--ui3n-scrollbar-track-width': trackWidthCss,
|
|
241
|
+
'--ui3n-scrollbar-track-radius': trackRadiusCss,
|
|
236
242
|
'--ui3n-scrollbar-track-color': trackColorCss,
|
|
237
243
|
}"
|
|
238
244
|
@mouseenter="isHovered = true"
|
|
@@ -249,7 +255,7 @@
|
|
|
249
255
|
<div
|
|
250
256
|
ref="trackRef"
|
|
251
257
|
:class="[$style.track, { [$style.trackVisible]: isBarVisible }]"
|
|
252
|
-
@
|
|
258
|
+
@pointerdown="onTrackClick"
|
|
253
259
|
>
|
|
254
260
|
<div
|
|
255
261
|
ref="thumbRef"
|
|
@@ -293,6 +299,7 @@
|
|
|
293
299
|
bottom: 0;
|
|
294
300
|
width: var(--ui3n-scrollbar-track-width);
|
|
295
301
|
background: var(--ui3n-scrollbar-track-color);
|
|
302
|
+
border-radius: var(--ui3n-scrollbar-track-radius);
|
|
296
303
|
z-index: 10;
|
|
297
304
|
visibility: hidden;
|
|
298
305
|
opacity: 0;
|
|
@@ -27,6 +27,14 @@ export type Ui3nSelectorValue<T extends Ui3nSelectorOptionBase> = T | T[keyof T]
|
|
|
27
27
|
* Selector component properties
|
|
28
28
|
*/
|
|
29
29
|
export interface Ui3nSelectorProps<T extends Ui3nSelectorOptionBase> {
|
|
30
|
+
/**
|
|
31
|
+
* Root element id
|
|
32
|
+
*/
|
|
33
|
+
id?: string;
|
|
34
|
+
/**
|
|
35
|
+
* HTML name attribute for form submission
|
|
36
|
+
*/
|
|
37
|
+
name?: string;
|
|
30
38
|
/**
|
|
31
39
|
* Current selector value
|
|
32
40
|
*/
|
|
@@ -147,3 +155,7 @@ export interface Ui3nSelectorSlots<T extends Ui3nSelectorOptionBase> {
|
|
|
147
155
|
*/
|
|
148
156
|
selection?: (props: { value: Ui3nSelectorValue<T>; selectedItem: T | undefined }) => VNode;
|
|
149
157
|
}
|
|
158
|
+
|
|
159
|
+
export interface Ui3nSelectorExpose {
|
|
160
|
+
clear: () => void;
|
|
161
|
+
}
|