@xen-orchestra/web-core 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/lib/assets/all-done.svg +62 -0
  2. package/lib/assets/all-good.svg +113 -0
  3. package/lib/assets/error.svg +57 -372
  4. package/lib/assets/no-data.svg +190 -65
  5. package/lib/assets/not-found.svg +446 -126
  6. package/lib/assets/offline.svg +118 -0
  7. package/lib/assets/under-construction.svg +245 -193
  8. package/lib/assets/zoom.svg +85 -0
  9. package/lib/components/backup-state/VtsBackupState.vue +20 -17
  10. package/lib/components/cell-object/VtsCellObject.vue +4 -1
  11. package/lib/components/console/VtsActionsConsole.vue +7 -4
  12. package/lib/components/console/VtsClipboardConsole.vue +9 -6
  13. package/lib/components/copy-button/VtsCopyButton.vue +7 -14
  14. package/lib/components/dropdown/DropdownTitle.vue +5 -2
  15. package/lib/components/icon/NewVtsIcon.vue +49 -0
  16. package/lib/components/input-group/VtsInputGroup.vue +41 -0
  17. package/lib/components/input-wrapper/VtsInputWrapper.vue +2 -2
  18. package/lib/components/layout/VtsLayoutSidebar.vue +6 -3
  19. package/lib/components/linear-chart/VtsLinearChart.vue +4 -0
  20. package/lib/components/object-icon/VtsObjectIcon.vue +22 -0
  21. package/lib/components/quick-info-card/VtsQuickInfoCard.vue +4 -1
  22. package/lib/components/select/VtsOption.vue +10 -6
  23. package/lib/components/select/VtsSelect.vue +74 -50
  24. package/lib/components/state-hero/VtsAllDoneHero.vue +16 -0
  25. package/lib/components/state-hero/VtsAllGoodHero.vue +16 -0
  26. package/lib/components/state-hero/VtsComingSoonHero.vue +4 -1
  27. package/lib/components/state-hero/VtsErrorNoDataHero.vue +4 -1
  28. package/lib/components/state-hero/VtsLoadingHero.vue +4 -1
  29. package/lib/components/state-hero/VtsNoDataHero.vue +4 -1
  30. package/lib/components/state-hero/VtsNoSelectionHero.vue +4 -1
  31. package/lib/components/state-hero/VtsObjectNotFoundHero.vue +4 -1
  32. package/lib/components/state-hero/VtsOfflineHero.vue +16 -0
  33. package/lib/components/state-hero/VtsPageNotFoundHero.vue +4 -1
  34. package/lib/components/state-hero/VtsStateHero.vue +10 -1
  35. package/lib/components/table/ColumnTitle.vue +2 -2
  36. package/lib/components/task/VtsQuickTaskButton.vue +4 -1
  37. package/lib/components/task/VtsQuickTaskList.vue +5 -2
  38. package/lib/components/task/VtsQuickTaskTabBar.vue +8 -5
  39. package/lib/components/ui/card-numbers/UiCardNumbers.vue +15 -33
  40. package/lib/components/ui/character-limit/UiCharacterLimit.vue +4 -1
  41. package/lib/components/ui/input/UiInput.vue +2 -2
  42. package/lib/components/ui/label/UiLabel.vue +4 -1
  43. package/lib/components/ui/progress-bar/UiProgressBar.vue +5 -2
  44. package/lib/components/ui/query-search-bar/UiQuerySearchBar.vue +9 -6
  45. package/lib/components/ui/quick-task-item/UiQuickTaskItem.vue +6 -3
  46. package/lib/components/ui/stacked-bar/StackedBarSegment.vue +4 -1
  47. package/lib/components/ui/table-pagination/UiTablePagination.vue +6 -3
  48. package/lib/components/ui/text-area/UiTextarea.vue +4 -1
  49. package/lib/components/ui/top-bottom-table/UiTopBottomTable.vue +6 -3
  50. package/lib/components/ui/tree-item-label/UiTreeItemLabel.vue +4 -1
  51. package/lib/composables/local-time-ago.composable.ts +53 -0
  52. package/lib/composables/locale-time-ago.composable.ts +53 -0
  53. package/lib/icons/fa-icons.ts +164 -0
  54. package/lib/icons/index.ts +15 -0
  55. package/lib/icons/legacy-icons.ts +80 -0
  56. package/lib/icons/object-icons.ts +187 -0
  57. package/lib/layouts/CoreLayout.vue +7 -3
  58. package/lib/locales/cs.json +73 -7
  59. package/lib/locales/de.json +5 -1
  60. package/lib/locales/en.json +33 -3
  61. package/lib/locales/es.json +9 -5
  62. package/lib/locales/fr.json +32 -2
  63. package/lib/locales/it.json +1 -1
  64. package/lib/locales/nl.json +51 -9
  65. package/lib/locales/ru.json +28 -1
  66. package/lib/locales/sv.json +77 -13
  67. package/lib/packages/collection/README.md +23 -18
  68. package/lib/packages/collection/create-collection.ts +22 -21
  69. package/lib/packages/collection/create-item.ts +21 -20
  70. package/lib/packages/collection/create-use-subset.ts +23 -0
  71. package/lib/packages/collection/guess-item-id.ts +26 -16
  72. package/lib/packages/collection/index.ts +4 -0
  73. package/lib/packages/collection/types.ts +65 -37
  74. package/lib/packages/collection/use-collection.ts +68 -18
  75. package/lib/packages/collection/use-flag-registry.ts +38 -17
  76. package/lib/packages/form-select/guess-label.ts +45 -0
  77. package/lib/packages/form-select/guess-value.ts +23 -0
  78. package/lib/packages/form-select/index.ts +6 -0
  79. package/lib/packages/form-select/normalize-search-term.ts +11 -0
  80. package/lib/packages/form-select/types.ts +90 -42
  81. package/lib/packages/form-select/use-form-option-controller.ts +7 -3
  82. package/lib/packages/form-select/use-form-select-controller.ts +38 -27
  83. package/lib/packages/form-select/use-form-select-keyboard-navigation.ts +1 -1
  84. package/lib/packages/form-select/use-form-select.ts +308 -130
  85. package/lib/packages/icon/DisplayIcon.vue +25 -0
  86. package/lib/packages/icon/DisplayIconAny.vue +16 -0
  87. package/lib/packages/icon/DisplayIconSingle.vue +35 -0
  88. package/lib/packages/icon/DisplayIconStack.vue +34 -0
  89. package/lib/packages/icon/README.md +286 -0
  90. package/lib/packages/icon/create-icon-bindings.ts +27 -0
  91. package/lib/packages/icon/define-icon-pack.ts +23 -0
  92. package/lib/packages/icon/define-icon-single.ts +17 -0
  93. package/lib/packages/icon/define-icon-stack.ts +20 -0
  94. package/lib/packages/icon/define-icon.ts +40 -0
  95. package/lib/packages/icon/generate-icon-variants.ts +17 -0
  96. package/lib/packages/icon/index.ts +8 -0
  97. package/lib/packages/icon/is-icon-stack.ts +5 -0
  98. package/lib/packages/icon/merge-icons.ts +25 -0
  99. package/lib/packages/icon/merge-transforms.ts +12 -0
  100. package/lib/packages/icon/normalize-icon.ts +25 -0
  101. package/lib/packages/icon/to-tuple.ts +7 -0
  102. package/lib/packages/icon/types.ts +72 -0
  103. package/lib/packages/job/README.md +2 -2
  104. package/lib/packages/mapper/README.md +166 -0
  105. package/lib/packages/mapper/convert-to-map.ts +5 -0
  106. package/lib/packages/mapper/create-mapper.ts +30 -0
  107. package/lib/packages/mapper/index.ts +4 -0
  108. package/lib/packages/mapper/types.ts +1 -0
  109. package/lib/packages/mapper/use-mapper.ts +31 -0
  110. package/lib/stores/sidebar.store.ts +1 -1
  111. package/lib/types/chart.ts +2 -2
  112. package/lib/types/utility.type.ts +9 -0
  113. package/lib/utils/object.util.ts +16 -0
  114. package/lib/utils/size.util.ts +4 -2
  115. package/package.json +2 -1
  116. package/lib/components/backup-item/VtsBackupItem.vue +0 -47
  117. package/lib/composables/mapper.composable.md +0 -74
  118. package/lib/composables/mapper.composable.ts +0 -18
