@v1nt1248/3nclient-lib 0.3.30 → 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 (189) 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-breadcrumbs/types.d.ts +2 -0
  4. package/dist/{components → src/components}/ui3n-dialog/types.d.ts +1 -1
  5. package/dist/{components → src/components}/ui3n-editable/types.d.ts +1 -1
  6. package/dist/{components → src/components}/ui3n-editable/ui3n-editable.d.ts +1 -1
  7. package/dist/{components → src/components}/ui3n-editable/useContentEditable.d.ts +1 -1
  8. package/dist/{components → src/components}/ui3n-input/types.d.ts +2 -2
  9. package/dist/{components → src/components}/ui3n-menu/types.d.ts +16 -1
  10. package/dist/{components → src/components}/ui3n-menu/ui3n-menu.d.ts +2 -0
  11. package/dist/{components → src/components}/ui3n-mobile-menu/ui3n-mobile-menu.d.ts +2 -2
  12. package/dist/{components → src/components}/ui3n-notification/types.d.ts +0 -4
  13. package/dist/src/components/ui3n-notification/ui3n-notification-container.d.ts +11 -0
  14. package/dist/{components → src/components}/ui3n-notification/ui3n-notification.d.ts +1 -1
  15. package/dist/{components → src/components}/ui3n-progress/ui3n-progress-circular.d.ts +3 -3
  16. package/dist/{components → src/components}/ui3n-progress/ui3n-progress-linear.d.ts +2 -0
  17. package/dist/{components → src/components}/ui3n-selector/types.d.ts +1 -11
  18. package/dist/{components → src/components}/ui3n-step-line-bar/ui3n-step-line-bar.d.ts +1 -0
  19. package/dist/{components → src/components}/ui3n-switch/ui3n-switch.d.ts +2 -6
  20. package/dist/{components → src/components}/ui3n-table/composables/useTable.d.ts +4 -3
  21. package/dist/{components → src/components}/ui3n-text/ui3n-text.d.ts +1 -0
  22. package/dist/{components → src/components}/ui3n-tooltip/ui3n-tooltip.d.ts +1 -0
  23. package/dist/{index.d.ts → src/index.d.ts} +1 -1
  24. package/dist/{plugins → src/plugins}/dialogs/dialogs.d.ts +2 -2
  25. package/dist/{plugins → src/plugins}/dialogs/store-dialog.d.ts +2 -2
  26. package/dist/{plugins → src/plugins}/dialogs/types.d.ts +1 -1
  27. package/dist/{plugins → src/plugins}/notifications/store-notifications.d.ts +1 -1
  28. package/dist/{plugins → src/plugins}/notifications/types.d.ts +1 -1
  29. package/dist/{ui3n-components.d.ts → src/ui3n-components.d.ts} +1 -1
  30. package/dist/{ui3n-plugins.d.ts → src/ui3n-plugins.d.ts} +5 -5
  31. package/dist/{utils → src/utils}/files/create-video-thumbnail.d.ts +1 -1
  32. package/dist/{utils → src/utils}/for-vue/try-on-scope-dispose.d.ts +1 -1
  33. package/dist/{utils → src/utils}/for-vue/unref-element.d.ts +1 -1
  34. package/dist/src/utils/processes/scheduler-yield.d.ts +1 -0
  35. package/dist/{utils → src/utils}/processes/task-runner.d.ts +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/ui3n-components.js +1402 -1392
  38. package/dist/ui3n-plugins.js +56 -43
  39. package/package.json +2 -2
  40. package/src/components/index.ts +9 -2
  41. package/src/components/ui3n-autocomplete/ui3n-autocomplete.vue +2 -1
  42. package/src/components/ui3n-breadcrumbs/types.ts +2 -0
  43. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumb.vue +45 -35
  44. package/src/components/ui3n-breadcrumbs/ui3n-breadcrumbs.vue +12 -1
  45. package/src/components/ui3n-checkbox/ui3n-checkbox.vue +33 -67
  46. package/src/components/ui3n-editable/ui3n-editable.vue +68 -46
  47. package/src/components/ui3n-emoji/ui3n-emoji.vue +21 -27
  48. package/src/components/ui3n-icon/ui3n-icon.vue +13 -5
  49. package/src/components/ui3n-input/types.ts +2 -2
  50. package/src/components/ui3n-input/ui3n-input.vue +15 -9
  51. package/src/components/ui3n-menu/types.ts +19 -1
  52. package/src/components/ui3n-menu/ui3n-menu.vue +60 -57
  53. package/src/components/ui3n-mobile-menu/ui3n-mobile-menu.vue +87 -38
  54. package/src/components/ui3n-notification/types.ts +0 -4
  55. package/src/components/ui3n-notification/ui3n-notification-container.vue +62 -0
  56. package/src/components/ui3n-notification/ui3n-notification.vue +74 -70
  57. package/src/components/ui3n-progress/ui3n-progress-circular.vue +80 -120
  58. package/src/components/ui3n-progress/ui3n-progress-linear.vue +32 -15
  59. package/src/components/ui3n-radio-group/ui3n-radio-group.vue +2 -1
  60. package/src/components/ui3n-radio-group/ui3n-radio.vue +38 -47
  61. package/src/components/ui3n-scrollbar-horizontal/{ui3n-scroolbar-horizontal.vue → ui3n-scrollbar-horizontal.vue} +6 -8
  62. package/src/components/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.vue +10 -6
  63. package/src/components/ui3n-selector/types.ts +1 -10
  64. package/src/components/ui3n-selector/ui3n-selector.vue +49 -47
  65. package/src/components/ui3n-slider/ui3n-slider.vue +6 -9
  66. package/src/components/ui3n-step-line-bar/ui3n-step-line-bar.vue +5 -1
  67. package/src/components/ui3n-switch/ui3n-switch.vue +24 -19
  68. package/src/components/ui3n-table/composables/useTable.ts +37 -22
  69. package/src/components/ui3n-table/ui3n-table-sort-icon.vue +6 -1
  70. package/src/components/ui3n-table/ui3n-table.vue +3 -1
  71. package/src/components/ui3n-tabs/ui3n-tabs.vue +0 -23
  72. package/src/components/ui3n-text/ui3n-text.vue +36 -8
  73. package/src/components/ui3n-tooltip/ui3n-tooltip.vue +39 -18
  74. package/src/components/ui3n-virtual-scroll/ui3n-virtual-scroll.vue +2 -2
  75. package/dist/utils/processes/scheduler-yield.d.ts +0 -1
  76. /package/dist/{components → src/components}/ui3n-autocomplete/types.d.ts +0 -0
  77. /package/dist/{components → src/components}/ui3n-autocomplete/ui3n-autocomplete.d.ts +0 -0
  78. /package/dist/{components → src/components}/ui3n-badge/types.d.ts +0 -0
  79. /package/dist/{components → src/components}/ui3n-badge/ui3n-badge-simple.d.ts +0 -0
  80. /package/dist/{components → src/components}/ui3n-badge/ui3n-badge.d.ts +0 -0
  81. /package/dist/{components → src/components}/ui3n-breadcrumbs/ui3n-breadcrumb.d.ts +0 -0
  82. /package/dist/{components → src/components}/ui3n-breadcrumbs/ui3n-breadcrumbs.d.ts +0 -0
  83. /package/dist/{components → src/components}/ui3n-button/constants.d.ts +0 -0
  84. /package/dist/{components → src/components}/ui3n-button/types.d.ts +0 -0
  85. /package/dist/{components → src/components}/ui3n-button/ui3n-button.d.ts +0 -0
  86. /package/dist/{components → src/components}/ui3n-checkbox/types.d.ts +0 -0
  87. /package/dist/{components → src/components}/ui3n-checkbox/ui3n-checkbox.d.ts +0 -0
  88. /package/dist/{components → src/components}/ui3n-chip/types.d.ts +0 -0
  89. /package/dist/{components → src/components}/ui3n-chip/ui3n-chip.d.ts +0 -0
  90. /package/dist/{components → src/components}/ui3n-dialog/ui3n-dialog-provider.d.ts +0 -0
  91. /package/dist/{components → src/components}/ui3n-dialog/ui3n-dialog.d.ts +0 -0
  92. /package/dist/{components → src/components}/ui3n-dialog/util.d.ts +0 -0
  93. /package/dist/{components → src/components}/ui3n-drop-files/types.d.ts +0 -0
  94. /package/dist/{components → src/components}/ui3n-drop-files/ui3n-drop-files.d.ts +0 -0
  95. /package/dist/{components → src/components}/ui3n-emoji/types.d.ts +0 -0
  96. /package/dist/{components → src/components}/ui3n-emoji/ui3n-emoji.d.ts +0 -0
  97. /package/dist/{components → src/components}/ui3n-icon/types.d.ts +0 -0
  98. /package/dist/{components → src/components}/ui3n-icon/ui3n-icon.d.ts +0 -0
  99. /package/dist/{components → src/components}/ui3n-input/ui3n-input.d.ts +0 -0
  100. /package/dist/{components → src/components}/ui3n-input-file/types.d.ts +0 -0
  101. /package/dist/{components → src/components}/ui3n-input-file/ui3n-input-file.d.ts +0 -0
  102. /package/dist/{components → src/components}/ui3n-list/types.d.ts +0 -0
  103. /package/dist/{components → src/components}/ui3n-list/ui3n-list.d.ts +0 -0
  104. /package/dist/{components → src/components}/ui3n-mobile-menu/types.d.ts +0 -0
  105. /package/dist/{components → src/components}/ui3n-mobile-menu-item/types.d.ts +0 -0
  106. /package/dist/{components → src/components}/ui3n-mobile-menu-item/ui3n-mobile-menu-item.d.ts +0 -0
  107. /package/dist/{components → src/components}/ui3n-progress/types.d.ts +0 -0
  108. /package/dist/{components → src/components}/ui3n-radio-group/types.d.ts +0 -0
  109. /package/dist/{components → src/components}/ui3n-radio-group/ui3n-radio-group.d.ts +0 -0
  110. /package/dist/{components → src/components}/ui3n-radio-group/ui3n-radio.d.ts +0 -0
  111. /package/dist/{components → src/components}/ui3n-scrollbar-horizontal/types.d.ts +0 -0
  112. /package/dist/{components/ui3n-scrollbar-horizontal/ui3n-scroolbar-horizontal.d.ts → src/components/ui3n-scrollbar-horizontal/ui3n-scrollbar-horizontal.d.ts} +0 -0
  113. /package/dist/{components → src/components}/ui3n-scrollbar-vertical/types.d.ts +0 -0
  114. /package/dist/{components → src/components}/ui3n-scrollbar-vertical/ui3n-scrollbar-vertical.d.ts +0 -0
  115. /package/dist/{components → src/components}/ui3n-selector/ui3n-selector.d.ts +0 -0
  116. /package/dist/{components → src/components}/ui3n-slider/types.d.ts +0 -0
  117. /package/dist/{components → src/components}/ui3n-slider/ui3n-slider.d.ts +0 -0
  118. /package/dist/{components → src/components}/ui3n-step-line-bar/types.d.ts +0 -0
  119. /package/dist/{components → src/components}/ui3n-switch/types.d.ts +0 -0
  120. /package/dist/{components → src/components}/ui3n-table/types.d.ts +0 -0
  121. /package/dist/{components → src/components}/ui3n-table/ui3n-table-sort-icon.d.ts +0 -0
  122. /package/dist/{components → src/components}/ui3n-table/ui3n-table.d.ts +0 -0
  123. /package/dist/{components → src/components}/ui3n-tabs/types.d.ts +0 -0
  124. /package/dist/{components → src/components}/ui3n-tabs/ui3n-tabs.d.ts +0 -0
  125. /package/dist/{components → src/components}/ui3n-text/types.d.ts +0 -0
  126. /package/dist/{components → src/components}/ui3n-tooltip/types.d.ts +0 -0
  127. /package/dist/{components → src/components}/ui3n-virtual-scroll/types.d.ts +0 -0
  128. /package/dist/{components → src/components}/ui3n-virtual-scroll/ui3n-virtual-scroll.d.ts +0 -0
  129. /package/dist/{composables → src/composables}/index.d.ts +0 -0
  130. /package/dist/{composables → src/composables}/useDblClickHandler.d.ts +0 -0
  131. /package/dist/{constants → src/constants}/emoticons.d.ts +0 -0
  132. /package/dist/{constants → src/constants}/general.d.ts +0 -0
  133. /package/dist/{constants → src/constants}/index.d.ts +0 -0
  134. /package/dist/{constants → src/constants}/plugins-keys.d.ts +0 -0
  135. /package/dist/{demo → src/demo}/constants.d.ts +0 -0
  136. /package/dist/{directives → src/directives}/index.d.ts +0 -0
  137. /package/dist/{directives → src/directives}/ui3n-click-outside.d.ts +0 -0
  138. /package/dist/{directives → src/directives}/ui3n-html.d.ts +0 -0
  139. /package/dist/{directives → src/directives}/ui3n-long-press.d.ts +0 -0
  140. /package/dist/{directives → src/directives}/ui3n-resize.d.ts +0 -0
  141. /package/dist/{directives → src/directives}/ui3n-ripple.d.ts +0 -0
  142. /package/dist/{directives → src/directives}/ui3n-title.d.ts +0 -0
  143. /package/dist/{plugins → src/plugins}/index.d.ts +0 -0
  144. /package/dist/{plugins → src/plugins}/notifications/notifications.d.ts +0 -0
  145. /package/dist/{plugins → src/plugins}/vue-bus/store-vue-bus.d.ts +0 -0
  146. /package/dist/{plugins → src/plugins}/vue-bus/types.d.ts +0 -0
  147. /package/dist/{plugins → src/plugins}/vue-bus/vue-bus.d.ts +0 -0
  148. /package/dist/{types → src/types}/components.types.d.ts +0 -0
  149. /package/dist/{types → src/types}/directives.types.d.ts +0 -0
  150. /package/dist/{types → src/types}/index.d.ts +0 -0
  151. /package/dist/{types → src/types}/plugins.types.d.ts +0 -0
  152. /package/dist/{types → src/types}/utils.types.d.ts +0 -0
  153. /package/dist/{ui3n-utils.d.ts → src/ui3n-utils.d.ts} +0 -0
  154. /package/dist/{utils → src/utils}/copy-to-clipboard.d.ts +0 -0
  155. /package/dist/{utils → src/utils}/debounce.d.ts +0 -0
  156. /package/dist/{utils → src/utils}/execute-function.d.ts +0 -0
  157. /package/dist/{utils → src/utils}/files/b64-to-blob.d.ts +0 -0
  158. /package/dist/{utils → src/utils}/files/blob-from-data-url.d.ts +0 -0
  159. /package/dist/{utils → src/utils}/files/blob-to-b64.d.ts +0 -0
  160. /package/dist/{utils → src/utils}/files/file-to-uint8array.d.ts +0 -0
  161. /package/dist/{utils → src/utils}/files/format-file-size.d.ts +0 -0
  162. /package/dist/{utils → src/utils}/files/get-file-extension.d.ts +0 -0
  163. /package/dist/{utils → src/utils}/files/is-file-archive.d.ts +0 -0
  164. /package/dist/{utils → src/utils}/files/is-file-audio.d.ts +0 -0
  165. /package/dist/{utils → src/utils}/files/is-file-image.d.ts +0 -0
  166. /package/dist/{utils → src/utils}/files/is-file-video.d.ts +0 -0
  167. /package/dist/{utils → src/utils}/files/mime-types.d.ts +0 -0
  168. /package/dist/{utils → src/utils}/files/resize-image.d.ts +0 -0
  169. /package/dist/{utils → src/utils}/files/uint8-to-data-url.d.ts +0 -0
  170. /package/dist/{utils → src/utils}/for-web3n.d.ts +0 -0
  171. /package/dist/{utils → src/utils}/get-random-id.d.ts +0 -0
  172. /package/dist/{utils → src/utils}/index.d.ts +0 -0
  173. /package/dist/{utils → src/utils}/processes/deferred.d.ts +0 -0
  174. /package/dist/{utils → src/utils}/processes/named-procs.d.ts +0 -0
  175. /package/dist/{utils → src/utils}/processes/single.d.ts +0 -0
  176. /package/dist/{utils → src/utils}/processes/sleep.d.ts +0 -0
  177. /package/dist/{utils → src/utils}/remove-whitespace-in-string.d.ts +0 -0
  178. /package/dist/{utils → src/utils}/round.d.ts +0 -0
  179. /package/dist/{utils → src/utils}/sqlite-on-3nstorage/index.d.ts +0 -0
  180. /package/dist/{utils → src/utils}/sqlite-on-3nstorage/types.d.ts +0 -0
  181. /package/dist/{utils → src/utils}/textarea-max-rows.d.ts +0 -0
  182. /package/dist/{utils → src/utils}/ui/capitalize.d.ts +0 -0
  183. /package/dist/{utils → src/utils}/ui/generate-color.d.ts +0 -0
  184. /package/dist/{utils → src/utils}/ui/has-slot-content.d.ts +0 -0
  185. /package/dist/{utils → src/utils}/ui/html2text.d.ts +0 -0
  186. /package/dist/{utils → src/utils}/ui/invert-color.d.ts +0 -0
  187. /package/dist/{utils → src/utils}/ui/mark-search.d.ts +0 -0
  188. /package/dist/{utils → src/utils}/ui/prepare-date-as-string.d.ts +0 -0
  189. /package/dist/{utils → src/utils}/ui/selection.d.ts +0 -0
