@v1nt1248/3nclient-lib 0.3.29 → 0.3.31

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 (190) hide show
  1. package/dist/chunks/{ui3n-notification-Dr_3Td9N.js → ui3n-notification-DPC5Ke4b.js} +96 -97
  2. package/dist/{components → src/components}/index.d.ts +3 -3
  3. package/dist/{components → src/components}/ui3n-autocomplete/types.d.ts +5 -0
  4. package/dist/{components → src/components}/ui3n-breadcrumbs/types.d.ts +2 -0
  5. package/dist/{components → src/components}/ui3n-dialog/types.d.ts +1 -1
  6. package/dist/{components → src/components}/ui3n-editable/types.d.ts +1 -1
  7. package/dist/{components → src/components}/ui3n-editable/ui3n-editable.d.ts +1 -1
  8. package/dist/{components → src/components}/ui3n-editable/useContentEditable.d.ts +1 -1
  9. package/dist/{components → src/components}/ui3n-input/types.d.ts +2 -2
  10. package/dist/{components → src/components}/ui3n-menu/types.d.ts +21 -1
  11. package/dist/{components → src/components}/ui3n-menu/ui3n-menu.d.ts +3 -0
  12. package/dist/{components → src/components}/ui3n-mobile-menu/ui3n-mobile-menu.d.ts +2 -2
  13. package/dist/{components → src/components}/ui3n-notification/types.d.ts +0 -4
  14. package/dist/src/components/ui3n-notification/ui3n-notification-container.d.ts +11 -0
  15. package/dist/{components → src/components}/ui3n-notification/ui3n-notification.d.ts +1 -1
  16. package/dist/{components → src/components}/ui3n-progress/ui3n-progress-circular.d.ts +3 -3
  17. package/dist/{components → src/components}/ui3n-progress/ui3n-progress-linear.d.ts +2 -0
  18. package/dist/{components → src/components}/ui3n-selector/types.d.ts +1 -11
  19. package/dist/{components → src/components}/ui3n-step-line-bar/ui3n-step-line-bar.d.ts +1 -0
  20. package/dist/{components → src/components}/ui3n-switch/ui3n-switch.d.ts +2 -6
  21. package/dist/{components → src/components}/ui3n-table/composables/useTable.d.ts +4 -3
  22. package/dist/{components → src/components}/ui3n-text/ui3n-text.d.ts +1 -0
  23. package/dist/{components → src/components}/ui3n-tooltip/ui3n-tooltip.d.ts +1 -0
  24. package/dist/{index.d.ts → src/index.d.ts} +1 -1
  25. package/dist/{plugins → src/plugins}/dialogs/dialogs.d.ts +2 -2
  26. package/dist/{plugins → src/plugins}/dialogs/store-dialog.d.ts +2 -2
  27. package/dist/{plugins → src/plugins}/dialogs/types.d.ts +1 -1
  28. package/dist/{plugins → src/plugins}/notifications/store-notifications.d.ts +1 -1
  29. package/dist/{plugins → src/plugins}/notifications/types.d.ts +1 -1
  30. package/dist/{ui3n-components.d.ts → src/ui3n-components.d.ts} +1 -1
  31. package/dist/{ui3n-plugins.d.ts → src/ui3n-plugins.d.ts} +5 -5
  32. package/dist/{utils → src/utils}/files/create-video-thumbnail.d.ts +1 -1
  33. package/dist/{utils → src/utils}/for-vue/try-on-scope-dispose.d.ts +1 -1
  34. package/dist/{utils → src/utils}/for-vue/unref-element.d.ts +1 -1
  35. package/dist/src/utils/processes/scheduler-yield.d.ts +1 -0
  36. package/dist/{utils → src/utils}/processes/task-runner.d.ts +1 -1
  37. package/dist/style.css +1 -1
  38. package/dist/ui3n-components.js +1196 -1137
  39. package/dist/ui3n-plugins.js +56 -43
  40. package/package.json +2 -2
  41. package/src/components/index.ts +9 -2
  42. package/src/components/ui3n-autocomplete/types.ts +5 -0
  43. package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +9 -5
  44. package/src/components/ui3n-breadcrumbs/types.ts +2 -0
  45. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +45 -35
  46. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +12 -1
  47. package/src/components/ui3n-checkbox/ui3n-checkbox.vue +33 -67
  48. package/src/components/ui3n-editable/ui3n-editable.vue +68 -46
  49. package/src/components/ui3n-emoji/ui3n-emoji.vue +21 -27
  50. package/src/components/ui3n-icon/ui3n-icon.vue +13 -5
  51. package/src/components/ui3n-input/types.ts +2 -2
  52. package/src/components/ui3n-input/ui3n-input.vue +15 -9
  53. package/src/components/ui3n-menu/types.ts +24 -1
  54. package/src/components/ui3n-menu/ui3n-menu.vue +133 -11
  55. package/src/components/ui3n-mobile-menu/ui3n-mobile-menu.vue +87 -38
  56. package/src/components/ui3n-notification/types.ts +0 -4
  57. package/src/components/ui3n-notification/ui3n-notification-container.vue +62 -0
  58. package/src/components/ui3n-notification/ui3n-notification.vue +74 -70
  59. package/src/components/ui3n-progress/ui3n-progress-circular.vue +80 -120
  60. package/src/components/ui3n-progress/ui3n-progress-linear.vue +32 -15
  61. package/src/components/ui3n-radio-group/ui3n-radio-group.vue +2 -1
  62. package/src/components/ui3n-radio-group/ui3n-radio.vue +38 -47
  63. package/src/components/ui3n-scrollbar-horizontal/{ui3n-scroolbar-horizontal.vue → ui3n-scrollbar-horizontal.vue} +6 -8
  64. package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +10 -6
  65. package/src/components/ui3n-selector/types.ts +1 -10
  66. package/src/components/ui3n-selector/ui3n-selector.vue +49 -47
  67. package/src/components/ui3n-slider/ui3n-slider.vue +6 -9
  68. package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +5 -1
  69. package/src/components/ui3n-switch/ui3n-switch.vue +24 -19
  70. package/src/components/ui3n-table/composables/useTable.ts +37 -22
  71. package/src/components/ui3n-table/ui3n-table-sort-icon.vue +6 -1
  72. package/src/components/ui3n-table/ui3n-table.vue +3 -1
  73. package/src/components/ui3n-tabs/ui3n-tabs.vue +0 -23
  74. package/src/components/ui3n-text/ui3n-text.vue +36 -8
  75. package/src/components/ui3n-tooltip/ui3n-tooltip.vue +39 -18
  76. package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +2 -2
  77. package/dist/utils/processes/scheduler-yield.d.ts +0 -1
  78. /package/dist/{components → src/components}/ui3n-autocomplete/ui3n-autocomplete.d.ts +0 -0
  79. /package/dist/{components → src/components}/ui3n-badge/types.d.ts +0 -0
  80. /package/dist/{components → src/components}/ui3n-badge/ui3n-badge-simple.d.ts +0 -0
  81. /package/dist/{components → src/components}/ui3n-badge/ui3n-badge.d.ts +0 -0
  82. /package/dist/{components → src/components}/ui3n-breadcrumbs/ui3n-breadcrumb.d.ts +0 -0
  83. /package/dist/{components → src/components}/ui3n-breadcrumbs/ui3n-breadcrumbs.d.ts +0 -0
  84. /package/dist/{components → src/components}/ui3n-button/constants.d.ts +0 -0
  85. /package/dist/{components → src/components}/ui3n-button/types.d.ts +0 -0
  86. /package/dist/{components → src/components}/ui3n-button/ui3n-button.d.ts +0 -0
  87. /package/dist/{components → src/components}/ui3n-checkbox/types.d.ts +0 -0
  88. /package/dist/{components → src/components}/ui3n-checkbox/ui3n-checkbox.d.ts +0 -0
  89. /package/dist/{components → src/components}/ui3n-chip/types.d.ts +0 -0
  90. /package/dist/{components → src/components}/ui3n-chip/ui3n-chip.d.ts +0 -0
  91. /package/dist/{components → src/components}/ui3n-dialog/ui3n-dialog-provider.d.ts +0 -0
  92. /package/dist/{components → src/components}/ui3n-dialog/ui3n-dialog.d.ts +0 -0
  93. /package/dist/{components → src/components}/ui3n-dialog/util.d.ts +0 -0
  94. /package/dist/{components → src/components}/ui3n-drop-files/types.d.ts +0 -0
  95. /package/dist/{components → src/components}/ui3n-drop-files/ui3n-drop-files.d.ts +0 -0
  96. /package/dist/{components → src/components}/ui3n-emoji/types.d.ts +0 -0
  97. /package/dist/{components → src/components}/ui3n-emoji/ui3n-emoji.d.ts +0 -0
  98. /package/dist/{components → src/components}/ui3n-icon/types.d.ts +0 -0
  99. /package/dist/{components → src/components}/ui3n-icon/ui3n-icon.d.ts +0 -0
  100. /package/dist/{components → src/components}/ui3n-input/ui3n-input.d.ts +0 -0
  101. /package/dist/{components → src/components}/ui3n-input-file/types.d.ts +0 -0
  102. /package/dist/{components → src/components}/ui3n-input-file/ui3n-input-file.d.ts +0 -0
  103. /package/dist/{components → src/components}/ui3n-list/types.d.ts +0 -0
  104. /package/dist/{components → src/components}/ui3n-list/ui3n-list.d.ts +0 -0
  105. /package/dist/{components → src/components}/ui3n-mobile-menu/types.d.ts +0 -0
  106. /package/dist/{components → src/components}/ui3n-mobile-menu-item/types.d.ts +0 -0
  107. /package/dist/{components → src/components}/ui3n-mobile-menu-item/ui3n-mobile-menu-item.d.ts +0 -0
  108. /package/dist/{components → src/components}/ui3n-progress/types.d.ts +0 -0
  109. /package/dist/{components → src/components}/ui3n-radio-group/types.d.ts +0 -0
  110. /package/dist/{components → src/components}/ui3n-radio-group/ui3n-radio-group.d.ts +0 -0
  111. /package/dist/{components → src/components}/ui3n-radio-group/ui3n-radio.d.ts +0 -0
  112. /package/dist/{components → src/components}/ui3n-scrollbar-horizontal/types.d.ts +0 -0
  113. /package/dist/{components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.d.ts → src/components/ui3n-scrollbar-horizontal/ui3n-scrollbar-horizontal.d.ts} +0 -0
  114. /package/dist/{components → src/components}/ui3n-scrollbar-vertical/types.d.ts +0 -0
  115. /package/dist/{components → src/components}/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +0 -0
  116. /package/dist/{components → src/components}/ui3n-selector/ui3n-selector.d.ts +0 -0
  117. /package/dist/{components → src/components}/ui3n-slider/types.d.ts +0 -0
  118. /package/dist/{components → src/components}/ui3n-slider/ui3n-slider.d.ts +0 -0
  119. /package/dist/{components → src/components}/ui3n-step-line-bar/types.d.ts +0 -0
  120. /package/dist/{components → src/components}/ui3n-switch/types.d.ts +0 -0
  121. /package/dist/{components → src/components}/ui3n-table/types.d.ts +0 -0
  122. /package/dist/{components → src/components}/ui3n-table/ui3n-table-sort-icon.d.ts +0 -0
  123. /package/dist/{components → src/components}/ui3n-table/ui3n-table.d.ts +0 -0
  124. /package/dist/{components → src/components}/ui3n-tabs/types.d.ts +0 -0
  125. /package/dist/{components → src/components}/ui3n-tabs/ui3n-tabs.d.ts +0 -0
  126. /package/dist/{components → src/components}/ui3n-text/types.d.ts +0 -0
  127. /package/dist/{components → src/components}/ui3n-tooltip/types.d.ts +0 -0
  128. /package/dist/{components → src/components}/ui3n-virtual-scroll/types.d.ts +0 -0
  129. /package/dist/{components → src/components}/ui3n-virtual-scroll/ui3n-virtual-scroll.d.ts +0 -0
  130. /package/dist/{composables → src/composables}/index.d.ts +0 -0
  131. /package/dist/{composables → src/composables}/useDblClickHandler.d.ts +0 -0
  132. /package/dist/{constants → src/constants}/emoticons.d.ts +0 -0
  133. /package/dist/{constants → src/constants}/general.d.ts +0 -0
  134. /package/dist/{constants → src/constants}/index.d.ts +0 -0
  135. /package/dist/{constants → src/constants}/plugins-keys.d.ts +0 -0
  136. /package/dist/{demo → src/demo}/constants.d.ts +0 -0
  137. /package/dist/{directives → src/directives}/index.d.ts +0 -0
  138. /package/dist/{directives → src/directives}/ui3n-click-outside.d.ts +0 -0
  139. /package/dist/{directives → src/directives}/ui3n-html.d.ts +0 -0
  140. /package/dist/{directives → src/directives}/ui3n-long-press.d.ts +0 -0
  141. /package/dist/{directives → src/directives}/ui3n-resize.d.ts +0 -0
  142. /package/dist/{directives → src/directives}/ui3n-ripple.d.ts +0 -0
  143. /package/dist/{directives → src/directives}/ui3n-title.d.ts +0 -0
  144. /package/dist/{plugins → src/plugins}/index.d.ts +0 -0
  145. /package/dist/{plugins → src/plugins}/notifications/notifications.d.ts +0 -0
  146. /package/dist/{plugins → src/plugins}/vue-bus/store-vue-bus.d.ts +0 -0
  147. /package/dist/{plugins → src/plugins}/vue-bus/types.d.ts +0 -0
  148. /package/dist/{plugins → src/plugins}/vue-bus/vue-bus.d.ts +0 -0
  149. /package/dist/{types → src/types}/components.types.d.ts +0 -0
  150. /package/dist/{types → src/types}/directives.types.d.ts +0 -0
  151. /package/dist/{types → src/types}/index.d.ts +0 -0
  152. /package/dist/{types → src/types}/plugins.types.d.ts +0 -0
  153. /package/dist/{types → src/types}/utils.types.d.ts +0 -0
  154. /package/dist/{ui3n-utils.d.ts → src/ui3n-utils.d.ts} +0 -0
  155. /package/dist/{utils → src/utils}/copy-to-clipboard.d.ts +0 -0
  156. /package/dist/{utils → src/utils}/debounce.d.ts +0 -0
  157. /package/dist/{utils → src/utils}/execute-function.d.ts +0 -0
  158. /package/dist/{utils → src/utils}/files/b64-to-blob.d.ts +0 -0
  159. /package/dist/{utils → src/utils}/files/blob-from-data-url.d.ts +0 -0
  160. /package/dist/{utils → src/utils}/files/blob-to-b64.d.ts +0 -0
  161. /package/dist/{utils → src/utils}/files/file-to-uint8array.d.ts +0 -0
  162. /package/dist/{utils → src/utils}/files/format-file-size.d.ts +0 -0
  163. /package/dist/{utils → src/utils}/files/get-file-extension.d.ts +0 -0
  164. /package/dist/{utils → src/utils}/files/is-file-archive.d.ts +0 -0
  165. /package/dist/{utils → src/utils}/files/is-file-audio.d.ts +0 -0
  166. /package/dist/{utils → src/utils}/files/is-file-image.d.ts +0 -0
  167. /package/dist/{utils → src/utils}/files/is-file-video.d.ts +0 -0
  168. /package/dist/{utils → src/utils}/files/mime-types.d.ts +0 -0
  169. /package/dist/{utils → src/utils}/files/resize-image.d.ts +0 -0
  170. /package/dist/{utils → src/utils}/files/uint8-to-data-url.d.ts +0 -0
  171. /package/dist/{utils → src/utils}/for-web3n.d.ts +0 -0
  172. /package/dist/{utils → src/utils}/get-random-id.d.ts +0 -0
  173. /package/dist/{utils → src/utils}/index.d.ts +0 -0
  174. /package/dist/{utils → src/utils}/processes/deferred.d.ts +0 -0
  175. /package/dist/{utils → src/utils}/processes/named-procs.d.ts +0 -0
  176. /package/dist/{utils → src/utils}/processes/single.d.ts +0 -0
  177. /package/dist/{utils → src/utils}/processes/sleep.d.ts +0 -0
  178. /package/dist/{utils → src/utils}/remove-whitespace-in-string.d.ts +0 -0
  179. /package/dist/{utils → src/utils}/round.d.ts +0 -0
  180. /package/dist/{utils → src/utils}/sqlite-on-3nstorage/index.d.ts +0 -0
  181. /package/dist/{utils → src/utils}/sqlite-on-3nstorage/types.d.ts +0 -0
  182. /package/dist/{utils → src/utils}/textarea-max-rows.d.ts +0 -0
  183. /package/dist/{utils → src/utils}/ui/capitalize.d.ts +0 -0
  184. /package/dist/{utils → src/utils}/ui/generate-color.d.ts +0 -0
  185. /package/dist/{utils → src/utils}/ui/has-slot-content.d.ts +0 -0
  186. /package/dist/{utils → src/utils}/ui/html2text.d.ts +0 -0
  187. /package/dist/{utils → src/utils}/ui/invert-color.d.ts +0 -0
  188. /package/dist/{utils → src/utils}/ui/mark-search.d.ts +0 -0
  189. /package/dist/{utils → src/utils}/ui/prepare-date-as-string.d.ts +0 -0
  190. /package/dist/{utils → src/utils}/ui/selection.d.ts +0 -0
