@xen-orchestra/web-core 0.3.0 → 0.5.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 (124) hide show
  1. package/lib/assets/css/_colors.pcss +56 -24
  2. package/lib/assets/css/_context.pcss +9 -9
  3. package/lib/assets/css/base.pcss +6 -6
  4. package/lib/components/backup-item/VtsBackupItem.vue +47 -0
  5. package/lib/components/backup-state/{BackupState.vue → VtsBackupState.vue} +4 -4
  6. package/lib/components/{button/ButtonGroup.vue → button-group/VtsButtonGroup.vue} +7 -6
  7. package/lib/components/cell-object/{CellObject.vue → VtsCellObject.vue} +14 -14
  8. package/lib/components/cell-text/{CellText.vue → VtsCellText.vue} +11 -11
  9. package/lib/components/console/{RemoteConsole.vue → VtsRemoteConsole.vue} +12 -18
  10. package/lib/components/donut-chart-with-legend/{DonutChartWithLegend.vue → VtsDonutChartWithLegend.vue} +6 -6
  11. package/lib/components/dropdown/DropdownItem.vue +8 -14
  12. package/lib/components/dropdown/DropdownTitle.vue +3 -3
  13. package/lib/components/icon/VtsIcon.vue +38 -42
  14. package/lib/components/layout/{LayoutSidebar.vue → VtsLayoutSidebar.vue} +31 -30
  15. package/lib/components/legend-group/VtsLegendGroup.vue +44 -0
  16. package/lib/components/{legend/LegendList.vue → legend-list/VtsLegendList.vue} +2 -2
  17. package/lib/components/menu/MenuTrigger.vue +2 -2
  18. package/lib/components/stacked-bar-with-legend/{StackedBarWithLegend.vue → VtsStackedBarWithLegend.vue} +14 -14
  19. package/lib/components/state-hero/VtsComingSoonHero.vue +13 -0
  20. package/lib/components/state-hero/VtsLoadingHero.vue +15 -0
  21. package/lib/components/state-hero/VtsNoDataHero.vue +11 -0
  22. package/lib/components/state-hero/VtsObjectNotFoundHero.vue +13 -0
  23. package/lib/components/state-hero/{StateHero.vue → VtsStateHero.vue} +42 -35
  24. package/lib/components/tab/TabItem.vue +6 -6
  25. package/lib/components/table/ColumnTitle.vue +7 -7
  26. package/lib/components/table/{UiTable.vue → VtsTable.vue} +7 -3
  27. package/lib/components/task/{QuickTaskButton.vue → VtsQuickTaskButton.vue} +8 -7
  28. package/lib/components/task/{QuickTaskList.vue → VtsQuickTaskList.vue} +10 -11
  29. package/lib/components/task/{QuickTaskTabBar.vue → VtsQuickTaskTabBar.vue} +9 -13
  30. package/lib/components/{tooltip/TooltipList.vue → tooltip-list/VtsTooltipList.vue} +2 -3
  31. package/lib/components/tree/{TreeItem.vue → VtsTreeItem.vue} +3 -4
  32. package/lib/components/tree/VtsTreeItemError.vue +18 -0
  33. package/lib/components/tree/{TreeLine.vue → VtsTreeLine.vue} +9 -11
  34. package/lib/components/tree/{TreeList.vue → VtsTreeList.vue} +5 -2
  35. package/lib/components/tree/VtsTreeLoadingItem.vue +61 -0
  36. package/lib/components/ui/account-menu-button/UiAccountMenuButton.vue +64 -0
  37. package/lib/components/ui/actions-title/UiActionsTitle.vue +18 -0
  38. package/lib/components/ui/button/UiButton.vue +532 -0
  39. package/lib/components/ui/button-icon/UiButtonIcon.vue +248 -0
  40. package/lib/components/{UiCard.vue → ui/card/UiCard.vue} +8 -6
  41. package/lib/components/ui/card-numbers/UiCardNumbers.vue +103 -0
  42. package/lib/components/ui/card-subtitle/UiCardSubtitle.vue +24 -0
  43. package/lib/components/ui/card-title/UiCardTitle.vue +56 -0
  44. package/lib/components/ui/checkbox/UiCheckbox.vue +410 -0
  45. package/lib/components/ui/checkbox-group/UiCheckboxGroup.vue +57 -0
  46. package/lib/components/ui/chip/ChipIcon.vue +21 -0
  47. package/lib/components/ui/chip/ChipRemoveIcon.vue +13 -0
  48. package/lib/components/ui/chip/UiChip.vue +135 -0
  49. package/lib/components/{icon/ComplexIcon.vue → ui/complex-icon/UiComplexIcon.vue} +21 -27
  50. package/lib/components/ui/counter/UiCounter.vue +134 -0
  51. package/lib/components/{donut-chart/DonutChart.vue → ui/donut-chart/UiDonutChart.vue} +28 -30
  52. package/lib/components/{head-bar/HeadBar.vue → ui/head-bar/UiHeadBar.vue} +31 -31
  53. package/lib/components/{info/VtsInfo.vue → ui/info/UiInfo.vue} +13 -11
  54. package/lib/components/{input → ui/input}/UiInput.vue +9 -7
  55. package/lib/components/ui/input/UiTextarea.vue +120 -0
  56. package/lib/components/ui/label/UiLabel.vue +76 -0
  57. package/lib/components/ui/legend/UiLegend.vue +98 -0
  58. package/lib/components/{LegendTitle.vue → ui/legend-title/UiLegendTitle.vue} +4 -4
  59. package/lib/components/{UiSpinner.vue → ui/loader/UiLoader.vue} +3 -3
  60. package/lib/components/{icon/ObjectIcon.vue → ui/object-icon/UiObjectIcon.vue} +44 -36
  61. package/lib/components/ui/object-link/UiObjectLink.vue +83 -0
  62. package/lib/components/ui/panel/UiPanel.vue +57 -0
  63. package/lib/components/{query-search-bar/QuerySearchBar.vue → ui/query-search-bar/UiQuerySearchBar.vue} +16 -16
  64. package/lib/components/{task/QuickTaskItem.vue → ui/quick-task-item/UiQuickTaskItem.vue} +46 -34
  65. package/lib/components/{task/QuickTaskPanel.vue → ui/quick-task-panel/UiQuickTaskPanel.vue} +8 -7
  66. package/lib/components/ui/radio-button/UiRadioButton.vue +196 -0
  67. package/lib/components/ui/radio-button-group/UiRadioButtonGroup.vue +56 -0
  68. package/lib/components/{stacked-bar → ui/stacked-bar}/StackedBarSegment.vue +23 -26
  69. package/lib/components/{stacked-bar/StackedBar.vue → ui/stacked-bar/UiStackedBar.vue} +6 -6
  70. package/lib/components/ui/table-actions/UiTableActions.vue +46 -0
  71. package/lib/components/ui/tag/UiTag.vue +118 -0
  72. package/lib/components/ui/title/UiTitle.vue +39 -0
  73. package/lib/components/ui/toaster/UiToaster.vue +100 -0
  74. package/lib/components/ui/toggle/UiToggle.vue +117 -0
  75. package/lib/components/{tooltip/TooltipItem.vue → ui/tooltip/UiTooltip.vue} +15 -15
  76. package/lib/components/ui/top-bottom-table/UiTopBottomTable.vue +64 -0
  77. package/lib/components/{tree/TreeItemLabel.vue → ui/tree-item-label/UiTreeItemLabel.vue} +60 -59
  78. package/lib/components/ui/user-link/UiUserLink.vue +76 -0
  79. package/lib/components/ui/user-logo/UiUserLogo.vue +50 -0
  80. package/lib/composables/route-query.composable.md +136 -0
  81. package/lib/composables/table.composable.md +159 -0
  82. package/lib/composables/tree/define-tree.ts +1 -1
  83. package/lib/composables/tree/tree-node-base.ts +6 -6
  84. package/lib/composables/tree.composable.md +536 -0
  85. package/lib/layouts/CoreLayout.vue +8 -6
  86. package/lib/locales/de.json +3 -2
  87. package/lib/locales/en.json +7 -3
  88. package/lib/locales/fa.json +3 -2
  89. package/lib/locales/fr.json +7 -3
  90. package/lib/types/color.type.ts +0 -2
  91. package/lib/types/subscribable-store.type.ts +2 -2
  92. package/lib/utils/create-subscribable-store-context.util.ts +1 -1
  93. package/lib/utils/if-else.utils.md +23 -0
  94. package/lib/utils/if-else.utils.ts +2 -2
  95. package/lib/utils/to-variants.util.md +62 -0
  96. package/package.json +7 -7
  97. package/lib/components/CardNumbers.vue +0 -101
  98. package/lib/components/PowerStateIcon.vue +0 -46
  99. package/lib/components/UiTag.vue +0 -101
  100. package/lib/components/backup-item/BackupItem.vue +0 -40
  101. package/lib/components/button/ButtonIcon.vue +0 -220
  102. package/lib/components/button/UiButton.vue +0 -470
  103. package/lib/components/card/CardSubtitle.vue +0 -24
  104. package/lib/components/card/CardTitle.vue +0 -57
  105. package/lib/components/chip/ChipIcon.vue +0 -30
  106. package/lib/components/chip/ChipRemoveIcon.vue +0 -13
  107. package/lib/components/chip/UiChip.vue +0 -137
  108. package/lib/components/counter/VtsCounter.vue +0 -147
  109. package/lib/components/legend/LegendGroup.vue +0 -44
  110. package/lib/components/legend/LegendItem.vue +0 -86
  111. package/lib/components/object-link/ObjectLink.vue +0 -87
  112. package/lib/components/state-hero/ComingSoonHero.vue +0 -13
  113. package/lib/components/state-hero/LoadingHero.vue +0 -15
  114. package/lib/components/state-hero/NoDataHero.vue +0 -11
  115. package/lib/components/state-hero/ObjectNotFoundHero.vue +0 -13
  116. package/lib/components/tree/TreeItemError.vue +0 -13
  117. package/lib/components/tree/TreeLoadingItem.vue +0 -60
  118. package/lib/components/user/UserLink.vue +0 -72
  119. package/lib/components/user/UserLogo.vue +0 -57
  120. package/lib/types/backup.type.ts +0 -11
  121. package/lib/types/size.type.ts +0 -1
  122. package/lib/types/task.type.ts +0 -13
  123. /package/lib/components/backdrop/{Backdrop.vue → VtsBackdrop.vue} +0 -0
  124. /package/lib/components/divider/{Divider.vue → VtsDivider.vue} +0 -0
