@v1nt1248/3nclient-lib 0.3.27 → 0.3.29

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 (115) hide show
  1. package/dist/chunks/ui3n-notification-Dr_3Td9N.js +279 -0
  2. package/dist/components/index.d.ts +12 -12
  3. package/dist/components/ui3n-autocomplete/types.d.ts +8 -0
  4. package/dist/components/ui3n-autocomplete/ui3n-autocomplete.d.ts +2 -2
  5. package/dist/components/ui3n-badge/types.d.ts +12 -0
  6. package/dist/components/ui3n-badge/ui3n-badge-simple.d.ts +1 -1
  7. package/dist/components/ui3n-badge/ui3n-badge.d.ts +1 -1
  8. package/dist/components/ui3n-breadcrumbs/types.d.ts +1 -1
  9. package/dist/components/ui3n-breadcrumbs/ui3n-breadcrumb.d.ts +2 -2
  10. package/dist/components/ui3n-button/types.d.ts +4 -2
  11. package/dist/components/ui3n-checkbox/types.d.ts +11 -0
  12. package/dist/components/ui3n-checkbox/ui3n-checkbox.d.ts +4 -1
  13. package/dist/components/ui3n-chip/types.d.ts +6 -1
  14. package/dist/components/ui3n-chip/ui3n-chip.d.ts +2 -0
  15. package/dist/components/ui3n-drop-files/types.d.ts +7 -0
  16. package/dist/components/ui3n-drop-files/ui3n-drop-files.d.ts +7 -1
  17. package/dist/components/ui3n-editable/types.d.ts +11 -0
  18. package/dist/components/ui3n-editable/ui3n-editable.d.ts +4 -2
  19. package/dist/components/ui3n-icon/types.d.ts +5 -1
  20. package/dist/components/ui3n-icon/ui3n-icon.d.ts +2 -2
  21. package/dist/components/ui3n-input/types.d.ts +4 -0
  22. package/dist/components/ui3n-input/ui3n-input.d.ts +4 -1
  23. package/dist/components/ui3n-input-file/types.d.ts +11 -0
  24. package/dist/components/ui3n-input-file/ui3n-input-file.d.ts +4 -1
  25. package/dist/components/ui3n-list/types.d.ts +4 -0
  26. package/dist/components/ui3n-menu/types.d.ts +4 -0
  27. package/dist/components/ui3n-menu/ui3n-menu.d.ts +1 -1
  28. package/dist/components/ui3n-notification/ui3n-notification.d.ts +2 -2
  29. package/dist/components/ui3n-progress/ui3n-progress-circular.d.ts +1 -1
  30. package/dist/components/ui3n-progress/ui3n-progress-linear.d.ts +1 -1
  31. package/dist/components/ui3n-radio-group/types.d.ts +18 -0
  32. package/dist/components/ui3n-radio-group/ui3n-radio-group.d.ts +3 -1
  33. package/dist/components/ui3n-radio-group/ui3n-radio.d.ts +6 -7
  34. package/dist/components/ui3n-scrollbar-horizontal/types.d.ts +1 -0
  35. package/dist/components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.d.ts +1 -0
  36. package/dist/components/ui3n-scrollbar-vertical/types.d.ts +3 -0
  37. package/dist/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +3 -0
  38. package/dist/components/ui3n-selector/types.d.ts +11 -0
  39. package/dist/components/ui3n-selector/ui3n-selector.d.ts +2 -2
  40. package/dist/components/ui3n-slider/types.d.ts +11 -0
  41. package/dist/components/ui3n-slider/ui3n-slider.d.ts +4 -1
  42. package/dist/components/ui3n-step-line-bar/types.d.ts +4 -0
  43. package/dist/components/ui3n-switch/types.d.ts +11 -0
  44. package/dist/components/ui3n-switch/ui3n-switch.d.ts +4 -1
  45. package/dist/components/ui3n-table/composables/useTable.d.ts +1 -0
  46. package/dist/components/ui3n-table/types.d.ts +4 -0
  47. package/dist/components/ui3n-table/ui3n-table-sort-icon.d.ts +4 -1
  48. package/dist/components/ui3n-tabs/types.d.ts +4 -0
  49. package/dist/components/ui3n-text/types.d.ts +11 -0
  50. package/dist/components/ui3n-text/ui3n-text.d.ts +4 -1
  51. package/dist/components/ui3n-tooltip/types.d.ts +4 -0
  52. package/dist/components/ui3n-tooltip/ui3n-tooltip.d.ts +4 -2
  53. package/dist/style.css +1 -1
  54. package/dist/ui3n-components.js +2083 -1697
  55. package/dist/ui3n-plugins.js +1 -1
  56. package/package.json +1 -1
  57. package/src/components/index.ts +29 -7
  58. package/src/components/ui3n-autocomplete/types.ts +9 -1
  59. package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +182 -51
  60. package/src/components/ui3n-badge/types.ts +10 -0
  61. package/src/components/ui3n-badge/ui3n-badge-simple.vue +54 -55
  62. package/src/components/ui3n-badge/ui3n-badge.vue +4 -0
  63. package/src/components/ui3n-breadcrumbs/types.ts +1 -1
  64. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +7 -5
  65. package/src/components/ui3n-button/types.ts +4 -2
  66. package/src/components/ui3n-button/ui3n-button.vue +24 -19
  67. package/src/components/ui3n-checkbox/types.ts +12 -0
  68. package/src/components/ui3n-checkbox/ui3n-checkbox.vue +79 -29
  69. package/src/components/ui3n-chip/types.ts +6 -1
  70. package/src/components/ui3n-chip/ui3n-chip.vue +64 -61
  71. package/src/components/ui3n-dialog/ui3n-dialog.vue +3 -3
  72. package/src/components/ui3n-drop-files/types.ts +8 -0
  73. package/src/components/ui3n-drop-files/ui3n-drop-files.vue +73 -29
  74. package/src/components/ui3n-editable/types.ts +12 -0
  75. package/src/components/ui3n-editable/ui3n-editable.vue +56 -24
  76. package/src/components/ui3n-icon/types.ts +5 -1
  77. package/src/components/ui3n-icon/ui3n-icon.vue +45 -50
  78. package/src/components/ui3n-input/types.ts +4 -0
  79. package/src/components/ui3n-input/ui3n-input.vue +14 -1
  80. package/src/components/ui3n-input-file/types.ts +12 -0
  81. package/src/components/ui3n-input-file/ui3n-input-file.vue +33 -16
  82. package/src/components/ui3n-list/types.ts +4 -0
  83. package/src/components/ui3n-list/ui3n-list.vue +3 -1
  84. package/src/components/ui3n-menu/types.ts +4 -0
  85. package/src/components/ui3n-menu/ui3n-menu.vue +43 -32
  86. package/src/components/ui3n-notification/ui3n-notification.vue +190 -175
  87. package/src/components/ui3n-progress/ui3n-progress-circular.vue +40 -22
  88. package/src/components/ui3n-progress/ui3n-progress-linear.vue +14 -7
  89. package/src/components/ui3n-radio-group/types.ts +20 -0
  90. package/src/components/ui3n-radio-group/ui3n-radio-group.vue +61 -48
  91. package/src/components/ui3n-radio-group/ui3n-radio.vue +60 -65
  92. package/src/components/ui3n-scrollbar-horizontal/types.ts +1 -0
  93. package/src/components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.vue +8 -1
  94. package/src/components/ui3n-scrollbar-vertical/types.ts +3 -0
  95. package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +12 -5
  96. package/src/components/ui3n-selector/types.ts +12 -0
  97. package/src/components/ui3n-selector/ui3n-selector.vue +63 -40
  98. package/src/components/ui3n-slider/types.ts +12 -0
  99. package/src/components/ui3n-slider/ui3n-slider.vue +88 -39
  100. package/src/components/ui3n-step-line-bar/types.ts +4 -0
  101. package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +8 -10
  102. package/src/components/ui3n-switch/types.ts +12 -0
  103. package/src/components/ui3n-switch/ui3n-switch.vue +57 -25
  104. package/src/components/ui3n-table/composables/useTable.ts +17 -0
  105. package/src/components/ui3n-table/types.ts +4 -0
  106. package/src/components/ui3n-table/ui3n-table-sort-icon.vue +9 -8
  107. package/src/components/ui3n-table/ui3n-table.vue +48 -17
  108. package/src/components/ui3n-tabs/types.ts +4 -0
  109. package/src/components/ui3n-tabs/ui3n-tabs.vue +146 -108
  110. package/src/components/ui3n-text/types.ts +12 -0
  111. package/src/components/ui3n-text/ui3n-text.vue +56 -15
  112. package/src/components/ui3n-tooltip/types.ts +4 -0
  113. package/src/components/ui3n-tooltip/ui3n-tooltip.vue +61 -43
  114. package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +201 -17
  115. package/dist/chunks/ui3n-notification-DlDM-u-R.js +0 -276
