@v1nt1248/3nclient-lib 0.2.33 → 0.2.35

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 (53) hide show
  1. package/README.md +5 -0
  2. package/dist/components/ui3n-dialog/types.d.ts +1 -1
  3. package/dist/components/ui3n-editable/types.d.ts +1 -1
  4. package/dist/components/ui3n-editable/ui3n-editable.vue.d.ts +1 -1
  5. package/dist/components/ui3n-editable/useContentEditable.d.ts +1 -1
  6. package/dist/composables/index.d.ts +1 -0
  7. package/dist/composables/useDblClickHandler.d.ts +3 -0
  8. package/dist/directives/index.d.ts +2 -1
  9. package/dist/directives/ui3n-long-press.d.ts +27 -0
  10. package/dist/index.d.ts +3 -2
  11. package/dist/style.css +1 -1
  12. package/dist/types/directives.types.d.ts +7 -0
  13. package/dist/types/index.d.ts +3 -0
  14. package/dist/ui3n-components.d.ts +4 -1
  15. package/dist/ui3n-components.js +4879 -4810
  16. package/dist/ui3n-plugins.d.ts +1 -2
  17. package/dist/ui3n-plugins.js +2 -2
  18. package/dist/ui3n-utils.js +154 -144
  19. package/dist/utils/files/create-video-thumbnail.d.ts +1 -1
  20. package/dist/utils/for-vue/try-on-scope-dispose.d.ts +2 -0
  21. package/dist/utils/for-vue/unref-element.d.ts +2 -0
  22. package/dist/utils/index.d.ts +3 -1
  23. package/package.json +18 -13
  24. package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +32 -9
  25. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +14 -14
  26. package/src/components/ui3n-button/ui3n-button.vue +229 -226
  27. package/src/components/ui3n-checkbox/ui3n-checkbox.vue +30 -7
  28. package/src/components/ui3n-chip/ui3n-chip.vue +113 -109
  29. package/src/components/ui3n-dialog/types.ts +1 -1
  30. package/src/components/ui3n-dialog/ui3n-dialog.vue +7 -8
  31. package/src/components/ui3n-editable/types.ts +1 -1
  32. package/src/components/ui3n-editable/ui3n-editable.vue +34 -12
  33. package/src/components/ui3n-editable/useContentEditable.ts +6 -3
  34. package/src/components/ui3n-icon/ui3n-icon.vue +1 -1
  35. package/src/components/ui3n-input/ui3n-input.vue +272 -273
  36. package/src/components/ui3n-input-file/ui3n-input-file.vue +2 -2
  37. package/src/components/ui3n-list/ui3n-list.vue +70 -60
  38. package/src/components/ui3n-menu/ui3n-menu.vue +1 -1
  39. package/src/components/ui3n-notification/ui3n-notification.vue +4 -1
  40. package/src/components/ui3n-progress/ui3n-progress-circular.vue +168 -147
  41. package/src/components/ui3n-progress/ui3n-progress-linear.vue +77 -73
  42. package/src/components/ui3n-radio-group/ui3n-radio.vue +178 -177
  43. package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +50 -46
  44. package/src/components/ui3n-switch/ui3n-switch.vue +114 -116
  45. package/src/components/ui3n-table/composables/useTable.ts +17 -9
  46. package/src/components/ui3n-table/ui3n-table-sort-icon.vue +9 -6
  47. package/src/components/ui3n-table/ui3n-table.vue +7 -5
  48. package/src/components/ui3n-text/ui3n-text.vue +157 -215
  49. package/src/components/ui3n-tooltip/ui3n-tooltip.vue +4 -5
  50. package/src/components/types/index.ts +0 -15
  51. /package/dist/{components/types/index.d.ts → types/components.types.d.ts} +0 -0
  52. /package/dist/{plugins/types.d.ts → types/plugins.types.d.ts} +0 -0
  53. /package/dist/utils/{for-we3n.d.ts → for-web3n.d.ts} +0 -0
@@ -1,67 +1,71 @@
1
1
  <script lang="ts" setup>