@@ -7,8 +7,16 @@
7
7
  const emits = defineEmits<Ui3nMobileMenuEmits>();
8
8
  defineSlots<Ui3nMobileMenuSlots>();
9
9
 
10
- const widthCss = computed(() => props.width || '240px');
11
- const blurValue = computed(() => (props.withBlur ? '2px' : '0'));
10
+ const inlineStyles = computed(() => {
11
+ const numericWidth = !isNaN(Number(props.width));
12
+ const widthStr = numericWidth ? `${props.width}px` : props.width || '240px';
13
+ const blurStr = props.withBlur ? '2px' : '0';
14
+
15
+ return {
16
+ '--ui3n-menu-width-custom': widthStr,
17
+ '--ui3n-menu-blur-custom': blurStr,
18
+ };
19
+ });
12
20
 
13
21
  function toggleMenu() {
14
22
  emits('update:modelValue', !props.modelValue);
@@ -16,7 +24,10 @@
16
24
  </script>
17
25
 
18
26
  <template>
19
- <div :class="$style.ui3nMobileMenu">
27
+ <div
28
+ :class="$style.ui3nMobileMenu"
29
+ :style="inlineStyles"
30
+ >
20
31
  <ui3n-button
21
32
  v-if="!modelValue"
22
33
  type="icon"
@@ -31,46 +42,72 @@
31
42
  <transition name="slide-fade">
32
43
  <div
33
44
  v-if="modelValue"
34
- :class="$style.appMenu"
45
+ :class="$style.menuWrapper"
35
46
  >
36
- <div :class="$style.appMenuHeader">
37
- <slot name="header" />
38
- </div>
39
- <div :class="$style.appMenuBody">
40
- <slot name="menuBody" />
41
- </div>
42
- <div :class="$style.appMenuFooter">
43
- <slot name="footer" />
44
- </div>
45
-
46
- <ui3n-button
47
- type="icon"
48
- icon="round-close"
49
- color="transparent"
50
- icon-color="var(--color-icon-block-secondary-default)"
51
- icon-size="32"
52
- :class="$style.closeBtn"
53
- @click.stop.prevent="toggleMenu"
47
+ <div
48
+ :class="$style.overlay"
49
+ @click="toggleMenu"
54
50
  />
51
+
52
+ <div :class="$style.menuPanel">
53
+ <div :class="$style.appMenu">
54
+ <div :class="$style.appMenuHeader">
55
+ <slot name="header" />
56
+ </div>
57
+ <div :class="$style.appMenuBody">
58
+ <slot name="menuBody" />
59
+ </div>
60
+ <div :class="$style.appMenuFooter">
61
+ <slot name="footer" />
62
+ </div>
63
+ </div>
64
+
65
+ <ui3n-button
66
+ type="icon"
67
+ icon="round-close"
68
+ color="transparent"
69
+ icon-color="var(--color-icon-block-secondary-default)"
70
+ icon-size="32"
71
+ :class="$style.closeBtn"
72
+ @click.stop.prevent="toggleMenu"
73
+ />
74
+ </div>
55
75
  </div>
56
76
  </transition>
57
77
  </div>
58
- <div
59
- v-if="modelValue"
60
- :class="$style.overlay"
61
- />
62
78
  </template>
63
79
 
64
80
  <style lang="scss" module>
65
81
  @use '../../assets/styles/mixins' as mixins;
82
+
66
83
  .ui3nMobileMenu {
67
- --ui3n-menu-width-custom: v-bind(widthCss);
84
+ --ui3n-menu-width-custom: 240px;
68
85
 
86
+ display: inline-block;
69
87
  width: max-content;
70
88
  }
71
89
 
72
- .appMenu {
90
+ .menuWrapper {
73
91
  position: fixed;
92
+ inset: 0;
93
+ width: 100vw;
94
+ height: 100dvh;
95
+ z-index: 1050;
96
+ pointer-events: auto;
97
+ }
98
+
99
+ .menuPanel {
100
+ position: absolute;
101
+ top: 0;
102
+ left: 0;
103
+ display: flex;
104
+ align-items: flex-start;
105
+ height: 100dvh;
106
+ z-index: 2;
107
+ }
108
+
109
+ .appMenu {
110
+ position: relative;
74
111
  top: 0;
75
112
  left: 0;
76
113
  width: var(--ui3n-menu-width-custom);
@@ -79,13 +116,13 @@
79
116
  flex-direction: column;
80
117
  justify-content: flex-start;
81
118
  align-items: stretch;
82
- min-height: 100dvh;
83
- max-height: 100dvh;
119
+ height: 100%;
84
120
  color: var(--color-text-block-primary-default);
85
121
  background-color: var(--color-bg-block-primary-default);
86
122
  overflow-x: hidden;
87
123
  overflow-y: auto;
88
- z-index: 1050;
124
+ box-shadow: 4px 0 16px var(--shadow-close);
125
+ flex-shrink: 0;
89
126
  }
90
127
 
91
128
  .appMenuHeader {
@@ -112,20 +149,20 @@
112
149
  }
113
150
 
114
151
  .closeBtn {
115
- position: fixed;
152
+ margin-top: 8px;
153
+ margin-left: 8px;
116
154
  min-width: 48px !important;
117
155
  height: 48px;
118
- top: 8px;
119
- left: calc(var(--ui3n-menu-width-custom) + 8px);
120
- z-index: 1005;
156
+ flex-shrink: 0;
121
157
  }
122
158
 
123
159
  .overlay {
124
- position: fixed;
160
+ position: absolute;
125
161
  inset: 0;
126
162
  background-color: oklch(from var(--color-bg-block-primary-default) calc(l * 0.1) c h / 0.5);
127
- backdrop-filter: blur(v-bind(blurValue));
128
- z-index: 1000;
163
+ backdrop-filter: blur(var(--ui3n-menu-blur-custom, 0px));
164
+ z-index: 1;
165
+ cursor: pointer;
129
166
  }
130
167
  </style>
131
168
 
@@ -135,17 +172,29 @@
135
172
  transition:
136
173
  transform 0.2s ease-in-out,
137
174
  opacity 0.2s ease-in-out;
175
+
176
+ div[class*='menuPanel'] {
177
+ transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
178
+ }
138
179
  }
139
180
 
140
181
  .slide-fade-enter-from,
141
182
  .slide-fade-leave-to {
142
183
  transform: translateX(calc(var(--ui3n-menu-width-custom) * -1));
143
184
  opacity: 0;
185
+
186
+ div[class*='menuPanel'] {
187
+ transform: translateX(-100%);
188
+ }
144
189
  }
145
190
 
146
191
  .slide-fade-enter-to,
147
192
  .slide-fade-leave-from {
148
193
  transform: translateX(0);
149
194
  opacity: 1;
195
+
196
+ div[class*='menuPanel'] {
197
+ transform: translateX(0);
198
+ }
150
199
  }
151
200
  </style>
@@ -24,10 +24,6 @@ export interface Ui3nNotificationProps {
24
24
  * @default false
25
25
  */
26
26
  withIcon?: boolean;
27
- /**
28
- * Teleport target
29
- */
30
- teleport?: string;
31
27
  /**
32
28
  * Called when notification opens
33
29
  */
@@ -0,0 +1,62 @@
1
+ <script lang="ts" setup>
2
+ import { ref } from 'vue';
3
+ import Ui3nNotification from './ui3n-notification.vue';
4
+ import type { Ui3nNotificationProps } from './types';
5
+
6
+ interface IdentifiableNotice extends Ui3nNotificationProps {
7
+ id: string;
8
+ }
9
+
10
+ const notices = ref<IdentifiableNotice[]>([]);
11
+
12
+ function add(notice: IdentifiableNotice) {
13
+ notices.value.push(notice);
14
+ }
15
+
16
+ function remove(id: string) {
17
+ notices.value = notices.value.filter(n => n.id !== id);
18
+ }
19
+
20
+ function onClose(notice: IdentifiableNotice) {
21
+ if (notice.onClose) {
22
+ notice.onClose();
23
+ }
24
+
25
+ remove(notice.id);
26
+ }
27
+
28
+ defineExpose({ add, remove });
29
+ </script>
30
+
31
+ <template>
32
+ <div
33
+ id="ui3n-notifications-container"
34
+ :class="$style.ui3nNotificationsWrapper"
35
+ >
36
+ <ui3n-notification
37
+ v-for="notice in notices"
38
+ :key="notice.id"
39
+ v-bind="notice"
40
+ :on-close="() => onClose(notice)"
41
+ />
42
+ </div>
43
+ </template>
44
+
45
+ <style lang="scss" module>
46
+ .ui3nNotificationsWrapper {
47
+ position: fixed;
48
+ top: 24px;
49
+ right: 24px;
50
+ z-index: 9999;
51
+ display: flex;
52
+ flex-direction: column;
53
+ gap: 8px;
54
+ max-width: 380px;
55
+ width: 100%;
56
+ pointer-events: none;
57
+ }
58
+
59
+ .ui3nNotificationsWrapper :global([class*='ui3nNotification']) {
60
+ pointer-events: auto;
61
+ }
62
+ </style>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { computed, onMounted, onBeforeUnmount, useCssModule } from 'vue';
2
+ import { computed, onMounted, onBeforeUnmount, ref, useCssModule } from 'vue';
3
3
  import Ui3nIcon from '../ui3n-icon/ui3n-icon.vue';
4
4
  import Ui3nButton from '../ui3n-button/ui3n-button.vue';
5
5
  import type { Ui3nNotificationProps } from './types';
@@ -9,58 +9,64 @@
9
9
  position: 'center',
10
10
  duration: 0,
11
11
  withIcon: true,
12
- onOpen: () => void 0,
13
- onClose: () => void 0,
12
+ onOpen: () => {},
13
+ onClose: () => {},
14
14
  });