@@ -1,69 +1,77 @@
1
1
  <script lang="ts" setup>
2
- import { computed, useCssModule, useSlots } from 'vue';
2
+ import { computed, useSlots } from 'vue';
3
3
  import Ui3nButton from '../ui3n-button/ui3n-button.vue';
4
4
  import type { Ui3nChipEmits, Ui3nChipProps, Ui3nChipSlots } from './types';
5
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
- );
6
+ const props = withDefaults(defineProps<Ui3nChipProps>(), {
7
+ height: 24,
8
+ maxWidth: 200,
9
+ plain: false,
10
+ round: true,
11
+ closeable: false,
12
+ color: 'var(--color-bg-control-secondary-default)',
13
+ textSize: 10,
14
+ textColor: 'var(--color-text-control-primary-default)',
15
+ });
19
16
 
20
17
  const emits = defineEmits<Ui3nChipEmits>();
21
18
  defineSlots<Ui3nChipSlots>();
22
19
 
23
20
  const slots = useSlots();
24
- const $css = useCssModule();
25
-
26
- const height = computed(() => `${props.height}px`);
27
- const iconHeight = computed(() => Number(props.height) - 4);
28
21
 
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
- }
22
+ const chipHeight = computed(() => {
23
+ const num = Number(props.height);
24
+ return isNaN(num) ? 24 : num;
25
+ });
26
+ const heightCss = computed(() => `${chipHeight.value}px`);
27
+ const iconSize = computed(() => chipHeight.value - 4);
41
28
 
