@v1nt1248/3nclient-lib 0.0.42 → 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.
Files changed (56) hide show
  1. package/README.md +4 -4
  2. package/dist/components/index.d.ts +20 -19
  3. package/dist/components/ui3n-badge-simple.vue.d.ts +2 -2
  4. package/dist/components/ui3n-badge.vue.d.ts +1 -1
  5. package/dist/components/ui3n-breadcrumb.vue.d.ts +7 -7
  6. package/dist/components/ui3n-breadcrumbs.vue.d.ts +3 -3
  7. package/dist/components/ui3n-button.vue.d.ts +29 -4
  8. package/dist/components/ui3n-checkbox.vue.d.ts +2 -2
  9. package/dist/components/ui3n-chip.vue.d.ts +2 -2
  10. package/dist/components/ui3n-dialog.vue.d.ts +4 -4
  11. package/dist/components/ui3n-drop-files.vue.d.ts +23 -3
  12. package/dist/components/ui3n-emoji.vue.d.ts +2 -2
  13. package/dist/components/ui3n-icon.vue.d.ts +29 -3
  14. package/dist/components/ui3n-input.vue.d.ts +9 -9
  15. package/dist/components/ui3n-list.vue.d.ts +1 -1
  16. package/dist/components/ui3n-menu.vue.d.ts +2 -2
  17. package/dist/components/ui3n-notification.vue.d.ts +30 -1
  18. package/dist/components/ui3n-switch.vue.d.ts +55 -0
  19. package/dist/components/ui3n-table-sort-icon.vue.d.ts +1 -1
  20. package/dist/components/ui3n-table.vue.d.ts +2 -2
  21. package/dist/components/ui3n-tabs.vue.d.ts +2 -2
  22. package/dist/components/ui3n-text.vue.d.ts +29 -3
  23. package/dist/components/ui3n-virtual-scroll.vue.d.ts +9 -6
  24. package/dist/constants/types.d.ts +2 -4
  25. package/dist/directives/index.d.ts +1 -1
  26. package/dist/index.d.ts +25 -27
  27. package/dist/plugins/dialogs.d.ts +1 -1
  28. package/dist/plugins/index.d.ts +8 -8
  29. package/dist/plugins/notifications.d.ts +1 -1
  30. package/dist/plugins/vue-bus.d.ts +1 -1
  31. package/dist/style.css +1 -1
  32. package/dist/tools/sqlite-on-3nstorage/index.d.ts +3 -3
  33. package/dist/ui-3n-lib.js +6794 -6469
  34. package/package.json +57 -59
  35. package/src/components/index.ts +47 -41
  36. package/src/components/ui3n-badge-simple.vue +35 -38
  37. package/src/components/ui3n-badge.vue +25 -25
  38. package/src/components/ui3n-breadcrumb.vue +44 -44
  39. package/src/components/ui3n-breadcrumbs.vue +19 -19
  40. package/src/components/ui3n-button.vue +240 -150
  41. package/src/components/ui3n-checkbox.vue +199 -158
  42. package/src/components/ui3n-chip.vue +96 -98
  43. package/src/components/ui3n-dialog.vue +225 -235
  44. package/src/components/ui3n-drop-files.vue +146 -154
  45. package/src/components/ui3n-emoji.vue +62 -64
  46. package/src/components/ui3n-icon.vue +32 -13
  47. package/src/components/ui3n-input.vue +239 -221
  48. package/src/components/ui3n-list.vue +92 -111
  49. package/src/components/ui3n-menu.vue +101 -100
  50. package/src/components/ui3n-notification.vue +182 -113
  51. package/src/components/ui3n-switch.vue +146 -0
  52. package/src/components/ui3n-table-sort-icon.vue +1 -2
  53. package/src/components/ui3n-table.vue +229 -223
  54. package/src/components/ui3n-tabs.vue +141 -148
  55. package/src/components/ui3n-text.vue +235 -146
  56. package/src/components/ui3n-virtual-scroll.vue +68 -68
@@ -1,174 +1,167 @@
1
1
  <script lang="ts" setup>
2
- import { computed, onMounted, ref, watch } 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';
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
- 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(--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
- function setTabsActivity(index: number): void {
71
- if (children.value) {
72
- for (let i = 0; i < children.value.length; i++) {
73
- if (i === index) {
74
- children.value[i].classList.add('ui3n-tabs__item--active')
75
- } else {
76
- children.value[i].classList.remove('ui3n-tabs__item--active')
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
- const onClick = (ev: MouseEvent) => {
83
- // @ts-ignore
84
- const { index } = ev.target.dataset
85
- if (index) {
86
- emits('update:modelValue', Number(index))
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" scoped>
105
- @import "../assets/styles/mixins";
106
-
107
- .ui3n-tabs {
108
- --ui3n-tabs-height: 48px;
109
-
110
- position: relative;
111
- height: var(--ui3n-tabs-height);
112
- display: flex;
113
- justify-content: center;
114
- align-items: stretch;
115
-
116
- :deep(.ui3n-tabs__item) {
117
- cursor: pointer;
118
-
119
- &.ui3n-tabs__item {
120
- position: relative;
121
- user-select: none;
122
- color: v-bind('inactiveColor');
123
-
124
- &:hover {
125
- background-color: var(--blue-main-20, #d8edfd);
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
- &.ui3n-tabs__item--active {
149
- color: v-bind('activeColor');
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
- &::after {
152
- background-color: v-bind('indicatorColor');
153
- transition: background-color 250ms ease-in-out;
154
- }
155
- }
156
- }
138
+ &[disabled] {
139
+ opacity: 0.5;
140
+ cursor: default;
141
+ pointer-events: none
142
+ }
143
+ }
157
144
 
158
- &--vertical {
159
- height: auto;
160
- flex-direction: column;
161
-
162
- :deep(.ui3n-tabs__item) {
163
- &.ui3n-tabs__item {
164
- &::after {
165
- left: v-bind('indicatorPosition');
166
- width: v-bind('indicatorSize');
167
- bottom: 0;
168
- height: 100%;
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>