15
15
 
16
- const $style = useCssModule();
16
+ let timerId: ReturnType<typeof setTimeout> | null = null;
17
17
 
18
- const stylesByTypes = {
19
- success: {
20
- color: 'var(--success-content-default)',
21
- icon: 'round-check-circle',
22
- iconColor: 'var(--success-fill-default)',
23
- iconRotate: 0,
24
- },
25
- warning: {
26
- color: 'var(--warning-content-default)',
27
- icon: 'round-warning',
28
- iconColor: 'var(--warning-fill-default)',
29
- iconRotate: 0,
30
- },
31
- info: {
32
- color: 'var(--info-content-default)',
33
- icon: 'round-info',
34
- iconColor: 'var(--info-fill-default)',
35
- iconRotate: 180,
36
- },
37
- error: {
38
- color: 'var(--error-content-default)',
39
- icon: 'round-info',
40
- iconColor: 'var(--error-fill-default)',
41
- iconRotate: 180,
42
- },
43
- };
18
+ const $style = useCssModule();
44
19
 
45
- let timerId: ReturnType<typeof setTimeout> | null = null;
20
+ const currentTypeConfig = computed(() => {
21
+ const stylesByTypes = {
22
+ success: {
23
+ color: 'var(--success-content-default)',
24
+ icon: 'round-check-circle',
25
+ iconColor: 'var(--success-fill-default)',
26
+ iconRotate: 0,
27
+ },
28
+ warning: {
29
+ color: 'var(--warning-content-default)',
30
+ icon: 'round-warning',
31
+ iconColor: 'var(--warning-fill-default)',
32
+ iconRotate: 0,
33
+ },
34
+ info: {
35
+ color: 'var(--info-content-default)',
36
+ icon: 'round-info',
37
+ iconColor: 'var(--info-fill-default)',
38
+ iconRotate: 180,
39
+ },
40
+ error: {
41
+ color: 'var(--error-content-default)',
42
+ icon: 'round-info',
43
+ iconColor: 'var(--error-fill-default)',
44
+ iconRotate: 180,
45
+ },
46
+ };
47
+ return stylesByTypes[props.type || 'info'];
48
+ });
46
49
 