2
- import { computed, useCssModule, useSlots } from 'vue';
3
- import Ui3nButton from '../ui3n-button/ui3n-button.vue';
4
- import type { Ui3nChipEmits, Ui3nChipProps, Ui3nChipSlots } from './types';
5
-
6
- const props = withDefaults(
7
- defineProps<Ui3nChipProps>(),
8
- {
9
- height: 24,
10
- maxWidth: 200,
11
- plain: false,
12
- round: true,
13
- closeable: false,
14
- color: 'var(--color-bg-control-secondary-default)',
15
- textSize: 10,
16
- textColor: 'var(--color-text-control-primary-default)',
17
- },
18
- );
19
-
20
- const emits = defineEmits<Ui3nChipEmits>();
21
- defineSlots<Ui3nChipSlots>();
22
-
23
- const slots = useSlots();
24
- const $css = useCssModule();
25
-
26
- const height = computed(() => `${props.height}px`);
27
- const iconHeight = computed(() => Number(props.height) - 4);
28
-
29
- const maxWidth = computed(() => `${props.maxWidth}px`);
30
- const bgColor = computed(() => props.color);
31
- const textSize = computed(() => `${props.textSize}px`);
32
- const textColor = computed(() => props.textColor);
33
- const hasLeftSlot = computed(() => !!slots.left);
34
-
35
- const padding = computed(() => {
36
- const padValue = Math.round(Number(props.height) / 3);
37
-
38
- if (hasLeftSlot.value) {
39
- return `0 ${padValue}px 0 4px`;
40
- }
2
+ import { computed, useCssModule, useSlots } from 'vue';
3
+ import Ui3nButton from '../ui3n-button/ui3n-button.vue';
4
+ import type { Ui3nChipEmits, Ui3nChipProps, Ui3nChipSlots } from './types';
5
+
6
+ const props = withDefaults(
7
+ defineProps<Ui3nChipProps>(),
8
+ {
9
+ height: 24,
10
+ maxWidth: 200,
11
+ plain: false,
12
+ round: true,
13
+ closeable: false,
14
+ color: 'var(--color-bg-control-secondary-default)',
15
+ textSize: 10,
16
+ textColor: 'var(--color-text-control-primary-default)',
17
+ },
18
+ );
19
+
20
+ const emits = defineEmits<Ui3nChipEmits>();
21
+ defineSlots<Ui3nChipSlots>();
22
+
23
+ const slots = useSlots();
24
+ const $css = useCssModule();
25
+
26
+ const height = computed(() => `${props.height}px`);
27
+ const iconHeight = computed(() => Number(props.height) - 4);
28
+
29
+ const maxWidth = computed(() => `${props.maxWidth}px`);
30
+ const bgColor = computed(() => props.color);
31
+ const textSize = computed(() => `${props.textSize}px`);
32
+ const textColor = computed(() => props.textColor);
33
+ const hasLeftSlot = computed(() => !!slots.left);
34
+
35
+ const padding = computed(() => {
36
+ const padValue = Math.round(Number(props.height) / 3);
37
+
38
+ if (hasLeftSlot.value) {
39
+ return `0 ${padValue}px 0 4px`;
40
+ }
41
41
 
42
- return `0 ${padValue}px`;
43
- });
42
+ return `0 ${padValue}px`;
43
+ });
44
44
 
45
- const mainCssClasses = computed(() => {
46
- const val = [$css.ui3nChip];
45
+ const mainCssClasses = computed(() => {
46
+ const val = [$css.ui3nChip];
47
47
 
48
- props.round && val.push($css.round);
49
- props.plain && val.push($css.plain);
50
- props.closeable && val.push($css.closeable);
51
- hasLeftSlot.value && val.push($css.withIcon);
48
+ props.round && val.push($css.round);
49
+ props.plain && val.push($css.plain);
50
+ props.closeable && val.push($css.closeable);
51
+ hasLeftSlot.value && val.push($css.withIcon);
52
52
 
53
- return val;
54
- });
53
+ return val;
54
+ });
55
55
 