@@ -1,129 +1,76 @@
1
1
  <script lang="ts" setup>
2
- import { computed, onBeforeUnmount, ref, useCssModule, watch } from 'vue';
3
- import toNumber from 'lodash/toNumber';
2
+ import { computed } from 'vue';
4
3
  import type { Ui3nProgressCircularProps } from './types';
5
4
 
6
- const thresholdSize = 64;
7
- const indeterminateModeValues = [1, 5, 10, 15, 20, 30, 40, 50, 60, 70, 80, 85, 90, 95, 99];
8
-
9
5
  const props = withDefaults(defineProps<Ui3nProgressCircularProps>(), {
10
6
  value: 0,
11
7
  size: 64,
12
8
  bgColor: 'var(--color-bg-control-primary-default)',
13
9
  color: 'var(--color-bg-control-accent-default)',
10
+ indeterminate: false,
11
+ withText: false,
14
12
  });
15
13
 
16
- const $style = useCssModule();
14
+ const parseToNumber = (val: number | string): number => {
15
+ const num = parseFloat(String(val));
16
+ return isNaN(num) ? 0 : num;
17
+ };
17
18
 
18
- const element = ref<HTMLDivElement>();
19
+ const innerSize = computed(() => parseToNumber(props.size) || 64);
20
+ const innerValue = computed(() => Math.min(Math.max(parseToNumber(props.value), 0), 100));
19
21
  const isValueShown = computed(() => props.withText && !props.indeterminate);
