@xen-orchestra/web-core 0.4.0 → 0.6.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.
- package/lib/assets/css/_colors.pcss +56 -24
- package/lib/assets/css/_context.pcss +9 -9
- package/lib/assets/css/base.pcss +6 -6
- package/lib/assets/error.svg +375 -0
- package/lib/assets/no-selection.svg +70 -0
- package/lib/components/backup-item/VtsBackupItem.vue +47 -0
- package/lib/components/backup-state/{BackupState.vue → VtsBackupState.vue} +4 -4
- package/lib/components/{button/ButtonGroup.vue → button-group/VtsButtonGroup.vue} +7 -6
- package/lib/components/cell-object/{CellObject.vue → VtsCellObject.vue} +14 -14
- package/lib/components/cell-text/{CellText.vue → VtsCellText.vue} +11 -11
- package/lib/components/console/VtsActionsConsole.vue +67 -0
- package/lib/components/console/VtsClipboardConsole.vue +38 -0
- package/lib/components/console/VtsLayoutConsole.vue +40 -0
- package/lib/components/console/{RemoteConsole.vue → VtsRemoteConsole.vue} +14 -17
- package/lib/components/donut-chart-with-legend/{DonutChartWithLegend.vue → VtsDonutChartWithLegend.vue} +6 -6
- package/lib/components/dropdown/DropdownItem.vue +8 -14
- package/lib/components/dropdown/DropdownTitle.vue +3 -3
- package/lib/components/icon/VtsIcon.vue +38 -42
- package/lib/components/layout/{LayoutSidebar.vue → VtsLayoutSidebar.vue} +31 -30
- package/lib/components/legend-group/VtsLegendGroup.vue +44 -0
- package/lib/components/{legend/LegendList.vue → legend-list/VtsLegendList.vue} +2 -2
- package/lib/components/menu/MenuTrigger.vue +2 -2
- package/lib/components/stacked-bar-with-legend/{StackedBarWithLegend.vue → VtsStackedBarWithLegend.vue} +14 -14
- package/lib/components/state-hero/VtsComingSoonHero.vue +13 -0
- package/lib/components/state-hero/VtsLoadingHero.vue +15 -0
- package/lib/components/state-hero/VtsNoDataHero.vue +11 -0
- package/lib/components/state-hero/VtsObjectNotFoundHero.vue +13 -0
- package/lib/components/state-hero/VtsStateHero.vue +117 -0
- package/lib/components/tab/TabItem.vue +6 -6
- package/lib/components/table/ColumnTitle.vue +7 -7
- package/lib/components/table/{UiTable.vue → VtsTable.vue} +7 -3
- package/lib/components/task/{QuickTaskButton.vue → VtsQuickTaskButton.vue} +8 -7
- package/lib/components/task/{QuickTaskList.vue → VtsQuickTaskList.vue} +10 -11
- package/lib/components/task/{QuickTaskTabBar.vue → VtsQuickTaskTabBar.vue} +9 -13
- package/lib/components/{tooltip/TooltipList.vue → tooltip-list/VtsTooltipList.vue} +2 -3
- package/lib/components/tree/{TreeItem.vue → VtsTreeItem.vue} +3 -4
- package/lib/components/tree/VtsTreeItemError.vue +18 -0
- package/lib/components/tree/{TreeLine.vue → VtsTreeLine.vue} +9 -11
- package/lib/components/tree/{TreeList.vue → VtsTreeList.vue} +5 -2
- package/lib/components/tree/VtsTreeLoadingItem.vue +61 -0
- package/lib/components/ui/account-menu-button/UiAccountMenuButton.vue +64 -0
- package/lib/components/ui/actions-title/UiActionsTitle.vue +2 -2
- package/lib/components/ui/button/UiButton.vue +532 -0
- package/lib/components/ui/button-icon/UiButtonIcon.vue +248 -0
- package/lib/components/{UiCard.vue → ui/card/UiCard.vue} +8 -6
- package/lib/components/ui/card-numbers/UiCardNumbers.vue +103 -0
- package/lib/components/ui/card-subtitle/UiCardSubtitle.vue +24 -0
- package/lib/components/ui/card-title/UiCardTitle.vue +56 -0
- package/lib/components/ui/checkbox/UiCheckbox.vue +410 -0
- package/lib/components/ui/checkbox-group/UiCheckboxGroup.vue +57 -0
- package/lib/components/ui/chip/ChipIcon.vue +21 -0
- package/lib/components/ui/chip/ChipRemoveIcon.vue +13 -0
- package/lib/components/ui/chip/UiChip.vue +135 -0
- package/lib/components/{icon/ComplexIcon.vue → ui/complex-icon/UiComplexIcon.vue} +21 -27
- package/lib/components/ui/counter/UiCounter.vue +134 -0
- package/lib/components/{donut-chart/DonutChart.vue → ui/donut-chart/UiDonutChart.vue} +28 -30
- package/lib/components/{head-bar/HeadBar.vue → ui/head-bar/UiHeadBar.vue} +31 -31
- package/lib/components/{info/VtsInfo.vue → ui/info/UiInfo.vue} +13 -11
- package/lib/components/{input → ui/input}/UiInput.vue +9 -7
- package/lib/components/ui/input/UiTextarea.vue +120 -0
- package/lib/components/{input/VtsLabel.vue → ui/label/UiLabel.vue} +25 -25
- package/lib/components/ui/legend/UiLegend.vue +98 -0
- package/lib/components/{LegendTitle.vue → ui/legend-title/UiLegendTitle.vue} +4 -4
- package/lib/components/{UiSpinner.vue → ui/loader/UiLoader.vue} +3 -3
- package/lib/components/{icon/ObjectIcon.vue → ui/object-icon/UiObjectIcon.vue} +44 -36
- package/lib/components/ui/object-link/UiObjectLink.vue +83 -0
- package/lib/components/ui/panel/UiPanel.vue +57 -0
- package/lib/components/{query-search-bar/QuerySearchBar.vue → ui/query-search-bar/UiQuerySearchBar.vue} +16 -16
- package/lib/components/{task/QuickTaskItem.vue → ui/quick-task-item/UiQuickTaskItem.vue} +46 -34
- package/lib/components/{task/QuickTaskPanel.vue → ui/quick-task-panel/UiQuickTaskPanel.vue} +8 -7
- package/lib/components/ui/radio-button/UiRadioButton.vue +196 -0
- package/lib/components/ui/radio-button-group/UiRadioButtonGroup.vue +56 -0
- package/lib/components/{stacked-bar → ui/stacked-bar}/StackedBarSegment.vue +23 -26
- package/lib/components/{stacked-bar/StackedBar.vue → ui/stacked-bar/UiStackedBar.vue} +6 -6
- package/lib/components/ui/table-actions/UiTableActions.vue +46 -0
- package/lib/components/ui/tag/UiTag.vue +118 -0
- package/lib/components/ui/title/UiTitle.vue +2 -2
- package/lib/components/ui/toaster/UiToaster.vue +100 -0
- package/lib/components/ui/toggle/UiToggle.vue +117 -0
- package/lib/components/{tooltip/TooltipItem.vue → ui/tooltip/UiTooltip.vue} +15 -15
- package/lib/components/ui/top-bottom-table/UiTopBottomTable.vue +64 -0
- package/lib/components/{tree/TreeItemLabel.vue → ui/tree-item-label/UiTreeItemLabel.vue} +60 -59
- package/lib/components/ui/user-link/UiUserLink.vue +76 -0
- package/lib/components/ui/user-logo/UiUserLogo.vue +50 -0
- package/lib/composables/route-query.composable.md +136 -0
- package/lib/composables/table.composable.md +159 -0
- package/lib/composables/tree/define-tree.ts +1 -1
- package/lib/composables/tree/tree-node-base.ts +6 -6
- package/lib/composables/tree.composable.md +536 -0
- package/lib/i18n.ts +4 -0
- package/lib/layouts/CoreLayout.vue +8 -6
- package/lib/locales/cs.json +76 -0
- package/lib/locales/de.json +5 -2
- package/lib/locales/en.json +14 -3
- package/lib/locales/fa.json +5 -2
- package/lib/locales/fr.json +14 -3
- package/lib/types/color.type.ts +0 -2
- package/lib/types/subscribable-store.type.ts +2 -2
- package/lib/utils/create-subscribable-store-context.util.ts +1 -1
- package/lib/utils/if-else.utils.md +23 -0
- package/lib/utils/if-else.utils.ts +2 -2
- package/lib/utils/to-variants.util.md +62 -0
- package/package.json +7 -7
- package/lib/components/CardNumbers.vue +0 -101
- package/lib/components/PowerStateIcon.vue +0 -46
- package/lib/components/UiTag.vue +0 -101
- package/lib/components/backup-item/BackupItem.vue +0 -40
- package/lib/components/button/ButtonIcon.vue +0 -220
- package/lib/components/button/UiButton.vue +0 -470
- package/lib/components/card/CardSubtitle.vue +0 -24
- package/lib/components/card/CardTitle.vue +0 -57
- package/lib/components/chip/ChipIcon.vue +0 -30
- package/lib/components/chip/ChipRemoveIcon.vue +0 -13
- package/lib/components/chip/UiChip.vue +0 -137
- package/lib/components/counter/VtsCounter.vue +0 -147
- package/lib/components/legend/LegendGroup.vue +0 -44
- package/lib/components/legend/LegendItem.vue +0 -86
- package/lib/components/object-link/ObjectLink.vue +0 -87
- package/lib/components/state-hero/ComingSoonHero.vue +0 -13
- package/lib/components/state-hero/LoadingHero.vue +0 -15
- package/lib/components/state-hero/NoDataHero.vue +0 -11
- package/lib/components/state-hero/ObjectNotFoundHero.vue +0 -13
- package/lib/components/state-hero/StateHero.vue +0 -74
- package/lib/components/tree/TreeItemError.vue +0 -13
- package/lib/components/tree/TreeLoadingItem.vue +0 -60
- package/lib/components/user/UserLink.vue +0 -72
- package/lib/components/user/UserLogo.vue +0 -57
- package/lib/types/backup.type.ts +0 -11
- package/lib/types/size.type.ts +0 -1
- package/lib/types/task.type.ts +0 -13
- /package/lib/components/backdrop/{Backdrop.vue → VtsBackdrop.vue} +0 -0
- /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
|
-
<!--
|
|
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.
|
|
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
|
|
25
|
+
export type DonutSegmentAccent = 'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'muted'
|
|
26
26
|
|
|
27
27
|
export type DonutSegment = {
|
|
28
28
|
value: number
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
fill: transparent;
|
|
70
|
-
--stroke-color: var(--color-neutral-txt-primary);
|
|
65
|
+
.segment {
|
|
66
|
+
stroke-width: 10;
|
|
67
|
+
fill: transparent;
|
|
71
68
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
&.accent--neutral {
|
|
70
|
+
stroke: var(--color-neutral-txt-primary);
|
|
71
|
+
}
|
|
75
72
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
73
|
+
&.accent--info {
|
|
74
|
+
stroke: var(--color-info-item-base);
|
|
75
|
+
}
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
&.accent--success {
|
|
78
|
+
stroke: var(--color-success-item-base);
|
|
79
|
+
}
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
&.accent--warning {
|
|
82
|
+
stroke: var(--color-warning-item-base);
|
|
83
|
+
}
|
|
87
84
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
&.accent--danger {
|
|
86
|
+
stroke: var(--color-danger-item-base);
|
|
87
|
+
}
|
|
91
88
|
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
&.accent--muted {
|
|
90
|
+
stroke: var(--color-neutral-background-disabled);
|
|
91
|
+
}
|
|
94
92
|
}
|
|
95
93
|
}
|
|
96
94
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<!--
|
|
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
|
|
34
|
-
icon
|
|
35
|
-
status
|
|
36
|
-
actions
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
59
|
-
}
|
|
56
|
+
.label {
|
|
57
|
+
color: var(--color-neutral-txt-primary);
|
|
58
|
+
}
|
|
60
59
|
|
|
61
|
-
.icon {
|
|
62
|
-
|
|
63
|
-
}
|
|
60
|
+
.icon {
|
|
61
|
+
font-size: 2.4rem;
|
|
62
|
+
}
|
|
64
63
|
|
|
65
|
-
.status {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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="
|
|
3
|
+
<div class="ui-info">
|
|
4
4
|
<VtsIcon :accent class="icon" :icon="faCircle" :overlay-icon="icon" />
|
|
5
|
-
<p class="message"
|
|
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: '
|
|
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
|
-
|
|
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
|
-
.
|
|
44
|
+
.ui-info {
|
|
43
45
|
align-items: start;
|
|
44
46
|
display: flex;
|
|
45
47
|
gap: 0.8rem;
|
|
46
|
-
}
|
|
47
48
|
|
|
48
|
-
.icon {
|
|
49
|
-
|
|
50
|
-
}
|
|
49
|
+
.icon {
|
|
50
|
+
font-size: 1.6rem;
|
|
51
|
+
}
|
|
51
52
|
|
|
52
|
-
.message {
|
|
53
|
-
|
|
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="
|
|
5
|
+
<input :id v-model.trim="modelValue" class="typo p1-regular input" type="search" v-bind="attrs" />
|
|
6
6
|
<VtsIcon
|
|
7
|
-
v-if="
|
|
7
|
+
v-if="!attrs.disabled && modelValue"
|
|
8
8
|
:icon="faXmark"
|
|
9
9
|
class="after"
|
|
10
|
-
accent="
|
|
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-
|
|
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-
|
|
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-
|
|
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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- WIP -->
|
|
2
2
|
<template>
|
|
3
|
-
<div :class="accent" class="
|
|
3
|
+
<div :class="toVariants({ accent })" class="ui-label">
|
|
4
4
|
<VtsIcon accent="current" :icon class="left-icon" />
|
|
5
5
|
<span :class="{ required }" class="typo c2-semi-bold label"><slot /></span>
|
|
6
6
|
<!-- @TODO: Replace it by the VtsLink component when available -->
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
|
|
14
14
|
<script lang="ts" setup>
|
|
15
15
|
import VtsIcon from '@core/components/icon/VtsIcon.vue'
|
|
16
|
+
import { toVariants } from '@core/utils/to-variants.util'
|
|
16
17
|
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
|
|
17
18
|
import { faUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'
|
|
18
19
|
|
|
19
20
|
defineProps<{
|
|
20
|
-
accent: '
|
|
21
|
+
accent: 'neutral' | 'warning' | 'danger'
|
|
21
22
|
icon?: IconDefinition
|
|
22
23
|
required?: boolean
|
|
23
24
|
href?: string
|
|
@@ -25,26 +26,7 @@ defineProps<{
|
|
|
25
26
|
</script>
|
|
26
27
|
|
|
27
28
|
<style lang="postcss" scoped>
|
|
28
|
-
|
|
29
|
-
ACCENT
|
|
30
|
-
--vts-label--color
|
|
31
|
-
*/
|
|
32
|
-
.vts-label {
|
|
33
|
-
&.brand {
|
|
34
|
-
--vts-label--color: var(--color-neutral-txt-primary);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&.warning {
|
|
38
|
-
--vts-label--color: var(--color-warning-txt-base);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&.danger {
|
|
42
|
-
--vts-label--color: var(--color-danger-txt-base);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/* IMPLEMENTATION */
|
|
47
|
-
.vts-label {
|
|
29
|
+
.ui-label {
|
|
48
30
|
display: flex;
|
|
49
31
|
align-items: center;
|
|
50
32
|
|
|
@@ -53,12 +35,10 @@ ACCENT
|
|
|
53
35
|
}
|
|
54
36
|
|
|
55
37
|
.label {
|
|
56
|
-
color: var(--vts-label--color);
|
|
57
|
-
|
|
58
38
|
&.required::after {
|
|
59
39
|
content: '*';
|
|
60
40
|
margin-left: 0.4rem;
|
|
61
|
-
color: var(--color-
|
|
41
|
+
color: var(--color-info-txt-base);
|
|
62
42
|
}
|
|
63
43
|
}
|
|
64
44
|
|
|
@@ -72,5 +52,25 @@ ACCENT
|
|
|
72
52
|
.link-icon {
|
|
73
53
|
font-size: 0.8rem;
|
|
74
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
75
|
}
|
|
76
76
|
</style>
|