@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.
Files changed (78) hide show
  1. package/README.md +4 -4
  2. package/dist/components/index.d.ts +22 -38
  3. package/dist/components/ui3n-badge-simple.vue.d.ts +3 -3
  4. package/dist/components/ui3n-badge.vue.d.ts +2 -2
  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 +3 -3
  9. package/dist/components/ui3n-chip.vue.d.ts +3 -3
  10. package/dist/components/ui3n-dialog.vue.d.ts +6 -5
  11. package/dist/components/ui3n-drop-files.vue.d.ts +23 -3
  12. package/dist/components/ui3n-emoji.vue.d.ts +3 -3
  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 +4 -4
  16. package/dist/components/ui3n-menu.vue.d.ts +3 -3
  17. package/dist/components/ui3n-notification.vue.d.ts +32 -2
  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 +4 -3
  21. package/dist/components/ui3n-tabs.vue.d.ts +3 -3
  22. package/dist/components/ui3n-text.vue.d.ts +29 -3
  23. package/dist/components/ui3n-virtual-scroll.vue.d.ts +12 -9
  24. package/dist/constants/types.d.ts +2 -4
  25. package/dist/directives/index.d.ts +3 -2
  26. package/dist/directives/ui3n-click-outside.d.ts +2 -1
  27. package/dist/directives/ui3n-html.d.ts +1 -0
  28. package/dist/index.d.ts +27 -29
  29. package/dist/plugins/dialogs.d.ts +3 -3
  30. package/dist/plugins/i18n.d.ts +2 -2
  31. package/dist/plugins/icons.d.ts +1 -0
  32. package/dist/plugins/index.d.ts +5 -8
  33. package/dist/plugins/notifications.d.ts +2 -2
  34. package/dist/plugins/store-dialogs.d.ts +2 -1
  35. package/dist/plugins/store-notifications.d.ts +2 -1
  36. package/dist/plugins/store-vue-bus.d.ts +2 -1
  37. package/dist/plugins/vue-bus.d.ts +3 -3
  38. package/dist/style.css +1 -1
  39. package/dist/tools/sqlite-on-3nstorage/index.d.ts +3 -2
  40. package/dist/tools/ui.helpers.d.ts +1 -0
  41. package/dist/ui-3n-lib.js +6953 -6615
  42. package/package.json +57 -58
  43. package/src/components/index.ts +47 -41
  44. package/src/components/ui3n-badge-simple.vue +35 -38
  45. package/src/components/ui3n-badge.vue +25 -25
  46. package/src/components/ui3n-breadcrumb.vue +44 -44
  47. package/src/components/ui3n-breadcrumbs.vue +19 -19
  48. package/src/components/ui3n-button.vue +240 -150
  49. package/src/components/ui3n-checkbox.vue +199 -158
  50. package/src/components/ui3n-chip.vue +96 -98
  51. package/src/components/ui3n-dialog.vue +225 -235
  52. package/src/components/ui3n-drop-files.vue +146 -154
  53. package/src/components/ui3n-emoji.vue +62 -64
  54. package/src/components/ui3n-icon.vue +32 -13
  55. package/src/components/ui3n-input.vue +239 -221
  56. package/src/components/ui3n-list.vue +92 -111
  57. package/src/components/ui3n-menu.vue +101 -100
  58. package/src/components/ui3n-notification.vue +182 -113
  59. package/src/components/ui3n-switch.vue +146 -0
  60. package/src/components/ui3n-table-sort-icon.vue +1 -2
  61. package/src/components/ui3n-table.vue +229 -223
  62. package/src/components/ui3n-tabs.vue +141 -148
  63. package/src/components/ui3n-text.vue +235 -146
  64. package/src/components/ui3n-virtual-scroll.vue +68 -68
  65. package/dist/stories/Ui3nBadge.stories.d.ts +0 -124
  66. package/dist/stories/Ui3nBreadcrumbs.stories.d.ts +0 -252
  67. package/dist/stories/Ui3nButton.stories.d.ts +0 -152
  68. package/dist/stories/Ui3nCheckbox.stories.d.ts +0 -186
  69. package/dist/stories/Ui3nChip.stories.d.ts +0 -562
  70. package/dist/stories/Ui3nDialog.stories.d.ts +0 -41
  71. package/dist/stories/Ui3nDropFiles.stories.d.ts +0 -73
  72. package/dist/stories/Ui3nEmoji.stories.d.ts +0 -39
  73. package/dist/stories/Ui3nIcon.stories.d.ts +0 -80
  74. package/dist/stories/Ui3nInput.stories.d.ts +0 -456
  75. package/dist/stories/Ui3nList.stories.d.ts +0 -54
  76. package/dist/stories/Ui3nTabs.stories.d.ts +0 -177
  77. package/dist/stories/data/data-to-list.d.ts +0 -8
  78. package/dist/stories/data/icons.d.ts +0 -1