47
50
  const mainCssClasses = computed(() => {
48
51
  const val = [$style.ui3nNotification, $style[`${props.type}Type`], $style[`${props.position}Position`]];
49
52
  props.withIcon && val.push($style.withIcon);
50
-
51
53
  return val;
52
54
  });
53
55
 
54
56
  function closeNotification() {
55
- props.onClose && props.onClose();
57
+ if (props.onClose) {
58
+ props.onClose();
59
+ }
56
60
  }
57
61
 
58
62
  onMounted(() => {
59
- props.onOpen && props.onOpen();
63
+ if (props.onOpen) {
64
+ props.onOpen();
65
+ }
60
66
 
61
67
  if (props.duration > 0) {
62
68
  timerId = setTimeout(() => {
63
- props.onClose();
69
+ closeNotification();
64
70
  }, props.duration);
65
71
  }
66
72
  });
@@ -73,43 +79,38 @@
73
79
  </script>
74
80
 
75
81
  <template>
76
- <component
77
- :is="teleport ? 'Teleport' : 'div'"
78
- :to="teleport"
82
+ <div
83
+ :id="id"
84
+ :class="mainCssClasses"
79
85
  >
80
86
  <div
81
- :id="id"
82
- :class="mainCssClasses"
87
+ v-if="withIcon"
88
+ :class="$style.ui3nNotificationIcon"
83
89
  >
