sprintify-ui 0.4.10 → 0.5.2
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/sprintify-ui.es.js +11724 -11622
- package/dist/types/src/components/BaseActionItem.vue.d.ts +10 -18
- package/dist/types/src/components/BaseActionItemButton.vue.d.ts +4 -4
- package/dist/types/src/components/BaseAddressForm.vue.d.ts +15 -13
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +13 -5
- package/dist/types/src/components/BaseAutocompleteDrawer.vue.d.ts +5 -2
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +10 -4
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +6 -4
- package/dist/types/src/components/BaseBelongsToFetch.vue.d.ts +6 -4
- package/dist/types/src/components/BaseButtonGroup.vue.d.ts +5 -3
- package/dist/types/src/components/BaseCalendar.vue.d.ts +12 -1
- package/dist/types/src/components/BaseClickOutside.vue.d.ts +3 -1
- package/dist/types/src/components/BaseColor.vue.d.ts +5 -3
- package/dist/types/src/components/BaseDataIterator.vue.d.ts +15 -5
- package/dist/types/src/components/BaseDataIteratorSectionColumns.vue.d.ts +31 -11
- package/dist/types/src/components/BaseDataTable.vue.d.ts +14 -8
- package/dist/types/src/components/BaseDataTableRowAction.vue.d.ts +1 -1
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +23 -21
- package/dist/types/src/components/BaseDateSelect.vue.d.ts +4 -2
- package/dist/types/src/components/BaseDialog.vue.d.ts +4 -1
- package/dist/types/src/components/BaseDraggable.vue.d.ts +3 -1
- package/dist/types/src/components/BaseDropdown.vue.d.ts +4 -1
- package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +7 -4
- package/dist/types/src/components/BaseField.vue.d.ts +19 -1
- package/dist/types/src/components/BaseFieldI18n.vue.d.ts +4 -2
- package/dist/types/src/components/BaseFilePicker.vue.d.ts +3 -1
- package/dist/types/src/components/BaseFilePickerCrop.vue.d.ts +3 -1
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +25 -20
- package/dist/types/src/components/BaseForm.vue.d.ts +4 -1
- package/dist/types/src/components/BaseGantt.vue.d.ts +4 -1
- package/dist/types/src/components/BaseHasMany.vue.d.ts +5 -3
- package/dist/types/src/components/BaseHeader.vue.d.ts +3 -2
- package/dist/types/src/components/BaseIconPicker.vue.d.ts +3 -1
- package/dist/types/src/components/BaseInput.vue.d.ts +9 -5
- package/dist/types/src/components/BaseInputPercent.vue.d.ts +8 -4
- package/dist/types/src/components/BaseLayoutNotificationDropdown.vue.d.ts +4 -1
- package/dist/types/src/components/BaseLayoutNotificationItem.vue.d.ts +3 -1
- package/dist/types/src/components/BaseLayoutSidebarConfigurable.vue.d.ts +9 -5
- package/dist/types/src/components/BaseLayoutStacked.vue.d.ts +20 -11
- package/dist/types/src/components/BaseLayoutStackedConfigurable.vue.d.ts +13 -9
- package/dist/types/src/components/BaseMediaGallery.vue.d.ts +5 -2
- package/dist/types/src/components/BaseMediaGalleryItem.vue.d.ts +4 -2
- package/dist/types/src/components/BaseMediaItem.vue.d.ts +3 -1
- package/dist/types/src/components/BaseMediaLibrary.vue.d.ts +11 -5
- package/dist/types/src/components/BaseMediaList.vue.d.ts +5 -2
- package/dist/types/src/components/BaseMediaListItem.vue.d.ts +5 -2
- package/dist/types/src/components/BaseMediaPictures.vue.d.ts +5 -2
- package/dist/types/src/components/BaseMediaPicturesItem.vue.d.ts +4 -2
- package/dist/types/src/components/BaseMediaPreview.vue.d.ts +3 -1
- package/dist/types/src/components/BaseMenu.vue.d.ts +6 -6
- package/dist/types/src/components/BaseMenuItem.vue.d.ts +2 -2
- package/dist/types/src/components/BaseModalCenter.vue.d.ts +3 -1
- package/dist/types/src/components/BaseModalSide.vue.d.ts +3 -1
- package/dist/types/src/components/BaseNavbar.vue.d.ts +32 -1
- package/dist/types/src/components/BaseNavbarItem.vue.d.ts +4 -2
- package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +2 -2
- package/dist/types/src/components/BaseNavbarSideItem.vue.d.ts +4 -11
- package/dist/types/src/components/BaseNavbarSideItemContent.vue.d.ts +2 -2
- package/dist/types/src/components/BasePagination.vue.d.ts +3 -1
- package/dist/types/src/components/BasePassword.vue.d.ts +6 -4
- package/dist/types/src/components/BaseProgressCircle.vue.d.ts +1 -1
- package/dist/types/src/components/BaseRadioGroup.vue.d.ts +5 -3
- package/dist/types/src/components/BaseRichText.vue.d.ts +6 -4
- package/dist/types/src/components/BaseSelect.vue.d.ts +6 -4
- package/dist/types/src/components/BaseShortcut.vue.d.ts +2 -2
- package/dist/types/src/components/BaseStatistic.vue.d.ts +1 -1
- package/dist/types/src/components/BaseStepper.vue.d.ts +3 -1
- package/dist/types/src/components/BaseStepperItem.vue.d.ts +3 -1
- package/dist/types/src/components/BaseSwitch.vue.d.ts +5 -3
- package/dist/types/src/components/BaseSystemAlert.vue.d.ts +4 -2
- package/dist/types/src/components/BaseTable.vue.d.ts +11 -2
- package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +11 -5
- package/dist/types/src/components/BaseTagAutocompleteFetch.vue.d.ts +7 -2
- package/dist/types/src/components/BaseTextarea.vue.d.ts +6 -4
- package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +8 -3
- package/dist/types/src/components/BaseUniqueCode.vue.d.ts +3 -1
- package/dist/types/src/types/ActionItem.d.ts +14 -0
- package/dist/types/src/types/index.d.ts +0 -26
- package/package.json +1 -1
- package/src/components/BaseActionItem.vue +25 -14
- package/src/components/BaseActionItemButton.vue +14 -16
- package/src/components/BaseDataIterator.stories.js +1 -1
- package/src/components/BaseDataIterator.vue +2 -2
- package/src/components/BaseDataTable.stories.js +1 -1
- package/src/components/BaseDataTable.vue +4 -4
- package/src/components/BaseField.vue +17 -0
- package/src/components/BaseHeader.vue +3 -2
- package/src/components/BaseInputLabel.vue +5 -5
- package/src/components/BaseLayoutSidebarConfigurable.stories.js +25 -5
- package/src/components/BaseLayoutSidebarConfigurable.vue +23 -27
- package/src/components/BaseLayoutStacked.vue +27 -11
- package/src/components/BaseLayoutStackedConfigurable.stories.js +6 -2
- package/src/components/BaseLayoutStackedConfigurable.vue +11 -10
- package/src/components/BaseMenu.vue +3 -3
- package/src/components/BaseNavbar.stories.js +8 -7
- package/src/components/BaseNavbar.vue +58 -12
- package/src/components/BaseNavbarItem.vue +2 -5
- package/src/components/BaseNavbarSideItem.vue +22 -17
- package/src/components/BaseRadioGroup.stories.js +0 -1
- package/src/components/BaseRadioGroup.vue +0 -1
- package/src/components/BaseShortcut.vue +5 -3
- package/src/components/BaseSideNavigation.stories.js +1 -1
- package/src/components/BaseTabs.stories.js +1 -1
- package/src/stories/List.stories.js +1 -1
- package/src/types/ActionItem.ts +15 -0
- package/src/types/index.ts +0 -29
|
@@ -9,17 +9,20 @@
|
|
|
9
9
|
<div class="px-3 py-6">
|
|
10
10
|
<div class="space-y-8">
|
|
11
11
|
<div
|
|
12
|
-
v-for="section in
|
|
13
|
-
:key="section.
|
|
12
|
+
v-for="section in menu"
|
|
13
|
+
:key="section.label"
|
|
14
14
|
>
|
|
15
|
-
<
|
|
16
|
-
v-if="section.
|
|
17
|
-
|
|
18
|
-
:class="sectionTitleClasses"
|
|
15
|
+
<div
|
|
16
|
+
v-if="section.label && !section.href && !section.to && !section.action"
|
|
17
|
+
:key="section.label"
|
|
19
18
|
>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
<h2
|
|
20
|
+
class="pl-3"
|
|
21
|
+
:class="sectionLabelClasses"
|
|
22
|
+
>
|
|
23
|
+
{{ section.label }}
|
|
24
|
+
</h2>
|
|
25
|
+
|
|
23
26
|
<div :class="[size == 'md' ? 'space-y-1' : 'space-y-0.5']">
|
|
24
27
|
<BaseNavbarSideItem
|
|
25
28
|
v-for="item in section.actions"
|
|
@@ -30,6 +33,13 @@
|
|
|
30
33
|
/>
|
|
31
34
|
</div>
|
|
32
35
|
</div>
|
|
36
|
+
|
|
37
|
+
<BaseNavbarSideItem
|
|
38
|
+
v-else
|
|
39
|
+
:item="section"
|
|
40
|
+
:dark="dark"
|
|
41
|
+
:size="size"
|
|
42
|
+
/>
|
|
33
43
|
</div>
|
|
34
44
|
</div>
|
|
35
45
|
</div>
|
|
@@ -92,7 +102,8 @@
|
|
|
92
102
|
<script setup lang="ts">
|
|
93
103
|
import { User } from '@/types/User';
|
|
94
104
|
import { PropType } from 'vue';
|
|
95
|
-
import {
|
|
105
|
+
import { NotificationsConfig } from '../types';
|
|
106
|
+
import { ActionItem } from '@/types/ActionItem';
|
|
96
107
|
import BaseAvatar from './BaseAvatar.vue';
|
|
97
108
|
import BaseLayoutNotificationDropdown from './BaseLayoutNotificationDropdown.vue';
|
|
98
109
|
import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
|
|
@@ -112,7 +123,7 @@ const props = defineProps({
|
|
|
112
123
|
},
|
|
113
124
|
menu: {
|
|
114
125
|
required: true,
|
|
115
|
-
type: Array as PropType<ActionItem[]
|
|
126
|
+
type: Array as PropType<ActionItem[]>,
|
|
116
127
|
},
|
|
117
128
|
userMenu: {
|
|
118
129
|
required: true,
|
|
@@ -136,22 +147,7 @@ const props = defineProps({
|
|
|
136
147
|
},
|
|
137
148
|
});
|
|
138
149
|
|
|
139
|
-
const
|
|
140
|
-
const isActionSections = props.menu.length > 0 && 'actions' in props.menu[0];
|
|
141
|
-
|
|
142
|
-
if (isActionSections) {
|
|
143
|
-
return props.menu as ActionSection[];
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
return [
|
|
147
|
-
{
|
|
148
|
-
title: '',
|
|
149
|
-
actions: props.menu as ActionItem[],
|
|
150
|
-
},
|
|
151
|
-
];
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
const sectionTitleClasses = computed((): string[] => {
|
|
150
|
+
const sectionLabelClasses = computed((): string[] => {
|
|
155
151
|
const classList = ['mb-3 font-semibold uppercase tracking-widest'];
|
|
156
152
|
|
|
157
153
|
if (props.dark) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div :class="classInternal">
|
|
3
3
|
<BaseSystemAlert
|
|
4
4
|
v-for="systemAlert in systemAlerts"
|
|
5
5
|
:key="systemAlert.id"
|
|
@@ -12,13 +12,19 @@
|
|
|
12
12
|
{{ systemAlert.message }}
|
|
13
13
|
</BaseSystemAlert>
|
|
14
14
|
|
|
15
|
-
<BaseNavbar
|
|
16
|
-
<template #navbar>
|
|
17
|
-
<slot
|
|
15
|
+
<BaseNavbar v-bind="navbar">
|
|
16
|
+
<template #navbar="navbarProps">
|
|
17
|
+
<slot
|
|
18
|
+
name="navbar"
|
|
19
|
+
v-bind="navbarProps"
|
|
20
|
+
/>
|
|
18
21
|
</template>
|
|
19
22
|
|
|
20
|
-
<template #mobile>
|
|
21
|
-
<slot
|
|
23
|
+
<template #mobile="mobileProps">
|
|
24
|
+
<slot
|
|
25
|
+
name="mobile"
|
|
26
|
+
v-bind="mobileProps"
|
|
27
|
+
/>
|
|
22
28
|
</template>
|
|
23
29
|
</BaseNavbar>
|
|
24
30
|
</div>
|
|
@@ -29,17 +35,27 @@
|
|
|
29
35
|
</template>
|
|
30
36
|
|
|
31
37
|
<script lang="ts" setup>
|
|
38
|
+
import { twMerge } from 'tailwind-merge';
|
|
32
39
|
import { useSystemAlertStore } from '../stores/systemAlerts';
|
|
33
40
|
import BaseNavbar from './BaseNavbar.vue';
|
|
34
41
|
import BaseSystemAlert from './BaseSystemAlert.vue';
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
default: false,
|
|
39
|
-
type: Boolean,
|
|
40
|
-
},
|
|
43
|
+
defineOptions({
|
|
44
|
+
inheritAttrs: false
|
|
41
45
|
});
|
|
42
46
|
|
|
47
|
+
const props = defineProps<{
|
|
48
|
+
class?: string | string[];
|
|
49
|
+
navbar?: Record<string, unknown>;
|
|
50
|
+
}>();
|
|
51
|
+
|
|
52
|
+
const classInternal = computed(() => {
|
|
53
|
+
return twMerge(
|
|
54
|
+
'sticky top-0 z-20 w-full shadow-sm',
|
|
55
|
+
props.class,
|
|
56
|
+
)
|
|
57
|
+
})
|
|
58
|
+
|
|
43
59
|
/**
|
|
44
60
|
* System Alerts
|
|
45
61
|
*/
|
|
@@ -98,12 +98,16 @@ const Template = (args) => ({
|
|
|
98
98
|
|
|
99
99
|
export const Light = Template.bind({});
|
|
100
100
|
Light.args = {
|
|
101
|
-
|
|
101
|
+
navbar: {
|
|
102
|
+
dark: false,
|
|
103
|
+
},
|
|
102
104
|
logoUrl: 'https://sprintify.witify.io/img/logo/logo-side.svg',
|
|
103
105
|
};
|
|
104
106
|
|
|
105
107
|
export const Dark = Template.bind({});
|
|
106
108
|
Dark.args = {
|
|
107
|
-
|
|
109
|
+
navbar: {
|
|
110
|
+
dark: true,
|
|
111
|
+
},
|
|
108
112
|
logoUrl: 'https://sprintify.witify.io/img/logo/logo-side-dark.svg',
|
|
109
113
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<BaseLayoutStacked :
|
|
3
|
-
<template #navbar>
|
|
4
|
-
<div class="flex
|
|
2
|
+
<BaseLayoutStacked :navbar="navbar">
|
|
3
|
+
<template #navbar="{ dark }">
|
|
4
|
+
<div class="flex w-full justify-between">
|
|
5
5
|
<!-- Left -->
|
|
6
6
|
|
|
7
|
-
<div class="flex
|
|
7
|
+
<div class="flex grow">
|
|
8
8
|
<!-- Logo -->
|
|
9
9
|
<RouterLink
|
|
10
10
|
to="/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
<!-- Right -->
|
|
32
|
-
<div class="flex items-center md:ml-6">
|
|
32
|
+
<div class="flex shrink-0 items-center md:ml-6">
|
|
33
33
|
<!-- Notification dropdown -->
|
|
34
34
|
<BaseLayoutNotificationDropdown
|
|
35
35
|
v-if="notifications"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
</div>
|
|
63
63
|
</template>
|
|
64
64
|
|
|
65
|
-
<template #mobile>
|
|
65
|
+
<template #mobile="{ dark }">
|
|
66
66
|
<!-- Links mobile -->
|
|
67
67
|
<div class="space-y-1 p-2 pt-0">
|
|
68
68
|
<BaseNavbarSideItem
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
<script lang="ts" setup>
|
|
108
108
|
import { User } from '@/types/User';
|
|
109
109
|
import { PropType } from 'vue';
|
|
110
|
-
import {
|
|
110
|
+
import { NotificationsConfig } from '../types';
|
|
111
|
+
import { ActionItem } from '@/types/ActionItem';
|
|
111
112
|
import BaseAvatar from './BaseAvatar.vue';
|
|
112
113
|
import BaseLayoutStacked from './BaseLayoutStacked.vue';
|
|
113
114
|
import BaseMenu from './BaseMenu.vue';
|
|
@@ -142,9 +143,9 @@ defineProps({
|
|
|
142
143
|
default: undefined,
|
|
143
144
|
type: Object as PropType<NotificationsConfig>,
|
|
144
145
|
},
|
|
145
|
-
|
|
146
|
-
default:
|
|
147
|
-
type:
|
|
146
|
+
navbar: {
|
|
147
|
+
default: undefined,
|
|
148
|
+
type: Object as PropType<Record<string, unknown>>,
|
|
148
149
|
},
|
|
149
150
|
});
|
|
150
151
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
:key="item.label + 'link'"
|
|
37
37
|
>
|
|
38
38
|
<div
|
|
39
|
-
v-if="item.line"
|
|
39
|
+
v-if="item.meta?.line"
|
|
40
40
|
class="-mx-1 my-1 flex h-px bg-slate-200"
|
|
41
41
|
/>
|
|
42
42
|
|
|
@@ -118,14 +118,14 @@
|
|
|
118
118
|
<script lang="ts" setup>
|
|
119
119
|
import { PropType } from 'vue';
|
|
120
120
|
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue';
|
|
121
|
-
import { MenuItemInterface } from '@/types';
|
|
122
121
|
import BaseMenuItem from './BaseMenuItem.vue';
|
|
123
122
|
import { twMerge } from 'tailwind-merge';
|
|
123
|
+
import { ActionItem } from '@/types/ActionItem';
|
|
124
124
|
|
|
125
125
|
const props = defineProps({
|
|
126
126
|
items: {
|
|
127
127
|
default: undefined,
|
|
128
|
-
type: Array as PropType<
|
|
128
|
+
type: Array as PropType<ActionItem[]>,
|
|
129
129
|
},
|
|
130
130
|
position: {
|
|
131
131
|
default: 'bottom-left',
|
|
@@ -6,7 +6,7 @@ import BaseMenu from './BaseMenu.vue';
|
|
|
6
6
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
-
title: '
|
|
9
|
+
title: 'Navigation/BaseNavbar',
|
|
10
10
|
component: BaseNavbar,
|
|
11
11
|
args: {},
|
|
12
12
|
parameters: {
|
|
@@ -56,7 +56,7 @@ const Template = (args) => ({
|
|
|
56
56
|
href: 'https://google.com',
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
line: true,
|
|
59
|
+
meta: { line: true },
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
62
|
label: 'Logout',
|
|
@@ -71,12 +71,12 @@ const Template = (args) => ({
|
|
|
71
71
|
<div class="sticky top-0 left-0 w-full shadow">
|
|
72
72
|
<BaseNavbar v-bind="args">
|
|
73
73
|
<template #navbar>
|
|
74
|
-
<div class="flex
|
|
74
|
+
<div class="flex w-full justify-between">
|
|
75
75
|
<!-- Left -->
|
|
76
76
|
|
|
77
|
-
<div class="flex justify-
|
|
77
|
+
<div class="flex justify-start grow">
|
|
78
78
|
<!-- Logo -->
|
|
79
|
-
<RouterLink to="/" class="flex flex-shrink-0
|
|
79
|
+
<RouterLink to="/" class="flex flex-shrink-0 items-center">
|
|
80
80
|
<img
|
|
81
81
|
class="block h-8 w-auto"
|
|
82
82
|
src="https://sprintify.witify.io/img/logo/logo-side.svg"
|
|
@@ -90,6 +90,7 @@ const Template = (args) => ({
|
|
|
90
90
|
v-for="item in menu"
|
|
91
91
|
:key="item.label"
|
|
92
92
|
:item="item"
|
|
93
|
+
class="flex"
|
|
93
94
|
item-class="flex"
|
|
94
95
|
/>
|
|
95
96
|
</div>
|
|
@@ -97,13 +98,13 @@ const Template = (args) => ({
|
|
|
97
98
|
|
|
98
99
|
<!-- Right -->
|
|
99
100
|
|
|
100
|
-
<div class="hidden md:ml-6 md:flex md:items-center">
|
|
101
|
+
<div class="hidden md:ml-6 md:flex md:items-center shrink-0">
|
|
101
102
|
<!-- Profile dropdown -->
|
|
102
103
|
<BaseMenu tw-menu="w-52" :items="userMenu">
|
|
103
104
|
<template #button="{ open }">
|
|
104
105
|
<div
|
|
105
106
|
class="flex rounded-full"
|
|
106
|
-
:class="[open ? 'bg-slate-700 ring-
|
|
107
|
+
:class="[open ? 'bg-slate-700 ring-4 ring-slate-200' : '']"
|
|
107
108
|
>
|
|
108
109
|
<BaseAvatar :user="user" />
|
|
109
110
|
</div>
|
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<nav
|
|
3
|
-
class="border-t-[3px] border-primary-500"
|
|
4
|
-
:class="[dark ? 'bg-slate-900' : 'bg-white']"
|
|
5
|
-
>
|
|
2
|
+
<nav :class="classInternal">
|
|
6
3
|
<BaseContainer :size="size">
|
|
7
|
-
<div
|
|
4
|
+
<div
|
|
5
|
+
:style="{
|
|
6
|
+
height: `${height}px`,
|
|
7
|
+
}"
|
|
8
|
+
class="flex justify-between"
|
|
9
|
+
>
|
|
8
10
|
<!-- Navbar (desktop and mobile) -->
|
|
9
|
-
<div class="grow">
|
|
10
|
-
<slot
|
|
11
|
+
<div class="grow flex">
|
|
12
|
+
<slot
|
|
13
|
+
name="navbar"
|
|
14
|
+
:dark="dark"
|
|
15
|
+
/>
|
|
11
16
|
</div>
|
|
12
17
|
|
|
13
18
|
<!-- Mobile Burger menu button -->
|
|
14
|
-
<div
|
|
19
|
+
<div
|
|
20
|
+
v-if="mobile"
|
|
21
|
+
class="-mr-2 flex items-center"
|
|
22
|
+
>
|
|
15
23
|
<button
|
|
16
24
|
type="button"
|
|
17
25
|
class="inline-flex items-center justify-center rounded-md p-2 focus:outline-none focus:ring-2 focus:ring-offset-2"
|
|
@@ -42,12 +50,13 @@
|
|
|
42
50
|
|
|
43
51
|
<!-- Mobile -->
|
|
44
52
|
<div
|
|
45
|
-
v-if="showMobileMenu"
|
|
46
|
-
class="absolute w-full
|
|
47
|
-
:class="
|
|
53
|
+
v-if="mobile && showMobileMenu"
|
|
54
|
+
class="absolute w-full"
|
|
55
|
+
:class="backgroundClass"
|
|
48
56
|
>
|
|
49
57
|
<slot
|
|
50
58
|
name="mobile"
|
|
59
|
+
:dark="dark"
|
|
51
60
|
:toggle-menu="toggleMenu"
|
|
52
61
|
:close-menu="closeMenu"
|
|
53
62
|
:open-menu="openMenu"
|
|
@@ -59,8 +68,15 @@
|
|
|
59
68
|
<script setup lang="ts">
|
|
60
69
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
61
70
|
import BaseContainer from './BaseContainer.vue';
|
|
71
|
+
import { twMerge } from 'tailwind-merge';
|
|
72
|
+
import { PropType } from 'vue';
|
|
73
|
+
import { useWindowSize } from '@vueuse/core';
|
|
62
74
|
|
|
63
|
-
|
|
75
|
+
defineOptions({
|
|
76
|
+
inheritAttrs: false,
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const props = defineProps({
|
|
64
80
|
size: {
|
|
65
81
|
default: '7xl',
|
|
66
82
|
type: String,
|
|
@@ -69,8 +85,38 @@ defineProps({
|
|
|
69
85
|
default: false,
|
|
70
86
|
type: Boolean,
|
|
71
87
|
},
|
|
88
|
+
height: {
|
|
89
|
+
default: 64,
|
|
90
|
+
type: Number,
|
|
91
|
+
},
|
|
92
|
+
breakpoint: {
|
|
93
|
+
default: 768,
|
|
94
|
+
type: Number,
|
|
95
|
+
},
|
|
96
|
+
class: {
|
|
97
|
+
default: '',
|
|
98
|
+
type: [String, Array] as PropType<string | string[]>,
|
|
99
|
+
}
|
|
72
100
|
});
|
|
73
101
|
|
|
102
|
+
const window = useWindowSize();
|
|
103
|
+
|
|
104
|
+
const mobile = computed(() => {
|
|
105
|
+
return window.width.value < props.breakpoint;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const backgroundClass = computed(() => {
|
|
109
|
+
return props.dark ? 'bg-slate-900' : 'bg-white';
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const classInternal = computed(() => {
|
|
113
|
+
return twMerge(
|
|
114
|
+
'w-full border-t-[3px] border-primary-500',
|
|
115
|
+
backgroundClass.value,
|
|
116
|
+
props.class,
|
|
117
|
+
)
|
|
118
|
+
})
|
|
119
|
+
|
|
74
120
|
const showMobileMenu = ref(false);
|
|
75
121
|
|
|
76
122
|
function toggleMenu() {
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="flex">
|
|
3
3
|
<BaseActionItem
|
|
4
|
-
:
|
|
5
|
-
:href="item.href"
|
|
6
|
-
:action="item.action"
|
|
7
|
-
:dark="dark"
|
|
4
|
+
:item="item"
|
|
8
5
|
class="flex w-full"
|
|
9
6
|
@click="onClick"
|
|
10
7
|
>
|
|
@@ -23,7 +20,7 @@
|
|
|
23
20
|
|
|
24
21
|
<script setup lang="ts">
|
|
25
22
|
import { PropType } from 'vue';
|
|
26
|
-
import { ActionItem } from '@/types';
|
|
23
|
+
import { ActionItem } from '@/types/ActionItem';
|
|
27
24
|
import BaseActionItem from './BaseActionItem.vue';
|
|
28
25
|
import BaseNavbarItemContent from './BaseNavbarItemContent.vue';
|
|
29
26
|
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<BaseActionItem
|
|
4
|
-
:
|
|
5
|
-
:href="item.href"
|
|
6
|
-
:action="item.action"
|
|
7
|
-
:dark="dark"
|
|
4
|
+
:item="item"
|
|
8
5
|
class="flex w-full"
|
|
9
6
|
@click="onClick"
|
|
10
7
|
>
|
|
@@ -29,12 +26,23 @@
|
|
|
29
26
|
:key="subItem.label"
|
|
30
27
|
>
|
|
31
28
|
<BaseActionItem
|
|
32
|
-
:
|
|
33
|
-
:href="subItem.href"
|
|
34
|
-
:action="subItem.action"
|
|
29
|
+
:item="subItem"
|
|
35
30
|
:class="subItemClasses"
|
|
36
31
|
>
|
|
37
|
-
{
|
|
32
|
+
<template #default="{ active }">
|
|
33
|
+
<div
|
|
34
|
+
class="grow"
|
|
35
|
+
:class="{ 'font-medium': active, 'text-white': active && dark }"
|
|
36
|
+
>
|
|
37
|
+
{{ subItem.label }}
|
|
38
|
+
</div>
|
|
39
|
+
<BaseCounter
|
|
40
|
+
v-if="subItem.count"
|
|
41
|
+
:count="subItem.count"
|
|
42
|
+
:size="size"
|
|
43
|
+
:color="dark ? 'light' : 'light'"
|
|
44
|
+
/>
|
|
45
|
+
</template>
|
|
38
46
|
</BaseActionItem>
|
|
39
47
|
</div>
|
|
40
48
|
</div>
|
|
@@ -43,9 +51,10 @@
|
|
|
43
51
|
|
|
44
52
|
<script setup lang="ts">
|
|
45
53
|
import { PropType } from 'vue';
|
|
46
|
-
import { ActionItem } from '@/types';
|
|
54
|
+
import { ActionItem } from '@/types/ActionItem';
|
|
47
55
|
import BaseActionItem from './BaseActionItem.vue';
|
|
48
56
|
import BaseNavbarSideItemContent from './BaseNavbarSideItemContent.vue';
|
|
57
|
+
import BaseCounter from './BaseCounter.vue';
|
|
49
58
|
|
|
50
59
|
const props = defineProps({
|
|
51
60
|
item: {
|
|
@@ -56,10 +65,6 @@ const props = defineProps({
|
|
|
56
65
|
default: false,
|
|
57
66
|
type: Boolean,
|
|
58
67
|
},
|
|
59
|
-
actionsVisible: {
|
|
60
|
-
default: 'toggle',
|
|
61
|
-
type: String as PropType<'toggle' | 'always'>,
|
|
62
|
-
},
|
|
63
68
|
size: {
|
|
64
69
|
default: 'md',
|
|
65
70
|
type: String as PropType<'xs' | 'sm' | 'md'>,
|
|
@@ -83,7 +88,7 @@ const routeActive = computed((): boolean => {
|
|
|
83
88
|
});
|
|
84
89
|
|
|
85
90
|
const showSubActions = computed((): boolean => {
|
|
86
|
-
if (props.
|
|
91
|
+
if (props.item.meta?.showSubItems == 'always') {
|
|
87
92
|
return true;
|
|
88
93
|
}
|
|
89
94
|
if (!props.item.to) {
|
|
@@ -102,11 +107,11 @@ const subItemClasses = computed((): string[] => {
|
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
if (props.size == 'xs') {
|
|
105
|
-
classList.push('pl-[33.5px] text-[13px] mb-1');
|
|
110
|
+
classList.push('pl-[33.5px] text-[13px] mb-1 pr-2.5');
|
|
106
111
|
} else if (props.size == 'sm') {
|
|
107
|
-
classList.push('pl-[36px] text-sm mb-1.5');
|
|
112
|
+
classList.push('pl-[36px] text-sm mb-1.5 pr-3');
|
|
108
113
|
} else {
|
|
109
|
-
classList.push('pl-[40px] text-base mb-1');
|
|
114
|
+
classList.push('pl-[40px] text-base mb-1 pr-3');
|
|
110
115
|
}
|
|
111
116
|
|
|
112
117
|
return classList;
|
|
@@ -103,7 +103,6 @@ const { nameInternal, requiredInternal, emitUpdate } = useField({
|
|
|
103
103
|
hasError: computed(() => props.hasError),
|
|
104
104
|
emit: emit,
|
|
105
105
|
errorType: 'alert',
|
|
106
|
-
labelClass: 'mb-3 font-medium',
|
|
107
106
|
});
|
|
108
107
|
|
|
109
108
|
function isChecked(option: NormalizedOption): boolean {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RouteLocationRaw } from "vue-router";
|
|
2
|
+
import { ActionColors } from ".";
|
|
3
|
+
|
|
4
|
+
export interface ActionItem {
|
|
5
|
+
label?: string;
|
|
6
|
+
href?: string;
|
|
7
|
+
to?: RouteLocationRaw;
|
|
8
|
+
action?: () => Promise<void> | void;
|
|
9
|
+
icon?: string;
|
|
10
|
+
count?: number;
|
|
11
|
+
color?: ActionColors;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
meta?: Record<string, any>;
|
|
14
|
+
actions?: ActionItem[];
|
|
15
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -75,35 +75,6 @@ export type ActionColors =
|
|
|
75
75
|
| 'primary'
|
|
76
76
|
| 'secondary';
|
|
77
77
|
|
|
78
|
-
export interface MenuItemInterface {
|
|
79
|
-
label?: string;
|
|
80
|
-
href?: string;
|
|
81
|
-
to?: RouteLocationRaw;
|
|
82
|
-
action?: () => Promise<void> | void;
|
|
83
|
-
icon?: string;
|
|
84
|
-
count?: number;
|
|
85
|
-
color?: ActionColors;
|
|
86
|
-
line?: boolean;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface ActionItem {
|
|
90
|
-
label: string;
|
|
91
|
-
href?: string;
|
|
92
|
-
to?: RouteLocationRaw;
|
|
93
|
-
action?: () => Promise<void> | void;
|
|
94
|
-
icon?: string;
|
|
95
|
-
count?: number;
|
|
96
|
-
color?: ActionColors;
|
|
97
|
-
disabled?: boolean;
|
|
98
|
-
meta?: Record<string, any>;
|
|
99
|
-
actions?: ActionItem[];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface ActionSection {
|
|
103
|
-
title: string;
|
|
104
|
-
actions: ActionItem[];
|
|
105
|
-
}
|
|
106
|
-
|
|
107
78
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
79
|
export type Row = Record<string, any>;
|
|
109
80
|
|