@xen-orchestra/web-core 0.0.1
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 +125 -0
- package/lib/assets/css/_context.pcss +99 -0
- package/lib/assets/css/_fonts.pcss +6 -0
- package/lib/assets/css/_reset.pcss +42 -0
- package/lib/assets/css/_shadows.pcss +36 -0
- package/lib/assets/css/_typography.pcss +6 -0
- package/lib/assets/css/base.pcss +91 -0
- package/lib/assets/css/typography/_legacy.pcss +123 -0
- package/lib/assets/css/typography/_letter-spacing.pcss +27 -0
- package/lib/assets/css/typography/_line-height.pcss +19 -0
- package/lib/assets/css/typography/_size.pcss +95 -0
- package/lib/assets/css/typography/_style.pcss +34 -0
- package/lib/assets/css/typography/_weight.pcss +57 -0
- package/lib/assets/user.png +0 -0
- package/lib/components/PowerStateIcon.vue +46 -0
- package/lib/components/StatusPill.vue +32 -0
- package/lib/components/UiCounter.vue +89 -0
- package/lib/components/UiSpinner.vue +48 -0
- package/lib/components/UiTag.vue +97 -0
- package/lib/components/button/ButtonGroup.vue +33 -0
- package/lib/components/button/ButtonIcon.vue +199 -0
- package/lib/components/button/UiButton.vue +207 -0
- package/lib/components/chip/ChipIcon.vue +29 -0
- package/lib/components/chip/ChipRemoveIcon.vue +13 -0
- package/lib/components/chip/UiChip.vue +138 -0
- package/lib/components/dropdown/DropdownItem.vue +192 -0
- package/lib/components/dropdown/DropdownList.vue +31 -0
- package/lib/components/dropdown/DropdownTitle.vue +65 -0
- package/lib/components/icon/ComplexIcon.vue +51 -0
- package/lib/components/icon/ObjectIcon.vue +243 -0
- package/lib/components/icon/UiIcon.vue +47 -0
- package/lib/components/icon/VmIcon.vue +30 -0
- package/lib/components/layout/LayoutSidebar.vue +100 -0
- package/lib/components/menu/MenuItem.vue +82 -0
- package/lib/components/menu/MenuList.vue +104 -0
- package/lib/components/menu/MenuSeparator.vue +27 -0
- package/lib/components/menu/MenuTrigger.vue +52 -0
- package/lib/components/tab/TabItem.vue +100 -0
- package/lib/components/tab/TabList.vue +32 -0
- package/lib/components/tooltip/TooltipItem.vue +80 -0
- package/lib/components/tooltip/TooltipList.vue +15 -0
- package/lib/components/tree/TreeItem.vue +34 -0
- package/lib/components/tree/TreeItemError.vue +13 -0
- package/lib/components/tree/TreeItemLabel.vue +128 -0
- package/lib/components/tree/TreeLine.vue +51 -0
- package/lib/components/tree/TreeList.vue +14 -0
- package/lib/components/tree/TreeLoadingItem.vue +64 -0
- package/lib/components/user/UserLink.vue +72 -0
- package/lib/components/user/UserLogo.vue +57 -0
- package/lib/composables/context.composable.ts +34 -0
- package/lib/composables/tree/branch-definition.ts +17 -0
- package/lib/composables/tree/branch.ts +143 -0
- package/lib/composables/tree/build-nodes.ts +20 -0
- package/lib/composables/tree/define-branch.ts +23 -0
- package/lib/composables/tree/define-leaf.ts +16 -0
- package/lib/composables/tree/define-tree.ts +65 -0
- package/lib/composables/tree/leaf-definition.ts +8 -0
- package/lib/composables/tree/leaf.ts +34 -0
- package/lib/composables/tree/tree-node-base.ts +103 -0
- package/lib/composables/tree/tree-node-definition-base.ts +12 -0
- package/lib/composables/tree/types.ts +92 -0
- package/lib/composables/tree-filter.composable.ts +12 -0
- package/lib/composables/tree.composable.ts +85 -0
- package/lib/context.ts +10 -0
- package/lib/directives/tooltip.directive.md +117 -0
- package/lib/directives/tooltip.directive.ts +52 -0
- package/lib/i18n.ts +158 -0
- package/lib/layouts/CoreLayout.vue +182 -0
- package/lib/locales/de.json +6 -0
- package/lib/locales/en.json +15 -0
- package/lib/locales/fr.json +15 -0
- package/lib/stores/panel.store.ts +12 -0
- package/lib/stores/sidebar.store.ts +63 -0
- package/lib/stores/tooltip.store.ts +74 -0
- package/lib/stores/ui.store.ts +34 -0
- package/lib/types/button.type.ts +3 -0
- package/lib/types/color.type.ts +5 -0
- package/lib/types/object-icon.type.ts +43 -0
- package/lib/types/power-state.type.ts +1 -0
- package/lib/types/size.type.ts +3 -0
- package/lib/types/subscribable-store.type.ts +21 -0
- package/lib/types/utility.type.ts +1 -0
- package/lib/utils/create-subscribable-store-context.util.ts +66 -0
- package/lib/utils/has-ellipsis.util.ts +11 -0
- package/lib/utils/if-else.utils.ts +27 -0
- package/lib/utils/injection-keys.util.ts +17 -0
- package/lib/utils/sort-by-name-label.util.ts +6 -0
- package/lib/utils/to-array.utils.ts +9 -0
- package/lib/utils/unique-id.util.ts +8 -0
- package/package.json +45 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!-- v1.0 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div :class="{ active, disabled }" class="menu-trigger">
|
|
4
|
+
<UiIcon :busy="busy" :icon="icon" />
|
|
5
|
+
<slot />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import UiIcon from '@core/components/icon/UiIcon.vue'
|
|
11
|
+
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
|
|
12
|
+
|
|
13
|
+
defineProps<{
|
|
14
|
+
active?: boolean
|
|
15
|
+
busy?: boolean
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
icon?: IconDefinition
|
|
18
|
+
}>()
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<style lang="postcss" scoped>
|
|
22
|
+
.menu-trigger {
|
|
23
|
+
font-size: 1.6rem;
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
height: 4.4rem;
|
|
28
|
+
padding-right: 1.5rem;
|
|
29
|
+
padding-left: 1.5rem;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
border-radius: 0.8rem;
|
|
32
|
+
gap: 1rem;
|
|
33
|
+
background-color: var(--color-grey-600);
|
|
34
|
+
|
|
35
|
+
&.disabled {
|
|
36
|
+
color: var(--color-grey-500);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:not(.disabled) {
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
|
|
42
|
+
&:hover {
|
|
43
|
+
background-color: var(--background-color-purple-10);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:active,
|
|
47
|
+
&.active {
|
|
48
|
+
background-color: var(--background-color-purple-20);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<!-- v1.0 -->
|
|
2
|
+
<template>
|
|
3
|
+
<component :is="tag" :class="classNames" class="tab-item typo">
|
|
4
|
+
<slot />
|
|
5
|
+
</component>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import { useContext } from '@core/composables/context.composable'
|
|
10
|
+
import { DisabledContext } from '@core/context'
|
|
11
|
+
import { useUiStore } from '@core/stores/ui.store'
|
|
12
|
+
import { storeToRefs } from 'pinia'
|
|
13
|
+
import { computed } from 'vue'
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(
|
|
16
|
+
defineProps<{
|
|
17
|
+
disabled?: boolean
|
|
18
|
+
active?: boolean
|
|
19
|
+
tag?: string
|
|
20
|
+
}>(),
|
|
21
|
+
{ tag: 'span', disabled: undefined }
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
const { isMobile } = storeToRefs(useUiStore())
|
|
25
|
+
|
|
26
|
+
const isDisabled = useContext(DisabledContext, () => props.disabled)
|
|
27
|
+
|
|
28
|
+
const classNames = computed(() => {
|
|
29
|
+
return [
|
|
30
|
+
isMobile.value ? 'c3-semi-bold' : 'c1-semi-bold',
|
|
31
|
+
{
|
|
32
|
+
disabled: isDisabled.value,
|
|
33
|
+
active: props.active,
|
|
34
|
+
},
|
|
35
|
+
]
|
|
36
|
+
})
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<style lang="postcss" scoped>
|
|
40
|
+
/* COLOR VARIANTS */
|
|
41
|
+
.tab-item {
|
|
42
|
+
& {
|
|
43
|
+
--color: var(--color-grey-100);
|
|
44
|
+
--border-color: transparent;
|
|
45
|
+
--background-color: transparent;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&:is(:hover, .hover, :focus-visible) {
|
|
49
|
+
--color: var(--color-grey-100);
|
|
50
|
+
--border-color: var(--color-purple-d20);
|
|
51
|
+
--background-color: var(--background-color-purple-20);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:is(:active, .pressed) {
|
|
55
|
+
--color: var(--color-grey-100);
|
|
56
|
+
--border-color: var(--color-purple-d40);
|
|
57
|
+
--background-color: var(--background-color-purple-30);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&:is(.active, .selected) {
|
|
61
|
+
--color: var(--color-grey-100);
|
|
62
|
+
--border-color: var(--color-purple-base);
|
|
63
|
+
--background-color: var(--background-color-purple-10);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:is(:disabled, .disabled) {
|
|
67
|
+
--color: var(--color-grey-400);
|
|
68
|
+
--border-color: transparent;
|
|
69
|
+
--background-color: transparent;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* SIZE VARIANTS */
|
|
74
|
+
.tab-item {
|
|
75
|
+
&.c3-semi-bold {
|
|
76
|
+
--spacing: 0.8rem;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.c1-semi-bold {
|
|
80
|
+
--spacing: 1.6rem;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* IMPLEMENTATION */
|
|
85
|
+
.tab-item {
|
|
86
|
+
display: flex;
|
|
87
|
+
align-items: center;
|
|
88
|
+
gap: var(--spacing);
|
|
89
|
+
padding: var(--spacing);
|
|
90
|
+
text-decoration: none;
|
|
91
|
+
color: var(--color);
|
|
92
|
+
background-color: var(--background-color);
|
|
93
|
+
border-bottom: 0.2rem solid var(--border-color);
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
|
|
96
|
+
&.disabled {
|
|
97
|
+
pointer-events: none;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</style>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!-- v1.0 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="tab-list">
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import { useContext } from '@core/composables/context.composable'
|
|
10
|
+
import { DisabledContext } from '@core/context'
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(
|
|
13
|
+
defineProps<{
|
|
14
|
+
disabled?: boolean
|
|
15
|
+
}>(),
|
|
16
|
+
{ disabled: undefined }
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
useContext(DisabledContext, () => props.disabled)
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style lang="postcss" scoped>
|
|
23
|
+
.tab-list {
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: stretch;
|
|
26
|
+
height: 5rem;
|
|
27
|
+
border-bottom: 1px solid var(--color-grey-500);
|
|
28
|
+
background-color: var(--background-color-primary);
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
overflow: auto;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<!-- v1.0 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div v-if="!isDisabled" ref="tooltipElement" class="app-tooltip typo p3-regular">
|
|
4
|
+
{{ content }}
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import type { TooltipOptions } from '@core/stores/tooltip.store'
|
|
10
|
+
import { hasEllipsis } from '@core/utils/has-ellipsis.util'
|
|
11
|
+
import { isString } from 'lodash-es'
|
|
12
|
+
import place from 'placement.js'
|
|
13
|
+
import { computed, ref, watchEffect } from 'vue'
|
|
14
|
+
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
target: HTMLElement
|
|
17
|
+
options: TooltipOptions
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const tooltipElement = ref<HTMLElement>()
|
|
21
|
+
|
|
22
|
+
const content = computed(() => {
|
|
23
|
+
if (props.options.content === false) {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (isString(props.options.content)) {
|
|
28
|
+
return props.options.content.trim() === '' ? false : props.options.content
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const ellipsisTarget = props.options.selector ? props.target.querySelector(props.options.selector) : props.target
|
|
32
|
+
|
|
33
|
+
if (!ellipsisTarget || !hasEllipsis(ellipsisTarget, { vertical: props.options.vertical })) {
|
|
34
|
+
return false
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return ellipsisTarget.textContent?.trim() ?? false
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const isDisabled = computed(() => content.value === false)
|
|
41
|
+
|
|
42
|
+
const placement = computed(() => props.options.placement ?? 'top')
|
|
43
|
+
|
|
44
|
+
watchEffect(() => {
|
|
45
|
+
if (tooltipElement.value) {
|
|
46
|
+
place(props.target, tooltipElement.value, {
|
|
47
|
+
placement: placement.value,
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="postcss" scoped>
|
|
54
|
+
.app-tooltip {
|
|
55
|
+
position: relative;
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
padding: 0.4rem 0.8rem;
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
color: var(--color-grey-600);
|
|
60
|
+
border-radius: 0.4rem;
|
|
61
|
+
background-color: var(--color-grey-100);
|
|
62
|
+
z-index: 999999;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-placement^='top'] {
|
|
66
|
+
margin-bottom: 0.7rem;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
[data-placement^='right'] {
|
|
70
|
+
margin-left: 0.7rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
[data-placement^='bottom'] {
|
|
74
|
+
margin-top: 0.7rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
[data-placement^='left'] {
|
|
78
|
+
margin-right: 0.7rem;
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!-- v1.0 -->
|
|
2
|
+
<template>
|
|
3
|
+
<AppTooltip v-for="tooltip in tooltips" :key="tooltip.key" :options="tooltip.options" :target="tooltip.target" />
|
|
4
|
+
</template>
|
|
5
|
+
|
|
6
|
+
<script lang="ts" setup>
|
|
7
|
+
import AppTooltip from '@core/components/tooltip/TooltipItem.vue'
|
|
8
|
+
import { useTooltipStore } from '@core/stores/tooltip.store'
|
|
9
|
+
import { storeToRefs } from 'pinia'
|
|
10
|
+
|
|
11
|
+
const tooltipStore = useTooltipStore()
|
|
12
|
+
const { tooltips } = storeToRefs(tooltipStore)
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<style scoped></style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!-- v1.1 -->
|
|
2
|
+
<template>
|
|
3
|
+
<li class="tree-item">
|
|
4
|
+
<slot />
|
|
5
|
+
<slot v-if="isExpanded" name="sublist" />
|
|
6
|
+
</li>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import { IK_TREE_ITEM_EXPANDED, IK_TREE_ITEM_HAS_CHILDREN, IK_TREE_ITEM_TOGGLE } from '@core/utils/injection-keys.util'
|
|
11
|
+
import { useToggle } from '@vueuse/core'
|
|
12
|
+
import { onBeforeMount, onBeforeUpdate, provide, ref, useSlots } from 'vue'
|
|
13
|
+
|
|
14
|
+
defineSlots<{
|
|
15
|
+
default: () => void
|
|
16
|
+
sublist: () => void
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
const [isExpanded, toggle] = useToggle(true)
|
|
20
|
+
|
|
21
|
+
const hasChildren = ref(false)
|
|
22
|
+
|
|
23
|
+
const updateHasChildren = () => {
|
|
24
|
+
const { sublist } = useSlots()
|
|
25
|
+
hasChildren.value = sublist !== undefined
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
onBeforeMount(() => updateHasChildren())
|
|
29
|
+
onBeforeUpdate(() => updateHasChildren())
|
|
30
|
+
|
|
31
|
+
provide(IK_TREE_ITEM_HAS_CHILDREN, hasChildren)
|
|
32
|
+
provide(IK_TREE_ITEM_TOGGLE, toggle)
|
|
33
|
+
provide(IK_TREE_ITEM_EXPANDED, isExpanded)
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<!-- v1.1 -->
|
|
2
|
+
<template>
|
|
3
|
+
<RouterLink v-slot="{ isExactActive, href, navigate }" :to="route" custom>
|
|
4
|
+
<div
|
|
5
|
+
:class="isExactActive ? 'exact-active' : active ? 'active' : undefined"
|
|
6
|
+
class="tree-item-label"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
>
|
|
9
|
+
<template v-if="depth > 1">
|
|
10
|
+
<TreeLine
|
|
11
|
+
v-for="i in depth - 1"
|
|
12
|
+
:key="i"
|
|
13
|
+
:half-height="(!hasToggle && i === depth - 1) || !isExpanded"
|
|
14
|
+
:right="i === depth - 1"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
<ButtonIcon
|
|
18
|
+
v-if="hasToggle"
|
|
19
|
+
v-tooltip="isExpanded ? $t('core.close') : $t('core.open')"
|
|
20
|
+
:icon="isExpanded ? faAngleDown : faAngleRight"
|
|
21
|
+
size="small"
|
|
22
|
+
@click="toggle()"
|
|
23
|
+
/>
|
|
24
|
+
<TreeLine v-else-if="!noIndent" />
|
|
25
|
+
<a v-tooltip="{ selector: '.text' }" :href class="link typo p2-medium" @click="navigate">
|
|
26
|
+
<slot name="icon">
|
|
27
|
+
<UiIcon :icon class="icon" />
|
|
28
|
+
</slot>
|
|
29
|
+
<div class="text">
|
|
30
|
+
<slot />
|
|
31
|
+
</div>
|
|
32
|
+
</a>
|
|
33
|
+
<slot name="addons" />
|
|
34
|
+
</div>
|
|
35
|
+
</RouterLink>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts" setup>
|
|
39
|
+
import ButtonIcon from '@core/components/button/ButtonIcon.vue'
|
|
40
|
+
import UiIcon from '@core/components/icon/UiIcon.vue'
|
|
41
|
+
import TreeLine from '@core/components/tree/TreeLine.vue'
|
|
42
|
+
import { vTooltip } from '@core/directives/tooltip.directive'
|
|
43
|
+
import {
|
|
44
|
+
IK_TREE_ITEM_EXPANDED,
|
|
45
|
+
IK_TREE_ITEM_HAS_CHILDREN,
|
|
46
|
+
IK_TREE_ITEM_TOGGLE,
|
|
47
|
+
IK_TREE_LIST_DEPTH,
|
|
48
|
+
} from '@core/utils/injection-keys.util'
|
|
49
|
+
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
|
|
50
|
+
import { faAngleDown, faAngleRight } from '@fortawesome/free-solid-svg-icons'
|
|
51
|
+
import { inject, ref } from 'vue'
|
|
52
|
+
import type { RouteLocationRaw } from 'vue-router'
|
|
53
|
+
|
|
54
|
+
defineProps<{
|
|
55
|
+
icon?: IconDefinition
|
|
56
|
+
route: RouteLocationRaw
|
|
57
|
+
active?: boolean
|
|
58
|
+
noIndent?: boolean
|
|
59
|
+
}>()
|
|
60
|
+
|
|
61
|
+
const hasToggle = inject(IK_TREE_ITEM_HAS_CHILDREN, ref(false))
|
|
62
|
+
|
|
63
|
+
const toggle = inject(IK_TREE_ITEM_TOGGLE, () => undefined)
|
|
64
|
+
const isExpanded = inject(IK_TREE_ITEM_EXPANDED, ref(true))
|
|
65
|
+
|
|
66
|
+
const depth = inject(IK_TREE_LIST_DEPTH, 0)
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<style lang="postcss" scoped>
|
|
70
|
+
/* COLOR VARIANTS */
|
|
71
|
+
.tree-item-label {
|
|
72
|
+
--color: var(--color-grey-100);
|
|
73
|
+
--background-color: var(--background-color-primary);
|
|
74
|
+
|
|
75
|
+
&:is(.exact-active, .active) {
|
|
76
|
+
--color: var(--color-grey-100);
|
|
77
|
+
--background-color: var(--background-color-purple-10);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:hover {
|
|
81
|
+
--color: var(--color-grey-100);
|
|
82
|
+
--background-color: var(--background-color-purple-20);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:active {
|
|
86
|
+
--color: var(--color-grey-100);
|
|
87
|
+
--background-color: var(--background-color-purple-30);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* IMPLEMENTATION */
|
|
92
|
+
.tree-item-label {
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
color: var(--color);
|
|
96
|
+
background-color: var(--background-color);
|
|
97
|
+
border-radius: 0.8rem;
|
|
98
|
+
gap: 0.4rem;
|
|
99
|
+
padding: 0 0.8rem;
|
|
100
|
+
margin-bottom: 0.2rem;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.link {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
flex: 1;
|
|
107
|
+
min-width: 0;
|
|
108
|
+
padding: 0.8rem 0;
|
|
109
|
+
text-decoration: none;
|
|
110
|
+
color: inherit;
|
|
111
|
+
gap: 1.2rem;
|
|
112
|
+
|
|
113
|
+
&:hover {
|
|
114
|
+
color: var(--color-grey-100);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.text {
|
|
119
|
+
overflow: hidden;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
text-overflow: ellipsis;
|
|
122
|
+
padding-inline-end: 0.4rem;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.icon {
|
|
126
|
+
font-size: 1.6rem;
|
|
127
|
+
}
|
|
128
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<!-- v1.1 -->
|
|
2
|
+
<template>
|
|
3
|
+
<div class="tree-line">
|
|
4
|
+
<div :class="{ 'tree-line-half-height': halfHeight }" class="tree-line-vertical" />
|
|
5
|
+
<div :class="{ right }" class="tree-line-horizontal" />
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
defineProps<{
|
|
11
|
+
halfHeight?: boolean
|
|
12
|
+
right?: boolean
|
|
13
|
+
}>()
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<style lang="postcss" scoped>
|
|
17
|
+
.tree-line {
|
|
18
|
+
--offset: 0.7rem;
|
|
19
|
+
flex: 0 1 1em;
|
|
20
|
+
align-self: stretch;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: end;
|
|
24
|
+
|
|
25
|
+
.tree-line-vertical {
|
|
26
|
+
width: 0.1rem;
|
|
27
|
+
background: var(--color-purple-base);
|
|
28
|
+
height: calc(100% + var(--offset));
|
|
29
|
+
transform: translateY(calc(var(--offset) * -1));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.tree-line-horizontal {
|
|
33
|
+
height: 0.1rem;
|
|
34
|
+
width: 50%;
|
|
35
|
+
background: transparent;
|
|
36
|
+
|
|
37
|
+
&.right {
|
|
38
|
+
background: var(--color-purple-base);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.tree-item:last-child {
|
|
44
|
+
> .tree-item-label {
|
|
45
|
+
.tree-line-half-height {
|
|
46
|
+
align-self: start;
|
|
47
|
+
height: calc(50% + var(--offset));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!-- v1.1 -->
|
|
2
|
+
<template>
|
|
3
|
+
<ul class="tree-list">
|
|
4
|
+
<slot />
|
|
5
|
+
</ul>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import { IK_TREE_LIST_DEPTH } from '@core/utils/injection-keys.util'
|
|
10
|
+
import { inject, provide } from 'vue'
|
|
11
|
+
|
|
12
|
+
const depth = inject(IK_TREE_LIST_DEPTH, 0)
|
|
13
|
+
provide(IK_TREE_LIST_DEPTH, depth + 1)
|
|
14
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!-- v1.1 -->
|
|
2
|
+
<template>
|
|
3
|
+
<li class="tree-loading-item">
|
|
4
|
+
<div class="tree-loading-item-label-placeholder">
|
|
5
|
+
<div class="link-placeholder">
|
|
6
|
+
<template v-if="depth > 1">
|
|
7
|
+
<TreeLine v-for="i in depth - 1" :key="i" :right="i === depth - 1" full-height />
|
|
8
|
+
</template>
|
|
9
|
+
<UiIcon :icon class="icon" />
|
|
10
|
+
<div class="loader"> </div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</li>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import UiIcon from '@core/components/icon/UiIcon.vue'
|
|
18
|
+
import TreeLine from '@core/components/tree/TreeLine.vue'
|
|
19
|
+
import { IK_TREE_LIST_DEPTH } from '@core/utils/injection-keys.util'
|
|
20
|
+
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
|
|
21
|
+
import { inject } from 'vue'
|
|
22
|
+
|
|
23
|
+
defineProps<{
|
|
24
|
+
icon: IconDefinition
|
|
25
|
+
}>()
|
|
26
|
+
|
|
27
|
+
const depth = inject(IK_TREE_LIST_DEPTH, 0)
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<style lang="postcss" scoped>
|
|
31
|
+
.tree-loading-item-label-placeholder {
|
|
32
|
+
display: flex;
|
|
33
|
+
height: 4rem;
|
|
34
|
+
background-color: var(--background-color-primary);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.icon {
|
|
38
|
+
color: var(--color-grey-100);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.link-placeholder {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
flex: 1;
|
|
45
|
+
padding: 0 0.8rem;
|
|
46
|
+
gap: 0.4rem;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.loader {
|
|
50
|
+
flex: 1;
|
|
51
|
+
animation: pulse alternate 1s infinite;
|
|
52
|
+
background-color: var(--background-color-purple-10);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@keyframes pulse {
|
|
56
|
+
0% {
|
|
57
|
+
opacity: 0.5;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
100% {
|
|
61
|
+
opacity: 1;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!-- v1.0 -->
|
|
2
|
+
<template>
|
|
3
|
+
<RouterLink v-if="route && !disabled" :to="route" class="user-link is-link typo p3-medium">
|
|
4
|
+
<UserLogo class="logo" />
|
|
5
|
+
{{ username }}
|
|
6
|
+
</RouterLink>
|
|
7
|
+
<span v-else :class="{ disabled }" class="user-link typo p3-medium">
|
|
8
|
+
<UserLogo class="logo" />
|
|
9
|
+
{{ username }}
|
|
10
|
+
</span>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import UserLogo from '@core/components/user/UserLogo.vue'
|
|
15
|
+
import { type RouteLocationRaw } from 'vue-router'
|
|
16
|
+
|
|
17
|
+
defineProps<{
|
|
18
|
+
route?: RouteLocationRaw
|
|
19
|
+
disabled?: boolean
|
|
20
|
+
username: string
|
|
21
|
+
}>()
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style lang="postcss" scoped>
|
|
25
|
+
/* COLOR VARIANTS */
|
|
26
|
+
.user-link {
|
|
27
|
+
--color: var(--color-purple-base);
|
|
28
|
+
--border-color: var(--color-purple-base);
|
|
29
|
+
|
|
30
|
+
&.is-link {
|
|
31
|
+
&:is(:hover, .hover, :focus-visible) {
|
|
32
|
+
--color: var(--color-purple-d20);
|
|
33
|
+
--border-color: var(--color-purple-d20);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:is(:active, .pressed) {
|
|
37
|
+
--color: var(--color-purple-d40);
|
|
38
|
+
--border-color: var(--color-purple-d40);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&.disabled {
|
|
43
|
+
--color: var(--color-grey-400);
|
|
44
|
+
--border-color: var(--color-grey-400);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* IMPLEMENTATION */
|
|
49
|
+
.user-link {
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
color: var(--color);
|
|
53
|
+
gap: 0.8rem;
|
|
54
|
+
border-top: 1px solid transparent;
|
|
55
|
+
border-bottom: 1px solid var(--border-color);
|
|
56
|
+
line-height: 0;
|
|
57
|
+
|
|
58
|
+
&.disabled {
|
|
59
|
+
cursor: not-allowed;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.is-link {
|
|
63
|
+
text-decoration: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.logo {
|
|
67
|
+
/* Override the default color of UserLogo,
|
|
68
|
+
to apply hover, active and disabled styles */
|
|
69
|
+
--border-color: inherit;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
</style>
|