84
- <div
85
- v-if="withIcon"
86
- :class="$style.ui3nNotificationIcon"
87
- >
88
- <ui3n-icon
89
- :icon="stylesByTypes[type!].icon"
90
- size="16"
91
- :rotate="stylesByTypes[type!].iconRotate"
92
- :color="stylesByTypes[type!].iconColor"
93
- />
94
- </div>
95
-
96
- <div :class="$style.ui3nNotificationContent">
97
- {{ content }}
98
- </div>
99
-
100
- <ui3n-button
101
- v-if="!duration"
102
- type="icon"
103
- size="small"
104
- color="transparent"
105
- icon="round-close"
106
- :icon-color="stylesByTypes[type!].color"
107
- icon-size="16"
108
- :class="$style.closeBtn"
109
- @click="closeNotification"
90
+ <ui3n-icon
91
+ :icon="currentTypeConfig.icon"
92
+ size="16"
93
+ :rotate="currentTypeConfig.iconRotate"
94
+ :color="currentTypeConfig.iconColor"
110
95
  />
111
96
  </div>
112
- </component>
97
+
98
+ <div :class="$style.ui3nNotificationContent">
99
+ {{ content }}
100
+ </div>
101
+
102
+ <ui3n-button
103
+ v-if="!duration"
104
+ type="icon"
105
+ size="small"
106
+ color="transparent"
107
+ icon="round-close"
108
+ :icon-color="currentTypeConfig.color"
109
+ icon-size="16"
110
+ :class="$style.closeBtn"
111
+ @click="closeNotification"
112
+ />
113
+ </div>
113
114
  </template>