42
- return `0 ${padValue}px`;
29
+ const paddingCss = computed(() => {
30
+ const padValue = Math.round(chipHeight.value / 3);
31
+ return hasLeftSlot.value ? `0 ${padValue}px 0 4px` : `0 ${padValue}px`;
43
32
  });
44
33
 
45
- const mainCssClasses = computed(() => {
46
- const val = [$css.ui3nChip];
34
+ const maxWidthCss = computed(() => {
35
+ const num = Number(props.maxWidth);
36
+ return isNaN(num) ? String(props.maxWidth) : `${num}px`;
37
+ });
47
38
 
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);
39
+ const bgColor = computed(() => props.color);
52
40
 
53
- return val;
41
+ const textSize = computed(() => {
42
+ const num = Number(props.textSize);
43
+ return isNaN(num) ? String(props.textSize) : `${num}px`;
54
44
  });
55
45
 
56
- function onClick() {
57
- emits('close');
58
- }
46
+ const textColor = computed(() => props.textColor);
47
+
48
+ const hasLeftSlot = computed(() => !!slots.left);
59
49
  </script>
60
50
 
61
51
  <template>
62
- <div :class="mainCssClasses">
52
+ <div
53
+ :id="id"
54
+ :class="[
55
+ $style.ui3nChip,
56
+ round && $style.round,
57
+ plain && $style.plain,
58
+ closeable && $style.closeable,
59
+ hasLeftSlot && $style.withIcon,
60
+ ]"
61
+ :style="{
62
+ '--ui3n-chip-height': heightCss,
63
+ '--ui3n-chip-max-width': maxWidthCss,
64
+ '--ui3n-chip-padding': paddingCss,
65
+ '--ui3n-chip-bg-color': bgColor,
66
+ '--ui3n-chip-font-size': textSize,
67
+ '--ui3n-chip-font-color': textColor,
68
+ }"
69
+ @click="emits('click', $event)"
70
+ >
63
71
  <div :class="$style.ui3nChipIcon">
64
72
  <slot
65
73
  name="left"
66
- :size="iconHeight"
74
+ :size="iconSize"
67
75
  :color="textColor"
68
76
  />
69
77
  </div>
@@ -74,14 +82,13 @@
74
82
 
