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,134 @@
|
|
|
1
|
+
@import 'pikaday/css/pikaday.css';
|
|
2
|
+
|
|
3
|
+
.pikaday-white {
|
|
4
|
+
--backgroundColor: #ffffff;
|
|
5
|
+
--textColor: #718096;
|
|
6
|
+
--currentDateTextColor: #3182ce;
|
|
7
|
+
--selectedDateBackgroundColor: #3182ce;
|
|
8
|
+
--selectedDateTextColor: #ffffff;
|
|
9
|
+
|
|
10
|
+
--labelTextColor: #4a5568; /* eg. May 2020 */
|
|
11
|
+
--weekDaysTextColor: #a0aec0; /* eg. Mo Tu We ....*/
|
|
12
|
+
|
|
13
|
+
font-family: inherit;
|
|
14
|
+
background-color: var(--backgroundColor);
|
|
15
|
+
padding: 0.5rem;
|
|
16
|
+
z-index: 2000;
|
|
17
|
+
margin: 6px 0 0 0;
|
|
18
|
+
|
|
19
|
+
@apply shadow;
|
|
20
|
+
@apply rounded-lg;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.pikaday-white .pika-title {
|
|
24
|
+
width: 100%;
|
|
25
|
+
text-align: center;
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: flex-start;
|
|
28
|
+
margin-bottom: 5px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Next/Previous */
|
|
32
|
+
.pikaday-white .pika-prev,
|
|
33
|
+
.pikaday-white .pika-next {
|
|
34
|
+
position: absolute;
|
|
35
|
+
outline: none;
|
|
36
|
+
padding: 0;
|
|
37
|
+
width: 26px;
|
|
38
|
+
height: 26px;
|
|
39
|
+
top: -1px;
|
|
40
|
+
display: inline-block;
|
|
41
|
+
margin-top: 0;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
/* hide text using text-indent trick, using width value (it's enough) */
|
|
44
|
+
text-indent: -9999px;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
background-color: transparent;
|
|
48
|
+
background-position: center center;
|
|
49
|
+
background-repeat: no-repeat;
|
|
50
|
+
opacity: 0.7;
|
|
51
|
+
}
|
|
52
|
+
.pikaday-white .pika-prev:hover,
|
|
53
|
+
.pikaday-white .pika-next:hover {
|
|
54
|
+
opacity: 1;
|
|
55
|
+
}
|
|
56
|
+
.pikaday-white .pika-prev {
|
|
57
|
+
right: 30px;
|
|
58
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a0aec0'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 19l-7-7 7-7'%3E%3C/path%3E%3C/svg%3E");
|
|
59
|
+
}
|
|
60
|
+
.pikaday-white .pika-next {
|
|
61
|
+
right: 2px;
|
|
62
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a0aec0'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'%3E%3C/path%3E%3C/svg%3E");
|
|
63
|
+
}
|
|
64
|
+
.pika-prev.is-disabled,
|
|
65
|
+
.pika-next.is-disabled {
|
|
66
|
+
cursor: default;
|
|
67
|
+
opacity: 0.2;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.pikaday-white .pika-label {
|
|
71
|
+
@apply mr-1.5 rounded border border-slate-300 py-1 px-2 text-[14px] font-medium leading-none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Show Month & Year select */
|
|
75
|
+
.pikaday-white .pika-label {
|
|
76
|
+
position: relative; /* add this */
|
|
77
|
+
/* some additional code */
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.pikaday-white .pika-select-month,
|
|
81
|
+
.pikaday-white .pika-select-year {
|
|
82
|
+
/*display: none;*/
|
|
83
|
+
width: 100%;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
position: absolute;
|
|
86
|
+
z-index: 9998;
|
|
87
|
+
margin: 0;
|
|
88
|
+
left: 0;
|
|
89
|
+
top: 0;
|
|
90
|
+
opacity: 0;
|
|
91
|
+
padding: 0px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.pikaday-white table {
|
|
95
|
+
width: 100%;
|
|
96
|
+
border-collapse: collapse;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.pikaday-white table th {
|
|
100
|
+
width: 2em;
|
|
101
|
+
height: 2em;
|
|
102
|
+
font-weight: normal;
|
|
103
|
+
color: var(--weekDaysTextColor);
|
|
104
|
+
text-align: center;
|
|
105
|
+
}
|
|
106
|
+
.pikaday-white table th abbr {
|
|
107
|
+
text-decoration: none;
|
|
108
|
+
}
|
|
109
|
+
.pikaday-white table td {
|
|
110
|
+
padding: 1px;
|
|
111
|
+
}
|
|
112
|
+
.pikaday-white table td button {
|
|
113
|
+
width: 2em;
|
|
114
|
+
height: 2em;
|
|
115
|
+
text-align: center;
|
|
116
|
+
@apply rounded-full;
|
|
117
|
+
background-color: var(--backgroundColor);
|
|
118
|
+
}
|
|
119
|
+
.pikaday-white table td button:hover {
|
|
120
|
+
@apply bg-slate-200;
|
|
121
|
+
@apply text-slate-900;
|
|
122
|
+
}
|
|
123
|
+
.pikaday-white table td.is-today button {
|
|
124
|
+
color: var(--currentDateTextColor);
|
|
125
|
+
}
|
|
126
|
+
.pikaday-white table td.is-selected button {
|
|
127
|
+
@apply bg-primary-500;
|
|
128
|
+
@apply text-white;
|
|
129
|
+
@apply font-normal;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.pikaday-white table td button {
|
|
133
|
+
color: var(--textColor);
|
|
134
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import BaseAlert from './BaseAlert.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/BaseAlert',
|
|
5
|
+
component: BaseAlert,
|
|
6
|
+
argTypes: {
|
|
7
|
+
color: {
|
|
8
|
+
control: { type: 'select' },
|
|
9
|
+
options: ['success', 'info', 'warning', 'danger'],
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = (args) => ({
|
|
15
|
+
components: { BaseAlert },
|
|
16
|
+
setup() {
|
|
17
|
+
return { args };
|
|
18
|
+
},
|
|
19
|
+
template: `
|
|
20
|
+
<BaseAlert v-bind="args">
|
|
21
|
+
<p>Nisi Lorem sunt amet aliqua dolor ullamco deserunt enim irure non ad. Excepteur culpa consectetur dolore culpa sunt aliquip proident quis. Excepteur officia mollit aute sint quis nisi sint.</p>
|
|
22
|
+
</BaseAlert>
|
|
23
|
+
`,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const Demo = Template.bind({});
|
|
27
|
+
Demo.args = {
|
|
28
|
+
title: 'Be careful',
|
|
29
|
+
color: 'warning',
|
|
30
|
+
bordered: true,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Success = Template.bind({});
|
|
34
|
+
Success.args = {
|
|
35
|
+
title: 'Success',
|
|
36
|
+
color: 'success',
|
|
37
|
+
bordered: true,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Danger = Template.bind({});
|
|
41
|
+
Danger.args = {
|
|
42
|
+
title: 'Error',
|
|
43
|
+
color: 'danger',
|
|
44
|
+
bordered: true,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Info = Template.bind({});
|
|
48
|
+
Info.args = {
|
|
49
|
+
title: 'Information',
|
|
50
|
+
color: 'info',
|
|
51
|
+
bordered: true,
|
|
52
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="flex w-full items-start rounded-md p-4"
|
|
4
|
+
:class="[backgroundClass, borderClass]"
|
|
5
|
+
>
|
|
6
|
+
<div v-if="showIcon" class="mr-3">
|
|
7
|
+
<Icon
|
|
8
|
+
v-if="color == 'warning'"
|
|
9
|
+
icon="heroicons-solid:exclamation"
|
|
10
|
+
:class="iconClass"
|
|
11
|
+
/>
|
|
12
|
+
<Icon
|
|
13
|
+
v-else-if="color == 'danger'"
|
|
14
|
+
icon="heroicons-solid:exclamation-circle"
|
|
15
|
+
:class="iconClass"
|
|
16
|
+
/>
|
|
17
|
+
<Icon
|
|
18
|
+
v-else-if="color == 'success'"
|
|
19
|
+
icon="heroicons-solid:check-circle"
|
|
20
|
+
:class="iconClass"
|
|
21
|
+
/>
|
|
22
|
+
<Icon
|
|
23
|
+
v-else-if="color == 'info'"
|
|
24
|
+
icon="heroicons-solid:information-circle"
|
|
25
|
+
:class="iconClass"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div>
|
|
30
|
+
<h3
|
|
31
|
+
v-if="title"
|
|
32
|
+
class="mb-1 font-medium leading-tight"
|
|
33
|
+
:class="[titleClass]"
|
|
34
|
+
>
|
|
35
|
+
{{ title }}
|
|
36
|
+
</h3>
|
|
37
|
+
|
|
38
|
+
<div v-if="$slots.default" :class="[textClass, 'text-sm leading-tight']">
|
|
39
|
+
<slot />
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script lang="ts">
|
|
46
|
+
import { defineComponent, PropType } from 'vue';
|
|
47
|
+
|
|
48
|
+
export default defineComponent({
|
|
49
|
+
props: {
|
|
50
|
+
title: {
|
|
51
|
+
required: false,
|
|
52
|
+
default: '',
|
|
53
|
+
type: String,
|
|
54
|
+
},
|
|
55
|
+
color: {
|
|
56
|
+
default: 'success',
|
|
57
|
+
type: String as PropType<'info' | 'success' | 'danger' | 'warning'>,
|
|
58
|
+
},
|
|
59
|
+
showIcon: {
|
|
60
|
+
default: true,
|
|
61
|
+
type: Boolean,
|
|
62
|
+
},
|
|
63
|
+
bordered: {
|
|
64
|
+
default: false,
|
|
65
|
+
type: Boolean,
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
computed: {
|
|
69
|
+
backgroundClass(): string {
|
|
70
|
+
if (this.color == 'info') {
|
|
71
|
+
return 'bg-blue-50';
|
|
72
|
+
}
|
|
73
|
+
if (this.color == 'success') {
|
|
74
|
+
return 'bg-green-50';
|
|
75
|
+
}
|
|
76
|
+
if (this.color == 'danger') {
|
|
77
|
+
return 'bg-red-50';
|
|
78
|
+
}
|
|
79
|
+
if (this.color == 'warning') {
|
|
80
|
+
return 'bg-yellow-50';
|
|
81
|
+
}
|
|
82
|
+
return 'bg-slate-900';
|
|
83
|
+
},
|
|
84
|
+
borderClass(): string {
|
|
85
|
+
if (!this.bordered) {
|
|
86
|
+
return '';
|
|
87
|
+
}
|
|
88
|
+
if (this.color == 'info') {
|
|
89
|
+
return 'border border-blue-400';
|
|
90
|
+
}
|
|
91
|
+
if (this.color == 'success') {
|
|
92
|
+
return 'border border-green-400';
|
|
93
|
+
}
|
|
94
|
+
if (this.color == 'danger') {
|
|
95
|
+
return 'border border-red-400';
|
|
96
|
+
}
|
|
97
|
+
if (this.color == 'warning') {
|
|
98
|
+
return 'border border-yellow-400';
|
|
99
|
+
}
|
|
100
|
+
return 'borer border-slate-900';
|
|
101
|
+
},
|
|
102
|
+
titleClass(): string {
|
|
103
|
+
if (this.color == 'info') {
|
|
104
|
+
return 'text-blue-800';
|
|
105
|
+
}
|
|
106
|
+
if (this.color == 'success') {
|
|
107
|
+
return 'text-green-800';
|
|
108
|
+
}
|
|
109
|
+
if (this.color == 'warning') {
|
|
110
|
+
return 'text-yellow-800';
|
|
111
|
+
}
|
|
112
|
+
if (this.color == 'danger') {
|
|
113
|
+
return 'text-red-800';
|
|
114
|
+
}
|
|
115
|
+
return 'text-white';
|
|
116
|
+
},
|
|
117
|
+
textClass(): string {
|
|
118
|
+
if (this.color == 'info') {
|
|
119
|
+
return 'text-blue-700';
|
|
120
|
+
}
|
|
121
|
+
if (this.color == 'success') {
|
|
122
|
+
return 'text-green-700';
|
|
123
|
+
}
|
|
124
|
+
if (this.color == 'warning') {
|
|
125
|
+
return 'text-yellow-700';
|
|
126
|
+
}
|
|
127
|
+
if (this.color == 'danger') {
|
|
128
|
+
return 'text-red-700';
|
|
129
|
+
}
|
|
130
|
+
return 'text-white';
|
|
131
|
+
},
|
|
132
|
+
iconClass(): string {
|
|
133
|
+
return this.icon + ' w-5 h-5';
|
|
134
|
+
},
|
|
135
|
+
icon(): string {
|
|
136
|
+
if (this.color == 'info') {
|
|
137
|
+
return 'text-blue-400';
|
|
138
|
+
}
|
|
139
|
+
if (this.color == 'success') {
|
|
140
|
+
return 'text-green-500';
|
|
141
|
+
}
|
|
142
|
+
if (this.color == 'warning') {
|
|
143
|
+
return 'text-yellow-500';
|
|
144
|
+
}
|
|
145
|
+
if (this.color == 'danger') {
|
|
146
|
+
return 'text-red-500';
|
|
147
|
+
}
|
|
148
|
+
return 'text-white';
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
</script>
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import BaseAutocomplete from './BaseAutocomplete.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/BaseAutocomplete',
|
|
5
|
+
component: BaseAutocomplete,
|
|
6
|
+
argTypes: {},
|
|
7
|
+
args: {
|
|
8
|
+
labelKey: 'label',
|
|
9
|
+
valueKey: 'value',
|
|
10
|
+
inputClass: 'w-full border-slate-300',
|
|
11
|
+
options: [
|
|
12
|
+
{ label: 'Dark Vader', value: 'dark_vader' },
|
|
13
|
+
{ label: 'Darth Maul', value: 'darth_maul' },
|
|
14
|
+
{ label: 'Dark Sidious', value: 'dark_sidious' },
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
decorators: [() => ({ template: '<div class="mb-36"><story/></div>' })],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const Template = (args) => ({
|
|
21
|
+
components: { BaseAutocomplete },
|
|
22
|
+
setup() {
|
|
23
|
+
const value = ref(null);
|
|
24
|
+
return { args, value };
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<BaseAutocomplete v-model="value" v-bind="args"></BaseAutocomplete>
|
|
28
|
+
<p class="mt-5 text-sm">Value: <span class="bg-slate-200 font-mono px-1 py-px rounded">{{ value ?? 'NULL' }}</span></p>
|
|
29
|
+
`,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const Demo = Template.bind({});
|
|
33
|
+
Demo.args = {};
|
|
34
|
+
|
|
35
|
+
export const Disabled = Template.bind({});
|
|
36
|
+
Disabled.args = {
|
|
37
|
+
options: [],
|
|
38
|
+
disabled: true,
|
|
39
|
+
modelValue: { label: 'Dark Maul', value: '1' },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Loading = Template.bind({});
|
|
43
|
+
Loading.args = {
|
|
44
|
+
loading: true,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const SlotOption = (args) => ({
|
|
48
|
+
components: { BaseAutocomplete },
|
|
49
|
+
setup() {
|
|
50
|
+
const value = ref(null);
|
|
51
|
+
|
|
52
|
+
const options = [
|
|
53
|
+
{ label: 'Red', value: 'red' },
|
|
54
|
+
{ label: 'Blue', value: 'blue' },
|
|
55
|
+
{ label: 'Green', value: 'green' },
|
|
56
|
+
{ label: 'Black', value: 'black' },
|
|
57
|
+
{ label: 'Gray', value: 'gray' },
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
return { value, options, args };
|
|
61
|
+
},
|
|
62
|
+
template: `
|
|
63
|
+
<BaseAutocomplete
|
|
64
|
+
v-bind="args"
|
|
65
|
+
v-model="value"
|
|
66
|
+
:options="options"
|
|
67
|
+
>
|
|
68
|
+
<template #option="{ option, active, selected }">
|
|
69
|
+
<div
|
|
70
|
+
class="rounded px-2 font-semibold py-1 text-sm"
|
|
71
|
+
:class="{
|
|
72
|
+
'hover:bg-slate-100': !active && !selected,
|
|
73
|
+
'bg-slate-200 hover:bg-slate-300': active && !selected,
|
|
74
|
+
'bg-blue-500 text-white hover:bg-blue-600': !active && selected,
|
|
75
|
+
'bg-blue-600 text-white hover:bg-blue-700': active && selected,
|
|
76
|
+
}"
|
|
77
|
+
:style="{ color: selected ? '' : option.value }"
|
|
78
|
+
>
|
|
79
|
+
{{ option.label }}
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
82
|
+
</BaseAutocomplete>
|
|
83
|
+
`,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const SlotFooter = (args) => {
|
|
87
|
+
return {
|
|
88
|
+
components: { BaseAutocomplete },
|
|
89
|
+
setup() {
|
|
90
|
+
const value = ref(null);
|
|
91
|
+
return { args, value };
|
|
92
|
+
},
|
|
93
|
+
template: `
|
|
94
|
+
<BaseAutocomplete
|
|
95
|
+
v-model="value"
|
|
96
|
+
v-bind="args"
|
|
97
|
+
>
|
|
98
|
+
<template #footer>
|
|
99
|
+
<div class="text-center p-1 pt-2 mt-2 border-t">
|
|
100
|
+
<button class="btn btn-sm w-full btn-slate-200-outline">This is the footer 💯</button>
|
|
101
|
+
</div>
|
|
102
|
+
</template>
|
|
103
|
+
</BaseAutocomplete>
|
|
104
|
+
`,
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const SlotEmpty = (args) => {
|
|
109
|
+
return {
|
|
110
|
+
components: { BaseAutocomplete },
|
|
111
|
+
setup() {
|
|
112
|
+
const value = ref(null);
|
|
113
|
+
return { args, value };
|
|
114
|
+
},
|
|
115
|
+
template: `
|
|
116
|
+
<BaseAutocomplete
|
|
117
|
+
v-model="value"
|
|
118
|
+
v-bind="args"
|
|
119
|
+
:options="[]"
|
|
120
|
+
>
|
|
121
|
+
<template #empty>
|
|
122
|
+
<div class="text-center p-6 py-10 flex items-center justify-center">🤓🤓🤓</div>
|
|
123
|
+
</template>
|
|
124
|
+
</BaseAutocomplete>
|
|
125
|
+
`,
|
|
126
|
+
};
|
|
127
|
+
};
|