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,80 @@
|
|
|
1
|
+
import BaseButton from './BaseButton.vue';
|
|
2
|
+
|
|
3
|
+
const colors = [
|
|
4
|
+
'btn-primary',
|
|
5
|
+
'btn-secondary',
|
|
6
|
+
'btn-secondary-outline',
|
|
7
|
+
'btn-success',
|
|
8
|
+
'btn-warning',
|
|
9
|
+
'btn-danger',
|
|
10
|
+
'btn-white',
|
|
11
|
+
'btn-slate-100',
|
|
12
|
+
'btn-slate-100-outline',
|
|
13
|
+
'btn-slate-200',
|
|
14
|
+
'btn-slate-200-outline',
|
|
15
|
+
'btn-black',
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const sizes = ['btn-xs', 'btn-sm', 'btn-base', 'btn-lg', 'btn-xl'];
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
title: 'Components/BaseButton',
|
|
22
|
+
component: BaseButton,
|
|
23
|
+
argTypes: {
|
|
24
|
+
class: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const Template = (args) => ({
|
|
31
|
+
components: { BaseButton },
|
|
32
|
+
setup() {
|
|
33
|
+
return { args };
|
|
34
|
+
},
|
|
35
|
+
template: `
|
|
36
|
+
<BaseButton v-bind="args">
|
|
37
|
+
Click me
|
|
38
|
+
</BaseButton>
|
|
39
|
+
`,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const Demo = Template.bind({});
|
|
43
|
+
Demo.args = {
|
|
44
|
+
class: 'btn-primary btn-base',
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Loading = Template.bind({});
|
|
48
|
+
Loading.args = {
|
|
49
|
+
loading: true,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Colors = (args) => ({
|
|
53
|
+
components: { BaseButton },
|
|
54
|
+
setup() {
|
|
55
|
+
return { args, colors };
|
|
56
|
+
},
|
|
57
|
+
template: `
|
|
58
|
+
<div v-for="color in colors" :key="color" class="mb-4">
|
|
59
|
+
<p class="text-xs text-slate-600 leading-tight mb-1">{{ color }}</p>
|
|
60
|
+
<BaseButton :class="color">
|
|
61
|
+
Click here
|
|
62
|
+
</BaseButton>
|
|
63
|
+
</div>
|
|
64
|
+
`,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const Sizes = (args) => ({
|
|
68
|
+
components: { BaseButton },
|
|
69
|
+
setup() {
|
|
70
|
+
return { args, sizes };
|
|
71
|
+
},
|
|
72
|
+
template: `
|
|
73
|
+
<div v-for="size in sizes" :key="size" class="mb-4">
|
|
74
|
+
<p class="text-xs text-slate-600 leading-tight mb-1">{{ size }}</p>
|
|
75
|
+
<BaseButton class="btn-primary" :class="size">
|
|
76
|
+
Click here
|
|
77
|
+
</BaseButton>
|
|
78
|
+
</div>
|
|
79
|
+
`,
|
|
80
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component :is="as" ref="button" class="btn">
|
|
3
|
+
<div
|
|
4
|
+
class="flex items-center justify-center"
|
|
5
|
+
:class="{ 'opacity-0': loading }"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
v-if="loading"
|
|
12
|
+
class="absolute inset-0 flex h-full w-full items-center justify-center"
|
|
13
|
+
>
|
|
14
|
+
<svg class="h-4 w-4 animate-spin" viewBox="0 0 24 24">
|
|
15
|
+
<path
|
|
16
|
+
fill="currentColor"
|
|
17
|
+
d="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"
|
|
18
|
+
/>
|
|
19
|
+
</svg>
|
|
20
|
+
</div>
|
|
21
|
+
</component>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts">
|
|
25
|
+
import { defineComponent } from 'vue';
|
|
26
|
+
|
|
27
|
+
export default defineComponent({
|
|
28
|
+
props: {
|
|
29
|
+
loading: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false,
|
|
32
|
+
},
|
|
33
|
+
as: {
|
|
34
|
+
default: 'button',
|
|
35
|
+
type: String,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import BaseCard from './BaseCard.vue';
|
|
2
|
+
import BaseCardRow from './BaseCardRow.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Layout/BaseCard',
|
|
6
|
+
component: BaseCard,
|
|
7
|
+
argTypes: {},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = (args) => ({
|
|
11
|
+
components: { BaseCard, BaseCardRow },
|
|
12
|
+
setup() {
|
|
13
|
+
return { args };
|
|
14
|
+
},
|
|
15
|
+
template: `
|
|
16
|
+
<BaseCard class="mb-3">
|
|
17
|
+
Content (no padding)
|
|
18
|
+
</BaseCard>
|
|
19
|
+
|
|
20
|
+
<BaseCard class="mb-3">
|
|
21
|
+
<BaseCardRow>
|
|
22
|
+
Content (with padding)
|
|
23
|
+
</BaseCardRow>
|
|
24
|
+
</BaseCard>
|
|
25
|
+
|
|
26
|
+
<BaseCard class="mb-3">
|
|
27
|
+
<BaseCardRow>
|
|
28
|
+
Row 1
|
|
29
|
+
</BaseCardRow>
|
|
30
|
+
<BaseCardRow>
|
|
31
|
+
Row 2
|
|
32
|
+
</BaseCardRow>
|
|
33
|
+
</BaseCard>
|
|
34
|
+
|
|
35
|
+
<BaseCard class="mb-3">
|
|
36
|
+
<BaseCardRow size="xs">
|
|
37
|
+
Row (xs)
|
|
38
|
+
</BaseCardRow>
|
|
39
|
+
<BaseCardRow size="sm">
|
|
40
|
+
Row (sm)
|
|
41
|
+
</BaseCardRow>
|
|
42
|
+
<BaseCardRow size="base">
|
|
43
|
+
Row (base)
|
|
44
|
+
</BaseCardRow>
|
|
45
|
+
<BaseCardRow size="lg">
|
|
46
|
+
Row (lg)
|
|
47
|
+
</BaseCardRow>
|
|
48
|
+
</BaseCard>
|
|
49
|
+
|
|
50
|
+
<BaseCard :clipped="false" class="mb-3">
|
|
51
|
+
<div class="p-5 bg-slate-300">Not clipped</div>
|
|
52
|
+
</BaseCard>
|
|
53
|
+
|
|
54
|
+
<BaseCard clipped class="mb-3">
|
|
55
|
+
<div class="p-5 bg-slate-300">Clipped</div>
|
|
56
|
+
</BaseCard>
|
|
57
|
+
`,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const Demo = Template.bind({});
|
|
61
|
+
Demo.args = {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="card"
|
|
4
|
+
class="border-t border-b border-slate-300 bg-white"
|
|
5
|
+
:class="{
|
|
6
|
+
'rounded-lg border-r border-l shadow-sm': width != windowWidth,
|
|
7
|
+
'overflow-hidden': clipped,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<slot />
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script lang="ts" setup>
|
|
15
|
+
import { debounce } from 'lodash';
|
|
16
|
+
import { Ref } from 'vue';
|
|
17
|
+
|
|
18
|
+
defineProps({
|
|
19
|
+
clipped: {
|
|
20
|
+
default: false,
|
|
21
|
+
type: Boolean,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const windowWidth = ref(0);
|
|
26
|
+
const width = ref(0);
|
|
27
|
+
const card = ref(null) as Ref<HTMLElement | null>;
|
|
28
|
+
|
|
29
|
+
onMounted(() => {
|
|
30
|
+
window.addEventListener('resize', onResizeDebounced);
|
|
31
|
+
onResize();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
onBeforeUnmount(() => {
|
|
35
|
+
window.removeEventListener('resize', onResizeDebounced);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const onResizeDebounced = debounce(() => {
|
|
39
|
+
onResize();
|
|
40
|
+
}, 200);
|
|
41
|
+
|
|
42
|
+
function onResize() {
|
|
43
|
+
windowWidth.value = document.body.clientWidth;
|
|
44
|
+
if (!card.value) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
width.value = (card.value as HTMLElement).offsetWidth;
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="border-t border-slate-300 first:border-t-0">
|
|
3
|
+
<div :class="paddingClass">
|
|
4
|
+
<slot />
|
|
5
|
+
</div>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from 'vue';
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
props: {
|
|
14
|
+
size: {
|
|
15
|
+
default: 'base',
|
|
16
|
+
type: String,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
computed: {
|
|
20
|
+
paddingClass(): string {
|
|
21
|
+
if (this.size == 'xs') {
|
|
22
|
+
return 'md:p-3 p-2';
|
|
23
|
+
}
|
|
24
|
+
if (this.size == 'sm') {
|
|
25
|
+
return 'md:p-4 p-3';
|
|
26
|
+
}
|
|
27
|
+
if (this.size == 'lg') {
|
|
28
|
+
return 'md:p-8 p-6';
|
|
29
|
+
}
|
|
30
|
+
return 'md:p-6 px-4 py-5';
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import BaseClipboard from './BaseClipboard.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/BaseClipboard',
|
|
5
|
+
component: BaseClipboard,
|
|
6
|
+
argTypes: {},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = (args) => ({
|
|
10
|
+
components: { BaseClipboard },
|
|
11
|
+
setup() {
|
|
12
|
+
return { args };
|
|
13
|
+
},
|
|
14
|
+
template: `
|
|
15
|
+
<BaseClipboard class="mb-3">
|
|
16
|
+
<span class="underline text-blue-600">{{ args.value }}</span>
|
|
17
|
+
</BaseClipboard>
|
|
18
|
+
|
|
19
|
+
<br>
|
|
20
|
+
|
|
21
|
+
<BaseClipboard class="mb-3 border border-slate-200 rounded px-2 py-px">
|
|
22
|
+
<Icon icon="heroicons:server" class="mr-2 text-slate-500" />
|
|
23
|
+
<span class="font-mono text-sm text-slate-600">{{ args.value }}</span>
|
|
24
|
+
</BaseClipboard>
|
|
25
|
+
`,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const Demo = Template.bind({});
|
|
29
|
+
Demo.args = {
|
|
30
|
+
value: '168.192.0.1',
|
|
31
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
type="button"
|
|
4
|
+
class="relative inline-flex items-center"
|
|
5
|
+
@click="copyText()"
|
|
6
|
+
@mouseenter="showTooltip()"
|
|
7
|
+
@mouseleave="hideTooltip()"
|
|
8
|
+
>
|
|
9
|
+
<slot></slot>
|
|
10
|
+
<transition
|
|
11
|
+
enter-active-class="transition duration-200 ease-out"
|
|
12
|
+
enter-from-class="transform scale-90 opacity-0"
|
|
13
|
+
enter-to-class="transform scale-100 opacity-100"
|
|
14
|
+
leave-active-class="transition duration-75 ease-in"
|
|
15
|
+
leave-from-class="transform scale-100 opacity-100"
|
|
16
|
+
leave-to-class="transform scale-90 opacity-0"
|
|
17
|
+
>
|
|
18
|
+
<div
|
|
19
|
+
v-show="tooltipShown"
|
|
20
|
+
class="pointer-events-none absolute left-full z-10 items-center"
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
class="ml-2 whitespace-nowrap rounded bg-slate-900 bg-opacity-80 px-3 py-2 text-xs leading-tight text-white backdrop-blur"
|
|
24
|
+
>
|
|
25
|
+
<div v-if="showCopied" class="flex items-center">
|
|
26
|
+
<Icon
|
|
27
|
+
class="mr-1 text-green-500"
|
|
28
|
+
icon="heroicons:check-circle-solid"
|
|
29
|
+
></Icon>
|
|
30
|
+
{{ $t('sui.copied') }}
|
|
31
|
+
</div>
|
|
32
|
+
<div v-else>
|
|
33
|
+
{{ $t('sui.click_to_copy') }}
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</transition>
|
|
38
|
+
</button>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script lang="ts" setup>
|
|
42
|
+
import { defineProps } from 'vue';
|
|
43
|
+
|
|
44
|
+
const tooltipShown = ref(false);
|
|
45
|
+
const showCopied = ref(false);
|
|
46
|
+
|
|
47
|
+
const props = defineProps({
|
|
48
|
+
value: {
|
|
49
|
+
default: null,
|
|
50
|
+
type: String,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
async function writeText(text: string) {
|
|
55
|
+
if (
|
|
56
|
+
typeof navigator === 'undefined' ||
|
|
57
|
+
!navigator.clipboard ||
|
|
58
|
+
!navigator.clipboard.writeText
|
|
59
|
+
) {
|
|
60
|
+
throw new Error('Clipboard API not available in this browser');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
await navigator.clipboard.writeText(text);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let timeoutId = null as null | number;
|
|
67
|
+
|
|
68
|
+
function showTooltip() {
|
|
69
|
+
tooltipShown.value = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function hideTooltip() {
|
|
73
|
+
tooltipShown.value = false;
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
showCopied.value = false;
|
|
76
|
+
}, 200);
|
|
77
|
+
if (timeoutId) {
|
|
78
|
+
clearTimeout(timeoutId);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function copyText() {
|
|
83
|
+
writeText(props.value);
|
|
84
|
+
showSuccessMessage();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function showSuccessMessage() {
|
|
88
|
+
showCopied.value = true;
|
|
89
|
+
timeoutId = setTimeout(() => {
|
|
90
|
+
tooltipShown.value = false;
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
showCopied.value = false;
|
|
93
|
+
}, 200);
|
|
94
|
+
}, 1600);
|
|
95
|
+
}
|
|
96
|
+
</script>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import BaseContainer from './BaseContainer.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Layout/BaseContainer',
|
|
5
|
+
description: 'Lorem',
|
|
6
|
+
component: BaseContainer,
|
|
7
|
+
argTypes: {
|
|
8
|
+
size: {
|
|
9
|
+
control: { type: 'select' },
|
|
10
|
+
options: ['lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl', 'full'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Template = (args) => ({
|
|
16
|
+
components: { BaseContainer },
|
|
17
|
+
setup() {
|
|
18
|
+
return { args };
|
|
19
|
+
},
|
|
20
|
+
template: `
|
|
21
|
+
<div class="bg-slate-100 py-16">
|
|
22
|
+
<BaseContainer v-bind="args">
|
|
23
|
+
<div class="bg-white py-5 border-2 border-dashed border-slate-400 rounded">
|
|
24
|
+
<p class="text-center">Default slot</p>
|
|
25
|
+
</div>
|
|
26
|
+
</BaseContainer>
|
|
27
|
+
</div>`,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const Demo = Template.bind({});
|
|
31
|
+
|
|
32
|
+
Demo.args = {
|
|
33
|
+
size: '7xl',
|
|
34
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="mx-auto w-full md:px-8"
|
|
4
|
+
:class="[width, { 'px-4': !paddinglessMobile }]"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from 'vue';
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
props: {
|
|
15
|
+
size: {
|
|
16
|
+
default: '7xl',
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
paddinglessMobile: {
|
|
20
|
+
default: false,
|
|
21
|
+
type: Boolean,
|
|
22
|
+
},
|
|
23
|
+
fluid: {
|
|
24
|
+
default: false,
|
|
25
|
+
type: Boolean,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
computed: {
|
|
29
|
+
width() {
|
|
30
|
+
if (this.fluid) {
|
|
31
|
+
return 'max-w-full';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const sizes = {
|
|
35
|
+
lg: 'max-w-lg',
|
|
36
|
+
xl: 'max-w-xl',
|
|
37
|
+
'2xl': 'max-w-2xl',
|
|
38
|
+
'3xl': 'max-w-3xl',
|
|
39
|
+
'4xl': 'max-w-4xl',
|
|
40
|
+
'5xl': 'max-w-5xl',
|
|
41
|
+
'6xl': 'max-w-6xl',
|
|
42
|
+
'7xl': 'max-w-7xl',
|
|
43
|
+
full: 'max-w-full',
|
|
44
|
+
} as { [key: string]: string };
|
|
45
|
+
|
|
46
|
+
return sizes[this.size] || 'max-w-5xl';
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import BaseCounter from './BaseCounter.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/BaseCounter',
|
|
5
|
+
component: BaseCounter,
|
|
6
|
+
argTypes: {
|
|
7
|
+
color: {
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
options: ['primary', 'danger', 'dark', 'light', 'white'],
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
control: { type: 'select' },
|
|
13
|
+
options: ['xs', 'sm', 'base'],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const Template = (args) => ({
|
|
19
|
+
components: { BaseCounter },
|
|
20
|
+
setup() {
|
|
21
|
+
return { args };
|
|
22
|
+
},
|
|
23
|
+
template: `
|
|
24
|
+
<BaseCounter v-bind="args"></BaseCounter>
|
|
25
|
+
`,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const Demo = Template.bind({});
|
|
29
|
+
Demo.args = {
|
|
30
|
+
count: 355,
|
|
31
|
+
maxDigit: 2,
|
|
32
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="inline-flex h-4 w-auto items-center justify-center rounded-full px-1.5"
|
|
4
|
+
:class="[sizeClass, colorClass]"
|
|
5
|
+
>
|
|
6
|
+
{{ countLabel }}
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import { padStart } from 'lodash';
|
|
12
|
+
import { PropType } from 'vue';
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
count: {
|
|
16
|
+
required: true,
|
|
17
|
+
type: Number,
|
|
18
|
+
},
|
|
19
|
+
maxDigit: {
|
|
20
|
+
default: 3,
|
|
21
|
+
type: Number,
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: 'sm',
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
color: {
|
|
28
|
+
default: 'danger',
|
|
29
|
+
type: String as PropType<'danger' | 'primary' | 'dark' | 'light' | 'white'>,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const countLabel = computed((): string => {
|
|
34
|
+
const realMaxDigit = Math.max(1, props.maxDigit);
|
|
35
|
+
|
|
36
|
+
const countString = props.count + '';
|
|
37
|
+
const numberOfDigit = countString.length;
|
|
38
|
+
if (numberOfDigit > realMaxDigit) {
|
|
39
|
+
return padStart('+', realMaxDigit + 1, '9');
|
|
40
|
+
}
|
|
41
|
+
return countString;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const sizeClass = computed((): string => {
|
|
45
|
+
if (props.size == 'xs') {
|
|
46
|
+
return 'text-[10px]';
|
|
47
|
+
}
|
|
48
|
+
if (props.size == 'sm') {
|
|
49
|
+
return 'text-xs';
|
|
50
|
+
}
|
|
51
|
+
if (props.size == 'base') {
|
|
52
|
+
return 'text-sm';
|
|
53
|
+
}
|
|
54
|
+
return 'text-xs';
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const colorClass = computed((): string => {
|
|
58
|
+
if (props.color == 'danger') {
|
|
59
|
+
return 'bg-red-500 text-white';
|
|
60
|
+
}
|
|
61
|
+
if (props.color == 'primary') {
|
|
62
|
+
return 'bg-primary-500 text-white';
|
|
63
|
+
}
|
|
64
|
+
if (props.color == 'dark') {
|
|
65
|
+
return 'bg-slate-900 text-white';
|
|
66
|
+
}
|
|
67
|
+
if (props.color == 'light') {
|
|
68
|
+
return 'bg-slate-200 text-slate-900';
|
|
69
|
+
}
|
|
70
|
+
return 'bg-white text-slate-900';
|
|
71
|
+
});
|
|
72
|
+
</script>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import BaseDataIterator from './BaseDataIterator.vue';
|
|
2
|
+
import BaseCard from './BaseCard.vue';
|
|
3
|
+
import BaseCardRow from './BaseCardRow.vue';
|
|
4
|
+
import BaseLoadingCover from './BaseLoadingCover.vue';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Data/BaseDataIterator',
|
|
8
|
+
component: BaseDataIterator,
|
|
9
|
+
argTypes: {},
|
|
10
|
+
args: {
|
|
11
|
+
url: 'https://effettandem.com/api/content/articles',
|
|
12
|
+
urlQuery: {
|
|
13
|
+
per_page: 5,
|
|
14
|
+
},
|
|
15
|
+
history: false,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const template = `
|
|
20
|
+
<BaseDataIterator v-bind="args">
|
|
21
|
+
<template #default="{ items, loading }">
|
|
22
|
+
<div class="relative">
|
|
23
|
+
<div class="space-y-1.5">
|
|
24
|
+
<a
|
|
25
|
+
v-for="item in items"
|
|
26
|
+
:key="item.id"
|
|
27
|
+
:href="item.website_url"
|
|
28
|
+
target="_blank"
|
|
29
|
+
class="block group"
|
|
30
|
+
>
|
|
31
|
+
<BaseCard class="group-hover:bg-slate-100">
|
|
32
|
+
<BaseCardRow size="sm">
|
|
33
|
+
<div class="font-medium text-slate-900">
|
|
34
|
+
{{ item.title }}
|
|
35
|
+
</div>
|
|
36
|
+
<p class="text-xs leading-tight text-slate-500">
|
|
37
|
+
{{ item.subtitle }}
|
|
38
|
+
</p>
|
|
39
|
+
</BaseCardRow>
|
|
40
|
+
</BaseCard>
|
|
41
|
+
</a>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<BaseLoadingCover
|
|
45
|
+
v-show="loading"
|
|
46
|
+
backdropClass="bg-slate-100 bg-opacity-50"
|
|
47
|
+
>
|
|
48
|
+
</BaseLoadingCover>
|
|
49
|
+
</div>
|
|
50
|
+
</template>
|
|
51
|
+
</BaseDataIterator>
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
const Template = (args) => ({
|
|
55
|
+
components: { BaseDataIterator, BaseCard, BaseCardRow, BaseLoadingCover },
|
|
56
|
+
setup() {
|
|
57
|
+
return { args };
|
|
58
|
+
},
|
|
59
|
+
template: template,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const Demo = Template.bind({});
|
|
63
|
+
Demo.args = {
|
|
64
|
+
searchable: true,
|
|
65
|
+
actions: [
|
|
66
|
+
{
|
|
67
|
+
label: 'Open Google',
|
|
68
|
+
icon: 'heroicons:link',
|
|
69
|
+
href: 'https://google.com',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: 'Export',
|
|
73
|
+
icon: 'heroicons:table-cells',
|
|
74
|
+
action: () => alert('export!'),
|
|
75
|
+
},
|
|
76
|
+
{ line: true },
|
|
77
|
+
{
|
|
78
|
+
label: 'Delete all',
|
|
79
|
+
icon: 'heroicons:trash',
|
|
80
|
+
action: () => alert('Delete All!'),
|
|
81
|
+
color: 'danger',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const Simple = Template.bind({});
|
|
87
|
+
Simple.args = {
|
|
88
|
+
searchable: false,
|
|
89
|
+
actions: [],
|
|
90
|
+
};
|