@@ -0,0 +1,134 @@
1
+ <!-- v2 -->
2
+ <template>
3
+ <span :class="classNames" class="ui-counter">
4
+ <span class="inner">{{ value }}</span>
5
+ </span>
6
+ </template>
7
+
8
+ <script lang="ts" setup>
9
+ import { toVariants } from '@core/utils/to-variants.util'
10
+ import { computed } from 'vue'
11
+
12
+ type CounterAccent = 'info' | 'neutral' | 'success' | 'warning' | 'danger' | 'muted'
13
+ type CounterVariant = 'primary' | 'secondary'
14
+ type CounterSize = 'small' | 'medium'
15
+
16
+ const props = defineProps<{
17
+ value: number | string
18
+ accent: CounterAccent
19
+ variant: CounterVariant
20
+ size: CounterSize
21
+ }>()
22
+
23
+ const typoClasses = {
24
+ small: 'typo p4-semi-bold',
25
+ medium: 'typo p1-medium',
26
+ }
27
+
28
+ const classNames = computed(() => {
29
+ return [
30
+ typoClasses[props.size],
31
+ toVariants({
32
+ accent: props.accent,
33
+ variant: props.variant,
34
+ size: props.size,
35
+ }),
36
+ ]
37
+ })
38
+ </script>
39
+
40
+ <style lang="postcss" scoped>
41
+ .ui-counter {
42
+ display: inline-flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ vertical-align: middle;
46
+ text-transform: lowercase;
47
+
48
+ .inner {
49
+ line-height: 0;
50
+ }
51
+
52
+ /* VARIANT + ACCENT VARIANTS */
53
+
54
+ &.variant--primary {
55
+ &.accent--info {
56
+ background-color: var(--color-info-item-base);
57
+ color: var(--color-info-txt-item);
58
+ }
59
+
60
+ &.accent--neutral {
61
+ background-color: var(--color-neutral-txt-primary);
62
+ color: var(--color-neutral-background-primary);
63
+ }
64
+
65
+ &.accent--success {
66
+ background-color: var(--color-success-item-base);
67
+ color: var(--color-success-txt-item);
68
+ }
69
+
70
+ &.accent--warning {
71
+ background-color: var(--color-warning-item-base);
72
+ color: var(--color-warning-txt-item);
73
+ }
74
+
75
+ &.accent--danger {
76
+ background-color: var(--color-danger-item-base);
77
+ color: var(--color-danger-txt-item);
78
+ }
79
+
80
+ &.accent--muted {
81
+ background-color: var(--color-neutral-background-disabled);
82
+ color: var(--color-neutral-txt-secondary);
83
+ }
84
+ }
85
+
86
+ &.variant--secondary {
87
+ &.accent--info {
88
+ background-color: var(--color-info-background-selected);
89
+ color: var(--color-info-txt-base);
90
+ }
91
+
92
+ &.accent--neutral {
93
+ background-color: var(--color-neutral-background-secondary);
94
+ color: var(--color-neutral-txt-secondary);
95
+ }
96
+
97
+ &.accent--success {
98
+ background-color: var(--color-success-background-selected);
99
+ color: var(--color-success-txt-base);
100
+ }
101
+
102
+ &.accent--warning {
103
+ background-color: var(--color-warning-background-selected);
104
+ color: var(--color-warning-txt-base);
105
+ }
106
+
107
+ &.accent--danger {
108
+ background-color: var(--color-danger-background-selected);
109
+ color: var(--color-danger-txt-base);
110
+ }
111
+
112
+ &.accent--muted {
113
+ background-color: var(--color-neutral-background-secondary);
114
+ color: var(--color-neutral-txt-secondary);
115
+ }
116
+ }
117
+
118
+ /* SIZE VARIANTS */
119
+
120
+ &.size--small {
121
+ height: 1.5rem;
122
+ min-width: 1.5rem;
123
+ border-radius: calc(1.5rem / 2);
124
+ padding: 0 0.4rem;
125
+ }
126
+
127
+ &.size--medium {
128
+ height: 2.4rem;
129
+ min-width: 2.4rem;
130
+ border-radius: calc(2.4rem / 2);
131
+ padding: 0 0.6rem;
132
+ }
133
+ }
134
+ </style>
@@ -1,11 +1,11 @@
1
- <!-- v1.1 -->
1
+ <!-- v3 -->
2
2
  <template>