@@ -1,78 +1,101 @@
1
1
  <template>
2
2
  <div :class="className" class="vts-select">
3
- <VtsBackdrop v-if="isOpen" />
4
-
5
3
  <UiInput
6
4
  ref="triggerRef"
7
5
  :accent
6
+ :disabled="isDisabled"
7
+ :icon
8
8
  :model-value="selectedLabel"
9
9
  :placeholder
10
- :required
10
+ :required="isRequired"
11
11
  :right-icon="faAngleDown"
12
12
  readonly
13
13
  />
14
14
 
15
- <UiDropdownList v-if="isOpen" ref="dropdownRef" :style="floatingStyles" class="dropdown-list">
16
- <template v-if="searchTerm !== undefined" #before>
17
- <div class="search-container">
18
- <UiInput
19
- ref="searchRef"
20
- v-model="searchTerm"
21
- :placeholder="searchPlaceholder"
22
- :right-icon="faMagnifyingGlass"
23
- accent="brand"
24
- />
25
- </div>
26
- </template>
27
- <UiDropdown v-if="loading || options.length === 0" accent="normal" disabled>
28
- {{ loading ? t('loading-in-progress') : t('no-results') }}
29
- </UiDropdown>
30
- <template v-for="option of options" :key="option.id">
31
- <slot :option>
32
- <VtsOption :option />
33
- </slot>
34
- </template>
35
- </UiDropdownList>
15
+ <Teleport v-if="isOpen" to="body">
16
+ <VtsBackdrop />
17
+
18
+ <UiDropdownList ref="dropdownRef" :style="floatingStyles" class="dropdown-list">
19
+ <template v-if="isSearchable" #before>
20
+ <div class="search-container">
21
+ <UiInput
22
+ ref="searchRef"
23
+ v-model="searchTerm"
24
+ :placeholder="searchPlaceholder"
25
+ :right-icon="faMagnifyingGlass"
26
+ accent="brand"
27
+ />
28
+ </div>
29
+ </template>
30
+ <UiDropdown v-if="isLoading || options.length === 0" accent="normal" disabled>
31
+ {{ isLoading ? t('loading-in-progress') : t('no-results') }}
32
+ </UiDropdown>
33
+ <template v-for="option of options" :key="option.id">
34
+ <slot :option="option as FormSelectIdToOption<TSelectId>">
35
+ <VtsOption :option />
36
+ </slot>
37
+ </template>
38
+ </UiDropdownList>
39
+ </Teleport>
36
40
  </div>
