sprintify-ui 0.0.195 → 0.0.197
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 +7969 -7889
- package/dist/types/src/components/BaseAddressForm.vue.d.ts +2 -2
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +5 -5
- package/dist/types/src/components/BaseAutocompleteDrawer.vue.d.ts +2 -2
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +5 -5
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +3 -3
- package/dist/types/src/components/BaseButtonGroup.vue.d.ts +2 -2
- package/dist/types/src/components/BaseCharacterCounter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseColor.vue.d.ts +2 -2
- package/dist/types/src/components/BaseCounter.vue.d.ts +6 -6
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +1 -1
- package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +4 -4
- package/dist/types/src/components/BaseFieldI18n.vue.d.ts +2 -2
- package/dist/types/src/components/BaseFilePicker.vue.d.ts +1 -1
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +2 -2
- package/dist/types/src/components/BaseForm.vue.d.ts +1 -1
- package/dist/types/src/components/BaseHasMany.vue.d.ts +2 -2
- package/dist/types/src/components/BaseInput.vue.d.ts +5 -5
- package/dist/types/src/components/BaseInputPercent.vue.d.ts +4 -4
- package/dist/types/src/components/BaseLayoutNotificationDropdown.vue.d.ts +9 -0
- package/dist/types/src/components/BaseLayoutSidebar.vue.d.ts +10 -0
- package/dist/types/src/components/BaseLayoutSidebarConfigurable.vue.d.ts +9 -0
- package/dist/types/src/components/BaseLoadingCover.vue.d.ts +2 -2
- package/dist/types/src/components/BaseMediaLibrary.vue.d.ts +4 -4
- package/dist/types/src/components/BaseModalCenter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseModalSide.vue.d.ts +1 -1
- package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +11 -1
- package/dist/types/src/components/BaseNavbarSideItem.vue.d.ts +9 -0
- package/dist/types/src/components/BaseNavbarSideItemContent.vue.d.ts +11 -1
- package/dist/types/src/components/BaseNumber.vue.d.ts +16 -7
- package/dist/types/src/components/BasePassword.vue.d.ts +2 -2
- package/dist/types/src/components/BaseRadioGroup.vue.d.ts +1 -1
- package/dist/types/src/components/BaseRichText.vue.d.ts +2 -2
- package/dist/types/src/components/BaseSelect.vue.d.ts +3 -3
- package/dist/types/src/components/BaseSwitch.vue.d.ts +1 -1
- package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +4 -4
- package/dist/types/src/components/BaseTagAutocompleteFetch.vue.d.ts +2 -2
- package/dist/types/src/components/BaseTextarea.vue.d.ts +3 -3
- package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/BaseAvatar.vue +1 -1
- package/src/components/BaseCounter.stories.js +15 -0
- package/src/components/BaseCounter.vue +16 -8
- package/src/components/BaseForm.stories.js +48 -0
- package/src/components/BaseForm.vue +10 -5
- package/src/components/BaseLayoutNotificationDropdown.vue +39 -8
- package/src/components/BaseLayoutSidebar.vue +19 -3
- package/src/components/BaseLayoutSidebarConfigurable.stories.js +34 -16
- package/src/components/BaseLayoutSidebarConfigurable.vue +48 -11
- package/src/components/BaseMenuItem.vue +4 -9
- package/src/components/BaseNavbarItemContent.vue +13 -7
- package/src/components/BaseNavbarSideItem.vue +28 -8
- package/src/components/BaseNavbarSideItemContent.vue +40 -13
- package/src/components/BaseNumber.stories.js +19 -3
- package/src/components/BaseNumber.vue +57 -4
- package/src/composables/field.ts +11 -4
|
@@ -81,9 +81,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
81
81
|
}, {
|
|
82
82
|
name: string;
|
|
83
83
|
required: boolean;
|
|
84
|
-
modelValue: string | Delta | null | undefined;
|
|
85
|
-
placeholder: string;
|
|
86
84
|
disabled: boolean;
|
|
85
|
+
placeholder: string;
|
|
86
|
+
modelValue: string | Delta | null | undefined;
|
|
87
87
|
hasError: boolean;
|
|
88
88
|
enable: boolean;
|
|
89
89
|
toolbar: string | unknown[] | Record<string, any> | undefined;
|
|
@@ -79,13 +79,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
79
79
|
}, {
|
|
80
80
|
name: string;
|
|
81
81
|
required: boolean;
|
|
82
|
-
modelValue: (string | number | null) | undefined;
|
|
83
|
-
placeholder: string;
|
|
84
82
|
disabled: boolean;
|
|
85
|
-
|
|
83
|
+
placeholder: string;
|
|
86
84
|
options: Option[];
|
|
85
|
+
modelValue: (string | number | null) | undefined;
|
|
87
86
|
labelKey: string;
|
|
88
87
|
valueKey: string;
|
|
88
|
+
hasError: boolean;
|
|
89
89
|
}>, {
|
|
90
90
|
default: (_: {}) => any;
|
|
91
91
|
}>;
|
|
@@ -55,9 +55,9 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
55
55
|
name: string;
|
|
56
56
|
color: "success" | "info" | "danger" | "warning" | "dark" | "light" | "primary";
|
|
57
57
|
required: boolean;
|
|
58
|
+
size: "base" | "xs" | "sm" | "lg" | "xl";
|
|
58
59
|
modelValue: string | number | boolean | null | undefined;
|
|
59
60
|
hasError: boolean;
|
|
60
|
-
size: "base" | "xs" | "sm" | "lg" | "xl";
|
|
61
61
|
}>, {
|
|
62
62
|
default: (_: {}) => any;
|
|
63
63
|
}>;
|
|
@@ -137,8 +137,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
137
137
|
type: PropType<"focus" | "always">;
|
|
138
138
|
};
|
|
139
139
|
}>> & {
|
|
140
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
141
140
|
onScrollBottom?: ((...args: any[]) => any) | undefined;
|
|
141
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
142
142
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
143
143
|
onTyping?: ((...args: any[]) => any) | undefined;
|
|
144
144
|
onOpen?: ((...args: any[]) => any) | undefined;
|
|
@@ -146,13 +146,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
146
146
|
filter: (option: NormalizedOption) => boolean;
|
|
147
147
|
name: string;
|
|
148
148
|
required: boolean;
|
|
149
|
-
placeholder: string;
|
|
150
149
|
disabled: boolean;
|
|
151
150
|
max: number;
|
|
152
|
-
|
|
151
|
+
placeholder: string;
|
|
152
|
+
size: "base" | "xs" | "sm";
|
|
153
153
|
loading: boolean;
|
|
154
154
|
loadingBottom: boolean;
|
|
155
|
-
|
|
155
|
+
hasError: boolean;
|
|
156
156
|
inline: boolean;
|
|
157
157
|
dropdownShow: "focus" | "always";
|
|
158
158
|
}>, {
|
|
@@ -90,14 +90,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
90
90
|
};
|
|
91
91
|
}>> & {
|
|
92
92
|
onFocus?: ((...args: any[]) => any) | undefined;
|
|
93
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
94
93
|
onScrollBottom?: ((...args: any[]) => any) | undefined;
|
|
94
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
95
95
|
onTyping?: ((...args: any[]) => any) | undefined;
|
|
96
96
|
}, {
|
|
97
97
|
required: boolean;
|
|
98
|
-
placeholder: string;
|
|
99
98
|
disabled: boolean;
|
|
100
99
|
max: number;
|
|
100
|
+
placeholder: string;
|
|
101
101
|
hasError: boolean;
|
|
102
102
|
queryKey: string;
|
|
103
103
|
}>, {
|
|
@@ -87,11 +87,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
87
87
|
type: string;
|
|
88
88
|
name: string;
|
|
89
89
|
required: boolean;
|
|
90
|
-
|
|
91
|
-
placeholder: string;
|
|
90
|
+
autocomplete: boolean;
|
|
92
91
|
disabled: boolean;
|
|
92
|
+
placeholder: string;
|
|
93
|
+
modelValue: string | null | undefined;
|
|
93
94
|
hasError: boolean;
|
|
94
|
-
autocomplete: boolean;
|
|
95
95
|
preventSubmit: boolean;
|
|
96
96
|
rows: number;
|
|
97
97
|
}>;
|
|
@@ -87,9 +87,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
87
87
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
88
88
|
}, {
|
|
89
89
|
required: boolean;
|
|
90
|
-
modelValue: string;
|
|
91
|
-
placeholder: string;
|
|
92
90
|
disabled: boolean;
|
|
91
|
+
placeholder: string;
|
|
92
|
+
modelValue: string;
|
|
93
93
|
hasError: boolean;
|
|
94
94
|
maxHeight: number;
|
|
95
95
|
rows: number;
|
package/package.json
CHANGED
|
@@ -30,3 +30,18 @@ Demo.args = {
|
|
|
30
30
|
count: 355,
|
|
31
31
|
maxDigit: 2,
|
|
32
32
|
};
|
|
33
|
+
|
|
34
|
+
export const SizeXS = Template.bind({});
|
|
35
|
+
SizeXS.args = {
|
|
36
|
+
size: 'xs',
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const SizeSM = Template.bind({});
|
|
40
|
+
SizeSM.args = {
|
|
41
|
+
size: 'sm',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const SizeMD = Template.bind({});
|
|
45
|
+
SizeMD.args = {
|
|
46
|
+
size: 'md',
|
|
47
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="inline-flex
|
|
3
|
+
class="inline-flex w-auto items-center justify-center rounded-full"
|
|
4
4
|
:class="[sizeClass, colorClass]"
|
|
5
5
|
>
|
|
6
6
|
{{ countLabel }}
|
|
@@ -22,11 +22,13 @@ const props = defineProps({
|
|
|
22
22
|
},
|
|
23
23
|
size: {
|
|
24
24
|
default: 'sm',
|
|
25
|
-
type: String
|
|
25
|
+
type: String as PropType<'xs' | 'sm' | 'md'>,
|
|
26
26
|
},
|
|
27
27
|
color: {
|
|
28
28
|
default: 'danger',
|
|
29
|
-
type: String as PropType<
|
|
29
|
+
type: String as PropType<
|
|
30
|
+
'danger' | 'primary' | 'success' | 'warning' | 'dark' | 'light' | 'white'
|
|
31
|
+
>,
|
|
30
32
|
},
|
|
31
33
|
});
|
|
32
34
|
|
|
@@ -43,21 +45,27 @@ const countLabel = computed((): string => {
|
|
|
43
45
|
|
|
44
46
|
const sizeClass = computed((): string => {
|
|
45
47
|
if (props.size == 'xs') {
|
|
46
|
-
return 'text-[10px]';
|
|
48
|
+
return 'text-[10px] px-1 h-[14px]';
|
|
47
49
|
}
|
|
48
50
|
if (props.size == 'sm') {
|
|
49
|
-
return 'text-xs';
|
|
51
|
+
return 'text-xs px-1.5 h-4';
|
|
50
52
|
}
|
|
51
|
-
if (props.size == '
|
|
52
|
-
return 'text-sm';
|
|
53
|
+
if (props.size == 'md') {
|
|
54
|
+
return 'text-sm px-1.5 h-5';
|
|
53
55
|
}
|
|
54
|
-
return 'text-xs';
|
|
56
|
+
return 'text-xs px-1.5 h-4';
|
|
55
57
|
});
|
|
56
58
|
|
|
57
59
|
const colorClass = computed((): string => {
|
|
58
60
|
if (props.color == 'danger') {
|
|
59
61
|
return 'bg-red-500 text-white';
|
|
60
62
|
}
|
|
63
|
+
if (props.color == 'warning') {
|
|
64
|
+
return 'bg-yellow-400 text-white';
|
|
65
|
+
}
|
|
66
|
+
if (props.color == 'success') {
|
|
67
|
+
return 'bg-green-500 text-white';
|
|
68
|
+
}
|
|
61
69
|
if (props.color == 'primary') {
|
|
62
70
|
return 'bg-primary-500 text-white';
|
|
63
71
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import BaseForm from './BaseForm.vue';
|
|
2
|
+
import BaseField from './BaseField.vue';
|
|
3
|
+
import BaseNumber from './BaseNumber.vue';
|
|
4
|
+
import BaseMediaLibrary from './BaseMediaLibrary.vue';
|
|
5
|
+
import ShowValue from '../../.storybook/components/ShowValue.vue';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Form/BaseForm',
|
|
9
|
+
component: BaseForm,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Template = (args) => ({
|
|
13
|
+
components: {
|
|
14
|
+
ShowValue,
|
|
15
|
+
BaseForm,
|
|
16
|
+
BaseField,
|
|
17
|
+
BaseNumber,
|
|
18
|
+
BaseMediaLibrary,
|
|
19
|
+
},
|
|
20
|
+
setup() {
|
|
21
|
+
const form = ref({
|
|
22
|
+
number: 1.1,
|
|
23
|
+
});
|
|
24
|
+
return { args, form };
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<BaseForm
|
|
28
|
+
method="post"
|
|
29
|
+
url="https://faker.witify.io/api/todos/422"
|
|
30
|
+
:data="form"
|
|
31
|
+
v-slot="{disabled}"
|
|
32
|
+
>
|
|
33
|
+
<BaseField class="mb-3" name="number" label="Number">
|
|
34
|
+
<BaseNumber v-model="form.number"></BaseNumber>
|
|
35
|
+
</BaseField>
|
|
36
|
+
|
|
37
|
+
<BaseField class="mb-3" name="media" label="Media">
|
|
38
|
+
<BaseMediaLibrary v-model="form.media" upload-url="https://faker.witify.io/api/todos/upload"></BaseMediaLibrary>
|
|
39
|
+
</BaseField>
|
|
40
|
+
|
|
41
|
+
<button type="submit" class="btn btn-primary" :disabled="disabled">Submit</button>
|
|
42
|
+
</BaseForm>
|
|
43
|
+
<ShowValue :value="form" />
|
|
44
|
+
`,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const Demo = Template.bind({});
|
|
48
|
+
Demo.args = {};
|
|
@@ -112,7 +112,6 @@ const emit = defineEmits(['error', 'success']);
|
|
|
112
112
|
|
|
113
113
|
const form = ref<null | HTMLFormElement>(null);
|
|
114
114
|
const loading = ref(false);
|
|
115
|
-
const disabled = ref(false);
|
|
116
115
|
const errors = ref<Record<string, string[]>>({});
|
|
117
116
|
|
|
118
117
|
const httpClient = computed((): AxiosInstance => {
|
|
@@ -291,14 +290,20 @@ function clearErrors(name = null): void {
|
|
|
291
290
|
}
|
|
292
291
|
}
|
|
293
292
|
|
|
294
|
-
|
|
295
|
-
|
|
293
|
+
const disablingFields = reactive(new Set<string>());
|
|
294
|
+
|
|
295
|
+
function disabledForm(uuid: string) {
|
|
296
|
+
disablingFields.add(uuid);
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
function enableForm() {
|
|
299
|
-
|
|
299
|
+
function enableForm(uuid: string) {
|
|
300
|
+
disablingFields.delete(uuid);
|
|
300
301
|
}
|
|
301
302
|
|
|
303
|
+
const disabled = computed((): boolean => {
|
|
304
|
+
return disablingFields.size > 0;
|
|
305
|
+
});
|
|
306
|
+
|
|
302
307
|
provide('form:errors', readonly(errors));
|
|
303
308
|
provide('form:getErrorMessageByName', getErrorMessageByName);
|
|
304
309
|
provide('form:clearErrors', clearErrors);
|
|
@@ -6,18 +6,15 @@
|
|
|
6
6
|
>
|
|
7
7
|
<template #button="{ open }">
|
|
8
8
|
<div
|
|
9
|
-
class="relative flex items-center rounded-
|
|
10
|
-
:class="[open ? '' : '']"
|
|
9
|
+
class="relative flex items-center rounded-md p-1.5 hover:bg-slate-100"
|
|
10
|
+
:class="[open ? 'bg-slate-100' : '']"
|
|
11
11
|
@click="onOpen"
|
|
12
12
|
>
|
|
13
|
-
<BaseIcon
|
|
14
|
-
icon="heroicons:bell"
|
|
15
|
-
class="h-6 w-6"
|
|
16
|
-
:class="[dark ? 'text-slate-300' : 'text-slate-600']"
|
|
17
|
-
></BaseIcon>
|
|
13
|
+
<BaseIcon icon="fa-solid:bell" :class="[iconClasses]"></BaseIcon>
|
|
18
14
|
<BaseCounter
|
|
19
15
|
v-if="notificationsConfig.items.length"
|
|
20
16
|
class="absolute top-0 right-0"
|
|
17
|
+
:size="counterSize"
|
|
21
18
|
:count="notificationsConfig.items.length"
|
|
22
19
|
></BaseCounter>
|
|
23
20
|
</div>
|
|
@@ -87,7 +84,7 @@ import { Notification } from '@/types/Notification';
|
|
|
87
84
|
|
|
88
85
|
const emit = defineEmits(['click', 'open']);
|
|
89
86
|
|
|
90
|
-
defineProps({
|
|
87
|
+
const props = defineProps({
|
|
91
88
|
notificationsConfig: {
|
|
92
89
|
required: true,
|
|
93
90
|
type: Object as PropType<NotificationsConfig>,
|
|
@@ -96,6 +93,10 @@ defineProps({
|
|
|
96
93
|
default: false,
|
|
97
94
|
type: Boolean,
|
|
98
95
|
},
|
|
96
|
+
size: {
|
|
97
|
+
default: 'md',
|
|
98
|
+
type: String as PropType<'xs' | 'sm' | 'md'>,
|
|
99
|
+
},
|
|
99
100
|
});
|
|
100
101
|
|
|
101
102
|
const breakpoints = useBreakpoints();
|
|
@@ -111,4 +112,34 @@ function onClick(notification: Notification) {
|
|
|
111
112
|
function onOpen() {
|
|
112
113
|
emit('open');
|
|
113
114
|
}
|
|
115
|
+
|
|
116
|
+
const iconClasses = computed(() => {
|
|
117
|
+
const classList = [''];
|
|
118
|
+
|
|
119
|
+
if (props.dark) {
|
|
120
|
+
classList.push('text-slate-300');
|
|
121
|
+
} else {
|
|
122
|
+
classList.push('text-slate-600');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (props.size == 'xs') {
|
|
126
|
+
classList.push('h-4 w-4');
|
|
127
|
+
} else if (props.size == 'sm') {
|
|
128
|
+
classList.push('h-5 w-5');
|
|
129
|
+
} else {
|
|
130
|
+
classList.push('h-6 w-6');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return classList;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const counterSize = computed(() => {
|
|
137
|
+
if (props.size == 'xs') {
|
|
138
|
+
return 'xs';
|
|
139
|
+
} else if (props.size == 'sm') {
|
|
140
|
+
return 'xs';
|
|
141
|
+
} else {
|
|
142
|
+
return 'sm';
|
|
143
|
+
}
|
|
144
|
+
});
|
|
114
145
|
</script>
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
{{ systemAlert.message }}
|
|
91
91
|
</BaseSystemAlert>
|
|
92
92
|
|
|
93
|
-
<div class="flex
|
|
93
|
+
<div class="flex bg-white" :style="{ height: navbarHeight + 'px' }">
|
|
94
94
|
<button
|
|
95
95
|
type="button"
|
|
96
96
|
class="border-r border-slate-200 px-4 text-slate-500 xl:hidden"
|
|
@@ -126,7 +126,8 @@
|
|
|
126
126
|
:class="[dark ? 'bg-slate-800' : 'bg-white shadow']"
|
|
127
127
|
>
|
|
128
128
|
<div
|
|
129
|
-
class="flex
|
|
129
|
+
class="flex flex-shrink-0 items-center px-4"
|
|
130
|
+
:style="{ height: navbarHeight + 'px' }"
|
|
130
131
|
:class="[dark ? 'bg-slate-900' : 'bg-white']"
|
|
131
132
|
>
|
|
132
133
|
<img class="block h-8 w-auto" :src="logoUrl" :alt="appName" />
|
|
@@ -142,7 +143,7 @@
|
|
|
142
143
|
</template>
|
|
143
144
|
|
|
144
145
|
<script setup lang="ts">
|
|
145
|
-
import { ref } from 'vue';
|
|
146
|
+
import { ref, PropType } from 'vue';
|
|
146
147
|
import {
|
|
147
148
|
Dialog,
|
|
148
149
|
DialogPanel,
|
|
@@ -167,6 +168,10 @@ const props = defineProps({
|
|
|
167
168
|
default: false,
|
|
168
169
|
type: Boolean,
|
|
169
170
|
},
|
|
171
|
+
size: {
|
|
172
|
+
default: 'md',
|
|
173
|
+
type: String as PropType<'xs' | 'sm' | 'md'>,
|
|
174
|
+
},
|
|
170
175
|
});
|
|
171
176
|
|
|
172
177
|
/**
|
|
@@ -196,6 +201,17 @@ function openMenu() {
|
|
|
196
201
|
function closeMenu() {
|
|
197
202
|
showMobileMenu.value = false;
|
|
198
203
|
}
|
|
204
|
+
const navbarHeight = computed<number>(() => {
|
|
205
|
+
if (props.size === 'xs') {
|
|
206
|
+
return 50;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (props.size === 'sm') {
|
|
210
|
+
return 54;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return 64;
|
|
214
|
+
});
|
|
199
215
|
|
|
200
216
|
provide('toggleMenu', toggleMenu);
|
|
201
217
|
provide('openMenu', openMenu);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DateTime } from 'luxon';
|
|
2
|
-
import
|
|
2
|
+
import PageDashboard from '../../.storybook/components/PageDashboard.vue';
|
|
3
3
|
import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
@@ -24,12 +24,13 @@ export default {
|
|
|
24
24
|
{
|
|
25
25
|
label: 'Dashboard',
|
|
26
26
|
to: '/',
|
|
27
|
-
icon: 'heroicons-
|
|
27
|
+
icon: 'heroicons:home-20-solid',
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
label: 'Articles',
|
|
31
31
|
to: '/articles',
|
|
32
|
-
icon: 'heroicons:document-text',
|
|
32
|
+
icon: 'heroicons:document-text-solid',
|
|
33
|
+
count: 3134,
|
|
33
34
|
actions: [
|
|
34
35
|
{
|
|
35
36
|
label: 'Articles',
|
|
@@ -53,7 +54,7 @@ export default {
|
|
|
53
54
|
{
|
|
54
55
|
label: 'Users',
|
|
55
56
|
to: '/users',
|
|
56
|
-
icon: 'heroicons:users',
|
|
57
|
+
icon: 'heroicons:users-solid',
|
|
57
58
|
},
|
|
58
59
|
],
|
|
59
60
|
},
|
|
@@ -63,12 +64,12 @@ export default {
|
|
|
63
64
|
{
|
|
64
65
|
label: 'Account',
|
|
65
66
|
to: '/account',
|
|
66
|
-
icon: 'heroicons:cog',
|
|
67
|
+
icon: 'heroicons:cog-solid',
|
|
67
68
|
},
|
|
68
69
|
{
|
|
69
70
|
label: 'Logout',
|
|
70
71
|
action: logout,
|
|
71
|
-
icon: 'heroicons:arrow-left-on-rectangle',
|
|
72
|
+
icon: 'heroicons:arrow-left-on-rectangle-solid',
|
|
72
73
|
},
|
|
73
74
|
],
|
|
74
75
|
},
|
|
@@ -77,17 +78,17 @@ export default {
|
|
|
77
78
|
{
|
|
78
79
|
label: 'Dashboard',
|
|
79
80
|
to: '/',
|
|
80
|
-
icon: 'heroicons-
|
|
81
|
+
icon: 'heroicons:home-solid',
|
|
81
82
|
},
|
|
82
83
|
{
|
|
83
84
|
label: 'Settings',
|
|
84
85
|
to: '/account',
|
|
85
|
-
icon: 'heroicons:cog',
|
|
86
|
+
icon: 'heroicons:cog-solid',
|
|
86
87
|
},
|
|
87
88
|
{
|
|
88
89
|
label: 'Logout',
|
|
89
90
|
action: logout,
|
|
90
|
-
icon: 'heroicons:arrow-left-on-rectangle',
|
|
91
|
+
icon: 'heroicons:arrow-left-on-rectangle-20-solid',
|
|
91
92
|
},
|
|
92
93
|
],
|
|
93
94
|
notifications: {
|
|
@@ -116,20 +117,16 @@ async function logout() {
|
|
|
116
117
|
|
|
117
118
|
const Template = (args) => ({
|
|
118
119
|
components: {
|
|
119
|
-
BaseContainer,
|
|
120
120
|
BaseLayoutSidebarConfigurable,
|
|
121
|
+
PageDashboard,
|
|
121
122
|
},
|
|
122
123
|
setup() {
|
|
123
124
|
return { args };
|
|
124
125
|
},
|
|
125
126
|
template: `
|
|
126
127
|
<BaseLayoutSidebarConfigurable v-bind="args">
|
|
127
|
-
<div class="py-
|
|
128
|
-
<
|
|
129
|
-
<p v-for="i in 20" class="mb-1">
|
|
130
|
-
Amet occaecat enim pariatur incididunt enim laborum enim. Duis cillum in in excepteur sit excepteur laboris consectetur magna. Commodo proident labore commodo duis veniam do nisi irure ipsum officia excepteur non. Nisi cillum mollit tempor ut.
|
|
131
|
-
</p>
|
|
132
|
-
</BaseContainer>
|
|
128
|
+
<div class="py-10 bg-slate-50">
|
|
129
|
+
<PageDashboard />
|
|
133
130
|
</div>
|
|
134
131
|
</BaseLayoutSidebarConfigurable>
|
|
135
132
|
`,
|
|
@@ -146,3 +143,24 @@ Dark.args = {
|
|
|
146
143
|
dark: true,
|
|
147
144
|
logoUrl: 'https://sprintify.witify.io/img/logo/logo-side-dark.svg',
|
|
148
145
|
};
|
|
146
|
+
|
|
147
|
+
export const SizeXS = Template.bind({});
|
|
148
|
+
SizeXS.args = {
|
|
149
|
+
size: 'xs',
|
|
150
|
+
dark: true,
|
|
151
|
+
logoUrl: 'https://sprintify.witify.io/img/logo/logo-side-dark.svg',
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const SizeSM = Template.bind({});
|
|
155
|
+
SizeSM.args = {
|
|
156
|
+
size: 'sm',
|
|
157
|
+
dark: true,
|
|
158
|
+
logoUrl: 'https://sprintify.witify.io/img/logo/logo-side-dark.svg',
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const SizeMD = Template.bind({});
|
|
162
|
+
SizeMD.args = {
|
|
163
|
+
size: 'md',
|
|
164
|
+
dark: true,
|
|
165
|
+
logoUrl: 'https://sprintify.witify.io/img/logo/logo-side-dark.svg',
|
|
166
|
+
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<BaseLayoutSidebar
|
|
2
|
+
<BaseLayoutSidebar
|
|
3
|
+
:app-name="appName"
|
|
4
|
+
:logo-url="logoUrl"
|
|
5
|
+
:dark="dark"
|
|
6
|
+
:size="size"
|
|
7
|
+
>
|
|
3
8
|
<template #menu>
|
|
4
9
|
<div class="px-3 py-6">
|
|
5
10
|
<div class="space-y-8">
|
|
6
11
|
<div v-for="section in actionSections" :key="section.title">
|
|
7
|
-
<h2
|
|
8
|
-
v-if="section.title"
|
|
9
|
-
class="mb-3 pl-3 text-xs font-semibold uppercase tracking-widest"
|
|
10
|
-
:class="dark ? 'text-slate-400' : 'text-slate-500'"
|
|
11
|
-
>
|
|
12
|
+
<h2 v-if="section.title" class="pl-3" :class="sectionTitleClasses">
|
|
12
13
|
{{ section.title }}
|
|
13
14
|
</h2>
|
|
14
15
|
<div>
|
|
15
|
-
<div class="space-y-1">
|
|
16
|
+
<div :class="[size == 'md' ? 'space-y-1' : 'space-y-0.5']">
|
|
16
17
|
<BaseNavbarSideItem
|
|
17
18
|
v-for="item in section.actions"
|
|
18
19
|
:key="item.label"
|
|
19
20
|
:item="item"
|
|
20
21
|
:dark="dark"
|
|
22
|
+
:size="size"
|
|
21
23
|
/>
|
|
22
24
|
</div>
|
|
23
25
|
</div>
|
|
@@ -38,16 +40,27 @@
|
|
|
38
40
|
v-if="notifications"
|
|
39
41
|
:notifications-config="notifications"
|
|
40
42
|
class="mr-1 sm:mr-2"
|
|
43
|
+
:size="size"
|
|
41
44
|
@click="onNotificationClick"
|
|
42
45
|
@open="onNotificationOpen"
|
|
43
46
|
></BaseLayoutNotificationDropdown>
|
|
44
47
|
|
|
45
48
|
<!-- Profile dropdown -->
|
|
46
|
-
<div
|
|
47
|
-
|
|
49
|
+
<div
|
|
50
|
+
class="relative mr-2"
|
|
51
|
+
:class="{
|
|
52
|
+
'ml-2': size == 'md',
|
|
53
|
+
'ml-1': size == 'sm',
|
|
54
|
+
'ml-0': size == 'xs',
|
|
55
|
+
}"
|
|
56
|
+
>
|
|
57
|
+
<BaseMenu :items="userMenu" :size="size == 'xs' ? 'xs' : 'sm'">
|
|
48
58
|
<template #button="{ open }">
|
|
49
|
-
<div
|
|
50
|
-
|
|
59
|
+
<div
|
|
60
|
+
class="flex rounded-md p-1.5 hover:bg-slate-100"
|
|
61
|
+
:class="[open ? 'bg-slate-100' : '']"
|
|
62
|
+
>
|
|
63
|
+
<BaseAvatar :user="user" :size="size" show-details />
|
|
51
64
|
</div>
|
|
52
65
|
</template>
|
|
53
66
|
</BaseMenu>
|
|
@@ -103,6 +116,10 @@ const props = defineProps({
|
|
|
103
116
|
default: false,
|
|
104
117
|
type: Boolean,
|
|
105
118
|
},
|
|
119
|
+
size: {
|
|
120
|
+
default: 'md',
|
|
121
|
+
type: String as PropType<'xs' | 'sm' | 'md'>,
|
|
122
|
+
},
|
|
106
123
|
});
|
|
107
124
|
|
|
108
125
|
const actionSections = computed((): ActionSection[] => {
|
|
@@ -120,6 +137,26 @@ const actionSections = computed((): ActionSection[] => {
|
|
|
120
137
|
];
|
|
121
138
|
});
|
|
122
139
|
|
|
140
|
+
const sectionTitleClasses = computed((): string[] => {
|
|
141
|
+
const classList = ['mb-3 font-semibold uppercase tracking-widest'];
|
|
142
|
+
|
|
143
|
+
if (props.dark) {
|
|
144
|
+
classList.push('text-gray-400');
|
|
145
|
+
} else {
|
|
146
|
+
classList.push('text-gray-500');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (props.size === 'xs') {
|
|
150
|
+
classList.push('text-[10px]');
|
|
151
|
+
} else if (props.size === 'sm') {
|
|
152
|
+
classList.push('text-[11px]');
|
|
153
|
+
} else if (props.size === 'md') {
|
|
154
|
+
classList.push('text-xs');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return classList;
|
|
158
|
+
});
|
|
159
|
+
|
|
123
160
|
function onNotificationClick(notification: Notification) {
|
|
124
161
|
emit('notification:click', notification);
|
|
125
162
|
}
|
|
@@ -5,11 +5,7 @@
|
|
|
5
5
|
<span :class="textSize">{{ label }}</span>
|
|
6
6
|
</div>
|
|
7
7
|
<div v-if="count" class="relative -top-px ml-[5px]">
|
|
8
|
-
<BaseCounter
|
|
9
|
-
:count="count"
|
|
10
|
-
:max-digit="2"
|
|
11
|
-
:color="active ? 'white' : 'primary'"
|
|
12
|
-
/>
|
|
8
|
+
<BaseCounter :count="count" :max-digit="2" :color="color" />
|
|
13
9
|
</div>
|
|
14
10
|
</div>
|
|
15
11
|
</template>
|
|
@@ -79,11 +75,12 @@ const buttonClasses = computed((): string => {
|
|
|
79
75
|
let baseClasses =
|
|
80
76
|
'flex items-center justify-between w-full leading-tight py-2 text-sm text-left rounded';
|
|
81
77
|
|
|
78
|
+
baseClasses += ' ' + textColor.value;
|
|
79
|
+
|
|
82
80
|
if (!props.active) {
|
|
83
81
|
baseClasses += ' bg-white';
|
|
84
|
-
baseClasses += ' ' + textColor.value;
|
|
85
82
|
} else {
|
|
86
|
-
baseClasses += ' bg-
|
|
83
|
+
baseClasses += ' bg-slate-100';
|
|
87
84
|
}
|
|
88
85
|
|
|
89
86
|
if (props.icon) {
|
|
@@ -100,8 +97,6 @@ const iconClasses = computed((): string => {
|
|
|
100
97
|
|
|
101
98
|
if (!props.active) {
|
|
102
99
|
baseClasses += ' opacity-70 ' + textColor.value;
|
|
103
|
-
} else {
|
|
104
|
-
baseClasses += ' text-primary-100';
|
|
105
100
|
}
|
|
106
101
|
|
|
107
102
|
return baseClasses;
|