20
22
 
21
- const innerSize = computed(() => toNumber(props.size));
22
- const innerWidth = computed(() => {
23
+ const virtualStrokeWidth = computed(() => {
23
24
  if (props.width) {
24
- return toNumber(props.width);
25
- }
26
-
27
- const diff = innerSize.value - thresholdSize;
28
- if (diff <= 0) {
29
- return Math.round(innerSize.value / 10);
25
+ return (parseToNumber(props.width) / innerSize.value) * 100;
30
26
  }
31
-
32
- return 6 + Math.round(diff / 20);
27
+ return 8;
33
28
  });
34
29
 
35
- const innerValue = computed(() => toNumber(props.value));
36
- const fontSize = computed(() => `${Math.floor((innerSize.value - 2 * innerWidth.value) / 3.2)}px`);
30
+ const virtualRadius = computed(() => (100 - virtualStrokeWidth.value) / 2);
31
+ const virtualCircumference = computed(() => Math.round(Math.PI * 2 * virtualRadius.value));
37
32
 
38
- const circleRadius = computed(() => Math.round(innerSize.value / 2) - Math.round(innerWidth.value / 2));
39
- const circumference = computed(() => Math.round(Math.PI * 2 * circleRadius.value));
33
+ const strokeDasharray = computed(() => {
34
+ const dash = Math.round((virtualCircumference.value * innerValue.value) / 100);
35
+ const gap = virtualCircumference.value - dash;
36
+ return `${dash} ${gap}`;
37
+ });
40
38
 
41
- const timerId = ref<ReturnType<typeof setInterval> | null>(null);
42
- const indeterminateModeValue = ref(0);
43
- const isInverse = ref(false);
39
+ const fontSize = computed(() => `${Math.floor(innerSize.value / 3.8)}px`);
44
40
 
45
41
  const progressStyle = computed(() => ({
46
42
  '--ui3n-progress-circular-size': `${innerSize.value}px`,
47
- '--ui3n-progress-circular-width': `${innerWidth.value}px`,
48
43
  '--ui3n-progress-circular-font-size': fontSize.value,
49
44
  '--ui3n-progress-circular-bg': props.bgColor,
50
45
  '--ui3n-progress-circular-color': props.color,
46
+ '--ui3n-progress-virtual-width': String(virtualStrokeWidth.value),
51
47
  }));
52
-
53
- const strokeDasharray = computed(() => {
54
- const value = props.indeterminate ? indeterminateModeValue.value : innerValue.value;
55
- const dash = Math.round((circumference.value * value!) / 100);
56
- const gap = circumference.value - dash;
57
- return `${dash} ${gap}`;
58
- });
59
-
60
- function changeValueForIndeterminateMode() {
61
- if (timerId.value) {
62
- return;
63
- }
64
-
65
- const indeterminateModeValuesLength = indeterminateModeValues.length;
66
- let index = 0;
67
-
68
- timerId.value = setInterval(() => {
69
- indeterminateModeValue.value = indeterminateModeValues[index % indeterminateModeValuesLength];
70
- index += 1;
71
- if (index % indeterminateModeValuesLength === 1) {
72
- isInverse.value = !isInverse.value;
73
- }
74
- }, 200);
75
- }
76
-
77
- function clearIndeterminateTimer() {
78
- if (timerId.value) {
79
- clearInterval(timerId.value);
80
- timerId.value = null;
81
- }
82
- }
83
-
84
- watch(
85
- () => props.indeterminate,
86
- isIndeterminate => {
87
- if (isIndeterminate) {
88
- changeValueForIndeterminateMode();
89
- } else {
90
- clearIndeterminateTimer();
91
- isInverse.value = false;
92
- indeterminateModeValue.value = 0;
93
- }
94
- },
95
- { immediate: true },
96
- );
97
-
98
- onBeforeUnmount(() => {
99
- clearIndeterminateTimer();
100
- });
101
48
  </script>
102
49
 
103
50
  <template>
104
51
  <div
105
- ref="element"
106
52
  :style="progressStyle"
107
- :class="[$style.ui3nProgressCircular, indeterminate && $style.indeterminate, isInverse && $style.inverse]"
53
+ :class="[$style.ui3nProgressCircular, indeterminate && $style.indeterminate]"
108
54
  >
109
55
  <svg
110
56
  :height="innerSize"
111
57
  :width="innerSize"
58
+ viewBox="0 0 100 100"
112
59
  :class="$style.pie"
113
60
  >
114
61
  <circle
115
62
  :class="$style.background"
116
- :r="circleRadius"
117
- cx="50%"
118
- cy="50%"
63
+ :r="virtualRadius"
64
+ cx="50"
65
+ cy="50"
119
66
  />
120
67
 
121
68
  <circle
122
69
  :class="$style.chart"
123
- :r="circleRadius"
124
- cx="50%"
125
- cy="50%"
126
- :stroke-dasharray="strokeDasharray"
70
+ :r="virtualRadius"
71
+ cx="50"
72
+ cy="50"
73
+ :stroke-dasharray="indeterminate ? undefined : strokeDasharray"
127
74
  />
128
75
  </svg>
129
76
 
@@ -139,80 +86,93 @@
139
86
  <style lang="scss" module>
140
87
  .ui3nProgressCircular {
141
88
  position: relative;
89
+ display: inline-flex;
142
90
  min-width: var(--ui3n-progress-circular-size);
143
91
  width: var(--ui3n-progress-circular-size);
144
92
  min-height: var(--ui3n-progress-circular-size);
145
93
  height: var(--ui3n-progress-circular-size);
146
- border-radius: 50%;
147
- display: flex;
148
94
  justify-content: center;
149
95
  align-items: center;
150
-
151
- &.inverse {
152
- .background {
153
- stroke: var(--ui3n-progress-circular-color) !important;
154
- }
155
-
156
- .chart {
157
- stroke: var(--ui3n-progress-circular-bg) !important;
158
- }
159
- }
160
-
161
- &:not(.indeterminate) {
162
- .chart {
163
- transition: 0.2s ease-in-out all;
164
- }
165
- }
96
+ user-select: none;
166
97
  }
167
98
 
168
99
  .pie {
169
- min-width: var(--ui3n-progress-circular-size);
170
- width: var(--ui3n-progress-circular-size);
171
- min-height: var(--ui3n-progress-circular-size);
172
- height: var(--ui3n-progress-circular-size);
173
- border-radius: 50%;
174
100
  transform: rotate(-90deg);
101
+ width: 100%;
102
+ height: 100%;
175
103
  }
176
104
 
177
105
  .background {
178
106
  fill: none;
179
107
  stroke: var(--ui3n-progress-circular-bg);
180
- stroke-width: var(--ui3n-progress-circular-width);
108
+ stroke-width: var(--ui3n-progress-virtual-width);
109
+ transition: stroke 0.2s ease;
181
110
  }
182
111
 
183
112
  .chart {
184
113
  fill: none;
185
114
  stroke: var(--ui3n-progress-circular-color);
186
- stroke-width: var(--ui3n-progress-circular-width);
115
+ stroke-width: var(--ui3n-progress-virtual-width);
116
+ transition:
117
+ stroke-dasharray 0.2s ease-in-out,
118
+ stroke 0.2s ease;
187
119
  }
188
120
 
189
121
  .text {
190
122
  position: absolute;
191
- top: 0;
192
- left: 0;
193
- width: 100%;
194
- height: 100%;
123
+ inset: 0;
195
124
  display: flex;
196
125
  justify-content: center;
197
126
  align-items: center;
198
127
  font-size: var(--ui3n-progress-circular-font-size);
199
- font-weight: 500;
128
+ font-weight: 600;
129
+ line-height: 1;
200
130
  color: var(--ui3n-progress-circular-color);
201
131
  }
202
132
 
203
133
  .indeterminate {
204
- .pie {
205
- animation: 0.75s linear 0s infinite normal spin;
134
+ animation: circular-spin 2s linear infinite;
135
+
136
+ .chart {
137
+ stroke-linecap: round;
138
+ animation: circular-dash 1.5s cubic-bezier(0.42, 0, 0.58, 1) infinite;
206
139
  }
207
140
  }
208
141
 
209
- @keyframes spin {
210
- 0% {
211
- transform: rotate(-90deg);
142
+ :global {
143
+ @keyframes circular-spin {
144
+ 0% {
145
+ transform: rotate(0deg);
146
+ }
147
+ 100% {
148
+ transform: rotate(360deg);
149
+ }
212
150
  }
213
151
 
214
- 100% {
215
- transform: rotate(270deg);
152
+ :global {
153
+ @keyframes circular-spin {
154
+ 0% {
155
+ transform: rotate(0deg);
156
+ }
157
+ 100% {
158
+ transform: rotate(360deg);
159
+ }
160
+ }
161
+
162
+ @keyframes circular-dash {
163
+ 0% {
164
+ stroke-dasharray: 1 289;
165
+ stroke-dashoffset: 0;
166
+ }
167
+ 50% {
168
+ stroke-dasharray: 216 289;
169
+ stroke-dashoffset: -35;
170
+ }
171
+ 100% {
172
+ stroke-dasharray: 1 289;
173
+ stroke-dashoffset: -289;
174
+ }
175
+ }
216
176
  }
217
177
  }
218
178
  </style>
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" setup>
2
2
  import { computed } from 'vue';
3
- import toNumber from 'lodash/toNumber';
4
3
  import type { Ui3nProgressLinearProps } from './types';
5
4
 
6
5
  const thresholdHeight = 12;
@@ -11,12 +10,23 @@
11
10
  height: 2,
12
11
  bgColor: 'var(--color-bg-control-primary-default)',
13
12
  color: 'var(--color-bg-control-accent-default)',
13
+ indeterminate: false,
14
+ withText: false,
15
+ });
16
+
17
+ const parseToNumber = (val: number | string): number => {
18
+ const num = parseFloat(String(val));
19
+ return isNaN(num) ? 0 : num;
20
+ };
21
+
22
+ const innerHeight = computed(() => parseToNumber(props.height));
23
+ const innerValue = computed(() => {
24
+ const val = parseToNumber(props.value);
25
+ return Math.min(Math.max(val, 0), 100);
14
26
  });
15
27
 
16
28
  const isValueShown = computed(() => props.withText && !props.indeterminate);
17
- const innerHeight = computed(() => toNumber(props.height));
18
- const innerValue = computed(() => toNumber(props.value));
19
- const displayValue = computed(() => (props.indeterminate ? `20%` : `${Math.min(innerValue.value, 100)}%`));
29
+ const displayValue = computed(() => `${innerValue.value}%`);
20
30
 
21
31
  const progressStyle = computed(() => ({
22
32
  '--ui3n-progress-linear-height': `${innerHeight.value}px`,
@@ -41,7 +51,7 @@
41
51
  <div :class="$style.body">
42
52
  <div
43
53
  :class="$style.value"
44
- :style="{ width: displayValue }"
54
+ :style="indeterminate ? undefined : { width: displayValue }"
45
55
  >
46
56
  <div
47
57
  v-if="isValueShown && innerHeight >= thresholdHeight && innerValue >= thresholdValue"
@@ -58,6 +68,7 @@
58
68
  .ui3nProgressLinear {
59
69
  position: relative;
60
70
  width: 100%;
71
+ user-select: none;
61
72
  }
62
73
 
63
74
  .body {
@@ -66,7 +77,7 @@
66
77
  height: var(--ui3n-progress-linear-height);
67
78
  border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
68
79
  background-color: var(--ui3n-progress-linear-bg);
69
- overflow-x: hidden;
80
+ overflow: hidden;
70
81
  }
71
82
 
72
83
  .value {
@@ -75,7 +86,8 @@
75
86
  align-items: center;
76
87
  position: absolute;
77
88
  left: 0;
78
- height: var(--ui3n-progress-linear-height);
89
+ top: 0;
90
+ height: 100%;
79
91
  border-radius: calc(var(--ui3n-progress-linear-height) - 2px);
80
92
  background-color: var(--ui3n-progress-linear-color);
81
93
  transition: width 0.2s ease-in-out;
@@ -83,9 +95,10 @@
83
95
 
84
96
  .text {
85
97
  font-size: var(--ui3n-progress-linear-font-size);
86
- font-weight: 500;
98
+ font-weight: 600;
87
99
  line-height: var(--ui3n-progress-linear-height);
88
100
  color: var(--ui3n-progress-linear-bg);
101
+ white-space: nowrap;
89
102
  }
90
103
 
91
104
  .above {
@@ -95,22 +108,26 @@
95
108
  font-size: var(--font-14);
96
109
  line-height: var(--font-16);
97
110
  color: var(--color-bg-control-accent-default);
111
+ margin-bottom: 4px;
98
112
  }
99
113
 
100
114
  .indeterminate {
101
115
  .value {
102
116
  transition: none;
103
- animation: 1s linear 0s infinite normal move;
117
+ width: 25%;
118
+ left: 0;
119
+ top: 0;
120
+ height: 100%;
121
+ animation: linear-fly 1.4s linear infinite;
104
122
  }
105
123
  }
106
124
 
107
- @keyframes move {
108
- from {
109
- left: -22%;
125
+ @keyframes linear-fly {
126
+ 0% {
127
+ transform: translateX(-105%);
110
128
  }
111
-
112
- to {
113
- left: 122%;
129
+ 100% {
130
+ transform: translateX(405%);
114
131
  }
115
132
  }
116
133
  </style>
@@ -23,8 +23,9 @@
23
23
  emits('change', value);
24
24
  }
25
25
 
26
- provide(`radio-group-${props.name}`, {
26
+ provide('ui3n-radio-group-context', {
27
27
  groupValue: computed(() => groupValue.value),
28
+ groupName: computed(() => props.name || ''),
28
29
  updateGroupValue,
29
30
  });
30
31
 
@@ -17,27 +17,25 @@
17
17
 
18
18
  const slots = useSlots();
19
19
 
20
- const instance = getCurrentInstance();
21
- const isComponentPartOfGroup =
22
- instance?.parent?.type.__name === 'Ui3nRadioGroup' || instance?.parent?.type.__name === 'ui3n-radio-group';
23
- const groupName = (isComponentPartOfGroup ? instance?.parent?.props.name : '') as string;
24
-
25
- const {
26
- groupValue,
27
- updateGroupValue,
28
- }: {
29
- groupValue: ComputedRef<Ui3nRadioValue> | null;
30
- updateGroupValue: ((value: Ui3nRadioValue) => void) | null;
31
- } = groupName
32
- ? inject(`radio-group-${groupName}`)!
33
- : {
34
- groupValue: null,
35
- updateGroupValue: null,
36
- };
37
-
38
- const val = ref<Ui3nRadioValue>(groupName ? groupValue!.value : props.modelValue);
39
-
40
- const isOn = computed(() => val.value === props.checkedValue);
20
+ const groupContext = inject<{
21
+ groupValue: ComputedRef<Ui3nRadioValue>;
22
+ groupName: ComputedRef<string>;
23
+ updateGroupValue: (value: Ui3nRadioValue) => void;
24
+ } | null>('ui3n-radio-group-context', null);
25
+
26
+ const isComponentPartOfGroup = computed(() => groupContext !== null);
27
+ const finalGroupName = computed(() => (groupContext ? groupContext.groupName.value : props.name || ''));
28
+
29
+ const val = ref<Ui3nRadioValue>(
30
+ isComponentPartOfGroup.value && groupContext ? groupContext.groupValue.value : props.modelValue,
31
+ );
32
+
33
+ const isOn = computed(() => {
34
+ if (isComponentPartOfGroup.value && groupContext) {
35
+ return groupContext.groupValue.value === props.checkedValue;
36
+ }
37
+ return val.value === props.checkedValue;
38
+ });
41
39
 
42
40
  const radioStyle = computed(() => ({
43
41
  '--ui3n-radio-size': `${props.size}px`,
@@ -46,8 +44,11 @@
46
44
 
47
45
  function change(ev: Event) {
48
46
  ev.preventDefault();
47
+ if (props.disabled) {
48
+ return;
49
+ }
49
50
 
50
- if (!groupName) {
51
+ if (!isComponentPartOfGroup.value) {
51
52
  val.value = isOn.value ? props.uncheckedValue : props.checkedValue;
52
53
  emits('change', val.value);
53
54
  emits('update:modelValue', val.value);
@@ -58,13 +59,14 @@
58
59
  return;
59
60
  }
60
61
 
61
- val.value = props.checkedValue;
62
- updateGroupValue!(val.value);
62
+ if (groupContext) {
63
+ groupContext.updateGroupValue(props.checkedValue);
64
+ }
63
65
  }
64
66
 
65
67
  function clear() {
66
68
  val.value = props.uncheckedValue;
67
- if (!groupName) {
69
+ if (!isComponentPartOfGroup.value) {
68
70
  emits('change', val.value);
69
71
  emits('update:modelValue', val.value);
70
72
  }
@@ -74,26 +76,24 @@
74
76
  clear,
75
77
  });
76
78
 
79
+ onBeforeMount(() => {
80
+ const hasChecked = !!slots['checkedIcon'];
81
+ const hasUnchecked = !!slots['uncheckedIcon'];
82
+
83
+ if ((hasChecked && !hasUnchecked) || (!hasChecked && hasUnchecked)) {
84
+ throw Error('[Ui3nRadio] Both checkedIcon and uncheckedIcon slots must have values defined.');
85
+ }
86
+ });
87
+
77
88
  watch(
78
89
  () => props.name,
79
90
  newName => {
80
- if (!newName && !groupName) {
91
+ if (!newName && !isComponentPartOfGroup.value) {
81
92
  clear();
82
93
  }
83
94
  },
84
95
  );
85
96
 
86
- onBeforeMount(() => {
87
- if (
88
- // @ts-ignore
89
- (slots.checkedIcon && !slots.uncheckedIcon) ||
90
- // @ts-ignore
91
- (!slots.checkedIcon && slots.uncheckedIcon)
92
- ) {
93
- throw Error('[Ui3nRadio] Both checkedIcon and uncheckedIcon slots must have values defined.');
94
- }
95
- });
96
-
97
97
  watch(
98
98
  () => props.modelValue,
99
99
  newValue => {
@@ -102,15 +102,6 @@
102
102
  }
103
103
  },
104
104
  );
105
-
106
- watch(
107
- () => groupValue?.value,
108
- newVal => {
109
- if (groupName) {
110
- val.value = newVal === props.checkedValue ? props.checkedValue : props.uncheckedValue;
111
- }
112
- },
113
- );
114
105
  </script>
115
106
 
116
107
  <template>
@@ -122,7 +113,7 @@
122
113
  <input
123
114
  type="radio"
124
115
  hidden
125
- :name="groupName || name"
116
+ :name="finalGroupName"
126
117
  :checked="isOn"
127
118
  :value="String(checkedValue)"
128
119
  :disabled="disabled"
@@ -37,7 +37,7 @@
37
37
  const isScrollingNow = ref(false);
38
38
 
39
39
  let resizeObserver: ResizeObserver | null = null;
40
- let scrollTimeout: number | undefined;
40
+ let scrollTimeout: ReturnType<typeof setTimeout> | undefined;
41
41
  let startX = 0;
42
42
  let startScrollLeft = 0;
43
43
 
@@ -114,9 +114,9 @@
114
114
  }
115
115
 
116
116
  isScrollingNow.value = true;
117
- window.clearTimeout(scrollTimeout);
117
+ clearTimeout(scrollTimeout);
118
118
 
119
- scrollTimeout = window.setTimeout(() => {
119
+ scrollTimeout = setTimeout(() => {
120
120
  isScrollingNow.value = false;
121
121
  }, 1500);
122
122
 
@@ -210,7 +210,7 @@
210
210
 
211
211
  onBeforeUnmount(() => {
212
212
  resizeObserver?.disconnect();
213
- window.clearTimeout(scrollTimeout);
213
+ scrollTimeout && clearTimeout(scrollTimeout);
214
214
 
215
215
  if (thumbRef.value) {
216
216
  thumbRef.value.removeEventListener('pointermove', onThumbPointerMove);
@@ -273,16 +273,14 @@
273
273
  .ui3nScrollbarHorizontal {
274
274
  position: relative;
275
275
  width: 100%;
276
- height: 100%;
277
- overflow: hidden;
276
+ overflow: visible;
278
277
  }
279
278
 
280
279
  .scrollbarContainer {
281
280
  position: relative;
282
281
  width: 100%;
283
- height: 100%;
284
282
  overflow-x: auto;
285
- overflow-y: hidden;
283
+ overflow-y: visible;
286
284
  scrollbar-width: none;
287
285
 
288
286
  &::-webkit-scrollbar {
@@ -37,7 +37,7 @@
37
37
  const isScrollingNow = ref(false);
38
38
 
39
39
  let resizeObserver: ResizeObserver | null = null;
40
- let scrollTimeout: number | undefined;
40
+ let scrollTimeout: ReturnType<typeof setTimeout> | undefined;
41
41
  let startY = 0;
42
42
  let startScrollTop = 0;
43
43
 
@@ -113,9 +113,9 @@
113
113
  }
114
114
 
115
115
  isScrollingNow.value = true;
116
- window.clearTimeout(scrollTimeout);
116
+ scrollTimeout && clearTimeout(scrollTimeout);
117
117
 
118
- scrollTimeout = window.setTimeout(() => {
118
+ scrollTimeout = setTimeout(() => {
119
119
  isScrollingNow.value = false;
120
120
  }, 1500);
121
121
 
@@ -146,7 +146,9 @@
146
146
  return;
147
147
  }
148
148
 
149
- e.preventDefault();
149
+ if (e.pointerType === 'mouse') {
150
+ e.preventDefault();
151
+ }
150
152
  e.stopPropagation();
151
153
 
152
154
  thumbRef.value.setPointerCapture(e.pointerId);
@@ -209,7 +211,7 @@
209
211
 
210
212
  onBeforeUnmount(() => {
211
213
  resizeObserver?.disconnect();
212
- window.clearTimeout(scrollTimeout);
214
+ scrollTimeout && clearTimeout(scrollTimeout);
213
215
 
214
216
  if (thumbRef.value) {
215
217
  thumbRef.value.removeEventListener('pointermove', onThumbPointerMove);
@@ -275,7 +277,8 @@
275
277
  position: relative;
276
278
  width: 100%;
277
279
  height: 100%;
278
- overflow: hidden;
280
+ overflow-x: visible;
281
+ overflow-y: hidden;
279
282
  }
280
283
 
281
284
  .scrollbarContainer {
@@ -283,6 +286,7 @@
283
286
  width: 100%;
284
287
  height: 100%;
285
288
  overflow-y: auto;
289
+ overflow-x: visible;
286
290
  scrollbar-width: none;
287
291
 
288
292
  &::-webkit-scrollbar {
@@ -59,10 +59,6 @@ export interface Ui3nSelectorProps<T extends Ui3nSelectorOptionBase> {
59
59
  * Property or function to display item
60
60
  */
61
61
  itemDisplay?: keyof T | Ui3nSelectorItemDisplayingFunction<T>;
62
- /**
63
- * Custom filter function
64
- */
65
- customFilter?: (value: Ui3nSelectorValue<T>, query: string) => boolean;
66
62
  /**
67
63
  * Whether to return the whole object or just the value
68
64
  * @default false
@@ -73,11 +69,6 @@ export interface Ui3nSelectorProps<T extends Ui3nSelectorOptionBase> {
73
69
  * @default false
74
70
  */
75
71
  clearable?: boolean;
76
- /**
77
- * Whether to show search input
78
- * @default false
79
- */
80
- withSearch?: boolean;
81
72
  /**
82
73
  * Whether to hide selected item
83
74
  * @default false
@@ -149,7 +140,7 @@ export interface Ui3nSelectorSlots<T extends Ui3nSelectorOptionBase> {
149
140
  /**
150
141
  * Item slot
151
142
  */
152
- item?: (props: { item: T; index: number; activeIndex: Nullable<number>; query?: string }) => VNode;
143
+ item?: (props: { item: T; index: number; activeIndex: Nullable<number> }) => VNode;
153
144
  /**
154
145
  * Selection slot
155
146
  */