37
41
  </template>
38
42
 
39
- <script generic="TOption extends FormOption" lang="ts" setup>
43
+ <script generic="TSelectId extends FormSelectId" lang="ts" setup>
40
44
  import VtsBackdrop from '@core/components/backdrop/VtsBackdrop.vue'
41
45
  import VtsOption from '@core/components/select/VtsOption.vue'
42
46
  import UiDropdown from '@core/components/ui/dropdown/UiDropdown.vue'
43
47
  import UiDropdownList from '@core/components/ui/dropdown/UiDropdownList.vue'
44
48
  import UiInput from '@core/components/ui/input/UiInput.vue'
45
- import type { FormOption } from '@core/packages/form-select/types.ts'
46
- import { useFormSelectController } from '@core/packages/form-select/use-form-select-controller.ts'
49
+ import {
50
+ type FormSelect,
51
+ type FormSelectId,
52
+ type FormSelectIdToOption,
53
+ useFormSelectController,
54
+ } from '@core/packages/form-select'
47
55
  import { toVariants } from '@core/utils/to-variants.util.ts'
56
+ import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
48
57
  import { faAngleDown, faMagnifyingGlass } from '@fortawesome/free-solid-svg-icons'
49
- import { computed } from 'vue'
58
+ import { useCurrentElement, useElementSize } from '@vueuse/core'
59
+ import { computed, inject } from 'vue'
50
60
  import { useI18n } from 'vue-i18n'
51
61
 