75
83
  <ui3n-button
76
84
  v-if="closeable"
77
- :class="$style.closeBtn"
78
85
  type="icon"
79
86
  size="small"
80
87
  color="transparent"
81
88
  icon="round-close"
82
89
  icon-color="var(--color-icon-control-primary-default)"
83
90
  :disabled="disabled"
84
- @click.stop.prevent="onClick"
91
+ @click.stop.prevent="emits('close')"
85
92
  />
86
93
  </div>
87
94
  </template>
@@ -90,13 +97,14 @@
90
97
  .ui3nChip {
91
98
  position: relative;
92
99
  display: flex;
93
- height: v-bind('height');
94
- padding: v-bind('padding');
100
+ height: var(--ui3n-chip-height);
101
+ padding: var(--ui3n-chip-padding);
95
102
  width: max-content;
96
- max-width: v-bind('maxWidth');
97
- background-color: v-bind('bgColor');
103
+ max-width: var(--ui3n-chip-max-width);
104
+ background-color: var(--ui3n-chip-bg-color);
98
105
  justify-content: flex-start;
99
106
  align-items: center;
107
+ column-gap: 4px;
100
108
 
101
109
  &.closeable:not(.withIcon) {
102
110
  .body {
@@ -106,31 +114,27 @@
106
114
 
107
115
  &.withIcon:not(.closeable) {
108
116
  .body {
109
- max-width: calc(100% - v-bind(height) - 4px);
117
+ max-width: calc(100% - var(--ui3n-chip-height) - 4px);
110
118
  }
111
119
  }
112
120
 
113
121
  &.closable.withIcon {
114
122
  .body {
115
- max-width: calc(100% - v-bind(height) - 28px);
123
+ max-width: calc(100% - var(--ui3n-chip-height) - 28px);
116
124
  }
117
125
  }
118
126
  }
119
127
 
120
128
  .ui3nChipBody {
121
- font-size: v-bind('textSize');
129
+ font-size: var(--ui3n-chip-font-size);
122
130
  line-height: 1;
123
131
  font-weight: 400;
124
- color: v-bind('textColor');
132
+ color: var(--ui3n-chip-font-color);
125
133
  overflow: hidden;
126
134
  white-space: nowrap;
127
135
  text-overflow: ellipsis;
128
136
  }
129
137
 
130
- .closeBtn {
131
- margin-left: var(--spacing-xs);
132
- }
133
-
134
138
  .withIcon {
135
139
  .ui3nChipIcon {
136
140
  display: flex;
@@ -138,20 +142,19 @@
138
142
  flex-shrink: 0;
139
143
  border-radius: 50%;
140
144
  overflow: hidden;
141
- margin-right: var(--spacing-xs);
142
145
  }
143
146
  }
144
147
 
145
148
  .round {
146
- border-radius: calc(v-bind('height') / 2);
149
+ border-radius: calc(var(--ui3n-chip-height) / 2);
147
150
  }
148
151
 
149
152
  .closeable {
150
- min-width: var(--spacing-ml);
153
+ min-width: 24px;
151
154
  padding-right: 0;
152
155
  }
153
156
 
154
157
  .plain {
155
- border: 1px solid v-bind('textColor');
158
+ border: 1px solid var(--ui3n-chip-font-color);
156
159
  }
157
160
  </style>
@@ -248,7 +248,7 @@
248
248
  display: flex;
249
249
  flex-direction: column;
250
250
  height: auto;
251
- min-height: var(--spacing-xxl);
251
+ min-height: 48px;
252
252
  max-height: 95%;
253
253
  background-color: var(--color-bg-block-primary-default);
254
254
  border: 1px solid var(--color-border-block-primary-default);
@@ -281,7 +281,7 @@
281
281
  display: flex;
282
282
  justify-content: flex-start;
283
283
  align-items: center;
284
- column-gap: var(--spacing-s);
284
+ column-gap: 8px;
285
285
  padding: var(--ui3n-dialog-title-padding);
286
286
  border-bottom: 1px solid var(--color-border-block-primary-default);
287
287
 
@@ -318,7 +318,7 @@
318
318
  display: flex;
319
319
  justify-content: flex-end;
320
320
  align-items: center;
321
- gap: var(--spacing-s);
321
+ gap: 8px;
322
322
  }
323
323
 
324
324
  .loading {
@@ -4,6 +4,10 @@ import { VNode } from 'vue';
4
4
  * Drop files component properties
5
5
  */
6
6
  export interface Ui3nDropFilesProps {
7
+ /**
8
+ * HTML name attribute for form submission
9
+ */
10
+ name?: string;
7
11
  /**
8
12
  * Drop files title
9
13
  */
@@ -46,3 +50,7 @@ export interface Ui3nDropFilesSlots {
46
50
  */
47
51
  'additional-text': () => VNode;
48
52
  }
53
+
54
+ export interface Ui3nDropFilesExpose {
55
+ clear: () => void;
56
+ }
@@ -1,47 +1,47 @@
1
1
  <script lang="ts" setup>
2
- import { onMounted, ref } from 'vue';
3
- import { Ui3nResize } from '@/directives';
4
- import type { Ui3nDropFilesEmits, Ui3nDropFilesProps, Ui3nDropFilesSlots } from './types';
2
+ import { onMounted, ref, watch } from 'vue';
3
+ import Ui3nResize from '../../directives/ui3n-resize';
4
+ import type { Ui3nDropFilesEmits, Ui3nDropFilesProps, Ui3nDropFilesSlots, Ui3nDropFilesExpose } from './types';
5
5
 
6
6
  const vUi3nResize = Ui3nResize;
7
7
 
8
- withDefaults(
9
- defineProps<Ui3nDropFilesProps>(),
10
- {
11
- title: 'Upload',
12
- text: '',
13
- additionalText: '',
14
- },
15
- );
8
+ const props = withDefaults(defineProps<Ui3nDropFilesProps>(), {
9
+ name: undefined,
10
+ title: 'Upload',
11
+ text: '',
12
+ additionalText: '',
13
+ permanentDisplay: false,
14
+ });
16
15
  const emits = defineEmits<Ui3nDropFilesEmits>();
17
16
  defineSlots<Ui3nDropFilesSlots>();
18
17
 
19
18
  const wrapperElement = ref<HTMLDivElement | null>(null);
19
+ const fileInput = ref<HTMLInputElement | null>(null);
20
20
  const wrapperElementMinSize = ref(0);
21
21
  const isOverDropPlace = ref(false);
22
22
  const isOverDropZone = ref(false);
23
23
 
24
- function onDragenter(ev: MouseEvent) {
24
+ function onDragenter(ev: DragEvent) {
25
25
  ev.preventDefault();
26
26
  isOverDropPlace.value = true;
27
27
  }
28
28
 
29
- function onDragleave(ev: MouseEvent) {
29
+ function onDragleave(ev: DragEvent) {
30
30
  ev.preventDefault();
31
31
  isOverDropPlace.value = false;
32
32
  }
33
33
 
34
- function onDropzoneDragover(ev: MouseEvent) {
34
+ function onDropzoneDragover(ev: DragEvent) {
35
35
  ev.preventDefault();
36
36
  ev.stopPropagation();
37
37
  }
38
38
 
39
- function onDropzoneDragenter(ev: MouseEvent) {
39
+ function onDropzoneDragenter(ev: DragEvent) {
40
40
  ev.preventDefault();
41
41
  isOverDropZone.value = true;
42
42
  }
43
43
 
44
- function onDropzoneDragleave(ev: MouseEvent) {
44
+ function onDropzoneDragleave(ev: DragEvent) {
45
45
  ev.preventDefault();
46
46
  isOverDropZone.value = false;
47
47
  }
@@ -49,9 +49,17 @@
49
49
  function onDrop(ev: DragEvent) {
50
50
  ev.stopPropagation();
51
51
  ev.preventDefault();
52
- if (ev.dataTransfer!.files) {
53
- emits('select', ev.dataTransfer!.files);
52
+
53
+ if (ev.dataTransfer?.files) {
54
+ const files = ev.dataTransfer.files;
55
+
56
+ if (fileInput.value) {
57
+ fileInput.value.files = files;
58
+ }
59
+
60
+ emits('select', files);
54
61
  }
62
+
55
63
  isOverDropPlace.value = false;
56
64
  isOverDropZone.value = false;
57
65
  }
@@ -59,17 +67,42 @@
59
67
  function calcElementsSizes() {
60
68
  if (wrapperElement.value) {
61
69
  wrapperElementMinSize.value = Math.min(wrapperElement.value.clientHeight, wrapperElement.value.clientWidth);
62
- wrapperElement.value.style.setProperty('--dropzone-height', `${wrapperElementMinSize.value}px`);
70
+ wrapperElement.value.style.setProperty('--ui3n-dropzone-height', `${wrapperElementMinSize.value}px`);
71
+
63
72
  let titleFontSize = 12;
64
73
  if (wrapperElementMinSize.value > 100 && wrapperElementMinSize.value <= 240) {
65
74
  titleFontSize = 16;
66
75
  } else if (wrapperElementMinSize.value > 240) {
67
76
  titleFontSize = 20;
68
77
  }
69
- wrapperElement.value.style.setProperty('--dropzone-title-font', `${titleFontSize}px`);
78
+ wrapperElement.value.style.setProperty('--ui3n-dropzone-title-font', `${titleFontSize}px`);
79
+ }
80
+ }
81
+
82
+ function clear() {
83
+ if (fileInput.value) {
84
+ fileInput.value.value = '';
70
85
  }
86
+ isOverDropPlace.value = false;
87
+ isOverDropZone.value = false;
88
+
89
+ const dataTransfer = new DataTransfer();
90
+ emits('select', dataTransfer.files);
71
91
  }
72
92
 
93
+ defineExpose<Ui3nDropFilesExpose>({
94
+ clear,
95
+ });
96
+
97
+ watch(
98
+ () => props.name,
99
+ newName => {
100
+ if (!newName && fileInput.value) {
101
+ fileInput.value.value = '';
102
+ }
103
+ },
104
+ );
105
+
73
106
  onMounted(() => {
74
107
  calcElementsSizes();
75
108
  });
@@ -83,11 +116,21 @@
83
116
  :class="[
84
117
  $style.ui3nDropFiles,
85
118
  permanentDisplay && $style.ui3nDropFilesWithBorder,
86
- (isOverDropPlace || isOverDropZone) && $style.ui3nDropFilesWithAccentBorder
119
+ (isOverDropPlace || isOverDropZone) && $style.ui3nDropFilesWithAccentBorder,
87
120
  ]"
88
121
  @dragenter="onDragenter"
122
+ @dragover.prevent
89
123
  @dragleave="onDragleave"
90
124
  >
125
+ <input
126
+ v-if="name"
127
+ ref="fileInput"
128
+ type="file"
129
+ :name="name"
130
+ multiple
131
+ hidden
132
+ />
133
+
91
134
  <slot />
92
135
 
93
136
  <div
@@ -130,14 +173,15 @@
130
173
 
131
174
  <style lang="scss" module>
132
175
  .ui3nDropFiles {
133
- --dropzone-height: 0;
134
- --dropzone-title-font: 0;
176
+ --ui3n-dropzone-height: 0;
177
+ --ui3n-dropzone-title-font: 0;
178
+ --ui3n-dropzone-border-radius: 4px;
135
179
 
136
180
  position: relative;
137
181
  box-sizing: border-box;
138
182
  width: 100%;
139
183
  height: 100%;
140
- border-radius: var(--spacing-s);
184
+ border-radius: var(--ui3n-dropzone-border-radius);
141
185
  }
142
186
 
143
187
  .ui3nDropFilesWithBorder {
@@ -156,13 +200,13 @@
156
200
  flex-direction: column;
157
201
  justify-content: center;
158
202
  align-items: center;
159
- row-gap: var(--spacing-m);
160
- inset: var(--spacing-xs);
203
+ row-gap: 16px;
204
+ inset: 4px;
161
205
  z-index: 5;
162
206
  }
163
207
 
164
208
  .ui3nDropFilesDropzoneTitle {
165
- font-size: var(--dropzone-title-font);
209
+ font-size: var(--ui3n-dropzone-title-font);
166
210
  font-weight: 500;
167
211
  color: var(--color-text-table-secondary-default);
168
212
  margin: 0;
@@ -171,8 +215,8 @@
171
215
 
172
216
  .ui3nDropFilesDropzoneIcon {
173
217
  position: relative;
174
- width: calc(var(--dropzone-height) * 0.4);
175
- height: calc(var(--dropzone-height) * 0.4);
218
+ width: calc(var(--ui3n-dropzone-height) * 0.4);
219
+ height: calc(var(--ui3n-dropzone-height) * 0.4);
176
220
  border-radius: 50%;
177
221
  background-color: var(--color-bg-button-tritery-default);
178
222
  display: flex;
@@ -80,6 +80,14 @@ export interface Ui3nContentEditableEmits {
80
80
  * Properties of the Ui3nEditable component
81
81
  */
82
82
  export interface Ui3nEditableProps {
83
+ /**
84
+ * Root element id
85
+ */
86
+ id?: string;
87
+ /**
88
+ * HTML name attribute for form submission
89
+ */
90
+ name?: string;
83
91
  /**
84
92
  * Current value of the editable content
85
93
  */
@@ -143,3 +151,7 @@ export interface Ui3nEditableEmits {
143
151
  */
144
152
  (event: 'focusout'): void;
145
153
  }
154
+
155
+ export interface Ui3nEditableExpose {
156
+ clear: () => void;
157
+ }
@@ -3,8 +3,8 @@
3
3
  import Ui3nIcon from '@/components/ui3n-icon/ui3n-icon.vue';
4
4
  import Ui3nRipple from '@/directives/ui3n-ripple';
5
5
  import Ui3nClickOutside from '@/directives/ui3n-click-outside';
6
- import type { Ui3nEditableProps, Ui3nEditableEmits } from './types';
7
6
  import type { Nullable } from '@/types';
7
+ import type { Ui3nEditableProps, Ui3nEditableEmits, Ui3nEditableExpose } from './types';
8
8
 
9
9
  const vUi3nRipple = Ui3nRipple;
10
10
  const vUi3nClickOutside = Ui3nClickOutside;
@@ -124,6 +124,16 @@
124
124
  }
125
125
  }
126
126
 
127
+ function clear() {
128
+ value.value = '';
129
+ initialValue.value = '';
130
+ emits('update:modelValue', '');
131
+ }
132
+
133
+ defineExpose<Ui3nEditableExpose>({
134
+ clear,
135
+ });
136
+
127
137
  watch(
128
138
  () => props.modelValue,
129
139
  (val, oVal) => {
@@ -140,14 +150,31 @@
140
150
  !props.disabled && emits('toggle:editMode', val);
141
151
  },
142
152
  );
153
+
154
+ watch(
155
+ () => props.name,
156
+ newName => {
157
+ if (!newName) {
158
+ clear();
159
+ }
160
+ },
161
+ );
143
162
  </script>
144
163
 
145
164
  <template>
146
165
  <div
166
+ :id="id"
147
167
  v-ui3n-click-outside="onClickOutside"
148
168
  :class="[$style.ui3nEditable, disabled && $style.ui3nEditableDisabled]"
149
- @focusin="emits('focusin', $event);"
169
+ @focusin="emits('focusin', $event)"
150
170
  >
171
+ <input
172
+ v-if="name"
173
+ type="hidden"
174
+ :name="name"
175
+ :value="value"
176
+ />
177
+
151
178
  <template v-if="inEdit">
152
179
  <span
153
180
  ref="hiddenEl"
@@ -165,7 +192,7 @@
165
192
  @keydown.enter="done"
166
193
  @keydown.tab="done"
167
194
  @keydown.esc="cancel"
168
- >
195
+ />
169
196
 
170
197
  <div
171
198
  v-ui3n-ripple
@@ -224,16 +251,21 @@
224
251
  --ui3n-editable-min-width: v-bind(cssMinWidth);
225
252
  --ui3n-editable-max-width: v-bind(cssMaxWidth);
226
253
  --ui3n-editable-height: 24px;
254
+ --ui3n-editable-font-size: 12px;
255
+ --ui3n-editable-border-radius: 4px;
256
+ --ui3n-editable-padding-base: 4px;
257
+ --ui3n-editable-padding: 4px 44px 4px 4px;
258
+ --ui3n-editable-button-size: 16px;
227
259
 
228
260
  position: relative;
229
261
  box-sizing: border-box;
230
262
  width: max-content;
231
263
  max-width: var(--ui3n-editable-max-width);
232
264
  height: var(--ui3n-editable-height);
233
- border-radius: var(--spacing-xs);
234
- font-size: var(--font-12);
265
+ border-radius: var(--ui3n-editable-border-radius);
266
+ font-size: var(--ui3n-editable-font-size);
235
267
  font-weight: 400;
236
- line-height: var(--font-16);
268
+ line-height: 1.33;
237
269
  color: var(--color-text-table-primary-default);
238
270
  overflow: hidden;
239
271
  }
@@ -248,8 +280,8 @@
248
280
  height: var(--ui3n-editable-height);
249
281
  min-width: var(--ui3n-editable-min-width);
250
282
  max-width: var(--ui3n-editable-max-width);
251
- padding: var(--spacing-xs) 44px var(--spacing-xs) var(--spacing-xs);
252
- border-radius: var(--spacing-xs);
283
+ padding: var(--ui3n-editable-padding);
284
+ border-radius: var(--ui3n-editable-border-radius);
253
285
  display: flex;
254
286
  justify-content: flex-start;
255
287
  align-items: center;
@@ -278,19 +310,19 @@
278
310
  position: relative;
279
311
  min-width: var(--ui3n-editable-min-width);
280
312
  max-width: calc(100% - 52px);
281
- padding: var(--spacing-xs) 44px var(--spacing-xs) var(--spacing-xs);
282
- font-size: var(--font-12);
313
+ padding: var(--ui3n-editable-padding);
314
+ font-size: var(--ui3n-editable-font-size);
283
315
  font-weight: 400;
284
- line-height: var(--font-16);
285
- border-radius: var(--spacing-xs);
316
+ line-height: 1.33;
317
+ border-radius: var(--ui3n-editable-border-radius);
286
318
 
287
319
  &::placeholder {
288
320
  color: var(--color-text-table-secondary-default);
289
321
  }
290
322
 
291
323
  &.inEdit {
292
- padding-top: calc(var(--spacing-xs) - 1px);
293
- padding-bottom: calc(var(--spacing-xs) - 1px);
324
+ padding-top: calc(var(--ui3n-editable-padding-base) - 1px);
325
+ padding-bottom: calc(var(--ui3n-editable-padding-base) - 1px);
294
326
 
295
327
  &:not(.inEditWarning) {
296
328
  border: 1px solid var(--color-border-table-accent-default);
@@ -314,10 +346,10 @@
314
346
 
315
347
  .btn {
316
348
  position: absolute;
317
- width: var(--spacing-m);
318
- min-width: var(--spacing-m);
319
- height: var(--spacing-m);
320
- min-height: var(--spacing-m);
349
+ width: var(--ui3n-editable-button-size);
350
+ min-width: var(--ui3n-editable-button-size);
351
+ height: var(--ui3n-editable-button-size);
352
+ min-height: var(--ui3n-editable-button-size);
321
353
  border-radius: 50%;
322
354
  background-color: transparent;
323
355
  cursor: pointer;
@@ -334,20 +366,20 @@
334
366
  }
335
367
 
336
368
  &.editBtn {
337
- top: var(--spacing-xs);
338
- right: var(--spacing-xs);
369
+ top: 4px;
370
+ right: 4px;
339
371
  opacity: 0;
340
372
  }
341
373
 
342
374
  &.cancelBtn {
343
- top: var(--spacing-xs);
344
- right: var(--spacing-xs);
375
+ top: 4px;
376
+ right: 4px;
345
377
  opacity: 1;
346
378
  }
347
379
 
348
380
  &.doneBtn {
349
- top: var(--spacing-xs);
350
- right: var(--spacing-ml);
381
+ top: 4px;
382
+ right: 24px;
351
383
  opacity: 1;
352
384
  }
353
385
  }
@@ -1,4 +1,8 @@
1
1
  export interface Ui3nIconProps {
2
+ /**
3
+ * Root element id
4
+ */
5
+ id?: string;
2
6
  /** Icon name */
3
7
  icon: string;
4
8
  /** Icon title */
@@ -21,5 +25,5 @@ export interface Ui3nIconProps {
21
25
 
22
26
  export interface Ui3nIconEmits {
23
27
  /** Called when the icon is clicked */
24
- (ev: 'click', value: Event): void;
28
+ (ev: 'click', value: MouseEvent): void;
25
29
  }