sprintify-ui 0.6.0 → 0.6.1
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 +3454 -3440
- package/dist/types/src/components/BaseCharacterCounter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseTooltip.vue.d.ts +28 -7
- package/dist/types/src/components/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/components/BaseAvatar.vue +43 -40
- package/src/components/BaseDisplayRelativeTime.vue +21 -20
- package/src/components/BaseInputLabel.vue +8 -14
- package/src/components/BaseTooltip.stories.js +62 -0
- package/src/components/BaseTooltip.vue +34 -9
- package/src/components/index.ts +2 -0
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
2
|
-
|
|
3
|
-
type: import("vue").PropType<
|
|
4
|
-
|
|
2
|
+
class: {
|
|
3
|
+
type: import("vue").PropType<string | string[] | null>;
|
|
4
|
+
default: null;
|
|
5
|
+
};
|
|
6
|
+
text: {
|
|
7
|
+
type: import("vue").PropType<string | null>;
|
|
8
|
+
default: null;
|
|
9
|
+
};
|
|
10
|
+
visible: {
|
|
11
|
+
type: import("vue").PropType<boolean>;
|
|
12
|
+
default: boolean;
|
|
5
13
|
};
|
|
6
14
|
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
-
|
|
8
|
-
type: import("vue").PropType<
|
|
9
|
-
|
|
15
|
+
class: {
|
|
16
|
+
type: import("vue").PropType<string | string[] | null>;
|
|
17
|
+
default: null;
|
|
18
|
+
};
|
|
19
|
+
text: {
|
|
20
|
+
type: import("vue").PropType<string | null>;
|
|
21
|
+
default: null;
|
|
22
|
+
};
|
|
23
|
+
visible: {
|
|
24
|
+
type: import("vue").PropType<boolean>;
|
|
25
|
+
default: boolean;
|
|
10
26
|
};
|
|
11
|
-
}>>, {
|
|
27
|
+
}>>, {
|
|
28
|
+
class: string | string[] | null;
|
|
29
|
+
text: string | null;
|
|
30
|
+
visible: boolean;
|
|
31
|
+
}, {}>, {
|
|
12
32
|
default?(_: {}): any;
|
|
33
|
+
tooltip?(_: {}): any;
|
|
13
34
|
}>;
|
|
14
35
|
export default _default;
|
|
15
36
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -89,9 +89,10 @@ import BaseTextarea from './BaseTextarea.vue';
|
|
|
89
89
|
import BaseTextareaAutoresize from './BaseTextareaAutoresize.vue';
|
|
90
90
|
import BaseTimeline from './BaseTimeline.vue';
|
|
91
91
|
import BaseTimelineItem from './BaseTimelineItem.vue';
|
|
92
|
+
import BaseTooltip from './BaseTooltip.vue';
|
|
92
93
|
import BaseUniqueCode from './BaseUniqueCode.vue';
|
|
93
94
|
import BaseLayoutStacked from './BaseLayoutStacked.vue';
|
|
94
95
|
import BaseLayoutStackedConfigurable from './BaseLayoutStackedConfigurable.vue';
|
|
95
96
|
import BaseLayoutSidebar from './BaseLayoutSidebar.vue';
|
|
96
97
|
import BaseLayoutSidebarConfigurable from './BaseLayoutSidebarConfigurable.vue';
|
|
97
|
-
export { BaseActionItem, BaseAddressForm, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseAvatarGroup, BaseBadge, BaseBelongsTo, BaseBelongsToFetch, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClipboard, BaseCalendar, BaseColor, BaseContainer, BaseCounter, BaseCropper, BaseCropperModal, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseDisplayRelativeTime, BaseDropdown, BaseDropdownAutocomplete, BaseEmptyState, BaseField, BaseFieldI18n, BaseFilePicker, BaseFilePickerCrop, BaseFileUploader, BaseForm, BaseGantt, BaseHasMany, BaseHeader, BaseIcon, BaseIconPicker, BaseInput, BaseInputLabel, BaseInputPercent, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BaseNavbarSideItem, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseRichText, BaseSelect, BaseShortcut, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseStatistic, BaseStepper, BaseStepperItem, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseTimeline, BaseTimelineItem, BaseUniqueCode, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
|
98
|
+
export { BaseActionItem, BaseAddressForm, BaseAlert, BaseApp, BaseAppDialogs, BaseAppNotifications, BaseAutocomplete, BaseAutocompleteFetch, BaseAvatar, BaseAvatarGroup, BaseBadge, BaseBelongsTo, BaseBelongsToFetch, BaseBoolean, BaseBreadcrumbs, BaseButton, BaseButtonGroup, BaseCard, BaseCardRow, BaseCharacterCounter, BaseClipboard, BaseCalendar, BaseColor, BaseContainer, BaseCounter, BaseCropper, BaseCropperModal, BaseDataIterator, BaseDataTable, BaseDatePicker, BaseDateSelect, BaseDescriptionList, BaseDescriptionListItem, BaseDialog, BaseDisplayRelativeTime, BaseDropdown, BaseDropdownAutocomplete, BaseEmptyState, BaseField, BaseFieldI18n, BaseFilePicker, BaseFilePickerCrop, BaseFileUploader, BaseForm, BaseGantt, BaseHasMany, BaseHeader, BaseIcon, BaseIconPicker, BaseInput, BaseInputLabel, BaseInputPercent, BaseLoadingCover, BaseMediaItem, BaseMediaLibrary, BaseMediaPreview, BaseMenu, BaseMenuItem, BaseModalCenter, BaseModalSide, BaseNavbar, BaseNavbarItem, BaseNavbarItemContent, BaseNavbarSideItem, BasePagination, BasePanel, BasePassword, BaseProgressCircle, BaseRadioGroup, BaseReadMore, BaseRichText, BaseSelect, BaseShortcut, BaseSideNavigation, BaseSideNavigationItem, BaseSkeleton, BaseStatistic, BaseStepper, BaseStepperItem, BaseSwitch, BaseSystemAlert, BaseTabs, BaseTabItem, BaseTagAutocomplete, BaseTagAutocompleteFetch, BaseTable, BaseTableColumn, BaseTextarea, BaseTextareaAutoresize, BaseTimeline, BaseTimelineItem, BaseTooltip, BaseUniqueCode, BaseLayoutStacked, BaseLayoutStackedConfigurable, BaseLayoutSidebar, BaseLayoutSidebarConfigurable, };
|
package/package.json
CHANGED
|
@@ -1,49 +1,40 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
:
|
|
4
|
-
|
|
5
|
-
:to="to"
|
|
2
|
+
<BaseTooltip
|
|
3
|
+
:visible="tooltip"
|
|
4
|
+
:text="tooltipText"
|
|
6
5
|
:class="classInternal"
|
|
7
6
|
>
|
|
8
|
-
<
|
|
9
|
-
:
|
|
10
|
-
:
|
|
11
|
-
class="
|
|
7
|
+
<component
|
|
8
|
+
:is="to ? 'RouterLink' : 'div'"
|
|
9
|
+
:to="to"
|
|
10
|
+
class="flex items-center"
|
|
12
11
|
>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</div>
|
|
32
|
-
|
|
33
|
-
<BaseTooltip
|
|
34
|
-
v-if="tooltip"
|
|
35
|
-
:target="buttonRef"
|
|
36
|
-
>
|
|
37
|
-
<div>
|
|
38
|
-
<p class="text-xs font-medium leading-tight">
|
|
12
|
+
<img
|
|
13
|
+
:src="user.avatar_url"
|
|
14
|
+
:class="[sizeClass, detailsPosition == 'left' ? 'order-2' : 'order-1']"
|
|
15
|
+
class="shrink-0 block overflow-hidden rounded-full object-cover object-center"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
v-if="showDetails"
|
|
19
|
+
class="max-w-[120px] grow leading-tight"
|
|
20
|
+
:class="[
|
|
21
|
+
textSizeClass,
|
|
22
|
+
detailsPosition == 'left' ? 'order-1 text-right' : 'order-2 text-left',
|
|
23
|
+
]"
|
|
24
|
+
:style="{
|
|
25
|
+
marginLeft: detailsPosition == 'right' ? spacing : '0',
|
|
26
|
+
marginRight: detailsPosition == 'left' ? spacing : '0',
|
|
27
|
+
}"
|
|
28
|
+
>
|
|
29
|
+
<div class="truncate">
|
|
39
30
|
{{ user.full_name }}
|
|
40
|
-
</
|
|
41
|
-
<
|
|
31
|
+
</div>
|
|
32
|
+
<div class="truncate font-light opacity-50">
|
|
42
33
|
{{ user.email }}
|
|
43
|
-
</
|
|
34
|
+
</div>
|
|
44
35
|
</div>
|
|
45
|
-
</
|
|
46
|
-
</
|
|
36
|
+
</component>
|
|
37
|
+
</BaseTooltip>
|
|
47
38
|
</template>
|
|
48
39
|
|
|
49
40
|
<script lang="ts" setup>
|
|
@@ -97,7 +88,19 @@ const classInternal = computed(() => {
|
|
|
97
88
|
);
|
|
98
89
|
})
|
|
99
90
|
|
|
100
|
-
const
|
|
91
|
+
const tooltipText = computed(() => {
|
|
92
|
+
|
|
93
|
+
if (!props.tooltip) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return `<p class="font-medium leading-tight">
|
|
98
|
+
${props.user.full_name}
|
|
99
|
+
</p>
|
|
100
|
+
<p class="text-slate-500 leading-tight">
|
|
101
|
+
${props.user.email}
|
|
102
|
+
</p>`;
|
|
103
|
+
})
|
|
101
104
|
|
|
102
105
|
const sizeClass = computed((): string => {
|
|
103
106
|
const base = 'h-9 w-9';
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
:
|
|
4
|
-
|
|
2
|
+
<BaseTooltip
|
|
3
|
+
:visible="tooltip"
|
|
4
|
+
:text="tooltipContent"
|
|
5
5
|
>
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
<component
|
|
7
|
+
:is="as"
|
|
8
|
+
ref="tooltipRef"
|
|
9
9
|
>
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>
|
|
19
|
-
|
|
20
|
-
{{ tooltipContent }}
|
|
21
|
-
</div>
|
|
22
|
-
</BaseTooltip>
|
|
23
|
-
</component>
|
|
10
|
+
<slot
|
|
11
|
+
name="default"
|
|
12
|
+
:readable-date="readableDate"
|
|
13
|
+
>
|
|
14
|
+
<span class="text-xs text-slate-600">
|
|
15
|
+
{{ readableDate }}
|
|
16
|
+
</span>
|
|
17
|
+
</slot>
|
|
18
|
+
</component>
|
|
19
|
+
</BaseTooltip>
|
|
24
20
|
</template>
|
|
25
21
|
|
|
26
22
|
<script lang="ts" setup>
|
|
@@ -52,6 +48,11 @@ const props = defineProps({
|
|
|
52
48
|
const tooltipRef = ref();
|
|
53
49
|
|
|
54
50
|
const tooltipContent = computed(() => {
|
|
51
|
+
|
|
52
|
+
if (!props.tooltip) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
55
56
|
return DateTime.fromISO(props.value)
|
|
56
57
|
.setLocale(useI18nStore().locale)
|
|
57
58
|
.toLocaleString(DateTime.DATETIME_MED);
|
|
@@ -7,27 +7,21 @@
|
|
|
7
7
|
>
|
|
8
8
|
<div> {{ label }}</div>
|
|
9
9
|
|
|
10
|
-
<
|
|
10
|
+
<BaseTooltip
|
|
11
11
|
v-if="help"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
:text="help"
|
|
13
|
+
>
|
|
14
|
+
<BaseIcon
|
|
15
|
+
class="block relative text-slate-900 -bottom-[3px] ml-1 mr-1 h-[13px] w-[13px]"
|
|
16
|
+
icon="mdi:information-outline"
|
|
17
|
+
/>
|
|
18
|
+
</BaseTooltip>
|
|
15
19
|
|
|
16
20
|
<div
|
|
17
21
|
v-if="required"
|
|
18
22
|
class="ml-0.5 text-red-600"
|
|
19
23
|
> *</div>
|
|
20
24
|
</div>
|
|
21
|
-
|
|
22
|
-
<BaseTooltip
|
|
23
|
-
v-if="help"
|
|
24
|
-
:target="labelRef"
|
|
25
|
-
>
|
|
26
|
-
<div class="text-xs">
|
|
27
|
-
{{ help }}
|
|
28
|
-
</div>
|
|
29
|
-
</BaseTooltip>
|
|
30
|
-
|
|
31
25
|
</label>
|
|
32
26
|
</template>
|
|
33
27
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import BaseTooltip from './BaseTooltip.vue';
|
|
2
|
+
import BaseCard from './BaseCard.vue';
|
|
3
|
+
import BaseCardRow from './BaseCardRow.vue';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/BaseTooltip',
|
|
7
|
+
component: BaseTooltip,
|
|
8
|
+
args: {
|
|
9
|
+
text: 'Click here to learn more about this button',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Template = (args) => ({
|
|
14
|
+
components: {
|
|
15
|
+
BaseCard,
|
|
16
|
+
BaseCardRow,
|
|
17
|
+
BaseTooltip,
|
|
18
|
+
},
|
|
19
|
+
setup() {
|
|
20
|
+
return { args };
|
|
21
|
+
},
|
|
22
|
+
template: `
|
|
23
|
+
<BaseCard>
|
|
24
|
+
<BaseCardRow size=sm>
|
|
25
|
+
<BaseTooltip class="inline-block" v-bind="args">
|
|
26
|
+
<div>Hover me, the tooltip show appear outside the BaseCard</div>
|
|
27
|
+
</BaseTooltip>
|
|
28
|
+
</BaseCardRow>
|
|
29
|
+
</BaseCard>
|
|
30
|
+
`,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Demo = Template.bind({});
|
|
34
|
+
Demo.args = {};
|
|
35
|
+
|
|
36
|
+
const CustomSlotTemplate = (args) => ({
|
|
37
|
+
components: {
|
|
38
|
+
BaseCard,
|
|
39
|
+
BaseCardRow,
|
|
40
|
+
BaseTooltip,
|
|
41
|
+
},
|
|
42
|
+
setup() {
|
|
43
|
+
return { args };
|
|
44
|
+
},
|
|
45
|
+
template: `
|
|
46
|
+
<BaseCard>
|
|
47
|
+
<BaseCardRow size=sm>
|
|
48
|
+
<BaseTooltip class="inline-block" v-bind="args">
|
|
49
|
+
<div>Hover me, the tooltip show appear outside the BaseCard</div>
|
|
50
|
+
<template #tooltip>
|
|
51
|
+
<div class="bg-black text-white text-xs p-3">
|
|
52
|
+
{{ args.text }}
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
</BaseTooltip>
|
|
56
|
+
</BaseCardRow>
|
|
57
|
+
</BaseCard>
|
|
58
|
+
`,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const CustomSlot = CustomSlotTemplate.bind({});
|
|
62
|
+
CustomSlot.args = {};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<div
|
|
3
|
+
ref="targetRef"
|
|
4
|
+
:class="props.class"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</div>
|
|
8
|
+
<Teleport
|
|
9
|
+
v-if="visible"
|
|
10
|
+
to="body"
|
|
11
|
+
>
|
|
3
12
|
<div
|
|
4
13
|
ref="tooltipRef"
|
|
5
14
|
class="fixed top-0 left-0 pointer-events-none z-tooltip"
|
|
@@ -13,12 +22,15 @@
|
|
|
13
22
|
leave-from-class="transform scale-100 opacity-100"
|
|
14
23
|
leave-to-class="transform scale-90 opacity-0"
|
|
15
24
|
>
|
|
16
|
-
<
|
|
25
|
+
<slot
|
|
17
26
|
v-if="showTooltip"
|
|
18
|
-
|
|
27
|
+
name="tooltip"
|
|
19
28
|
>
|
|
20
|
-
<
|
|
21
|
-
|
|
29
|
+
<div
|
|
30
|
+
class="bg-white shadow-md text-xs max-w-xs leading-snug ring-1 ring-black ring-opacity-10 text-slate-900 rounded-md pt-1.5 pb-2 px-3"
|
|
31
|
+
v-html="text"
|
|
32
|
+
/>
|
|
33
|
+
</slot>
|
|
22
34
|
</transition>
|
|
23
35
|
</div>
|
|
24
36
|
</Teleport>
|
|
@@ -26,12 +38,25 @@
|
|
|
26
38
|
|
|
27
39
|
<script lang="ts" setup>
|
|
28
40
|
import { useTooltip } from '@/composables/tooltip';
|
|
41
|
+
import { unrefElement } from '@vueuse/core';
|
|
29
42
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
43
|
+
defineOptions({
|
|
44
|
+
inheritAttrs: false,
|
|
45
|
+
});
|
|
33
46
|
|
|
34
|
-
const
|
|
47
|
+
const props = withDefaults(defineProps<{
|
|
48
|
+
visible?: boolean,
|
|
49
|
+
text?: string | null | undefined;
|
|
50
|
+
class?: string[] | string | null | undefined;
|
|
51
|
+
}>(), {
|
|
52
|
+
visible: true,
|
|
53
|
+
text: null,
|
|
54
|
+
class: null,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const targetRef = ref<HTMLElement | null>(null);
|
|
58
|
+
|
|
59
|
+
const targetInternal = computed(() => unrefElement(targetRef));
|
|
35
60
|
|
|
36
61
|
const tooltipRef = ref<HTMLElement | null>(null)
|
|
37
62
|
|
package/src/components/index.ts
CHANGED
|
@@ -89,6 +89,7 @@ import BaseTextarea from './BaseTextarea.vue';
|
|
|
89
89
|
import BaseTextareaAutoresize from './BaseTextareaAutoresize.vue';
|
|
90
90
|
import BaseTimeline from './BaseTimeline.vue';
|
|
91
91
|
import BaseTimelineItem from './BaseTimelineItem.vue';
|
|
92
|
+
import BaseTooltip from './BaseTooltip.vue';
|
|
92
93
|
import BaseUniqueCode from './BaseUniqueCode.vue';
|
|
93
94
|
|
|
94
95
|
import BaseLayoutStacked from './BaseLayoutStacked.vue';
|
|
@@ -188,6 +189,7 @@ export {
|
|
|
188
189
|
BaseTextareaAutoresize,
|
|
189
190
|
BaseTimeline,
|
|
190
191
|
BaseTimelineItem,
|
|
192
|
+
BaseTooltip,
|
|
191
193
|
BaseUniqueCode,
|
|
192
194
|
BaseLayoutStacked,
|
|
193
195
|
BaseLayoutStackedConfigurable,
|