52
- const { accent, options, selectedLabel } = defineProps<{
62
+ const { accent, id } = defineProps<{
53
63
  accent: 'brand' | 'warning' | 'danger'
54
- options: TOption[]
55
- selectedLabel: string
56
- required?: boolean
57
- placeholder?: string
58
- searchPlaceholder?: string
59
- loading?: boolean
64
+ id: TSelectId
65
+ icon?: IconDefinition
60
66
  }>()
61
67
 
62
- const searchTerm = defineModel<string>('search')
63
-
64
68
  defineSlots<{
65
- default(props: { option: TOption }): any
69
+ default(props: { option: FormSelectIdToOption<TSelectId> }): any
66
70
  }>()
67
71
 
68
72
  const { t } = useI18n()
69
73
 
70
- const { triggerRef, dropdownRef, searchRef, isOpen, floatingStyles } = useFormSelectController({
71
- options: () => options,
74
+ const select = inject(id)
75
+
76
+ if (!select) {
77
+ throw new Error(`No select configuration has been found for this ID`)
78
+ }
79
+
80
+ const {
81
+ options,
72
82
  searchTerm,
73
- })
83
+ selectedLabel,
84
+ isSearchable,
85
+ isDisabled,
86
+ isRequired,
87
+ placeholder,
88
+ searchPlaceholder,
89
+ isLoading,
90
+ } = select as FormSelect
91
+
92
+ const { triggerRef, dropdownRef, searchRef, isOpen, floatingStyles } = useFormSelectController(select as FormSelect)
74
93
 
75
94
  const className = computed(() => toVariants({ accent }))
95
+
96
+ const { width } = useElementSize(useCurrentElement())
97
+
98
+ const minWidth = computed(() => `${width.value}px`)
76
99
  </script>
77
100
 
78
101
  <style lang="postcss" scoped>
@@ -80,17 +103,18 @@ const className = computed(() => toVariants({ accent }))
80
103
  .ui-input:deep(input) {
81
104
  cursor: default;
82
105
  }
106
+ }
83
107
 