@@ -1,69 +1,50 @@
1
1
  <script lang="ts" setup generic="T extends { id?: string }">
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- export interface Ui3nListProps<T> {
4
- title?: string;
5
- sticky?: boolean;
6
- items: T[];
7
- disabled?: boolean;
8
- }
9
-
10
- export interface Ui3nListEmits<T> {
11
- (ev: 'select', value: { value: T, index: number }): void;
12
- }
13
-
14
- export interface Ui3nListSlots<T> {
15
- title?: () => any;
16
- item?: ({ item, index }: { item: T, index: number }) => any;
17
- }
18
-
19
- const props = withDefaults(defineProps<Ui3nListProps<T>>(), {
20
- title: '',
21
- sticky: true,
22
- disabled: false,
23
- })
24
-
25
-
26
- const emits = defineEmits<Ui3nListEmits<T>>()
27
- defineSlots<Ui3nListSlots<T>>()
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ export interface Ui3nListProps<T> {
4
+ title?: string;
5
+ sticky?: boolean;
6
+ items: T[];
7
+ disabled?: boolean;
8
+ }
9
+
10
+ export interface Ui3nListEmits<T> {
11
+ (ev: 'select', value: { value: T, index: number }): void;
12
+ }
13
+
14
+ export interface Ui3nListSlots<T> {
15
+ title?: () => any;
16
+ item?: ({ item, index }: { item: T, index: number }) => any;
17
+ }
18
+
19
+ const props = withDefaults(defineProps<Ui3nListProps<T>>(), {
20
+ title: '',
21
+ sticky: true,
22
+ disabled: false,
23
+ });
24
+
25
+ const emits = defineEmits<Ui3nListEmits<T>>();
26
+ defineSlots<Ui3nListSlots<T>>();
28
27
  </script>
29
28
 
30
29
  <template>
31
- <div
32
- ref="listElement"
33
- class="ui3n-list"
34
- >
35
- <div
36
- :class="[
37
- 'ui3n-list__title',
38
- { 'ui3n-list__title--sticky': props.sticky },
39
- ]"
40
- >
30
+ <div ref="listElement" :class="$style.list">
31
+ <div :class="[$style.title, sticky && $style.stickyTitle]">
41
32
  <slot name="title">
42
- <div
43
- v-if="props.title"
44
- class="ui3n-list__title-content"
45
- >
46
- {{ props.title }}
33
+ <div v-if="props.title" :class="$style.titleContent">
34
+ {{ title }}
47
35
  </div>
48
36
  </slot>
49
37
  </div>
50
38
 
51
- <div class="ui3n-list__content">
39
+ <div :class="$style.content">
52
40
  <div
53
- v-for="(item, index) in props.items"
41
+ v-for="(item, index) in items"
54
42
  :key="item.id ?? index"
55
- class="ui3n-list__item"
43
+ :class="$style.item"
56
44
  >
57
- <slot
58
- name="item"
59
- :item="item"
60
- :index="index"
61
- >
45
+ <slot name="item" :item="item" :index="index">
62
46
  <div
63
- :class="[
64
- 'ui3n-list__item-content',
65
- { 'ui3n-list__item-content--disabled': props.disabled },
66
- ]"
47
+ :class="[$style.itemContent, disabled && $style.itemContentDisabled]"
67
48
  @click.stop="emits('select', { value: item, index })"
68
49
  >
69
50
  {{ item }}
@@ -74,62 +55,62 @@
74
55
  </div>
75
56
  </template>
76
57
 
