@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,83 +1,81 @@
1
1
  <script lang="ts" setup>
2
- import { computed, onMounted, ref } from 'vue'
3
-
4
- export interface Ui3nDropFilesProps {
5
- title?: string;
6
- text?: string;
7
- additionalText?: string;
8
- }
9
-
10
- export interface Ui3nDropFilesEmits {
11
- (e: 'select', fileList: FileList): void;
12
- }
13
-
14
- const props = defineProps<Ui3nDropFilesProps>()
15
- const emit = defineEmits<Ui3nDropFilesEmits>()
16
-
17
- const wrapperElement = ref<HTMLDivElement | null>(null)
18
- const wrapperElementHeight = ref(0)
19
- const isOverDropPlace = ref(false)
20
- const isOverDropZone = ref(false)
21
- const params = computed(() => {
22
- const {
23
- title = 'Upload',
24
- } = props
25
-
26
- return {
27
- title,
28
- }
29
- })
30
-
31
- onMounted(() => {
32
- if (wrapperElement.value) {
33
- wrapperElementHeight.value = wrapperElement.value.clientHeight
34
- wrapperElement.value.style.setProperty('--dropzone-height', `${wrapperElementHeight.value}px`)
35
- let titleFontSize = 12
36
- if (wrapperElementHeight.value > 100 && wrapperElementHeight.value <= 240) {
37
- titleFontSize = 16
38
- } else if (wrapperElementHeight.value > 240) {
39
- titleFontSize = 20
40
- }
41
- wrapperElement.value.style.setProperty('--dropzone-title-font', `${titleFontSize}px`)
2
+ import { onMounted, ref } from 'vue';
3
+
4
+ export interface Ui3nDropFilesProps {
5
+ title?: string;
6
+ text?: string;
7
+ additionalText?: string;
8
+ }
9
+
10
+ export interface Ui3nDropFilesEmits {
11
+ (e: 'select', fileList: FileList): void;
12
+ }
13
+
14
+ const props = withDefaults(
15
+ defineProps<Ui3nDropFilesProps>(),
16
+ {
17
+ title: 'Upload',
18
+ text: '',
19
+ additionalText: '',
20
+ },
21
+ );
22
+ const emits = defineEmits<Ui3nDropFilesEmits>();
23
+
24
+ const wrapperElement = ref<HTMLDivElement | null>(null);
25
+ const wrapperElementHeight = ref(0);
26
+ const isOverDropPlace = ref(false);
27
+ const isOverDropZone = ref(false);
28
+
29
+ onMounted(() => {
30
+ if (wrapperElement.value) {
31
+ wrapperElementHeight.value = wrapperElement.value.clientHeight;
32
+ wrapperElement.value.style.setProperty('--dropzone-height', `${wrapperElementHeight.value}px`);
33
+ let titleFontSize = 12;
34
+ if (wrapperElementHeight.value > 100 && wrapperElementHeight.value <= 240) {
35
+ titleFontSize = 16;
36
+ } else if (wrapperElementHeight.value > 240) {
37
+ titleFontSize = 20;
42
38
  }
43
- })
44
-
45
- const onDragenter = (ev: MouseEvent) => {
46
- ev.preventDefault()
47
- isOverDropPlace.value = true
48
- }
49
- const onDragleave = (ev: MouseEvent) => {
50
- ev.preventDefault()
51
- isOverDropPlace.value = false
52
- }
53
- const onDropzoneDragover = (ev: MouseEvent) => {
54
- ev.preventDefault()
55
- ev.stopPropagation()
56
- }
57
- const onDropzoneDragenter = (ev: MouseEvent) => {
58
- ev.preventDefault()
59
- isOverDropZone.value = true
39
+ wrapperElement.value.style.setProperty('--dropzone-title-font', `${titleFontSize}px`);
60
40
  }
61
- const onDropzoneDragleave = (ev: MouseEvent) => {
62
- ev.preventDefault()
63
- isOverDropZone.value = false
64
- }
65
- const onDrop = (ev: DragEvent) => {
66
- ev.stopPropagation()
67
- ev.preventDefault()
68
- if (ev.dataTransfer!.files) {
69
- emit('select', ev.dataTransfer!.files)
70
- }
71
- isOverDropPlace.value = false
72
- isOverDropZone.value = false
41
+ });
42
+
43
+ const onDragenter = (ev: MouseEvent) => {
44
+ ev.preventDefault();
45
+ isOverDropPlace.value = true;
46
+ };
47
+ const onDragleave = (ev: MouseEvent) => {
48
+ ev.preventDefault();
49
+ isOverDropPlace.value = false;
50
+ };
51
+ const onDropzoneDragover = (ev: MouseEvent) => {
52
+ ev.preventDefault();
53
+ ev.stopPropagation();
54
+ };
55
+ const onDropzoneDragenter = (ev: MouseEvent) => {
56
+ ev.preventDefault();
57
+ isOverDropZone.value = true;
58
+ };
59
+ const onDropzoneDragleave = (ev: MouseEvent) => {
60
+ ev.preventDefault();
61
+ isOverDropZone.value = false;
62
+ };
63
+ const onDrop = (ev: DragEvent) => {
64
+ ev.stopPropagation();
65
+ ev.preventDefault();
66
+ if (ev.dataTransfer!.files) {
67
+ emits('select', ev.dataTransfer!.files);
73
68
  }
69
+ isOverDropPlace.value = false;
70
+ isOverDropZone.value = false;
71
+ };
74
72
  </script>
75
73
 
76
74
  <template>
77
75
  <!-- eslint-disable max-len -->
78
76
  <div
79
77
  ref="wrapperElement"
80
- class="ui3n-drop-files"
78
+ :class="$style.dropFiles"
81
79
  @dragenter="onDragenter"
82
80
  @dragleave="onDragleave"
83
81
  >
@@ -85,17 +83,17 @@
85
83
 
86
84
  <div
87
85
  v-if="isOverDropPlace || isOverDropZone"
88
- class="ui3n-drop-files__dropzone"
86
+ :class="$style.dropzone"
89
87
  @dragenter="onDropzoneDragenter"
90
88
  @dragover="onDropzoneDragover"
91
89
  @dragleave="onDropzoneDragleave"
92
90
  @drop="onDrop"
93
91
  >
94
- <div class="ui3n-drop-files__dropzone-border" />
95
- <h3 class="ui3n-drop-files__dropzone-title">
96
- {{ params.title }}
92
+ <div :class="$style.dropzoneBorder" />
93
+ <h3 :class="$style.dropzoneTitle">
94
+ {{ title }}
97
95
  </h3>
98
- <div class="ui3n-drop-files__dropzone-icon">
96
+ <div :class="$style.dropzoneIcon">
99
97
  <svg
100
98
  :width="wrapperElementHeight / 2"
101
99
  :height="wrapperElementHeight / 2"
@@ -105,94 +103,88 @@
105
103
  >
106
104
  <path
107
105
  d="M51 152C47.9333 152 45.3333 150.934 43.2 148.8C41.0667 146.667 40 144.067 40 141V119.8H46.2V141C46.2 142.2 46.7 143.3 47.7 144.3C48.7 145.3 49.8 145.8 51 145.8H141C142.2 145.8 143.3 145.3 144.3 144.3C145.3 143.3 145.8 142.2 145.8 141V119.8H152V141C152 144.067 150.933 146.667 148.8 148.8C146.667 150.934 144.067 152 141 152H51ZM93 122.4V49.2002L72.8 69.2002L68.4 65.0002L96 37.2002L123.6 65.0002L119.2 69.2002L99 49.2002V122.4H93Z"
108
- fill="#212121"
106
+ fill="var(--color-icon-button-tritery-default)"
109
107
  />
110
108
  </svg>
111
109
  </div>
112
- <div
113
- v-if="props.text"
114
- class="ui3n-drop-files__dropzone-text"
115
- >
110
+ <div v-if="props.text" :class="$style.dropzoneText">
116
111
  {{ props.text }}
117
112
  </div>
118
- <div
119
- v-if="props.additionalText"
120
- class="ui3n-drop-files__dropzone-additional"
121
- >
113
+ <div v-if="props.additionalText" :class="$style.dropzoneText">
122
114
  {{ props.additionalText }}
123
115
  </div>
124
116
  </div>
125
117
  </div>
126
118
  </template>
127
119
 
128
- <style lang="scss" scoped>
129
- .ui3n-drop-files {
130
- --dropzone-height: 0;
131
- --dropzone-title-font: 0;
132
-
133
- position: relative;
134
- box-sizing: border-box;
135
- width: 100%;
136
- height: 100%;
137
-
138
- &__dropzone {
139
- box-sizing: border-box;
140
- position: absolute;
141
- background-color: var(--system-white, #fff);
142
- display: flex;
143
- flex-direction: column;
144
- justify-content: center;
145
- align-items: center;
146
- inset: var(--half-size, 4px) var(--base-size, 8px);
147
- border-radius: var(--base-size, 8px);
148
- z-index: 5;
149
-
150
- &-border {
151
- box-sizing: border-box;
152
- position: absolute;
153
- top: calc(var(--base-size, 8px) + 1px);
154
- bottom: calc(var(--base-size, 8px) + 1px);
155
- left: calc(var(--base-size, 8px) + 1px);
156
- right: calc(var(--base-size, 8px) + 1px);
157
- border-radius: var(--base-size, 8px);
158
- border: 2px dashed var(--gray-50, #f2f2f2);
159
- pointer-events: none;
160
- }
161
-
162
- &-title {
163
- margin: 0 0 var(--dropzone-title-font);
164
- font-size: var(--dropzone-title-font);
165
- font-weight: 600;
166
- color: var(--black-30, #b3b3b3);
167
- pointer-events: none;
168
- }
169
-
170
- &-icon {
171
- position: relative;
172
- width: calc(var(--dropzone-height) * 0.4);
173
- height: calc(var(--dropzone-height) * 0.4);
174
- border-radius: 50%;
175
- background-color: var(--gray-50, #f2f2f2);
176
- display: flex;
177
- justify-content: center;
178
- align-items: center;
179
- pointer-events: none;
180
- }
181
-
182
- &-text {
183
- margin-top: calc(var(--base-size, 8px) * 3);
184
- font-size: var(--font-12, 12px);
185
- line-height: var(--font-16, 16px);
186
- font-weight: 400;
187
- color: var(--black-30, #b3b3b3);
188
- }
189
-
190
- &-additional {
191
- margin-top: var(--half-size, 4px);
192
- font-size: var(--font-12, 12px);
193
- font-weight: 500;
194
- color: var(--black-90, #212121);
195
- }
196
- }
197
- }
120
+ <style lang="scss" module>
121
+ .dropFiles {
122
+ --dropzone-height: 0;
123
+ --dropzone-title-font: 0;
124
+
125
+ position: relative;
126
+ box-sizing: border-box;
127
+ width: 100%;
128
+ height: 100%;
129
+ }
130
+
131
+ .dropzone {
132
+ box-sizing: border-box;
133
+ position: absolute;
134
+ background-color: var(--white-0);
135
+ display: flex;
136
+ flex-direction: column;
137
+ justify-content: center;
138
+ align-items: center;
139
+ inset: var(--spacing-xs) var(--spacing-s);
140
+ border-radius: var(--spacing-s);
141
+ z-index: 5;
142
+ }
143
+
144
+ .dropzoneBorder {
145
+ box-sizing: border-box;
146
+ position: absolute;
147
+ top: calc(var(--spacing-s) + 1px);
148
+ bottom: calc(var(--spacing-s) + 1px);
149
+ left: calc(var(--spacing-s) + 1px);
150
+ right: calc(var(--spacing-s) + 1px);
151
+ border-radius: var(--spacing-s);
152
+ border: 2px dashed var(--fill-s-focused);
153
+ pointer-events: none;
154
+ }
155
+
156
+ .dropzoneTitle {
157
+ margin: 0 0 var(--dropzone-title-font);
158
+ font-size: var(--dropzone-title-font);
159
+ font-weight: 600;
160
+ color: var(--fill-pressed);
161
+ pointer-events: none;
162
+ }
163
+
164
+ .dropzoneIcon {
165
+ position: relative;
166
+ width: calc(var(--dropzone-height) * 0.4);
167
+ height: calc(var(--dropzone-height) * 0.4);
168
+ border-radius: 50%;
169
+ background-color: var(--fill-s-focused);
170
+ display: flex;
171
+ justify-content: center;
172
+ align-items: center;
173
+ pointer-events: none;
174
+ }
175
+
176
+ .dropzoneText {
177
+ margin-top: var(--spacing-ml);
178
+ font-size: var(--font-12);
179
+ line-height: var(--font-16);
180
+ font-weight: 400;
181
+ color: var(--fill-pressed);
182
+ }
183
+
184
+ .dropzoneAdditional {
185
+ margin-top: var(--spacing-xs);
186
+ font-size: var(--font-12);
187
+ font-weight: 500;
188
+ color: var(--color-text-control-primary-default);
189
+ }
198
190
  </style>
@@ -1,88 +1,86 @@
1
1
  <script lang="ts" setup>
2
- import { computed, onMounted, ref, watch } from 'vue'
3
- import { emoticons } from '../constants/emoticons'
2
+ import { computed, onMounted, ref, watch } from 'vue';
3
+ import { emoticons } from '../constants/emoticons';
4
4
 
5
+ export interface Ui3nEmojiProps {
6
+ emoji: string;
7
+ size?: string | number;
8
+ readonly?: boolean;
9
+ }
5
10
 
6
- export interface Ui3nEmojiProps {
7
- emoji: string;
8
- size?: string | number;
9
- readonly?: boolean;
10
- }
11
+ export interface Ui3nEmojiEmits {
12
+ (ev: 'click', value: Event): void;
13
+ }
11
14
 
12
- export interface Ui3nEmojiEmits {
13
- (ev: 'click', value: Event): void;
14
- }
15
+ const props = withDefaults(
16
+ defineProps<Ui3nEmojiProps>(),
17
+ {
18
+ size: 16,
19
+ readonly: false,
20
+ },
21
+ );
22
+ const emits = defineEmits<Ui3nEmojiEmits>();
15
23
 
16
- const props = withDefaults(
17
- defineProps<Ui3nEmojiProps>(),
18
- {
19
- size: 16,
20
- readonly: false,
21
- },
22
- )
23
- const emit = defineEmits<Ui3nEmojiEmits>()
24
+ const emojiElement = ref<HTMLDivElement | null>(null);
25
+ const emojiData = computed(() => emoticons[props.emoji]);
24
26
 
25
- const emojiElement = ref<HTMLDivElement | null>(null)
26
- const emojiData = computed(() => emoticons[props.emoji])
27
+ onMounted(() => {
28
+ if (emojiElement.value) {
29
+ emojiElement.value.style.setProperty('--emoji-size', `${props.size}px`);
30
+ }
31
+ });
27
32
 
28
- onMounted(() => {
29
- if (emojiElement.value) {
30
- emojiElement.value.style.setProperty('--emoji-size', `${props.size}px`)
33
+ watch(
34
+ () => props.emoji,
35
+ newValue => {
36
+ if (!Object.keys(emoticons).includes(newValue)) {
37
+ console.error(`[Ui3nEmoji] Invalid emoticon: ${newValue}`);
31
38
  }
32
- })
33
-
34
- watch(
35
- () => props.emoji,
36
- newValue => {
37
- if (!Object.keys(emoticons).includes(newValue)) {
38
- console.error(`[Ui3nEmoji] Invalid emoticon: ${newValue}`)
39
- }
40
- },
41
- { immediate: true },
42
- )
39
+ },
40
+ { immediate: true },
41
+ );
43
42
 
44
- watch(
45
- () => props.size,
46
- (newValue, prevValue) => {
47
- if (emojiElement.value && newValue && newValue !== prevValue) {
48
- emojiElement.value.style.setProperty('--emoji-size', `${newValue}px`)
49
- }
50
- },
51
- )
43
+ watch(
44
+ () => props.size,
45
+ (newValue, prevValue) => {
46
+ if (emojiElement.value && newValue && newValue !== prevValue) {
47
+ emojiElement.value.style.setProperty('--ui3n-emoji-size', `${newValue}px`);
48
+ }
49
+ },
50
+ );
52
51
 
53
- const onClick = (ev: Event) => {
54
- ev.stopImmediatePropagation()
55
- emit('click', ev)
56
- }
52
+ const onClick = (ev: Event) => {
53
+ ev.stopImmediatePropagation();
54
+ emits('click', ev);
55
+ };
57
56
  </script>
58
57
 
59
58
  <template>
60
59
  <div
61
60
  ref="emojiElement"
62
- :class="[
63
- 'ui3n-emoji',
64
- { 'ui3n-emoji--readonly': props.readonly },
65
- ]"
61
+ :class="[$style.emoji, readonly && $style.readonly]"
66
62
  v-on="readonly ? {} : { 'click': onClick }"
67
63
  >
68
64
  {{ emojiData && emojiData.value }}
69
65
  </div>
70
66
  </template>
71
67
 
72
- <style lang="scss" scoped>
73
- .ui3n-emoji {
74
- --emoji-size: 16px;
68
+ <style lang="scss" module>
69
+ .emoji {
70
+ --ui3n-emoji-size: 16px;
75
71
 
76
- display: flex;
77
- width: var(--emoji-size);
78
- height: var(--emoji-size);
79
- font-size: var(--emoji-size);
80
- justify-content: center;
81
- align-items: center;
82
- cursor: pointer;
72
+ display: flex;
73
+ min-width: var(--ui3n-emoji-size);
74
+ width: var(--ui3n-emoji-size);
75
+ min-height: var(--ui3n-emoji-size);
76
+ height: var(--ui3n-emoji-size);
77
+ font-size: var(--ui3n-emoji-size);
78
+ justify-content: center;
79
+ align-items: center;
80
+ cursor: pointer;
81
+ }
83
82
 
84
- &--readonly {
85
- cursor: default;
86
- }
87
- }
83
+ .readonly {
84
+ cursor: default;
85
+ }
88
86
  </style>
@@ -20,8 +20,17 @@
20
20
  (ev: 'click', value: Event): void;
21
21
  }
22
22
 
23
- const props = defineProps<Ui3nIconProps>()
24
- const emit = defineEmits<Ui3nIconEmits>()
23
+ const props = withDefaults(
24
+ defineProps<Ui3nIconProps>(),
25
+ {
26
+ title: '',
27
+ width: 16,
28
+ height: 16,
29
+ rotate: 0,
30
+ color: 'var(--color-icon-control-primary-default)',
31
+ },
32
+ );
33
+ const emits = defineEmits<Ui3nIconEmits>()
25
34
 
26
35
  const onLoad = (value: any) => {
27
36
  if (props.onLoad) {
@@ -29,23 +38,33 @@
29
38
  }
30
39
  }
31
40
  const onClick = (ev: Event) => {
32
- emit('click', ev)
41
+ emits('click', ev)
33
42
  }
34
43
  </script>
35
44
 
36
45
  <template>
37
46
  <icon
38
- :icon="props.icon"
39
- :title="props.title || ''"
40
- :inline="props.inline"
41
- :width="props.width || 16"
42
- :height="props.height || 16"
43
- :horizontal-flip="props.horizontalFlip"
44
- :vertical-flip="props.verticalFlip"
45
- :flip="props.flip"
46
- :rotate="props.rotate || 0"
47
- :color="props.color || 'var(--gray-90, #444)'"
47
+ :class="$style.icon"
48
+ :icon="icon"
49
+ :title="title"
50
+ :inline="inline"
51
+ :width="width"
52
+ :height="height"
53
+ :horizontal-flip="horizontalFlip"
54
+ :vertical-flip="verticalFlip"
55
+ :flip="flip"
56
+ :rotate="rotate"
57
+ :color="color"
48
58
  :on-load="onLoad"
49
59
  @click="onClick"
50
60
  />
51
61
  </template>
62
+
63
+ <style lang="scss" module>
64
+ .icon {
65
+ min-width: v-bind(width);
66
+ min-height: v-bind(height);
67
+ flex-grow: 0;
68
+ flex-shrink: 0;
69
+ }
70
+ </style>