sprintify-ui 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +188 -0
- package/dist/types/src/components/BaseAlert.vue.d.ts +51 -0
- package/dist/types/src/components/BaseAutocomplete.vue.d.ts +268 -0
- package/dist/types/src/components/BaseAutocompleteFetch.vue.d.ts +273 -0
- package/dist/types/src/components/BaseAvatar.vue.d.ts +126 -0
- package/dist/types/src/components/BaseBadge.vue.d.ts +94 -0
- package/dist/types/src/components/BaseBelongsTo.vue.d.ts +268 -0
- package/dist/types/src/components/BaseBoolean.vue.d.ts +64 -0
- package/dist/types/src/components/BaseBreadcrumbs.vue.d.ts +66 -0
- package/dist/types/src/components/BaseButton.vue.d.ts +23 -0
- package/dist/types/src/components/BaseCard.vue.d.ts +74 -0
- package/dist/types/src/components/BaseCardRow.vue.d.ts +16 -0
- package/dist/types/src/components/BaseClipboard.vue.d.ts +74 -0
- package/dist/types/src/components/BaseContainer.vue.d.ts +34 -0
- package/dist/types/src/components/BaseCounter.vue.d.ts +125 -0
- package/dist/types/src/components/BaseDataIterator.vue.d.ts +345 -0
- package/dist/types/src/components/BaseDataTable.vue.d.ts +657 -0
- package/dist/types/src/components/BaseDataTableToggleColumns.vue.d.ts +1281 -0
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +190 -0
- package/dist/types/src/components/BaseDateSelect.vue.d.ts +171 -0
- package/dist/types/src/components/BaseDescriptionList.vue.d.ts +48 -0
- package/dist/types/src/components/BaseDescriptionListItem.vue.d.ts +49 -0
- package/dist/types/src/components/BaseDialog.vue.d.ts +160 -0
- package/dist/types/src/components/BaseFilePicker.vue.d.ts +44 -0
- package/dist/types/src/components/BaseFileUploader.vue.d.ts +220 -0
- package/dist/types/src/components/BaseInput.vue.d.ts +209 -0
- package/dist/types/src/components/BaseInputLabel.vue.d.ts +31 -0
- package/dist/types/src/components/BaseLoadingCover.vue.d.ts +166 -0
- package/dist/types/src/components/BaseLoadingPage.vue.d.ts +2 -0
- package/dist/types/src/components/BaseMediaLibrary.vue.d.ts +269 -0
- package/dist/types/src/components/BaseMediaLibraryItem.vue.d.ts +75 -0
- package/dist/types/src/components/BaseMenu.vue.d.ts +117 -0
- package/dist/types/src/components/BaseMenuItem.vue.d.ts +147 -0
- package/dist/types/src/components/BaseModalCenter.vue.d.ts +141 -0
- package/dist/types/src/components/BaseModalSide.vue.d.ts +141 -0
- package/dist/types/src/components/BaseNavbar.vue.d.ts +79 -0
- package/dist/types/src/components/BaseNavbarItem.vue.d.ts +80 -0
- package/dist/types/src/components/BaseNavbarItemContent.vue.d.ts +127 -0
- package/dist/types/src/components/BasePagination.vue.d.ts +25 -0
- package/dist/types/src/components/BasePaginationSimple.vue.d.ts +25 -0
- package/dist/types/src/components/BasePanel.vue.d.ts +31 -0
- package/dist/types/src/components/BasePassword.vue.d.ts +66 -0
- package/dist/types/src/components/BaseProcessRing.vue.d.ts +36 -0
- package/dist/types/src/components/BaseReadMore.vue.d.ts +74 -0
- package/dist/types/src/components/BaseSelect.vue.d.ts +55 -0
- package/dist/types/src/components/BaseSideNavigation.vue.d.ts +48 -0
- package/dist/types/src/components/BaseSideNavigationItem.vue.d.ts +92 -0
- package/dist/types/src/components/BaseSkeleton.vue.d.ts +93 -0
- package/dist/types/src/components/BaseSpinner.vue.d.ts +2 -0
- package/dist/types/src/components/BaseSwitch.vue.d.ts +39 -0
- package/dist/types/src/components/BaseSystemAlert.vue.d.ts +141 -0
- package/dist/types/src/components/BaseTabItem.vue.d.ts +70 -0
- package/dist/types/src/components/BaseTable.vue.d.ts +467 -0
- package/dist/types/src/components/BaseTableColumn.vue.d.ts +164 -0
- package/dist/types/src/components/BaseTabs.vue.d.ts +48 -0
- package/dist/types/src/components/BaseTagAutocomplete.vue.d.ts +274 -0
- package/dist/types/src/components/BaseTagAutocompleteFetch.vue.d.ts +251 -0
- package/dist/types/src/components/BaseTextarea.vue.d.ts +228 -0
- package/dist/types/src/components/BaseTextareaAutoresize.vue.d.ts +44 -0
- package/dist/types/src/components/BaseTitle.vue.d.ts +45 -0
- package/dist/types/src/components/BaseWordCount.vue.d.ts +31 -0
- package/dist/types/src/components/SlotComponent.d.ts +43 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/composables/breakpoints.d.ts +12 -0
- package/dist/types/src/composables/modal.d.ts +6 -0
- package/dist/types/src/constants/MyConstants.d.ts +1 -0
- package/dist/types/src/constants/index.d.ts +2 -0
- package/dist/types/src/index.d.ts +253 -0
- package/dist/types/src/types/Media.d.ts +8 -0
- package/dist/types/src/types/UploadedFile.d.ts +9 -0
- package/dist/types/src/types/User.d.ts +6 -0
- package/dist/types/src/types/types.d.ts +88 -0
- package/dist/types/src/utils/fileSizeFormat.d.ts +1 -0
- package/dist/types/src/utils/index.d.ts +4 -0
- package/dist/types/src/utils/scrollPreventer.d.ts +4 -0
- package/dist/types/src/utils/toHumanList.d.ts +1 -0
- package/package.json +99 -0
- package/src/assets/button.css +80 -0
- package/src/assets/form.css +15 -0
- package/src/assets/main.css +3 -0
- package/src/assets/pikaday.css +134 -0
- package/src/assets/tailwind.css +5 -0
- package/src/components/BaseAlert.stories.js +52 -0
- package/src/components/BaseAlert.vue +152 -0
- package/src/components/BaseAutocomplete.stories.js +127 -0
- package/src/components/BaseAutocomplete.vue +376 -0
- package/src/components/BaseAutocompleteFetch.stories.js +121 -0
- package/src/components/BaseAutocompleteFetch.vue +185 -0
- package/src/components/BaseAvatar.stories.js +39 -0
- package/src/components/BaseAvatar.vue +92 -0
- package/src/components/BaseBadge.stories.js +61 -0
- package/src/components/BaseBadge.vue +70 -0
- package/src/components/BaseBelongsTo.stories.js +130 -0
- package/src/components/BaseBelongsTo.vue +122 -0
- package/src/components/BaseBoolean.stories.js +35 -0
- package/src/components/BaseBoolean.vue +29 -0
- package/src/components/BaseBreadcrumbs.stories.js +45 -0
- package/src/components/BaseBreadcrumbs.vue +78 -0
- package/src/components/BaseButton.stories.js +80 -0
- package/src/components/BaseButton.vue +39 -0
- package/src/components/BaseCard.stories.js +61 -0
- package/src/components/BaseCard.vue +49 -0
- package/src/components/BaseCardRow.vue +34 -0
- package/src/components/BaseClipboard.stories.js +31 -0
- package/src/components/BaseClipboard.vue +96 -0
- package/src/components/BaseContainer.stories.js +34 -0
- package/src/components/BaseContainer.vue +50 -0
- package/src/components/BaseCounter.stories.js +32 -0
- package/src/components/BaseCounter.vue +72 -0
- package/src/components/BaseDataIterator.stories.js +90 -0
- package/src/components/BaseDataIterator.vue +658 -0
- package/src/components/BaseDataTable.stories.js +95 -0
- package/src/components/BaseDataTable.vue +489 -0
- package/src/components/BaseDataTableToggleColumns.vue +69 -0
- package/src/components/BaseDatePicker.stories.js +53 -0
- package/src/components/BaseDatePicker.vue +166 -0
- package/src/components/BaseDateSelect.vue +192 -0
- package/src/components/BaseDescriptionList.vue +11 -0
- package/src/components/BaseDescriptionListItem.vue +12 -0
- package/src/components/BaseDialog.vue +104 -0
- package/src/components/BaseFilePicker.vue +101 -0
- package/src/components/BaseFileUploader.vue +166 -0
- package/src/components/BaseInput.vue +82 -0
- package/src/components/BaseInputLabel.vue +26 -0
- package/src/components/BaseLoadingCover.vue +84 -0
- package/src/components/BaseLoadingPage.vue +19 -0
- package/src/components/BaseMediaLibrary.vue +281 -0
- package/src/components/BaseMediaLibraryItem.vue +92 -0
- package/src/components/BaseMenu.vue +114 -0
- package/src/components/BaseMenuItem.vue +93 -0
- package/src/components/BaseModalCenter.vue +107 -0
- package/src/components/BaseModalSide.vue +112 -0
- package/src/components/BaseNavbar.vue +72 -0
- package/src/components/BaseNavbarItem.vue +72 -0
- package/src/components/BaseNavbarItemContent.vue +57 -0
- package/src/components/BasePagination.vue +82 -0
- package/src/components/BasePaginationSimple.vue +60 -0
- package/src/components/BasePanel.vue +39 -0
- package/src/components/BasePassword.vue +73 -0
- package/src/components/BaseProcessRing.vue +56 -0
- package/src/components/BaseReadMore.vue +72 -0
- package/src/components/BaseSelect.vue +59 -0
- package/src/components/BaseSideNavigation.vue +7 -0
- package/src/components/BaseSideNavigationItem.vue +42 -0
- package/src/components/BaseSkeleton.vue +24 -0
- package/src/components/BaseSpinner.vue +47 -0
- package/src/components/BaseSwitch.vue +87 -0
- package/src/components/BaseSystemAlert.vue +86 -0
- package/src/components/BaseTabItem.vue +30 -0
- package/src/components/BaseTable.vue +781 -0
- package/src/components/BaseTableColumn.vue +109 -0
- package/src/components/BaseTabs.vue +12 -0
- package/src/components/BaseTagAutocomplete.vue +385 -0
- package/src/components/BaseTagAutocompleteFetch.vue +154 -0
- package/src/components/BaseTextarea.vue +73 -0
- package/src/components/BaseTextareaAutoresize.vue +117 -0
- package/src/components/BaseTitle.vue +80 -0
- package/src/components/BaseWordCount.vue +36 -0
- package/src/components/SlotComponent.ts +37 -0
- package/src/components/index.ts +5 -0
- package/src/composables/breakpoints.ts +6 -0
- package/src/composables/modal.ts +77 -0
- package/src/constants/MyConstants.ts +1 -0
- package/src/constants/index.ts +5 -0
- package/src/env.d.ts +15 -0
- package/src/index.ts +70 -0
- package/src/lang/en.json +56 -0
- package/src/lang/fr.json +56 -0
- package/src/types/Media.ts +9 -0
- package/src/types/UploadedFile.ts +10 -0
- package/src/types/User.ts +7 -0
- package/src/types/types.ts +112 -0
- package/src/utils/fileSizeFormat.ts +15 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/scrollPreventer.ts +21 -0
- package/src/utils/toHumanList.ts +20 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="flex items-center">
|
|
3
|
+
<img
|
|
4
|
+
:src="user.avatar_url"
|
|
5
|
+
:class="[sizeClass, detailsPosition == 'left' ? 'order-2' : 'order-1']"
|
|
6
|
+
class="shrink-0 overflow-hidden rounded-full"
|
|
7
|
+
/>
|
|
8
|
+
<div
|
|
9
|
+
v-if="showDetails"
|
|
10
|
+
class="max-w-[120px] grow leading-tight"
|
|
11
|
+
:class="[
|
|
12
|
+
textSizeClass,
|
|
13
|
+
detailsPosition == 'left'
|
|
14
|
+
? 'order-1 mr-3 text-right'
|
|
15
|
+
: 'order-2 ml-3 text-left',
|
|
16
|
+
]"
|
|
17
|
+
>
|
|
18
|
+
<div class="truncate">
|
|
19
|
+
{{ user.full_name }}
|
|
20
|
+
</div>
|
|
21
|
+
<div class="truncate opacity-50">
|
|
22
|
+
{{ user.email }}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import { PropType } from 'vue';
|
|
30
|
+
import { User } from '@/types/User';
|
|
31
|
+
|
|
32
|
+
const props = defineProps({
|
|
33
|
+
user: {
|
|
34
|
+
required: true,
|
|
35
|
+
type: Object as PropType<User>,
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
default: 'base',
|
|
39
|
+
type: String,
|
|
40
|
+
},
|
|
41
|
+
showDetails: {
|
|
42
|
+
default: false,
|
|
43
|
+
type: Boolean,
|
|
44
|
+
},
|
|
45
|
+
detailsPosition: {
|
|
46
|
+
default: 'right',
|
|
47
|
+
type: String as PropType<'left' | 'right'>,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const sizeClass = computed((): string => {
|
|
52
|
+
const base = 'h-9 w-9';
|
|
53
|
+
|
|
54
|
+
if (props.size == 'xs') {
|
|
55
|
+
return 'h-6 w-6';
|
|
56
|
+
}
|
|
57
|
+
if (props.size == 'sm') {
|
|
58
|
+
return 'h-8 w-8';
|
|
59
|
+
}
|
|
60
|
+
if (props.size == 'base') {
|
|
61
|
+
return base;
|
|
62
|
+
}
|
|
63
|
+
if (props.size == 'lg') {
|
|
64
|
+
return 'h-12 w-12';
|
|
65
|
+
}
|
|
66
|
+
if (props.size == 'xl') {
|
|
67
|
+
return 'h-14 w-14';
|
|
68
|
+
}
|
|
69
|
+
return base;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const textSizeClass = computed((): string => {
|
|
73
|
+
const base = 'text-sm';
|
|
74
|
+
|
|
75
|
+
if (props.size == 'xs') {
|
|
76
|
+
return 'text-xs';
|
|
77
|
+
}
|
|
78
|
+
if (props.size == 'sm') {
|
|
79
|
+
return 'text-xs';
|
|
80
|
+
}
|
|
81
|
+
if (props.size == 'base') {
|
|
82
|
+
return base;
|
|
83
|
+
}
|
|
84
|
+
if (props.size == 'lg') {
|
|
85
|
+
return 'text-sm';
|
|
86
|
+
}
|
|
87
|
+
if (props.size == 'xl') {
|
|
88
|
+
return 'text-base';
|
|
89
|
+
}
|
|
90
|
+
return base;
|
|
91
|
+
});
|
|
92
|
+
</script>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import BaseBadge from './BaseBadge.vue';
|
|
2
|
+
|
|
3
|
+
const colors = [
|
|
4
|
+
'gray',
|
|
5
|
+
'red',
|
|
6
|
+
'yellow',
|
|
7
|
+
'green',
|
|
8
|
+
'blue',
|
|
9
|
+
'indigo',
|
|
10
|
+
'purple',
|
|
11
|
+
'pink',
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const sizes = ['base', 'lg'];
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
title: 'Components/BaseBadge',
|
|
18
|
+
component: BaseBadge,
|
|
19
|
+
argTypes: {
|
|
20
|
+
color: {
|
|
21
|
+
control: { type: 'select' },
|
|
22
|
+
options: colors,
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
control: { type: 'select' },
|
|
26
|
+
options: sizes,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const Template = (args) => ({
|
|
32
|
+
components: { BaseBadge },
|
|
33
|
+
setup() {
|
|
34
|
+
return { args };
|
|
35
|
+
},
|
|
36
|
+
template: `
|
|
37
|
+
<BaseBadge v-bind="args">
|
|
38
|
+
Administrator
|
|
39
|
+
</BaseBadge>
|
|
40
|
+
`,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const Demo = Template.bind({});
|
|
44
|
+
Demo.args = {};
|
|
45
|
+
|
|
46
|
+
export const AllBadges = (args) => ({
|
|
47
|
+
components: { BaseBadge },
|
|
48
|
+
setup() {
|
|
49
|
+
return { args, colors, sizes };
|
|
50
|
+
},
|
|
51
|
+
template: `
|
|
52
|
+
<BaseBadge v-for="color in colors" :key="color" :color="color">
|
|
53
|
+
Administrator
|
|
54
|
+
</BaseBadge>
|
|
55
|
+
<br>
|
|
56
|
+
<br>
|
|
57
|
+
<BaseBadge v-for="size in sizes" :key="size" :size="size">
|
|
58
|
+
Administrator
|
|
59
|
+
</BaseBadge>
|
|
60
|
+
`,
|
|
61
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
class="inline-flex items-center rounded-full font-medium"
|
|
4
|
+
:class="[colorClasses, sizeClasses]"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</span>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import { PropType } from 'vue';
|
|
12
|
+
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
color: {
|
|
15
|
+
default: 'gray',
|
|
16
|
+
type: String as PropType<
|
|
17
|
+
| 'gray'
|
|
18
|
+
| 'red'
|
|
19
|
+
| 'yellow'
|
|
20
|
+
| 'green'
|
|
21
|
+
| 'blue'
|
|
22
|
+
| 'indigo'
|
|
23
|
+
| 'purple'
|
|
24
|
+
| 'pink'
|
|
25
|
+
>,
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
default: 'base',
|
|
29
|
+
type: String as PropType<'base' | 'lg'>,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const colorClasses = computed(() => {
|
|
34
|
+
if (props.color == 'gray') {
|
|
35
|
+
return 'bg-slate-100 text-slate-800';
|
|
36
|
+
}
|
|
37
|
+
if (props.color == 'red') {
|
|
38
|
+
return 'bg-red-100 text-red-900';
|
|
39
|
+
}
|
|
40
|
+
if (props.color == 'yellow') {
|
|
41
|
+
return 'bg-yellow-100 text-yellow-900';
|
|
42
|
+
}
|
|
43
|
+
if (props.color == 'green') {
|
|
44
|
+
return 'bg-green-100 text-green-900';
|
|
45
|
+
}
|
|
46
|
+
if (props.color == 'blue') {
|
|
47
|
+
return 'bg-blue-100 text-blue-900';
|
|
48
|
+
}
|
|
49
|
+
if (props.color == 'indigo') {
|
|
50
|
+
return 'bg-indigo-100 text-indigo-900';
|
|
51
|
+
}
|
|
52
|
+
if (props.color == 'purple') {
|
|
53
|
+
return 'bg-purple-100 text-purple-900';
|
|
54
|
+
}
|
|
55
|
+
if (props.color == 'pink') {
|
|
56
|
+
return 'bg-pink-100 text-pink-900';
|
|
57
|
+
}
|
|
58
|
+
return 'bg-slate-100 text-slate-900';
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const sizeClasses = computed(() => {
|
|
62
|
+
if (props.size == 'base') {
|
|
63
|
+
return 'px-2.5 py-0.5 text-xs';
|
|
64
|
+
}
|
|
65
|
+
if (props.size == 'lg') {
|
|
66
|
+
return 'px-3 py-0.5 text-sm';
|
|
67
|
+
}
|
|
68
|
+
return 'px-2.5 py-0.5 text-xs';
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import BaseBelongsTo from './BaseBelongsTo.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/BaseBelongsTo',
|
|
5
|
+
component: BaseBelongsTo,
|
|
6
|
+
argTypes: {},
|
|
7
|
+
args: {
|
|
8
|
+
url: 'https://effettandem.com/api/content/articles',
|
|
9
|
+
field: 'title',
|
|
10
|
+
inputClass: 'w-full border-slate-300',
|
|
11
|
+
},
|
|
12
|
+
decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Template = (args) => {
|
|
16
|
+
return {
|
|
17
|
+
components: { BaseBelongsTo },
|
|
18
|
+
setup() {
|
|
19
|
+
const value = ref(null);
|
|
20
|
+
return { args, value };
|
|
21
|
+
},
|
|
22
|
+
template: `
|
|
23
|
+
<BaseBelongsTo
|
|
24
|
+
v-model="value"
|
|
25
|
+
v-bind="args"
|
|
26
|
+
></BaseBelongsTo>
|
|
27
|
+
<p class="mt-5 text-sm">Value: <span class="bg-slate-200 font-mono px-1 py-px rounded">{{ value ?? 'NULL' }}</span></p>
|
|
28
|
+
`,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const Demo = Template.bind({});
|
|
33
|
+
Demo.args = {};
|
|
34
|
+
|
|
35
|
+
export const CreateNew = Template.bind({});
|
|
36
|
+
CreateNew.args = {
|
|
37
|
+
createNewUrl: '/users/create',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Disabled = (args) => {
|
|
41
|
+
return {
|
|
42
|
+
components: { BaseBelongsTo },
|
|
43
|
+
setup() {
|
|
44
|
+
return { args };
|
|
45
|
+
},
|
|
46
|
+
template: `<BaseBelongsTo
|
|
47
|
+
v-bind="args"
|
|
48
|
+
:current-model="{title: 'Dark Vader', id: 1}"
|
|
49
|
+
:disabled="true"
|
|
50
|
+
></BaseBelongsTo>`,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const SlotOption = (args) => {
|
|
55
|
+
return {
|
|
56
|
+
components: { BaseBelongsTo },
|
|
57
|
+
setup() {
|
|
58
|
+
const value = ref(null);
|
|
59
|
+
return { args, value };
|
|
60
|
+
},
|
|
61
|
+
template: `
|
|
62
|
+
<div class="mb-20">
|
|
63
|
+
<BaseBelongsTo
|
|
64
|
+
v-model="value"
|
|
65
|
+
v-bind="args"
|
|
66
|
+
>
|
|
67
|
+
<template #option="{ option, active, selected }">
|
|
68
|
+
<div
|
|
69
|
+
class="rounded px-2 py-1"
|
|
70
|
+
:class="{
|
|
71
|
+
'hover:bg-slate-100': !active && !selected,
|
|
72
|
+
'bg-slate-200 hover:bg-slate-300': active && !selected,
|
|
73
|
+
'bg-blue-500 text-white hover:bg-blue-600': !active && selected,
|
|
74
|
+
'bg-blue-600 text-white hover:bg-blue-700': active && selected,
|
|
75
|
+
}"
|
|
76
|
+
>
|
|
77
|
+
<p class="text-sm font-medium">{{ option.title }}</p>
|
|
78
|
+
<p class="opacity-60 text-xs">{{ option.owner?.name }}</p>
|
|
79
|
+
</div>
|
|
80
|
+
</template>
|
|
81
|
+
</BaseBelongsTo>
|
|
82
|
+
</div>
|
|
83
|
+
`,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const SlotFooter = (args) => {
|
|
88
|
+
return {
|
|
89
|
+
components: { BaseBelongsTo },
|
|
90
|
+
setup() {
|
|
91
|
+
const value = ref(null);
|
|
92
|
+
return { args, value };
|
|
93
|
+
},
|
|
94
|
+
template: `
|
|
95
|
+
<BaseBelongsTo
|
|
96
|
+
v-model="value"
|
|
97
|
+
v-bind="args"
|
|
98
|
+
>
|
|
99
|
+
<template #footer>
|
|
100
|
+
<div class="text-center p-1 pt-2 mt-2 border-t">
|
|
101
|
+
<button class="btn btn-sm w-full btn-slate-200-outline">This is the footer 💯</button>
|
|
102
|
+
</div>
|
|
103
|
+
</template>
|
|
104
|
+
</BaseBelongsTo>
|
|
105
|
+
`,
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const SlotEmpty = (args) => {
|
|
110
|
+
return {
|
|
111
|
+
components: { BaseBelongsTo },
|
|
112
|
+
setup() {
|
|
113
|
+
const value = ref(null);
|
|
114
|
+
return { args, value };
|
|
115
|
+
},
|
|
116
|
+
template: `
|
|
117
|
+
<BaseBelongsTo
|
|
118
|
+
v-model="value"
|
|
119
|
+
v-bind="args"
|
|
120
|
+
>
|
|
121
|
+
<template #empty="props">
|
|
122
|
+
<div>
|
|
123
|
+
<div v-if="props.firstSearch" class="text-center py-10 p-6">🤓🤓🤓</div>
|
|
124
|
+
<div v-else class="text-center px-6 py-20">Start your search... 🔎</div>
|
|
125
|
+
</div>
|
|
126
|
+
</template>
|
|
127
|
+
</BaseBelongsTo>
|
|
128
|
+
`,
|
|
129
|
+
};
|
|
130
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BaseAutocompleteFetch
|
|
3
|
+
:model-value="model"
|
|
4
|
+
:url="url"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:placeholder="placeholder"
|
|
7
|
+
:required="required"
|
|
8
|
+
:value-key="foreignKey"
|
|
9
|
+
:label-key="field"
|
|
10
|
+
:create-new-url="createNewUrl"
|
|
11
|
+
:input-class="inputClass"
|
|
12
|
+
@update:model-value="onUpdate"
|
|
13
|
+
>
|
|
14
|
+
<template #option="optionProps">
|
|
15
|
+
<slot name="option" v-bind="optionProps"></slot>
|
|
16
|
+
</template>
|
|
17
|
+
<template #empty="emptyProps">
|
|
18
|
+
<slot name="empty" v-bind="emptyProps"></slot>
|
|
19
|
+
</template>
|
|
20
|
+
<template #footer="footerProps">
|
|
21
|
+
<slot name="footer" v-bind="footerProps"></slot>
|
|
22
|
+
</template>
|
|
23
|
+
</BaseAutocompleteFetch>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import { Selection } from '@/types/types';
|
|
28
|
+
import { PropType } from 'vue';
|
|
29
|
+
import { RouteLocationRaw } from 'vue-router';
|
|
30
|
+
import { AxiosResponse } from 'axios';
|
|
31
|
+
import { config } from 'src';
|
|
32
|
+
|
|
33
|
+
const props = defineProps({
|
|
34
|
+
modelValue: {
|
|
35
|
+
required: true,
|
|
36
|
+
type: [String, Number, null, undefined] as PropType<
|
|
37
|
+
string | number | null | undefined
|
|
38
|
+
>,
|
|
39
|
+
},
|
|
40
|
+
url: {
|
|
41
|
+
required: true,
|
|
42
|
+
type: String,
|
|
43
|
+
},
|
|
44
|
+
showRouteUrl: {
|
|
45
|
+
default: undefined,
|
|
46
|
+
type: Function as PropType<((id: string | number) => string) | undefined>,
|
|
47
|
+
},
|
|
48
|
+
foreignKey: {
|
|
49
|
+
default: 'id',
|
|
50
|
+
type: String,
|
|
51
|
+
},
|
|
52
|
+
field: {
|
|
53
|
+
required: true,
|
|
54
|
+
type: String,
|
|
55
|
+
},
|
|
56
|
+
required: {
|
|
57
|
+
default: false,
|
|
58
|
+
type: Boolean,
|
|
59
|
+
},
|
|
60
|
+
disabled: {
|
|
61
|
+
default: false,
|
|
62
|
+
type: Boolean,
|
|
63
|
+
},
|
|
64
|
+
placeholder: {
|
|
65
|
+
default: '',
|
|
66
|
+
type: String,
|
|
67
|
+
},
|
|
68
|
+
inputClass: {
|
|
69
|
+
default: '',
|
|
70
|
+
type: String,
|
|
71
|
+
},
|
|
72
|
+
currentModel: {
|
|
73
|
+
default: null,
|
|
74
|
+
type: [Object, null] as PropType<Selection>,
|
|
75
|
+
},
|
|
76
|
+
createNewUrl: {
|
|
77
|
+
default: '',
|
|
78
|
+
type: [String, Object] as PropType<RouteLocationRaw>,
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const http = config.http;
|
|
83
|
+
|
|
84
|
+
const emit = defineEmits(['update:modelValue']);
|
|
85
|
+
|
|
86
|
+
const model = ref(props.currentModel);
|
|
87
|
+
|
|
88
|
+
watch(
|
|
89
|
+
() => props.modelValue,
|
|
90
|
+
(newValue, oldValue) => {
|
|
91
|
+
if (newValue == oldValue) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (props.showRouteUrl == null) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!props.modelValue) {
|
|
100
|
+
model.value = null;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
http
|
|
105
|
+
.get(props.showRouteUrl(props.modelValue))
|
|
106
|
+
.then((response: AxiosResponse) => {
|
|
107
|
+
model.value = response.data.data;
|
|
108
|
+
})
|
|
109
|
+
.catch((e: Error) => e);
|
|
110
|
+
},
|
|
111
|
+
{ immediate: true }
|
|
112
|
+
);
|
|
113
|
+
function onUpdate(newModel: Selection) {
|
|
114
|
+
if (!newModel) {
|
|
115
|
+
model.value = null;
|
|
116
|
+
emit('update:modelValue', null);
|
|
117
|
+
} else {
|
|
118
|
+
model.value = newModel;
|
|
119
|
+
emit('update:modelValue', newModel[props.foreignKey]);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
</script>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import BaseBoolean from './BaseBoolean.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/BaseBoolean',
|
|
5
|
+
component: BaseBoolean,
|
|
6
|
+
argTypes: {
|
|
7
|
+
modelValue: {
|
|
8
|
+
control: { type: 'boolean' },
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Template = (args) => ({
|
|
14
|
+
components: { BaseBoolean },
|
|
15
|
+
setup() {
|
|
16
|
+
return { args };
|
|
17
|
+
},
|
|
18
|
+
template: `
|
|
19
|
+
<BaseBoolean v-bind="args"></BaseBoolean>
|
|
20
|
+
`,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const Demo = Template.bind({});
|
|
24
|
+
Demo.args = {};
|
|
25
|
+
|
|
26
|
+
export const AllValues = (args) => ({
|
|
27
|
+
components: { BaseBoolean },
|
|
28
|
+
setup() {
|
|
29
|
+
return { args };
|
|
30
|
+
},
|
|
31
|
+
template: `
|
|
32
|
+
<BaseBoolean :model-value="true"></BaseBoolean>
|
|
33
|
+
<BaseBoolean :model-value="false"></BaseBoolean>
|
|
34
|
+
`,
|
|
35
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="inline-flex h-5 w-5 items-center justify-center rounded-full"
|
|
4
|
+
:class="classes"
|
|
5
|
+
>
|
|
6
|
+
<div v-if="modelValue">
|
|
7
|
+
<Icon icon="heroicons-solid:check" />
|
|
8
|
+
</div>
|
|
9
|
+
<div v-else>
|
|
10
|
+
<Icon icon="heroicons-solid:x" />
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
modelValue: {
|
|
18
|
+
required: true,
|
|
19
|
+
type: [Boolean, String, Number],
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const classes = computed(() => {
|
|
24
|
+
if (props.modelValue) {
|
|
25
|
+
return 'text-white bg-green-500';
|
|
26
|
+
}
|
|
27
|
+
return 'text-white bg-red-500';
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import BaseBreadcrumbs from './BaseBreadcrumbs.vue';
|
|
2
|
+
|
|
3
|
+
const breadcrumbs = [
|
|
4
|
+
{
|
|
5
|
+
label: 'Home',
|
|
6
|
+
icon: 'heroicons:home-solid',
|
|
7
|
+
to: '/',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
label: 'Users',
|
|
11
|
+
to: '/users',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
label: 'John Doe',
|
|
15
|
+
to: '/users/1',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: 'Settings',
|
|
19
|
+
to: '/users/1/settings',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
title: 'Layout/BaseBreadcrumbs',
|
|
25
|
+
component: BaseBreadcrumbs,
|
|
26
|
+
argTypes: {},
|
|
27
|
+
args: {
|
|
28
|
+
breadcrumbs: breadcrumbs,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const Template = (args) => ({
|
|
33
|
+
components: { BaseBreadcrumbs },
|
|
34
|
+
setup() {
|
|
35
|
+
return { args, breadcrumbs };
|
|
36
|
+
},
|
|
37
|
+
template: `
|
|
38
|
+
<BaseBreadcrumbs v-bind="args"></BaseBreadcrumbs>
|
|
39
|
+
|
|
40
|
+
<pre class="mt-4 bg-slate-800 font-light text-xs p-3 rounded text-white">{{ breadcrumbs }}</pre>
|
|
41
|
+
`,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const Demo = Template.bind({});
|
|
45
|
+
Demo.args = {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<nav
|
|
4
|
+
v-if="breadcrumbs.length > 0"
|
|
5
|
+
class="hidden sm:flex"
|
|
6
|
+
aria-label="Breadcrumb"
|
|
7
|
+
>
|
|
8
|
+
<ol role="list" class="flex items-center space-x-3">
|
|
9
|
+
<li v-for="(breadcrumb, index) in breadcrumbs" :key="index">
|
|
10
|
+
<div class="flex items-center">
|
|
11
|
+
<Icon
|
|
12
|
+
v-if="index > 0"
|
|
13
|
+
icon="heroicons-solid:chevron-right"
|
|
14
|
+
class="h-5 w-5 flex-shrink-0 text-slate-400"
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
/>
|
|
17
|
+
<router-link
|
|
18
|
+
v-slot="{ href, navigate, isExactActive }"
|
|
19
|
+
:to="breadcrumb.to"
|
|
20
|
+
custom
|
|
21
|
+
>
|
|
22
|
+
<a
|
|
23
|
+
:href="href"
|
|
24
|
+
class="text-sm text-slate-500"
|
|
25
|
+
:class="[
|
|
26
|
+
{ 'ml-3': index > 0 },
|
|
27
|
+
isExactActive
|
|
28
|
+
? 'text-blue-600'
|
|
29
|
+
: 'text-slate-500 hover:text-slate-700',
|
|
30
|
+
]"
|
|
31
|
+
@click.prevent="navigate()"
|
|
32
|
+
>
|
|
33
|
+
<span v-if="breadcrumb.icon">
|
|
34
|
+
<Icon :icon="breadcrumb.icon" />
|
|
35
|
+
</span>
|
|
36
|
+
<span v-else>
|
|
37
|
+
{{ breadcrumb.label }}
|
|
38
|
+
</span>
|
|
39
|
+
</a>
|
|
40
|
+
</router-link>
|
|
41
|
+
</div>
|
|
42
|
+
</li>
|
|
43
|
+
</ol>
|
|
44
|
+
</nav>
|
|
45
|
+
|
|
46
|
+
<router-link
|
|
47
|
+
v-if="mobileBreadcrumb"
|
|
48
|
+
:to="mobileBreadcrumb.to"
|
|
49
|
+
class="block text-slate-500 sm:hidden"
|
|
50
|
+
>
|
|
51
|
+
<div class="flex items-center">
|
|
52
|
+
<Icon icon="heroicons-solid:arrow-left" class="mr-2" />
|
|
53
|
+
<span>
|
|
54
|
+
{{ mobileBreadcrumb.label }}
|
|
55
|
+
</span>
|
|
56
|
+
</div>
|
|
57
|
+
</router-link>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script lang="ts" setup>
|
|
62
|
+
import { PropType } from 'vue';
|
|
63
|
+
import { Breadcrumb } from '@/types/types';
|
|
64
|
+
|
|
65
|
+
const props = defineProps({
|
|
66
|
+
breadcrumbs: {
|
|
67
|
+
required: true,
|
|
68
|
+
type: Array as PropType<Breadcrumb[]>,
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const mobileBreadcrumb = computed((): Breadcrumb | undefined => {
|
|
73
|
+
if (props.breadcrumbs.length >= 2) {
|
|
74
|
+
return props.breadcrumbs[props.breadcrumbs.length - 2];
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
});
|
|
78
|
+
</script>
|