114
115
 
115
116
  <style lang="scss" module>
@@ -122,6 +123,7 @@
122
123
 
123
124
  display: flex;
124
125
  position: relative;
126
+ box-sizing: border-box;
125
127
  z-index: 5000;
126
128
  border-radius: var(--ui3n-notification-border-radius);
127
129
  outline: 1px solid var(--color-border-control-tritery-default);
@@ -130,7 +132,7 @@
130
132
  margin-bottom: var(--ui3n-notification-margin-bottom);
131
133
  justify-content: center;
132
134
  align-items: center;
133
- gap: 4px;
135
+ gap: 8px;
134
136
  }
135
137
 
136
138
  .withIcon {
@@ -147,6 +149,7 @@
147
149
  display: flex;
148
150
  justify-content: center;
149
151
  align-items: center;
152
+ flex-shrink: 0;
150
153
  }
151
154
 
152
155
  .ui3nNotificationContent {
@@ -155,13 +158,14 @@
155
158
  font-size: var(--ui3n-notification-font-size);
156
159
  font-weight: 500;
157
160
  line-height: 1.33;
161
+ padding-right: 20px;
158
162
  }
159
163
 
160
164
  .closeBtn {
161
165
  position: absolute;
162
166
  z-index: 1;
163
- top: 0;
164
- right: 0;
167
+ top: 6px;
168
+ right: 6px;
165
169
  }
166
170
 
167
171
  .infoType {