77
- <style lang="scss" scoped>
78
- .ui3n-list {
79
- --ui3n-list-item-height: 28px;
80
- --ui3n-list-bg-color: var(--system-white, #fff);
81
-
82
- position: relative;
83
- width: 100%;
84
- height: 100%;
85
- background-color: var(--ui3n-list-bg-color);
86
- display: flex;
87
- flex-direction: column;
88
- justify-content: flex-start;
89
- align-items: stretch;
90
-
91
- &__title {
92
- position: relative;
93
- top: 0;
94
- z-index: 1;
95
-
96
- &--sticky {
97
- position: sticky;
98
- }
99
- }
100
-
101
- &__content {
102
- position: relative;
103
- flex-grow: 1;
104
- }
105
-
106
- &__title-content,
107
- &__item {
108
- position: relative;
109
- width: 100%;
110
- min-height: var(--ui3n-list-item-height);
111
- padding: 4px 0;
112
- display: flex;
113
- justify-content: flex-start;
114
- align-items: center;
115
- }
116
-
117
- &__title-content {
118
- z-index: 1;
119
- font-size: 16px;
120
- font-weight: 600;
121
- background-color: var(--ui3n-list-bg-color);
122
- }
123
-
124
- &__item-content {
125
- font-size: 14px;
126
- font-weight: 400;
127
- cursor: pointer;
128
-
129
- &--disabled {
130
- pointer-events: none;
131
- cursor: default;
132
- }
133
- }
134
- }
58
+ <style lang="scss" module>
59
+ .list {
60
+ --ui3n-list-item-height: 28px;
61
+ --ui3n-list-bg-color: transparent;
62
+
63
+ position: relative;
64
+ width: 100%;
65
+ height: 100%;
66
+ background-color: transparent;
67
+ display: flex;
68
+ flex-direction: column;
69
+ justify-content: flex-start;
70
+ align-items: stretch;
71
+ }
72
+
73
+ .title {
74
+ position: relative;
75
+ top: 0;
76
+ z-index: 1;
77
+ }
78
+
79
+ .stickyTitle {
80
+ position: sticky;
81
+ }
82
+
83
+ .content {
84
+ position: relative;
85
+ flex-grow: 1;
86
+ }
87
+
88
+ .titleContent,
89
+ .item {
90
+ position: relative;
91
+ width: 100%;
92
+ min-height: var(--ui3n-list-item-height);
93
+ padding: 4px 0;
94
+ display: flex;
95
+ justify-content: flex-start;
96
+ align-items: center;
97
+ }
98
+
99
+ .titleContent {
100
+ z-index: 1;
101
+ font-size: 16px;
102
+ font-weight: 600;
103
+ background-color: var(--ui3n-list-bg-color);
104
+ }
105
+
106
+ .itemContent {
107
+ font-size: 14px;
108
+ font-weight: 400;
109
+ cursor: pointer;
110
+ }
111
+
112
+ .itemContentDisabled {
113
+ pointer-events: none;
114
+ cursor: default;
115
+ }
135
116
  </style>
@@ -1,80 +1,78 @@
1
1
  <script lang="ts" setup>
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import { computed, onMounted, ref } from 'vue'
4
- import { default as vClickOutside } from '../directives/ui3n-click-outside'
5
-
6
- export interface Ui3nMenuProps {
7
- offsetX?: number;
8
- offsetY?: number;
9
- closeOnClick?: boolean;
10
- closeOnClickOutside?: boolean;
11
- disabled?: boolean;
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ import { computed, onMounted, ref } from 'vue';
4
+ import { default as vClickOutside } from '../directives/ui3n-click-outside';
5
+
6
+ export interface Ui3nMenuProps {
7
+ offsetX?: number;
8
+ offsetY?: number;
9
+ closeOnClick?: boolean;
10
+ closeOnClickOutside?: boolean;
11
+ disabled?: boolean;
12
+ }
13
+
14
+ export interface Ui3nMenuEmits {
15
+ (ev: 'open'): void;
16
+ (ev: 'opened'): void;
17
+ (ev: 'close'): void;
18
+ (ev: 'closed'): void;
19
+ (ev: 'click-outside'): void;
20
+ }
21
+
22
+ export interface Ui3nMenuSlots {
23
+ default: () => any;
24
+ menu?: () => any;
25
+ }
26
+
27
+ const props = withDefaults(defineProps<Ui3nMenuProps>(), {
28
+ offsetX: 0,
29
+ offsetY: 0,
30
+ closeOnClick: true,
31
+ closeOnClickOutside: true,
32
+ disabled: false,
33
+ });
34
+ const emits = defineEmits<Ui3nMenuEmits>();
35
+ defineSlots<Ui3nMenuSlots>();
36
+
37
+ const menuElement = ref<HTMLDivElement | null>(null);
38
+ const menuTriggerElement = ref<HTMLDivElement | null>(null);
39
+ const isShow = ref(false);
40
+ const defaultAnimationDuration = 400;
41
+ const menuContentStyle = computed(() => {
42
+ if (!props.offsetX && !props.offsetY) {
43
+ return {};
12
44
  }
13
-
14
- export interface Ui3nMenuEmits {
15
- (ev: 'open'): void;
16
- (ev: 'opened'): void;
17
- (ev: 'close'): void;
18
- (ev: 'closed'): void;
19
- (ev: 'click-outside'): void;
20
- }
21
-
22
- export interface Ui3nMenuSlots {
23
- default: () => any;
24
- menu?: () => any;
25
- }
26
-
27
- const props = withDefaults(defineProps<Ui3nMenuProps>(), {
28
- offsetX: 0,
29
- offsetY: 0,
30
- closeOnClick: true,
31
- closeOnClickOutside: true,
32
- disabled: false,
33
- })
34
- const emits = defineEmits<Ui3nMenuEmits>()
35
- defineSlots<Ui3nMenuSlots>()
36
-
37
- const menuElement = ref<HTMLDivElement | null>(null)
38
- const menuTriggerElement = ref<HTMLDivElement | null>(null)
39
- const isShow = ref(false)
40
- const defaultAnimationDuration = 400
41
- const menuContentStyle = computed(() => {
42
- if (!props.offsetX && !props.offsetY) {
43
- return {}
44
- }
45
- return {
46
- ...(props.offsetX && { left: `${props.offsetX}px` }),
47
- ...(props.offsetY && { top: `${menuTriggerElement.value!.clientHeight + props.offsetY}px` }),
48
- }
49
- })
50
-
51
- onMounted(() => {
52
- menuElement.value!.style.setProperty('--menu-animation-duration', `${defaultAnimationDuration}ms`)
53
- })
54
-
55
- const toggleMenu = () => {
56
- isShow.value = !isShow.value
57
- }
58
-
59
- const onContentClick = () => {
60
- isShow.value = false
61
- }
62
- const onClickOutside = () => {
63
- emits('click-outside')
64
- if (props.closeOnClickOutside) {
65
- isShow.value = false
66
- }
45
+ return {
46
+ ...(props.offsetX && { left: `${props.offsetX}px` }),
47
+ ...(props.offsetY && { top: `${menuTriggerElement.value!.clientHeight + props.offsetY}px` }),
48
+ };
49
+ });
50
+
51
+ onMounted(() => {
52
+ menuElement.value!.style.setProperty('--ui3n-menu-animation-duration', `${defaultAnimationDuration}ms`);
53
+ });
54
+
55
+ function toggleMenu() {
56
+ isShow.value = !isShow.value;
57
+ }
58
+
59
+ function onContentClick() {
60
+ isShow.value = false;
61
+ }
62
+
63
+ function onClickOutside() {
64
+ emits('click-outside');
65
+ if (props.closeOnClickOutside) {
66
+ isShow.value = false;
67
67
  }
68
+ }
68
69
  </script>
69
70
 
70
71
  <template>
71
- <div
72
- ref="menuElement"
73
- class="ui3n-menu"
74
- >
72
+ <div ref="menuElement" :class="$style.menu">
75
73
  <div
76
74
  ref="menuTriggerElement"
77
- class="ui3n-menu__trigger"
75
+ :class="$style.trigger"
78
76
  @click.stop="toggleMenu"
79
77
  >
80
78
  <slot />
@@ -92,7 +90,7 @@
92
90
  v-if="isShow"
93
91
  v-click-outside="onClickOutside"
94
92
  :style="menuContentStyle"
95
- class="ui3n-menu__content"
93
+ :class="$style.content"
96
94
  v-on="props.closeOnClick ? { click: onContentClick } : {}"
97
95
  >
98
96
  <slot name="menu" />
@@ -101,35 +99,38 @@
101
99
  </div>
102
100
  </template>
103
101
 
102
+ <style lang="scss" module>
103
+ @import "../assets/styles/mixins";
104
+
105
+ .menu {
106
+ --ui3n-menu-animation-duration: 400ms;
107
+ --ui3n-menu-content-bg: var(--color-bg-control-secondary-default);
108
+
109
+ position: relative;
110
+ overflow: visible;
111
+ }
112
+
113
+ .trigger {
114
+ position: relative;
115
+ }
116
+
117
+ .content {
118
+ position: absolute;
119
+ border-radius: 4px;
120
+ background-color: var(--ui3n-menu-content-bg);
121
+ z-index: 1000;
122
+ @include elevation(3);
123
+ }
124
+ </style>
125
+
104
126
  <style lang="scss" scoped>
105
- @import "../assets/styles/mixins";
106
-
107
- .ui3n-menu {
108
- --menu-animation-duration: 400ms;
109
-
110
- position: relative;
111
- overflow: visible;
112
-
113
- .menu-enter-active,
114
- .menu-leave-active {
115
- transition: opacity var(--menu-animation-duration);
116
- }
117
-
118
- .menu-enter-from,
119
- .menu-leave-to {
120
- opacity: 0;
121
- }
122
-
123
- &__trigger {
124
- position: relative;
125
- }
126
-
127
- &__content {
128
- position: absolute;
129
- border-radius: 4px;
130
- background-color: var(--system-white, #fff);
131
- z-index: 1000;
132
- @include elevation(3);
133
- }
134
- }
127
+ .menu-enter-active,
128
+ .menu-leave-active {
129
+ transition: opacity var(--ui3n-menu-animation-duration);
130
+ }
131
+
132
+ .menu-enter-from,
133
+ .menu-leave-to {
134
+ opacity: 0;
135
+ }
135
136
  </style>