84
- .dropdown-list {
85
- min-width: 40rem;
86
- max-height: 36.2rem; /* 8 Dropdown items */
87
- overflow: auto;
88
- z-index: 1020;
108
+ /* Teleported */
109
+ .dropdown-list {
110
+ min-width: v-bind(minWidth);
111
+ max-height: 36.2rem; /* 8 Dropdown items */
112
+ overflow: auto;
113
+ z-index: 1020;
89
114
 
90
- .search-container {
91
- background-color: var(--color-neutral-background-primary);
92
- padding: 0.4rem;
93
- }
115
+ .search-container {
116
+ background-color: var(--color-neutral-background-primary);
117
+ padding: 0.4rem;
94
118
  }
95
119
  }
96
120
  </style>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <VtsStateHero :type class="vts-all-done-hero" image="all-done">
3
+ {{ t('all-done') }}
4
+ </VtsStateHero>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
9
+ import { useI18n } from 'vue-i18n'
10
+
11
+ defineProps<{
12
+ type: StateHeroType
13
+ }>()
14
+
15
+ const { t } = useI18n()
16
+ </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <VtsStateHero :type class="vts-all-good-hero" image="all-good">
3
+ {{ t('all-good') }}
4
+ </VtsStateHero>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
9
+ import { useI18n } from 'vue-i18n'
10
+
11
+ defineProps<{
12
+ type: StateHeroType
13
+ }>()
14
+
15
+ const { t } = useI18n()
16
+ </script>
@@ -1,13 +1,16 @@
1
1
  <template>
2
2
  <VtsStateHero :type class="vts-coming-soon-hero" image="under-construction">
3
- {{ $t('coming-soon') }}
3
+ {{ t('coming-soon') }}
4
4
  </VtsStateHero>
5
5
  </template>
6
6
 
7
7
  <script lang="ts" setup>
8
8
  import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
9
+ import { useI18n } from 'vue-i18n'
9
10
 
10
11
  defineProps<{
11
12
  type: StateHeroType
12
13
  }>()
14
+
15
+ const { t } = useI18n()
13
16
  </script>
@@ -1,11 +1,14 @@
1
1
  <template>
2
- <VtsStateHero class="vts-error-hero" image="error" :type>{{ $t('error-no-data') }}</VtsStateHero>
2
+ <VtsStateHero class="vts-error-hero" image="error" :type>{{ t('error-no-data') }}</VtsStateHero>
3
3
  </template>
4
4
 
5
5
  <script lang="ts" setup>
6
6
  import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
7
+ import { useI18n } from 'vue-i18n'
7
8
 
8
9
  defineProps<{
9
10
  type: StateHeroType
10
11
  }>()
12
+
13
+ const { t } = useI18n()
11
14
  </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="vts-loading-hero">
3
3
  <VtsStateHero :type busy>
4
- {{ $t('loading-in-progress') }}
4
+ {{ t('loading-in-progress') }}
5
5
  </VtsStateHero>
6
6
  <div v-if="slots.title || slots.text" class="content">
7
7
  <div v-if="slots.title" class="title" :class="className">
@@ -17,6 +17,7 @@
17
17
  <script lang="ts" setup>
18
18
  import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
19
19
  import { computed } from 'vue'
20
+ import { useI18n } from 'vue-i18n'
20
21
 
21
22
  const { type } = defineProps<{
22
23
  type: StateHeroType
@@ -27,6 +28,8 @@ const slots = defineSlots<{
27
28
  text?(): any
28
29
  }>()
29
30
 
31
+ const { t } = useI18n()
32
+
30
33
  const className = computed(() => (type === 'page' ? 'typo-h1' : 'typo-h2'))
31
34
  </script>
32
35
 
@@ -1,11 +1,14 @@
1
1
  <template>
2
- <VtsStateHero class="vts-no-data-hero" image="no-data" :type>{{ $t('no-data') }}</VtsStateHero>
2
+ <VtsStateHero class="vts-no-data-hero" image="no-data" :type>{{ t('no-data') }}</VtsStateHero>
3
3
  </template>
4
4
 
5
5
  <script lang="ts" setup>
6
6
  import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
7
+ import { useI18n } from 'vue-i18n'
7
8
 
8
9
  defineProps<{
9
10
  type: StateHeroType
10
11
  }>()
12
+
13
+ const { t } = useI18n()
11
14
  </script>
@@ -1,13 +1,16 @@
1
1
  <template>
2
2
  <VtsStateHero :type class="vts-no-selection-hero" image="no-selection">
3
- {{ $t('select-to-see-details') }}
3
+ {{ t('select-to-see-details') }}
4
4
  </VtsStateHero>
5
5
  </template>
6
6
 
7
7
  <script lang="ts" setup>
8
8
  import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
9
+ import { useI18n } from 'vue-i18n'
9
10
 
10
11
  defineProps<{
11
12
  type: StateHeroType
12
13
  }>()
14
+
15
+ const { t } = useI18n()
13
16
  </script>
@@ -1,14 +1,17 @@
1
1
  <template>
2
2
  <VtsStateHero class="vts-object-not-found-hero" image="no-result" :type>
3
- {{ $t('object-not-found', { id }) }}
3
+ {{ t('object-not-found', { id }) }}
4
4
  </VtsStateHero>
5
5
  </template>
6
6
 
7
7
  <script lang="ts" setup>
8
8
  import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
9
+ import { useI18n } from 'vue-i18n'
9
10
 
10
11
  defineProps<{
11
12
  id: string
12
13
  type: StateHeroType
13
14
  }>()
15
+
16
+ const { t } = useI18n()
14
17
  </script>
@@ -0,0 +1,16 @@
1
+ <template>
2
+ <VtsStateHero :type class="vts-offline-hero" image="offline">
3
+ {{ t('offline') }}
4
+ </VtsStateHero>
5
+ </template>
6
+
7
+ <script lang="ts" setup>
8
+ import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
9
+ import { useI18n } from 'vue-i18n'
10
+
11
+ defineProps<{
12
+ type: StateHeroType
13
+ }>()
14
+
15
+ const { t } = useI18n()
16
+ </script>
@@ -1,16 +1,19 @@
1
1
  <template>
2
2
  <VtsStateHero class="vts-page-not-found-hero" image="not-found" :type>
3
3
  <span class="numeric">404</span><br />
4
- {{ $t('page-not-found') }}
4
+ {{ t('page-not-found') }}
5
5
  </VtsStateHero>
6
6
  </template>
7
7
 
8
8
  <script lang="ts" setup>
9
9
  import VtsStateHero, { type StateHeroType } from '@core/components/state-hero/VtsStateHero.vue'
10
+ import { useI18n } from 'vue-i18n'
10
11
 
11
12
  defineProps<{
12
13
  type: StateHeroType
13
14
  }>()
15
+
16
+ const { t } = useI18n()
14
17
  </script>
15
18
 
16
19
  <style lang="postcss" scoped>
@@ -17,7 +17,16 @@ export type StateHeroType = 'page' | 'card' | 'panel' | 'table'
17
17
  const props = defineProps<{
18
18
  type: StateHeroType
19
19
  busy?: boolean
20
- image?: 'no-result' | 'under-construction' | 'no-data' | 'no-selection' | 'error' | 'not-found' // TODO: 'offline' | 'all-good' | 'all-done''
20
+ image?:
21
+ | 'no-result'
22
+ | 'under-construction'
23
+ | 'no-data'
24
+ | 'no-selection'
25
+ | 'error'
26
+ | 'not-found'
27
+ | 'offline'
28
+ | 'all-good'
29
+ | 'all-done'
21
30
  }>()
22
31
 
23
32
  const slots = defineSlots<{
@@ -19,14 +19,14 @@
19
19
  <MenuItem
20
20
  v-for="interaction in interactions"
21
21
  :key="interaction.id"
22
- v-tooltip="$t('coming-soon')"
22
+ v-tooltip="t('coming-soon')"
23
23
  :disabled="interaction.disabled"
24
24
  :on-click="() => updateInteraction(interaction)"
25
25
  >
26
26
  <VtsIcon :icon="interaction.icon" accent="current" />
27
27
  {{ interaction.label }}
28
28
  <i v-if="currentInteraction?.id === interaction.id" class="current-interaction typo-body-regular-small">
29
- {{ $t('core.current').toLowerCase() }}
29
+ {{ t('core.current').toLowerCase() }}
30
30
  </i>
31
31
  </MenuItem>
32
32
  </MenuList>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <UiButtonIcon
3
3
  ref="buttonRef"
4
- v-tooltip="{ content: $t('tasks.quick-view'), placement: 'bottom-end' }"
4
+ v-tooltip="{ content: t('tasks.quick-view'), placement: 'bottom-end' }"
5
5
  accent="brand"
6
6
  :dot="hasNewTask"
7
7
  :icon="faBarsProgress"
@@ -24,12 +24,15 @@ import { faBarsProgress } from '@fortawesome/free-solid-svg-icons'
24
24
  import { unrefElement, watchArray, whenever } from '@vueuse/core'
25
25
  import placementJs from 'placement.js'
26
26
  import { computed, nextTick, ref } from 'vue'
27
+ import { useI18n } from 'vue-i18n'
27
28
 
28
29
  const props = defineProps<{
29
30
  tasks: Task[]
30
31
  loading?: boolean
31
32
  }>()
32
33
 
34
+ const { t } = useI18n()
35
+
33
36
  const ids = computed(() => props.tasks.map(task => task.id))
34
37
 
35
38
  const isPanelOpen = ref(false)
@@ -3,11 +3,11 @@
3
3
  <li v-if="loading">
4
4
  <div class="loading">
5
5
  <UiLoader />
6
- <div>{{ $t('loading-in-progress') }}</div>
6
+ <div>{{ t('loading-in-progress') }}</div>
7
7
  </div>
8
8
  </li>
9
9
  <template v-else>
10
- <li v-if="tasks.length === 0" class="typo-body-bold">{{ $t('tasks.no-tasks') }}</li>
10
+ <li v-if="tasks.length === 0" class="typo-body-bold">{{ t('tasks.no-tasks') }}</li>
11
11
  <UiQuickTaskItem v-for="task of tasks" :key="task.id" :task />
12
12
  </template>
13
13
  </ul>
@@ -16,12 +16,15 @@
16
16
  <script lang="ts" setup>
17
17
  import UiLoader from '@core/components/ui/loader/UiLoader.vue'
18
18
  import UiQuickTaskItem, { type Task } from '@core/components/ui/quick-task-item/UiQuickTaskItem.vue'
19
+ import { useI18n } from 'vue-i18n'
19
20
 
20
21
  defineProps<{
21
22
  tasks: Task[]
22
23
  sublist?: boolean
23
24
  loading?: boolean
24
25
  }>()
26
+
27
+ const { t } = useI18n()
25
28
  </script>
26
29
 
27
30
  <style lang="postcss" scoped>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <TabList :disabled="loading">
3
3
  <TabItem v-bind="tabs.pending.bindings">
4
- {{ $t('tasks.quick-view.in-progress') }}
4
+ {{ t('tasks.quick-view.in-progress') }}
5
5
  <UiCounter
6
6
  v-if="pendingCount !== undefined"
7
7
  :value="pendingCount"
@@ -11,7 +11,7 @@
11
11
  />
12
12
  </TabItem>
13
13
  <TabItem v-bind="tabs.success.bindings">
14
- {{ $t('tasks.quick-view.done') }}
14
+ {{ t('tasks.quick-view.done') }}
15
15
  <UiCounter
16
16
  v-if="successCount !== undefined"
17
17
  :value="successCount"
@@ -21,7 +21,7 @@
21
21
  />
22
22
  </TabItem>
23
23
  <TabItem v-bind="tabs.failure.bindings">
24
- {{ $t('tasks.quick-view.failed') }}
24
+ {{ t('tasks.quick-view.failed') }}
25
25
  <UiCounter
26
26
  v-if="failureCount !== undefined"
27
27
  :value="failureCount"
@@ -32,12 +32,12 @@
32
32
  </TabItem>
33
33
  <VtsDivider type="tab" />
34
34
  <TabItem v-bind="tabs.all.bindings">
35
- {{ $t('tasks.quick-view.all') }}
35
+ {{ t('tasks.quick-view.all') }}
36
36
  </TabItem>
37
37
  <!--
38
38
  TODO
39
39
  <UiButton :right-icon="faAngleRight" class="see-all" level="tertiary" size="extra-small">
40
- {{ $t('see-all') }}
40
+ {{ t('see-all') }}
41
41
  </UiButton>
42
42
  -->
43
43
  </TabList>
@@ -50,6 +50,7 @@ import TabList from '@core/components/tab/TabList.vue'
50
50
  import UiCounter from '@core/components/ui/counter/UiCounter.vue'
51
51
  import type { TaskStatus } from '@core/components/ui/quick-task-item/UiQuickTaskItem.vue'
52
52
  import { useTabList } from '@core/composables/tab-list.composable'
53
+ import { useI18n } from 'vue-i18n'
53
54
 
54
55
  export type TaskTab = TaskStatus | 'all'
55
56
 
@@ -62,5 +63,7 @@ defineProps<{
62
63
 
63
64
  const currentTab = defineModel<TaskTab>({ required: true })
64
65
 
66
+ const { t } = useI18n()
67
+
65
68
  const { tabs } = useTabList<TaskTab>(['pending', 'success', 'failure', 'all'], currentTab)
66
69
  </script>
@@ -1,50 +1,42 @@
1
1
  <!-- v1 -->
2
2
  <template>
3
- <div class="ui-card-numbers" :class="sizeClass">
3
+ <div class="ui-card-numbers" :class="className">
4
4
  <span class="label typo-caption-small">{{ label }}</span>
5
- <div class="values" :class="sizeClass">
6
- <span v-if="percentValue" class="value typo-caption-small">
7
- {{ percentValue }}
5
+ <div class="values" :class="fontClass">
6
+ <span v-if="percentValue !== undefined">
7
+ {{ n(percentValue, 'percent') }}
8
+ </span>
9
+ <span>
10
+ {{ `${value ?? '-'} ${unit ?? ''}` }}
8
11
  </span>
9
-
10
- <div class="value" :class="valueFontClass">
11
- {{ value ?? '-' }}<span class="unit" :class="unitFontClass">{{ unit }}</span>
12
- </div>
13
12
  </div>
14
13
  </div>
15
14
  </template>
16
15
 
17
- <script setup lang="ts" generic="TSize extends 'small' | 'medium'">
16
+ <script setup lang="ts">
18
17
  import { toVariants } from '@core/utils/to-variants.util'
19
18
  import { computed } from 'vue'
20
19
  import { useI18n } from 'vue-i18n'
21
20
 
22
- const props = defineProps<{
21
+ const { size, value, max } = defineProps<{
23
22
  label: string
24
- size: TSize
23
+ size: 'small' | 'medium'
25
24
  value?: number
26
25
  unit?: string
27
- max?: TSize extends 'small' ? number : never
26
+ max?: number
28
27
  }>()
29
28
 
30
29
  const { n } = useI18n()
31
30
 
32
- const sizeClass = computed(() => toVariants({ size: props.size }))
33
-
34
- const valueFontClass = computed(() => (props.size === 'medium' ? 'typo-h3' : 'typo-caption-small'))
35
-
36
- const unitFontClass = computed(() => (props.size === 'medium' ? 'typo-body-bold-small' : 'typo-caption-small'))
31
+ const className = computed(() => toVariants({ size }))
32
+ const fontClass = computed(() => (size === 'medium' ? 'typo-h3' : 'typo-caption-small'))
37
33
 
38
34
  const percentValue = computed(() => {
39
- if (props.size !== 'small' || props.max === undefined || props.max === 0) {
35
+ if (value === undefined || max === undefined || max === 0) {
40
36
  return undefined
41
37
  }
42
38
 
43
- if (props.value === undefined) {
44
- return n(0, 'percent').replace('0', '-')
45
- }
46
-
47
- return n(props.value / props.max, 'percent')
39
+ return value / max
48
40
  })
49
41
  </script>
50
42
 
@@ -57,16 +49,6 @@ const percentValue = computed(() => {
57
49
  display: flex;
58
50
  flex-direction: column;
59
51
  gap: 0.8rem;
60
- }
61
-
62
- .value {
63
- color: var(--color-neutral-txt-primary);
64
- display: flex;
65
- gap: 0.2rem;
66
- align-items: center;
67
- }
68
-
69
- .unit {
70
52
  color: var(--color-neutral-txt-primary);
71
53
  }
72
54
 
@@ -1,18 +1,21 @@
1
1
  <!-- v1 -->
2
2
  <template>
3
3
  <span class="ui-character-limit" :class="classes">
4
- {{ $t('core.character-limit', { count, max }) }}
4
+ {{ t('core.character-limit', { count, max }) }}
5
5
  </span>
6
6
  </template>
7
7
 
8
8
  <script lang="ts" setup>
9
9
  import { computed } from 'vue'
10
+ import { useI18n } from 'vue-i18n'
10
11
 
11
12
  const { count, max } = defineProps<{
12
13
  count: number
13
14
  max: number
14
15
  }>()
15
16
 
17
+ const { t } = useI18n()
18
+
16
19
  const isTooLong = computed(() => count > max)
17
20
 
18
21
  const classes = computed(() => {
@@ -30,7 +30,7 @@
30
30
  import VtsIcon from '@core/components/icon/VtsIcon.vue'
31
31
  import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
32
32
  import type { LabelAccent } from '@core/components/ui/label/UiLabel.vue'
33
- import { useMapper } from '@core/composables/mapper.composable.ts'
33
+ import { useMapper } from '@core/packages/mapper/use-mapper.ts'
34
34
  import { IK_INPUT_WRAPPER_CONTROLLER } from '@core/utils/injection-keys.util'
35
35
  import { toVariants } from '@core/utils/to-variants.util'
36
36
  import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
@@ -79,7 +79,7 @@ const accent = useMapper<LabelAccent, InputAccent>(
79
79
  warning: 'warning',
80
80
  danger: 'danger',
81
81
  },
82
- () => _accent
82
+ 'neutral'
83
83
  )
84
84
 
85
85
  if (wrapperController) {
@@ -5,7 +5,7 @@
5
5
  <label :for="htmlFor" :class="{ required }" class="typo-caption label">
6
6
  <slot />
7
7
  </label>
8
- <UiLink v-if="href" class="learn-more-link" size="small" :href>{{ $t('learn-more') }}</UiLink>
8
+ <UiLink v-if="href" class="learn-more-link" size="small" :href>{{ t('learn-more') }}</UiLink>
9
9
  </div>
10
10
  </template>
11
11
 
@@ -14,6 +14,7 @@ import VtsIcon from '@core/components/icon/VtsIcon.vue'
14
14
  import UiLink from '@core/components/ui/link/UiLink.vue'
15
15
  import { toVariants } from '@core/utils/to-variants.util'
16
16
  import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
17
+ import { useI18n } from 'vue-i18n'
17
18
 
18
19
  export type LabelAccent = 'neutral' | 'warning' | 'danger'
19
20
 
@@ -24,6 +25,8 @@ const { for: htmlFor } = defineProps<{
24
25
  required?: boolean
25
26
  href?: string
26
27
  }>()
28
+
29
+ const { t } = useI18n()
27
30
  </script>
28
31
 
29
32
  <style lang="postcss" scoped>