56
- function onClick() {
57
- emits('close');
58
- }
56
+ function onClick() {
57
+ emits('close');
58
+ }
59
59
  </script>
60
60
 
61
61
  <template>
62
62
  <div :class="mainCssClasses">
63
63
  <div :class="$style.ui3nChipIcon">
64
- <slot name="left" :size="iconHeight" :color="textColor" />
64
+ <slot
65
+ name="left"
66
+ :size="iconHeight"
67
+ :color="textColor"
68
+ />
65
69
  </div>
66
70
 
67
71
  <div :class="$style.ui3nChipBody">
@@ -83,71 +87,71 @@ function onClick() {
83
87
  </template>
84
88
 
85
89
  <style lang="scss" module>
86
- .ui3nChip {
87
- position: relative;
88
- display: flex;
89
- height: v-bind('height');
90
- padding: v-bind('padding');
91
- width: max-content;
92
- max-width: v-bind('maxWidth');
93
- background-color: v-bind('bgColor');
94
- justify-content: flex-start;
95
- align-items: center;
96
-
97
- &.closeable:not(.withIcon) {
98
- .body {
99
- max-width: calc(100% - 24px);
90
+ .ui3nChip {
91
+ position: relative;
92
+ display: flex;
93
+ height: v-bind('height');
94
+ padding: v-bind('padding');
95
+ width: max-content;
96
+ max-width: v-bind('maxWidth');
97
+ background-color: v-bind('bgColor');
98
+ justify-content: flex-start;
99
+ align-items: center;
100
+
101
+ &.closeable:not(.withIcon) {
102
+ .body {
103
+ max-width: calc(100% - 24px);
104
+ }
100
105
  }
101
- }
102
106
 
103
- &.withIcon:not(.closeable) {
104
- .body {
105
- max-width: calc(100% - v-bind(height) - 4px);
107
+ &.withIcon:not(.closeable) {
108
+ .body {
109
+ max-width: calc(100% - v-bind(height) - 4px);
110
+ }
106
111
  }
107
- }
108
112
 
109
- &.closable.withIcon {
110
- .body {
111
- max-width: calc(100% - v-bind(height) - 28px);
113
+ &.closable.withIcon {
114
+ .body {
115
+ max-width: calc(100% - v-bind(height) - 28px);
116
+ }
112
117
  }
113
118
  }
114
- }
115
-
116
- .ui3nChipBody {
117
- font-size: v-bind('textSize');
118
- line-height: 1;
119
- font-weight: 400;
120
- color: v-bind('textColor');
121
- overflow: hidden;
122
- white-space: nowrap;
123
- text-overflow: ellipsis;
124
- }
125
-
126
- .closeBtn {
127
- margin-left: var(--spacing-xs);
128
- }
129
-
130
- .withIcon {
131
- .ui3nChipIcon {
132
- display: flex;
133
- flex-grow: 0;
134
- flex-shrink: 0;
135
- border-radius: 50%;
119
+
120
+ .ui3nChipBody {
121
+ font-size: v-bind('textSize');
122
+ line-height: 1;
123
+ font-weight: 400;
124
+ color: v-bind('textColor');
136
125
  overflow: hidden;
137
- margin-right: var(--spacing-xs);
126
+ white-space: nowrap;
127
+ text-overflow: ellipsis;
138
128
  }
139
- }
140
129
 
141
- .round {
142
- border-radius: calc(v-bind('height') / 2);
143
- }
130
+ .closeBtn {
131
+ margin-left: var(--spacing-xs);
132
+ }
133
+
134
+ .withIcon {
135
+ .ui3nChipIcon {
136
+ display: flex;
137
+ flex-grow: 0;
138
+ flex-shrink: 0;
139
+ border-radius: 50%;
140
+ overflow: hidden;
141
+ margin-right: var(--spacing-xs);
142
+ }
143
+ }
144
144
 
145
- .closeable {
146
- min-width: var(--spacing-ml);
147
- padding-right: 0;
148
- }
145
+ .round {
146
+ border-radius: calc(v-bind('height') / 2);
147
+ }
148
+
149
+ .closeable {
150
+ min-width: var(--spacing-ml);
151
+ padding-right: 0;
152
+ }
149
153
 
150
- .plain {
151
- border: 1px solid v-bind('textColor');
152
- }
154
+ .plain {
155
+ border: 1px solid v-bind('textColor');
156
+ }
153
157
  </style>
@@ -1,5 +1,5 @@
1
1
  import type { Component } from 'vue';
2
- import type { ExtractComponentProps, Ui3nIconField } from '../types/index';
2
+ import type { ExtractComponentProps, Ui3nIconField } from '@/types/index';
3
3
 
4
4
  export type Ui3nDialogEvent = 'open' | 'before-close' | 'close' | 'confirm' | 'cancel' | 'click-overlay';
5
5
 
@@ -4,7 +4,7 @@
4
4
  import Ui3nButton from '../ui3n-button/ui3n-button.vue';
5
5
  import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue';
6
6
  import type { Ui3nDialogEvent, Ui3nDialogComponentProps, Ui3nDialogComponentEmits } from './types';
7
- import { ExtractComponentProps } from '@/components/types';
7
+ import { ExtractComponentProps } from '@/types';
8
8
  import { determineWindowWidth } from './util';
9
9
 
10
10
  const props = defineProps<Ui3nDialogComponentProps<T>>();
@@ -226,12 +226,12 @@
226
226
  v-on="
227
227
  dialogProps?.draggable
228
228
  ? {
229
- dragstart: onDragstart,
230
- mousedown: onMousedown,
231
- mouseup: onMouseup,
232
- mousemove: onMousemove,
233
- keydown: onKeydown,
234
- }
229
+ dragstart: onDragstart,
230
+ mousedown: onMousedown,
231
+ mouseup: onMouseup,
232
+ mousemove: onMousemove,
233
+ keydown: onKeydown,
234
+ }
235
235
  : { keydown: onKeydown }
236
236
  "
237
237
  >
@@ -341,7 +341,6 @@
341
341
  background-color: var(--color-bg-block-primary-default);
342
342
  border-radius: var(--dialog-border-radius);
343
343
  outline: none;
344
-
345
344
  @include mixins.elevation();
346
345
 
347
346
  &.draggable {
@@ -1,4 +1,4 @@
1
- import type { Nullable } from '@/components/types';
1
+ import type { Nullable } from '@/types';
2
2
 
3
3
  export interface Ui3nContentEditableProps {
4
4
  modelValue: string;
@@ -4,7 +4,7 @@
4
4
  import Ui3nRipple from '@/directives/ui3n-ripple';
5
5
  import Ui3nClickOutside from '@/directives/ui3n-click-outside';
6
6
  import type { Ui3nEditableProps, Ui3nEditableEmits } from './types';
7
- import type { Nullable } from '@/components/types';
7
+ import type { Nullable } from '@/types';
8
8
 
9
9
  const vUi3nRipple = Ui3nRipple;
10
10
  const vUi3nClickOutside = Ui3nClickOutside;
@@ -149,7 +149,10 @@
149
149
  @focusin="emits('focusin', $event);"
150
150
  >
151
151
  <template v-if="inEdit">
152
- <span ref="hiddenEl" :class="$style.hidden" />
152
+ <span
153
+ ref="hiddenEl"
154
+ :class="$style.hidden"
155
+ />
153
156
 
154
157
  <input
155
158
  ref="inputEl"
@@ -162,14 +165,18 @@
162
165
  @keydown.enter="done"
163
166
  @keydown.tab="done"
164
167
  @keydown.esc="cancel"
165
- />
168
+ >
166
169
 
167
170
  <div
168
171
  v-ui3n-ripple
169
172
  :class="[$style.btn, $style.doneBtn, disabled && $style.btnDisabled]"
170
173
  @click.stop.prevent="done"
171
174
  >
172
- <ui3n-icon icon="round-done" size="12" color="var(--color-icon-table-accent-default)" />
175
+ <ui3n-icon
176
+ icon="round-done"
177
+ size="12"
178
+ color="var(--color-icon-table-accent-default)"
179
+ />
173
180
  </div>
174
181
 
175
182
  <div
@@ -177,21 +184,36 @@
177
184
  :class="[$style.btn, $style.cancelBtn, disabled && $style.btnDisabled]"
178
185
  @click.stop.prevent="cancel"
179
186
  >
180
- <ui3n-icon icon="round-close" size="12" color="var(--color-icon-table-secondary-default)" />
187
+ <ui3n-icon
188
+ icon="round-close"
189
+ size="12"
190
+ color="var(--color-icon-table-secondary-default)"
191
+ />
181
192
  </div>
182
193
  </template>
183
194
 
184
195
  <template v-else>
185
- <div :class="[$style.content, !value && $style.contentEmpty]" :title="isContentTruncated ? value : undefined">
186
- <span ref="contentValueEl">{{ value || placeholder || '...' }}</span>
187
-
188
- <div v-ui3n-ripple :class="[$style.btn, $style.editBtn]" @click.stop.prevent="turnOnEditMode">
189
- <ui3n-icon icon="round-edit" size="12" color="var(--color-icon-control-accent-unselected)" />
196
+ <div
197
+ :class="[$style.content, !value && $style.contentEmpty]"
198
+ :title="isContentTruncated ? value : undefined"
199
+ >
200
+ <span ref="contentValueEl">
201
+ {{ value || placeholder || '...' }}
202
+ </span>
203
+
204
+ <div
205
+ v-ui3n-ripple
206
+ :class="[$style.btn, $style.editBtn]"
207
+ @click.stop.prevent="turnOnEditMode"
208
+ >
209
+ <ui3n-icon
210
+ icon="round-edit"
211
+ size="12"
212
+ color="var(--color-icon-control-accent-unselected)"
213
+ />
190
214
  </div>
191
215
  </div>
192
216
  </template>
193
-
194
-
195
217
  </div>
196
218
  </template>
197
219
 
@@ -2,7 +2,7 @@ import { onMounted, ref, watch } from 'vue';
2
2
  import debounce from 'lodash/debounce';
3
3
  import sanitizeHtml from 'sanitize-html';
4
4
  import { selectAll } from '@/utils';
5
- import type { Nullable } from '@/components/types';
5
+ import type { Nullable } from '@/types';
6
6
  import type { Ui3nContentEditableEmits, Ui3nContentEditableProps } from '@/components/ui3n-editable/types';
7
7
 
8
8
  export function useContentEditable(props: Ui3nContentEditableProps, emits: Ui3nContentEditableEmits) {
@@ -90,7 +90,9 @@ export function useContentEditable(props: Ui3nContentEditableProps, emits: Ui3nC
90
90
  .replace(new RegExp(String.fromCharCode(160), 'g'), ' ')
91
91
  .replace(/(<([^>]+)>)/gi, '');
92
92
 
93
- if (value.length >= props.maxLength) ev.preventDefault();
93
+ if (value.length >= props.maxLength) {
94
+ ev.preventDefault();
95
+ }
94
96
  }
95
97
  }
96
98
 
@@ -104,8 +106,9 @@ export function useContentEditable(props: Ui3nContentEditableProps, emits: Ui3nC
104
106
 
105
107
  const selection = window.getSelection();
106
108
 
107
- if (value.length >= props.maxLength && ev.code !== 'Backspace' && selection?.toString().length === 0)
109
+ if (value.length >= props.maxLength && ev.code !== 'Backspace' && selection?.toString().length === 0) {
108
110
  ev.preventDefault();
111
+ }
109
112
  }
110
113
 
111
114
  emits('keydown', ev);
@@ -43,7 +43,7 @@ function onClick(ev: Event) {
43
43
  :title="title"
44
44
  :style="iconStyle"
45
45
  @click="onClick"
46
- ></div>
46
+ />
47
47
  </template>
48
48
 
49
49
  <style lang="scss">