@v1nt1248/3nclient-lib 0.0.41 → 0.1.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 +4 -4
- package/dist/components/index.d.ts +22 -38
- package/dist/components/ui3n-badge-simple.vue.d.ts +3 -3
- package/dist/components/ui3n-badge.vue.d.ts +2 -2
- package/dist/components/ui3n-breadcrumb.vue.d.ts +7 -7
- package/dist/components/ui3n-breadcrumbs.vue.d.ts +3 -3
- package/dist/components/ui3n-button.vue.d.ts +29 -4
- package/dist/components/ui3n-checkbox.vue.d.ts +3 -3
- package/dist/components/ui3n-chip.vue.d.ts +3 -3
- package/dist/components/ui3n-dialog.vue.d.ts +6 -5
- package/dist/components/ui3n-drop-files.vue.d.ts +23 -3
- package/dist/components/ui3n-emoji.vue.d.ts +3 -3
- package/dist/components/ui3n-icon.vue.d.ts +29 -3
- package/dist/components/ui3n-input.vue.d.ts +9 -9
- package/dist/components/ui3n-list.vue.d.ts +4 -4
- package/dist/components/ui3n-menu.vue.d.ts +3 -3
- package/dist/components/ui3n-notification.vue.d.ts +32 -2
- package/dist/components/ui3n-switch.vue.d.ts +55 -0
- package/dist/components/ui3n-table-sort-icon.vue.d.ts +1 -1
- package/dist/components/ui3n-table.vue.d.ts +4 -3
- package/dist/components/ui3n-tabs.vue.d.ts +3 -3
- package/dist/components/ui3n-text.vue.d.ts +29 -3
- package/dist/components/ui3n-virtual-scroll.vue.d.ts +12 -9
- package/dist/constants/types.d.ts +2 -4
- package/dist/directives/index.d.ts +3 -2
- package/dist/directives/ui3n-click-outside.d.ts +2 -1
- package/dist/directives/ui3n-html.d.ts +1 -0
- package/dist/index.d.ts +27 -29
- package/dist/plugins/dialogs.d.ts +3 -3
- package/dist/plugins/i18n.d.ts +2 -2
- package/dist/plugins/icons.d.ts +1 -0
- package/dist/plugins/index.d.ts +5 -8
- package/dist/plugins/notifications.d.ts +2 -2
- package/dist/plugins/store-dialogs.d.ts +2 -1
- package/dist/plugins/store-notifications.d.ts +2 -1
- package/dist/plugins/store-vue-bus.d.ts +2 -1
- package/dist/plugins/vue-bus.d.ts +3 -3
- package/dist/style.css +1 -1
- package/dist/tools/sqlite-on-3nstorage/index.d.ts +3 -2
- package/dist/tools/ui.helpers.d.ts +1 -0
- package/dist/ui-3n-lib.js +6953 -6615
- package/package.json +57 -58
- package/src/components/index.ts +47 -41
- package/src/components/ui3n-badge-simple.vue +35 -38
- package/src/components/ui3n-badge.vue +25 -25
- package/src/components/ui3n-breadcrumb.vue +44 -44
- package/src/components/ui3n-breadcrumbs.vue +19 -19
- package/src/components/ui3n-button.vue +240 -150
- package/src/components/ui3n-checkbox.vue +199 -158
- package/src/components/ui3n-chip.vue +96 -98
- package/src/components/ui3n-dialog.vue +225 -235
- package/src/components/ui3n-drop-files.vue +146 -154
- package/src/components/ui3n-emoji.vue +62 -64
- package/src/components/ui3n-icon.vue +32 -13
- package/src/components/ui3n-input.vue +239 -221
- package/src/components/ui3n-list.vue +92 -111
- package/src/components/ui3n-menu.vue +101 -100
- package/src/components/ui3n-notification.vue +182 -113
- package/src/components/ui3n-switch.vue +146 -0
- package/src/components/ui3n-table-sort-icon.vue +1 -2
- package/src/components/ui3n-table.vue +229 -223
- package/src/components/ui3n-tabs.vue +141 -148
- package/src/components/ui3n-text.vue +235 -146
- package/src/components/ui3n-virtual-scroll.vue +68 -68
- package/dist/stories/Ui3nBadge.stories.d.ts +0 -124
- package/dist/stories/Ui3nBreadcrumbs.stories.d.ts +0 -252
- package/dist/stories/Ui3nButton.stories.d.ts +0 -152
- package/dist/stories/Ui3nCheckbox.stories.d.ts +0 -186
- package/dist/stories/Ui3nChip.stories.d.ts +0 -562
- package/dist/stories/Ui3nDialog.stories.d.ts +0 -41
- package/dist/stories/Ui3nDropFiles.stories.d.ts +0 -73
- package/dist/stories/Ui3nEmoji.stories.d.ts +0 -39
- package/dist/stories/Ui3nIcon.stories.d.ts +0 -80
- package/dist/stories/Ui3nInput.stories.d.ts +0 -456
- package/dist/stories/Ui3nList.stories.d.ts +0 -54
- package/dist/stories/Ui3nTabs.stories.d.ts +0 -177
- package/dist/stories/data/data-to-list.d.ts +0 -8
- package/dist/stories/data/icons.d.ts +0 -1
|
@@ -1,174 +1,167 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { computed, onMounted, ref, watch, useCssModule } from 'vue';
|
|
3
|
+
|
|
4
|
+
export interface Ui3nTabsProps {
|
|
5
|
+
modelValue: number;
|
|
6
|
+
itemDirection?: 'horizontal' | 'vertical';
|
|
7
|
+
activeColor?: string;
|
|
8
|
+
inactiveColor?: string;
|
|
9
|
+
indicatorColor?: string;
|
|
10
|
+
indicatorSize?: number | string;
|
|
11
|
+
indicatorPosition?: 'normal' | 'reverse';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Ui3nTabsEmits {
|
|
15
|
+
(ev: 'update:modelValue', val: number): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Ui3nTabsSlots {
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
default: () => any;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const props = withDefaults(
|
|
24
|
+
defineProps<Ui3nTabsProps>(),
|
|
25
|
+
{
|
|
26
|
+
modelValue: 0,
|
|
27
|
+
itemDirection: 'horizontal',
|
|
28
|
+
activeColor: 'var(--color-text-control-accent-default)',
|
|
29
|
+
inactiveColor: 'var(--color-text-control-primary-default)',
|
|
30
|
+
indicatorColor: 'var(--color-border-control-accent-default)',
|
|
31
|
+
indicatorSize: 2,
|
|
32
|
+
indicatorPosition: 'normal',
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
const emits = defineEmits<Ui3nTabsEmits>();
|
|
36
|
+
|
|
37
|
+
const $style = useCssModule();
|
|
38
|
+
|
|
39
|
+
const tabs = ref<HTMLDivElement | null>(null);
|
|
40
|
+
const children = ref<HTMLCollection | null>(null);
|
|
41
|
+
|
|
42
|
+
const activeColor = computed(() => props.activeColor);
|
|
43
|
+
const inactiveColor = computed(() => props.inactiveColor);
|
|
44
|
+
const indicatorColor = computed(() => props.indicatorColor);
|
|
45
|
+
const indicatorSize = computed(() => `${props.indicatorSize}px`);
|
|
46
|
+
const indicatorPosition = computed(() => props.indicatorPosition === 'reverse' ? '100%' : '0');
|
|
47
|
+
|
|
48
|
+
watch(
|
|
49
|
+
() => props.modelValue,
|
|
50
|
+
newValue => setTabsActivity(newValue),
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
onMounted(() => {
|
|
54
|
+
if (tabs.value) {
|
|
55
|
+
children.value = tabs.value.children;
|
|
56
|
+
initialTabsActivity();
|
|
57
|
+
setTabsActivity(props.modelValue);
|
|
12
58
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const props = withDefaults(
|
|
24
|
-
defineProps<Ui3nTabsProps>(),
|
|
25
|
-
{
|
|
26
|
-
modelValue: 0,
|
|
27
|
-
itemDirection: 'horizontal',
|
|
28
|
-
activeColor: 'var(--blue-main, #0090ec)',
|
|
29
|
-
inactiveColor: 'var(--black-90, #212121)',
|
|
30
|
-
indicatorColor: 'var(--blue-main, #0090ec)',
|
|
31
|
-
indicatorSize: 2,
|
|
32
|
-
indicatorPosition: 'normal',
|
|
33
|
-
},
|
|
34
|
-
)
|
|
35
|
-
const emits = defineEmits<Ui3nTabsEmits>()
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const tabs = ref<HTMLDivElement | null>(null)
|
|
39
|
-
const children = ref<HTMLCollection | null>(null)
|
|
40
|
-
|
|
41
|
-
const activeColor = computed(() => props.activeColor)
|
|
42
|
-
const inactiveColor = computed(() => props.inactiveColor)
|
|
43
|
-
const indicatorColor = computed(() => props.indicatorColor)
|
|
44
|
-
const indicatorSize = computed(() => `${props.indicatorSize}px`)
|
|
45
|
-
const indicatorPosition = computed(() => props.indicatorPosition === 'reverse' ? '100%' : '0')
|
|
46
|
-
|
|
47
|
-
watch(
|
|
48
|
-
() => props.modelValue,
|
|
49
|
-
newValue => setTabsActivity(newValue),
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
onMounted(() => {
|
|
53
|
-
if (tabs.value) {
|
|
54
|
-
children.value = tabs.value.children
|
|
55
|
-
initialTabsActivity()
|
|
56
|
-
setTabsActivity(props.modelValue)
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
function initialTabsActivity(): void {
|
|
61
|
-
if (children.value) {
|
|
62
|
-
for (let i = 0; i < children.value.length; i++) {
|
|
63
|
-
// @ts-ignore
|
|
64
|
-
children.value[i].dataset.index = `${i}`
|
|
65
|
-
children.value[i].classList.add('ui3n-tabs__item')
|
|
66
|
-
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
function initialTabsActivity(): void {
|
|
62
|
+
if (children.value) {
|
|
63
|
+
for (let i = 0; i < children.value.length; i++) {
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
children.value[i].dataset.index = `${i}`;
|
|
66
|
+
children.value[i].classList.add($style.item);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function setTabsActivity(index: number): void {
|
|
72
|
+
if (children.value) {
|
|
73
|
+
for (let i = 0; i < children.value.length; i++) {
|
|
74
|
+
if (i === index) {
|
|
75
|
+
children.value[i].classList.add($style.active);
|
|
76
|
+
} else {
|
|
77
|
+
children.value[i].classList.remove($style.active);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
}
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
83
|
+
const onClick = (ev: MouseEvent) => {
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
const { index } = ev.target.dataset;
|
|
86
|
+
if (index) {
|
|
87
|
+
emits('update:modelValue', Number(index));
|
|
88
88
|
}
|
|
89
|
+
};
|
|
89
90
|
</script>
|
|
90
91
|
|
|
91
92
|
<template>
|
|
92
93
|
<div
|
|
93
94
|
ref="tabs"
|
|
94
|
-
:class="[
|
|
95
|
-
'ui3n-tabs',
|
|
96
|
-
props.itemDirection === 'vertical' && 'ui3n-tabs--vertical',
|
|
97
|
-
]"
|
|
95
|
+
:class="[$style.tabs, itemDirection === 'vertical' && $style.vertical]"
|
|
98
96
|
v-on="children ? { click: onClick } : {}"
|
|
99
97
|
>
|
|
100
98
|
<slot />
|
|
101
99
|
</div>
|
|
102
100
|
</template>
|
|
103
101
|
|
|
104
|
-
<style lang="scss"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
&::after {
|
|
129
|
-
position: absolute;
|
|
130
|
-
content: '';
|
|
131
|
-
left: 0;
|
|
132
|
-
width: 100%;
|
|
133
|
-
bottom: v-bind('indicatorPosition');
|
|
134
|
-
height: v-bind('indicatorSize');
|
|
135
|
-
background-color: transparent;
|
|
136
|
-
transition: background-color 250ms ease-in-out;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
&[disabled] {
|
|
140
|
-
opacity: 0.5;
|
|
141
|
-
cursor: default;
|
|
142
|
-
pointer-events: none
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
@include ripple(#d8edfd);
|
|
146
|
-
}
|
|
102
|
+
<style lang="scss" module>
|
|
103
|
+
@import "../assets/styles/mixins";
|
|
104
|
+
|
|
105
|
+
.tabs {
|
|
106
|
+
--ui3n-tabs-height: 48px;
|
|
107
|
+
|
|
108
|
+
position: relative;
|
|
109
|
+
height: var(--ui3n-tabs-height);
|
|
110
|
+
display: flex;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
align-items: stretch;
|
|
113
|
+
background-color: transparent;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.item {
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
position: relative;
|
|
119
|
+
user-select: none;
|
|
120
|
+
color: v-bind('inactiveColor');
|
|
121
|
+
@include ripple(var(--color-bg-control-secondary-default));
|
|
122
|
+
|
|
123
|
+
&:hover {
|
|
124
|
+
background-color: var(--color-bg-control-secondary-default);
|
|
125
|
+
}
|
|
147
126
|
|
|
148
|
-
|
|
149
|
-
|
|
127
|
+
&::after {
|
|
128
|
+
position: absolute;
|
|
129
|
+
content: '';
|
|
130
|
+
left: 0;
|
|
131
|
+
width: 100%;
|
|
132
|
+
bottom: v-bind('indicatorPosition');
|
|
133
|
+
height: v-bind('indicatorSize');
|
|
134
|
+
background-color: transparent;
|
|
135
|
+
transition: background-color 250ms ease-in-out;
|
|
136
|
+
}
|
|
150
137
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
138
|
+
&[disabled] {
|
|
139
|
+
opacity: 0.5;
|
|
140
|
+
cursor: default;
|
|
141
|
+
pointer-events: none
|
|
142
|
+
}
|
|
143
|
+
}
|
|
157
144
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
145
|
+
.active {
|
|
146
|
+
color: v-bind('activeColor');
|
|
147
|
+
|
|
148
|
+
&::after {
|
|
149
|
+
background-color: v-bind('indicatorColor');
|
|
150
|
+
transition: background-color 250ms ease-in-out;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.vertical {
|
|
155
|
+
height: auto;
|
|
156
|
+
flex-direction: column;
|
|
157
|
+
|
|
158
|
+
.item {
|
|
159
|
+
&::after {
|
|
160
|
+
left: v-bind('indicatorPosition');
|
|
161
|
+
width: v-bind('indicatorSize');
|
|
162
|
+
bottom: 0;
|
|
163
|
+
height: 100%;
|
|
172
164
|
}
|
|
173
165
|
}
|
|
166
|
+
}
|
|
174
167
|
</style>
|