3
- <svg class="donut-chart" viewBox="0 0 100 100">
3
+ <svg class="ui-donut-chart" viewBox="0 0 100 100">
4
4
  <circle class="segment" cx="50" cy="50" r="40" />
5
5
  <circle
6
6
  v-for="(segment, index) in computedSegments"
7
7
  :key="index"
8
- :class="segment.color"
8
+ :class="`accent--${segment.accent}`"
9
9
  :stroke-dasharray="`${segment.percent} ${circumference - segment.percent}`"
10
10
  :stroke-dashoffset="segment.offset"
11
11
  class="segment"
@@ -22,11 +22,11 @@ import VtsIcon from '@core/components/icon/VtsIcon.vue'
22
22
  import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
23
23
  import { computed } from 'vue'
24
24
 
25
- export type DonutSegmentColor = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'disabled'
25
+ export type DonutSegmentAccent = 'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'muted'
26
26
 
27
27
  export type DonutSegment = {
28
28
  value: number
29
- color: DonutSegmentColor
29
+ accent: DonutSegmentAccent
30
30
  }
31
31
 
32
32
  export type DonutChartProps = {
@@ -49,7 +49,7 @@ const computedSegments = computed(() => {
49
49
  nextOffset -= percent
50
50
 
51
51
  return {
52
- color: segment.color,
52
+ accent: segment.accent,
53
53
  percent,
54
54
  offset,
55
55
  }
@@ -58,39 +58,37 @@ const computedSegments = computed(() => {
58
58
  </script>
59
59
 
60
60
  <style lang="postcss" scoped>
61
- .donut-chart {
61
+ .ui-donut-chart {
62
62
  width: 100px;
63
63
  height: 100px;
64
- }
65
64
 
66
- .segment {
67
- stroke: var(--stroke-color);
68
- stroke-width: 10;
69
- fill: transparent;
70
- --stroke-color: var(--color-neutral-txt-primary);
65
+ .segment {
66
+ stroke-width: 10;
67
+ fill: transparent;
71
68
 
72
- &.primary {
73
- --stroke-color: var(--color-normal-item-base);
74
- }
69
+ &.accent--neutral {
70
+ stroke: var(--color-neutral-txt-primary);
71
+ }
75
72
 
76
- &.secondary {
77
- --stroke-color: var(--color-neutral-txt-primary);
78
- }
73
+ &.accent--info {
74
+ stroke: var(--color-info-item-base);
75
+ }
79
76
 
80
- &.success {
81
- --stroke-color: var(--color-success-item-base);
82
- }
77
+ &.accent--success {
78
+ stroke: var(--color-success-item-base);
79
+ }
83
80
 
84
- &.warning {
85
- --stroke-color: var(--color-warning-item-base);
86
- }
81
+ &.accent--warning {
82
+ stroke: var(--color-warning-item-base);
83
+ }
87
84
 
88
- &.danger {
89
- --stroke-color: var(--color-danger-item-base);
90
- }
85
+ &.accent--danger {
86
+ stroke: var(--color-danger-item-base);
87
+ }
91
88
 
92
- &.disabled {
93
- --stroke-color: var(--color-neutral-background-disabled);
89
+ &.accent--muted {
90
+ stroke: var(--color-neutral-background-disabled);
91
+ }
94
92
  }
95
93
  }
96
94
  </style>
@@ -1,6 +1,6 @@
1
- <!-- v1.0 -->
1
+ <!-- v3 -->
2
2
  <template>
3
- <div class="head-bar">
3
+ <div class="ui-head-bar">
4
4
  <div class="label-wrapper">
5
5
  <span v-if="slots.icon || icon" class="icon">
6
6
  <slot name="icon">
@@ -30,49 +30,49 @@ defineProps<{
30
30
  }>()
31
31
 
32
32
  const slots = defineSlots<{
33
- default: () => any
34
- icon?: () => any
35
- status?: () => any
36
- actions?: () => any
33
+ default(): any
34
+ icon?(): any
35
+ status?(): any
36
+ actions?(): any
37
37
  }>()
38
38
  </script>
39
39
 
40
40
  <style lang="postcss" scoped>
41
- .head-bar {
41
+ .ui-head-bar {
42
42
  padding: 0.8rem 1.6rem;
43
43
  display: flex;
44
44
  gap: 4.8rem;
45
45
  align-items: center;
46
46
  border-bottom: 0.1rem solid var(--color-neutral-border);
47
47
  background-color: var(--color-neutral-background-primary);
48
- }
49
48
 
50
- .label-wrapper {
51
- display: flex;
52
- gap: 1.6rem;
53
- align-items: center;
54
- min-width: 0;
55
- }
49
+ .label-wrapper {
50
+ display: flex;
51
+ gap: 1.6rem;
52
+ align-items: center;
53
+ min-width: 0;
54
+ }
56
55
 
57
- .label {
58
- color: var(--color-neutral-txt-primary);
59
- }
56
+ .label {
57
+ color: var(--color-neutral-txt-primary);
58
+ }
60
59
 
61
- .icon {
62
- font-size: 2.4rem;
63
- }
60
+ .icon {
61
+ font-size: 2.4rem;
62
+ }
64
63
 
65
- .status {
66
- color: var(--color-neutral-txt-secondary);
67
- display: flex;
68
- align-items: center;
69
- gap: 1.6rem;
70
- }
64
+ .status {
65
+ color: var(--color-neutral-txt-secondary);
66
+ display: flex;
67
+ align-items: center;
68
+ gap: 1.6rem;
69
+ }
71
70
 
72
- .actions {
73
- margin-inline-start: auto;
74
- display: flex;
75
- align-items: center;
76
- gap: 0.8rem;
71
+ .actions {
72
+ margin-inline-start: auto;
73
+ display: flex;
74
+ align-items: center;
75
+ gap: 0.8rem;
76
+ }
77
77
  }
78
78
  </style>
@@ -1,8 +1,10 @@
1
1
  <!-- v2 -->
2
2
  <template>
3
- <div class="vts-info">
3
+ <div class="ui-info">
4
4
  <VtsIcon :accent class="icon" :icon="faCircle" :overlay-icon="icon" />
5
- <p class="message"><slot /></p>
5
+ <p class="message">
6
+ <slot />
7
+ </p>
6
8
  </div>
7
9
  </template>
8
10
 
@@ -19,7 +21,7 @@ import {
19
21
  import { computed } from 'vue'
20
22
 
21
23
  type Props = {
22
- accent: 'brand' | 'success' | 'warning' | 'danger'
24
+ accent: 'info' | 'success' | 'warning' | 'danger'
23
25
  }
24
26
 
25
27
  const props = defineProps<Props>()
@@ -29,7 +31,7 @@ defineSlots<{
29
31
  }>()
30
32
 
31
33
  const iconByAccent: Record<Props['accent'], IconDefinition> = {
32
- brand: faInfo,
34
+ info: faInfo,
33
35
  success: faCheck,
34
36
  warning: faExclamation,
35
37
  danger: faXmark,
@@ -39,17 +41,17 @@ const icon = computed(() => iconByAccent[props.accent])
39
41
  </script>
40
42
 
41
43
  <style lang="postcss" scoped>
42
- .vts-info {
44
+ .ui-info {
43
45
  align-items: start;
44
46
  display: flex;
45
47
  gap: 0.8rem;
46
- }
47
48
 
48
- .icon {
49
- font-size: 1.6rem;
50
- }
49
+ .icon {
50
+ font-size: 1.6rem;
51
+ }
51
52
 
52
- .message {
53
- font-size: 1.2rem;
53
+ .message {
54
+ font-size: 1.2rem;
55
+ }
54
56
  }
55
57
  </style>
@@ -2,12 +2,12 @@
2
2
  <template>
3
3
  <div class="ui-input">
4
4
  <VtsIcon :icon accent="current" class="before" />
5
- <input :id v-model.trim="modelValue" class="typo p1-regular input" type="search" v-bind="$attrs" />
5
+ <input :id v-model.trim="modelValue" class="typo p1-regular input" type="search" v-bind="attrs" />
6
6
  <VtsIcon
7
- v-if="!$attrs.disabled && modelValue"
7
+ v-if="!attrs.disabled && modelValue"
8
8
  :icon="faXmark"
9
9
  class="after"
10
- accent="brand"
10
+ accent="info"
11
11
  @click="modelValue = ''"
12
12
  />
13
13
  </div>
@@ -18,7 +18,7 @@ import VtsIcon from '@core/components/icon/VtsIcon.vue'
18
18
  import { uniqueId } from '@core/utils/unique-id.util'
19
19
  import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
20
20
  import { faXmark } from '@fortawesome/free-solid-svg-icons'
21
- import { computed } from 'vue'
21
+ import { computed, useAttrs } from 'vue'
22
22
 
23
23
  defineOptions({
24
24
  inheritAttrs: false,
@@ -30,6 +30,8 @@ defineProps<{
30
30
 
31
31
  const modelValue = defineModel<string>({ required: true })
32
32
 
33
+ const attrs = useAttrs()
34
+
33
35
  const id = computed(() => uniqueId('input-'))
34
36
  </script>
35
37
 
@@ -42,17 +44,17 @@ const id = computed(() => uniqueId('input-'))
42
44
  }
43
45
 
44
46
  &:is(:hover, :focus-visible) {
45
- --border-color: var(--color-normal-item-hover);
47
+ --border-color: var(--color-info-item-hover);
46
48
  --background-color: var(--color-neutral-background-primary);
47
49
  }
48
50
 
49
51
  &:focus {
50
- --border-color: var(--color-normal-item-base);
52
+ --border-color: var(--color-info-item-base);
51
53
  --background-color: var(--color-neutral-background-primary);
52
54
  }
53
55
 
54
56
  &:active {
55
- --border-color: var(--color-normal-item-active);
57
+ --border-color: var(--color-info-item-active);
56
58
  --background-color: var(--color-neutral-background-primary);
57
59
  }
58
60
 
@@ -0,0 +1,120 @@
1
+ <!-- v2 -->
2
+ <template>
3
+ <div class="ui-textarea" :class="toVariants({ accent })">
4
+ <UiLabel v-if="slots.default" :accent="labelAccent" :required :icon :href><slot /></UiLabel>
5
+ <textarea v-model="model" :disabled class="textarea" v-bind="attrs" />
6
+ <UiInfo v-if="slots.info" :accent><slot name="info" /></UiInfo>
7
+ </div>
8
+ </template>
9
+
10
+ <script lang="ts" setup>
11
+ import UiInfo from '@core/components/ui/info/UiInfo.vue'
12
+ import UiLabel from '@core/components/ui/label/UiLabel.vue'
13
+ import { toVariants } from '@core/utils/to-variants.util'
14
+ import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
15
+ import { computed, useAttrs } from 'vue'
16
+
17
+ defineOptions({
18
+ inheritAttrs: false,
19
+ })
20
+
21
+ const props = defineProps<{
22
+ accent: 'info' | 'warning' | 'danger'
23
+ disabled?: boolean
24
+ href?: string
25
+ icon?: IconDefinition
26
+ required?: boolean
27
+ }>()
28
+
29
+ const model = defineModel<string>({ required: true })
30
+
31
+ const slots = defineSlots<{
32
+ default?(): any
33
+ info?(): any
34
+ }>()
35
+
36
+ const attrs = useAttrs()
37
+
38
+ const labelAccent = computed(() => (props.accent === 'info' ? 'neutral' : props.accent))
39
+ </script>
40
+
41
+ <style lang="postcss" scoped>
42
+ .ui-textarea {
43
+ display: flex;
44
+ flex-direction: column;
45
+ gap: 0.4rem;
46
+
47
+ .textarea {
48
+ border-radius: 0.4rem;
49
+ border-width: 0.1rem;
50
+ background-color: var(--color-neutral-background-primary);
51
+ height: 8rem;
52
+ outline: none;
53
+ padding: 0.8rem 1.6rem;
54
+ width: 100%;
55
+ }
56
+
57
+ &.accent--info {
58
+ .textarea {
59
+ border-color: var(--color-neutral-border);
60
+
61
+ &:hover {
62
+ border-color: var(--color-info-item-hover);
63
+ }
64
+ &:active {
65
+ border-color: var(--color-info-item-active);
66
+ }
67
+ &:focus:not(:active) {
68
+ border-width: 0.2rem;
69
+ border-color: var(--color-info-item-base);
70
+ }
71
+ &:disabled {
72
+ background-color: var(--color-neutral-background-disabled);
73
+ border-color: var(--color-neutral-border);
74
+ }
75
+ }
76
+ }
77
+
78
+ &.accent--warning {
79
+ .textarea {
80
+ border-color: var(--color-warning-item-base);
81
+
82
+ &:hover {
83
+ border-color: var(--color-warning-item-hover);
84
+ }
85
+ &:active {
86
+ border-color: var(--color-warning-item-active);
87
+ }
88
+ &:focus:not(:active) {
89
+ border-width: 0.2rem;
90
+ border-color: var(--color-warning-item-base);
91
+ }
92
+ &:disabled {
93
+ background-color: var(--color-neutral-background-disabled);
94
+ border-color: var(--color-neutral-border);
95
+ }
96
+ }
97
+ }
98
+
99
+ &.accent--danger {
100
+ .textarea {
101
+ border-color: var(--color-danger-item-base);
102
+
103
+ &:hover {
104
+ border-color: var(--color-danger-item-hover);
105
+ }
106
+ &:active {
107
+ border-color: var(--color-danger-item-active);
108
+ }
109
+ &:focus:not(:active) {
110
+ border-width: 0.2rem;
111
+ border-color: var(--color-danger-item-base);
112
+ }
113
+ &:disabled {
114
+ background-color: var(--color-neutral-background-disabled);
115
+ border-color: var(--color-neutral-border);
116
+ }
117
+ }
118
+ }
119
+ }
120
+ </style>
@@ -0,0 +1,76 @@
1
+ <!-- WIP -->
2
+ <template>
3
+ <div :class="toVariants({ accent })" class="ui-label">
4
+ <VtsIcon accent="current" :icon class="left-icon" />
5
+ <span :class="{ required }" class="typo c2-semi-bold label"><slot /></span>
6
+ <!-- @TODO: Replace it by the VtsLink component when available -->
7
+ <a v-if="href" :href class="link">
8
+ <span class="typo p3-regular-underline">{{ $t('learn-more') }}</span>
9
+ <VtsIcon accent="current" :icon="faUpRightFromSquare" class="link-icon" />
10
+ </a>
11
+ </div>
12
+ </template>
13
+
14
+ <script lang="ts" setup>
15
+ import VtsIcon from '@core/components/icon/VtsIcon.vue'
16
+ import { toVariants } from '@core/utils/to-variants.util'
17
+ import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
18
+ import { faUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'
19
+
20
+ defineProps<{
21
+ accent: 'neutral' | 'warning' | 'danger'
22
+ icon?: IconDefinition
23
+ required?: boolean
24
+ href?: string
25
+ }>()
26
+ </script>
27
+
28
+ <style lang="postcss" scoped>
29
+ .ui-label {
30
+ display: flex;
31
+ align-items: center;
32
+
33
+ .left-icon {
34
+ margin-right: 0.8rem;
35
+ }
36
+
37
+ .label {
38
+ &.required::after {
39
+ content: '*';
40
+ margin-left: 0.4rem;
41
+ color: var(--color-info-txt-base);
42
+ }
43
+ }
44
+
45
+ .link {
46
+ display: flex;
47
+ align-items: center;
48
+ gap: 0.8rem;
49
+ margin-left: auto;
50
+ }
51
+
52
+ .link-icon {
53
+ font-size: 0.8rem;
54
+ }
55
+
56
+ /* ACCENT VARIANTS */
57
+
58
+ &.accent--neutral {
59
+ .label {
60
+ color: var(--color-neutral-txt-primary);
61
+ }
62
+ }
63
+
64
+ &.accent--warning {
65
+ .label {
66
+ color: var(--color-warning-txt-base);
67
+ }
68
+ }
69
+
70
+ &.accent--danger {
71
+ .label {
72
+ color: var(--color-danger-txt-base);
73
+ }
74
+ }
75
+ }
76
+ </style>