design-system-next 2.20.1 → 2.20.4
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/dist/design-system-next.es.js +7510 -7503
- package/dist/design-system-next.es.js.gz +0 -0
- package/dist/design-system-next.umd.js +12 -12
- package/dist/design-system-next.umd.js.gz +0 -0
- package/dist/main.css +1 -1
- package/dist/main.css.gz +0 -0
- package/dist/package.json.d.ts +3 -2
- package/package.json +3 -2
- package/src/App.vue +51 -1
- package/src/assets/scripts/border-radius.ts +15 -15
- package/src/assets/scripts/colors.ts +134 -134
- package/src/assets/scripts/max-width.ts +11 -11
- package/src/assets/scripts/spacing.ts +23 -23
- package/src/assets/scripts/utilities.ts +15 -15
- package/src/components/accordion/accordion.ts +43 -43
- package/src/components/accordion/use-accordion.ts +43 -43
- package/src/components/banner/banner.ts +20 -20
- package/src/components/button/button.ts +72 -72
- package/src/components/button/button.vue +15 -15
- package/src/components/checkbox/checkbox.ts +45 -45
- package/src/components/collapsible/collapsible.ts +21 -21
- package/src/components/collapsible/collapsible.vue +27 -27
- package/src/components/dropdown/fix-multi-number.ts +92 -92
- package/src/components/empty-state/empty-state.ts +50 -50
- package/src/components/floating-action/floating-action.ts +12 -12
- package/src/components/input/input-email/input-email.vue +17 -17
- package/src/components/input/input-search/input-search.vue +13 -13
- package/src/components/input/input-url/input-url.vue +20 -20
- package/src/components/input/input-username/input-username.vue +17 -17
- package/src/components/list/ladderized-list/ladderized-list.ts +43 -39
- package/src/components/list/ladderized-list/ladderized-list.vue +1 -0
- package/src/components/list/list-item/list-item.ts +48 -0
- package/src/components/list/list-item/list-item.vue +112 -0
- package/src/components/list/list-item/use-list-item.ts +30 -0
- package/src/components/list/list.vue +60 -258
- package/src/components/list/use-list.ts +19 -5
- package/src/components/logo/logo.ts +43 -43
- package/src/components/logo/logo.vue +14 -14
- package/src/components/logo/use-logo.ts +41 -41
- package/src/components/lozenge/lozenge.ts +4 -18
- package/src/components/lozenge/lozenge.vue +14 -4
- package/src/components/lozenge/use-lozenge.ts +6 -0
- package/src/components/radio/radio.ts +42 -42
- package/src/components/select/select-ladderized/select-ladderized.ts +9 -1
- package/src/components/select/select-ladderized/select-ladderized.vue +3 -1
- package/src/components/select/select-multiple/select-multiple.ts +12 -2
- package/src/components/select/select-multiple/select-multiple.vue +3 -2
- package/src/components/select/select.ts +8 -0
- package/src/components/select/select.vue +5 -1
- package/src/components/sidepanel/sidepanel.vue +55 -55
- package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.ts +16 -16
- package/src/components/sidepanel/stacking-sidepanel/stacking-sidepanel.vue +39 -39
- package/src/components/slider/slider.ts +38 -38
- package/src/components/snackbar/snack/snack.ts +71 -71
- package/src/components/snackbar/use-snackbar.ts +34 -34
- package/src/components/status/status.ts +19 -19
- package/src/components/status/status.vue +13 -13
- package/src/components/stepper/step/step.ts +47 -47
- package/src/components/stepper/stepper.ts +47 -47
- package/src/components/stepper/stepper.vue +34 -34
- package/src/components/switch/switch.ts +42 -42
- package/src/components/table/table-actions/table-actions.ts +42 -42
- package/src/components/table/table-actions/table-actions.vue +40 -40
- package/src/components/table/table-chips-title/table-chips-title.ts +27 -27
- package/src/components/table/table-chips-title/table-chips-title.vue +32 -32
- package/src/components/table/table-chips-title/use-table-chips-title.ts +22 -22
- package/src/components/table/table-lozenge-title/table-lozenge-title.ts +23 -23
- package/src/components/table/table-lozenge-title/table-lozenge-title.vue +26 -26
- package/src/components/table/table-lozenge-title/use-table-lozenge-title.ts +21 -21
- package/src/components/tabs/tabs.ts +43 -43
- package/src/components/time-picker/time-picker.ts +69 -69
- package/src/components/tooltip/use-tooltip.ts +13 -13
- package/src/stores/useSnackbarStore.ts +44 -44
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
export const floatingActionPropTypes = {
|
|
6
|
-
show: {
|
|
7
|
-
type: Boolean,
|
|
8
|
-
default: false,
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type FloatingActionProps = ExtractPropTypes<typeof floatingActionPropTypes>;
|
|
1
|
+
import { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
export const floatingActionPropTypes = {
|
|
6
|
+
show: {
|
|
7
|
+
type: Boolean,
|
|
8
|
+
default: false,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type FloatingActionProps = ExtractPropTypes<typeof floatingActionPropTypes>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<spr-input v-bind="$attrs">
|
|
3
|
-
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
|
-
<slot :name="slotName" />
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<template #prefix>
|
|
8
|
-
<Icon icon="ph:envelope" />
|
|
9
|
-
</template>
|
|
10
|
-
</spr-input>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script setup lang="ts">
|
|
14
|
-
import { Icon } from '@iconify/vue';
|
|
15
|
-
|
|
16
|
-
import SprInput from '@/components/input/input.vue';
|
|
17
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<spr-input v-bind="$attrs">
|
|
3
|
+
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
|
+
<slot :name="slotName" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #prefix>
|
|
8
|
+
<Icon icon="ph:envelope" />
|
|
9
|
+
</template>
|
|
10
|
+
</spr-input>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { Icon } from '@iconify/vue';
|
|
15
|
+
|
|
16
|
+
import SprInput from '@/components/input/input.vue';
|
|
17
|
+
</script>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<spr-input v-bind="$attrs">
|
|
3
|
-
<template #icon>
|
|
4
|
-
<Icon icon="ph:magnifying-glass" />
|
|
5
|
-
</template>
|
|
6
|
-
</spr-input>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup lang="ts">
|
|
10
|
-
import { Icon } from '@iconify/vue';
|
|
11
|
-
|
|
12
|
-
import SprInput from '@/components/input/input.vue';
|
|
13
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<spr-input v-bind="$attrs">
|
|
3
|
+
<template #icon>
|
|
4
|
+
<Icon icon="ph:magnifying-glass" />
|
|
5
|
+
</template>
|
|
6
|
+
</spr-input>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup lang="ts">
|
|
10
|
+
import { Icon } from '@iconify/vue';
|
|
11
|
+
|
|
12
|
+
import SprInput from '@/components/input/input.vue';
|
|
13
|
+
</script>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<spr-input v-bind="$attrs" type="url">
|
|
3
|
-
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
|
-
<slot :name="slotName" />
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<template #prefix>
|
|
8
|
-
<span> https:// </span>
|
|
9
|
-
</template>
|
|
10
|
-
<template #icon>
|
|
11
|
-
<Icon icon="ph:question-fill" />
|
|
12
|
-
</template>
|
|
13
|
-
</spr-input>
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script setup lang="ts">
|
|
17
|
-
import { Icon } from '@iconify/vue';
|
|
18
|
-
|
|
19
|
-
import SprInput from '@/components/input/input.vue';
|
|
20
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<spr-input v-bind="$attrs" type="url">
|
|
3
|
+
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
|
+
<slot :name="slotName" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #prefix>
|
|
8
|
+
<span> https:// </span>
|
|
9
|
+
</template>
|
|
10
|
+
<template #icon>
|
|
11
|
+
<Icon icon="ph:question-fill" />
|
|
12
|
+
</template>
|
|
13
|
+
</spr-input>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { Icon } from '@iconify/vue';
|
|
18
|
+
|
|
19
|
+
import SprInput from '@/components/input/input.vue';
|
|
20
|
+
</script>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<spr-input v-bind="$attrs">
|
|
3
|
-
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
|
-
<slot :name="slotName" />
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<template #prefix>
|
|
8
|
-
<Icon icon="ph:user" />
|
|
9
|
-
</template>
|
|
10
|
-
</spr-input>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script setup lang="ts">
|
|
14
|
-
import { Icon } from '@iconify/vue';
|
|
15
|
-
|
|
16
|
-
import SprInput from '@/components/input/input.vue';
|
|
17
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<spr-input v-bind="$attrs">
|
|
3
|
+
<template v-for="(_, slotName) in $slots" #[slotName]>
|
|
4
|
+
<slot :name="slotName" />
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<template #prefix>
|
|
8
|
+
<Icon icon="ph:user" />
|
|
9
|
+
</template>
|
|
10
|
+
</spr-input>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { Icon } from '@iconify/vue';
|
|
15
|
+
|
|
16
|
+
import SprInput from '@/components/input/input.vue';
|
|
17
|
+
</script>
|
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
-
import { MenuListType } from '../list';
|
|
3
|
-
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
-
|
|
5
|
-
export const ladderizedListPropTypes = {
|
|
6
|
-
modelValue: {
|
|
7
|
-
type: Array as PropType<string[]>,
|
|
8
|
-
required: true,
|
|
9
|
-
default: [],
|
|
10
|
-
},
|
|
11
|
-
menuList: {
|
|
12
|
-
type: Array as PropType<MenuListType[]>,
|
|
13
|
-
required: true,
|
|
14
|
-
default: [],
|
|
15
|
-
},
|
|
16
|
-
menuLevel: {
|
|
17
|
-
type: Number,
|
|
18
|
-
default: 0,
|
|
19
|
-
},
|
|
20
|
-
searchableMenu: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
default: false,
|
|
23
|
-
},
|
|
24
|
-
searchableMenuPlaceholder: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: 'Search...',
|
|
27
|
-
},
|
|
28
|
-
removeCurrentLevelInBackLabel: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: false,
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export
|
|
39
|
-
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
import { MenuListType } from '../list';
|
|
3
|
+
export const definePropType = <T>(val: unknown): PropType<T> => val as PropType<T>;
|
|
4
|
+
|
|
5
|
+
export const ladderizedListPropTypes = {
|
|
6
|
+
modelValue: {
|
|
7
|
+
type: Array as PropType<string[]>,
|
|
8
|
+
required: true,
|
|
9
|
+
default: [],
|
|
10
|
+
},
|
|
11
|
+
menuList: {
|
|
12
|
+
type: Array as PropType<MenuListType[]>,
|
|
13
|
+
required: true,
|
|
14
|
+
default: [],
|
|
15
|
+
},
|
|
16
|
+
menuLevel: {
|
|
17
|
+
type: Number,
|
|
18
|
+
default: 0,
|
|
19
|
+
},
|
|
20
|
+
searchableMenu: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false,
|
|
23
|
+
},
|
|
24
|
+
searchableMenuPlaceholder: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: 'Search...',
|
|
27
|
+
},
|
|
28
|
+
removeCurrentLevelInBackLabel: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
loading: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: false,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const ladderizedListEmitTypes = {
|
|
39
|
+
'update:modelValue': (value: string[]) => value,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type LadderizedListPropTypes = ExtractPropTypes<typeof ladderizedListPropTypes>;
|
|
43
|
+
export type LadderizedListEmitTypes = typeof ladderizedListEmitTypes;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
:searchable-menu="props.searchableMenu"
|
|
13
13
|
:searchable-menu-placeholder="props.searchableMenuPlaceholder"
|
|
14
14
|
:sticky-search-offset="activeLevel > 0 ? 42 : 0"
|
|
15
|
+
:loading="props.loading"
|
|
15
16
|
@update:model-value="(value) => handleSelectedListItem(value[0])"
|
|
16
17
|
/>
|
|
17
18
|
</div>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { PropType, ExtractPropTypes } from 'vue';
|
|
2
|
+
import type { MenuListType } from '../list';
|
|
3
|
+
|
|
4
|
+
export const listItemPropTypes = {
|
|
5
|
+
item: {
|
|
6
|
+
type: Object as PropType<MenuListType>,
|
|
7
|
+
required: true,
|
|
8
|
+
},
|
|
9
|
+
isSelected: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
classes: {
|
|
14
|
+
type: [String, Array, Object] as PropType<string | string[] | Record<string, boolean>>,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
multiSelect: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
lozenge: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false,
|
|
24
|
+
},
|
|
25
|
+
ladderized: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false,
|
|
28
|
+
},
|
|
29
|
+
noCheck: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
itemIcon: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: '',
|
|
36
|
+
},
|
|
37
|
+
disabledUnselectedItems: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const listItemEmitTypes = {
|
|
44
|
+
select: () => true,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type ListItemPropTypes = ExtractPropTypes<typeof listItemPropTypes>;
|
|
48
|
+
export type ListItemEmitTypes = typeof listItemEmitTypes;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classes" @click="$emit('select')">
|
|
3
|
+
<template v-if="showLozengeMode">
|
|
4
|
+
<div class="spr-flex spr-items-center spr-gap-1">
|
|
5
|
+
<spr-checkbox
|
|
6
|
+
v-if="props.multiSelect"
|
|
7
|
+
:disabled="item.disabled || (props.disabledUnselectedItems && !isSelected)"
|
|
8
|
+
:checked="isSelected"
|
|
9
|
+
/>
|
|
10
|
+
<spr-lozenge
|
|
11
|
+
:label="item.text || (item.lozengeProps?.label as string)"
|
|
12
|
+
:tone="item.lozengeProps?.tone as string & (typeof LOZENGE_TONE)[number]"
|
|
13
|
+
:fill="item.lozengeProps?.fill as boolean"
|
|
14
|
+
:url="item.lozengeProps?.url as string"
|
|
15
|
+
:icon="item.lozengeProps?.icon as string"
|
|
16
|
+
:max-width="item.lozengeProps?.maxWidth as string"
|
|
17
|
+
:postfix-icon="item.lozengeProps?.postfixIcon as string"
|
|
18
|
+
/>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
<template v-else>
|
|
22
|
+
<div class="spr-flex spr-items-center spr-gap-1">
|
|
23
|
+
<spr-checkbox
|
|
24
|
+
v-if="props.multiSelect"
|
|
25
|
+
:disabled="item.disabled || (props.disabledUnselectedItems && !isSelected)"
|
|
26
|
+
:checked="isSelected"
|
|
27
|
+
/>
|
|
28
|
+
<div :class="[item.textColor, 'spr-flex spr-flex-row spr-items-center spr-gap-size-spacing-3xs']">
|
|
29
|
+
<span
|
|
30
|
+
v-if="hasIcon"
|
|
31
|
+
:class="[
|
|
32
|
+
item.iconColor,
|
|
33
|
+
'spr-mt-[2px]',
|
|
34
|
+
{ 'spr-text-color-disabled': item.disabled || (props.disabledUnselectedItems && !isSelected) },
|
|
35
|
+
]"
|
|
36
|
+
>
|
|
37
|
+
<Icon :icon="iconName" width="20px" height="20px" />
|
|
38
|
+
</span>
|
|
39
|
+
<div
|
|
40
|
+
:class="[
|
|
41
|
+
'spr-flex spr-flex-auto spr-flex-col spr-justify-start',
|
|
42
|
+
{ 'spr-text-color-disabled': item.disabled || (props.disabledUnselectedItems && !isSelected) },
|
|
43
|
+
]"
|
|
44
|
+
>
|
|
45
|
+
<span class="spr-break-words spr-text-left spr-text-xs">
|
|
46
|
+
{{ item.text }}
|
|
47
|
+
</span>
|
|
48
|
+
<span
|
|
49
|
+
v-if="item.subtext"
|
|
50
|
+
:class="[
|
|
51
|
+
'spr-body-xs-regular spr-text-color-base spr-break-words spr-text-left',
|
|
52
|
+
{ 'spr-text-color-disabled': item.disabled || (props.disabledUnselectedItems && !isSelected) },
|
|
53
|
+
]"
|
|
54
|
+
>
|
|
55
|
+
{{ item.subtext }}
|
|
56
|
+
</span>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<!-- Right Side Actions -->
|
|
62
|
+
<div class="spr-flex spr-items-center spr-gap-1">
|
|
63
|
+
<template v-if="props.ladderized">
|
|
64
|
+
<Icon v-if="hasSublevels" class="spr-text-color-weak spr-size-4" icon="ph:caret-right" />
|
|
65
|
+
<Icon
|
|
66
|
+
v-else-if="isSelected && !props.noCheck"
|
|
67
|
+
class="spr-text-color-brand-base spr-w-[1.39em]"
|
|
68
|
+
icon="ph:check"
|
|
69
|
+
/>
|
|
70
|
+
</template>
|
|
71
|
+
<template v-else>
|
|
72
|
+
<spr-lozenge
|
|
73
|
+
v-if="item.lozenge"
|
|
74
|
+
:label="item.lozenge?.label as string"
|
|
75
|
+
:tone="item.lozenge?.tone as string & (typeof LOZENGE_TONE)[number]"
|
|
76
|
+
:fill="item.lozenge?.fill as boolean"
|
|
77
|
+
:url="item.lozenge?.url as string"
|
|
78
|
+
:icon="item.lozenge?.icon as string"
|
|
79
|
+
:max-width="item.lozenge?.maxWidth as string"
|
|
80
|
+
:postfix-icon="item.lozenge?.postfixIcon as string"
|
|
81
|
+
/>
|
|
82
|
+
<Icon
|
|
83
|
+
v-if="isSelected && !props.noCheck && !props.multiSelect"
|
|
84
|
+
class="spr-text-color-brand-base spr-w-[1.39em]"
|
|
85
|
+
icon="ph:check"
|
|
86
|
+
/>
|
|
87
|
+
</template>
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
</div>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script lang="ts" setup>
|
|
94
|
+
import { computed } from 'vue';
|
|
95
|
+
import { Icon } from '@iconify/vue';
|
|
96
|
+
|
|
97
|
+
import SprCheckbox from '@/components/checkbox/checkbox.vue';
|
|
98
|
+
import SprLozenge from '@/components/lozenge/lozenge.vue';
|
|
99
|
+
|
|
100
|
+
import { LOZENGE_TONE } from '@/components/lozenge/lozenge';
|
|
101
|
+
|
|
102
|
+
import { listItemPropTypes, listItemEmitTypes } from './list-item';
|
|
103
|
+
import { useListItem } from './use-list-item';
|
|
104
|
+
|
|
105
|
+
const props = defineProps(listItemPropTypes);
|
|
106
|
+
const emit = defineEmits(listItemEmitTypes);
|
|
107
|
+
|
|
108
|
+
const { hasIcon, iconName, hasSublevels, showLozengeMode } = useListItem(props, emit);
|
|
109
|
+
|
|
110
|
+
// Computed property to ensure item is always defined
|
|
111
|
+
const item = computed(() => props.item!);
|
|
112
|
+
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ComputedRef } from 'vue';
|
|
2
|
+
import { computed } from 'vue';
|
|
3
|
+
|
|
4
|
+
import type { ListItemPropTypes } from './list-item';
|
|
5
|
+
|
|
6
|
+
export function useListItem(
|
|
7
|
+
props: ListItemPropTypes,
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
+
_emit?: unknown,
|
|
10
|
+
): {
|
|
11
|
+
hasIcon: ComputedRef<boolean>;
|
|
12
|
+
iconName: ComputedRef<string>;
|
|
13
|
+
hasSublevels: ComputedRef<boolean>;
|
|
14
|
+
showLozengeMode: ComputedRef<boolean>;
|
|
15
|
+
} {
|
|
16
|
+
const hasIcon = computed(() => !!(props.itemIcon || props.item!.icon));
|
|
17
|
+
|
|
18
|
+
const iconName = computed(() => props.itemIcon || props.item!.icon || '');
|
|
19
|
+
|
|
20
|
+
const hasSublevels = computed(() => !!(props.item!.sublevel && props.item!.sublevel.length > 0));
|
|
21
|
+
|
|
22
|
+
const showLozengeMode = computed(() => props.lozenge && !!props.item!.lozengeProps);
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
hasIcon,
|
|
26
|
+
iconName,
|
|
27
|
+
hasSublevels,
|
|
28
|
+
showLozengeMode,
|
|
29
|
+
};
|
|
30
|
+
}
|