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.
@@ -41,9 +41,9 @@ declare const _default: import("vue").DefineComponent<{
41
41
  type: BooleanConstructor;
42
42
  };
43
43
  }>>, {
44
+ trim: boolean;
44
45
  min: number;
45
46
  max: number;
46
- trim: boolean;
47
47
  removeDoubleSpaces: boolean;
48
48
  }, {}>;
49
49
  export default _default;
@@ -1,15 +1,36 @@
1
1
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
2
- target: {
3
- type: import("vue").PropType<HTMLElement | null>;
4
- required: true;
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
- target: {
8
- type: import("vue").PropType<HTMLElement | null>;
9
- required: true;
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,6 +1,6 @@
1
1
  {
2
2
  "name": "sprintify-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "scripts": {
5
5
  "build": "rimraf dist && vue-tsc && vite build",
6
6
  "build-fast": "rimraf dist && vite build",
@@ -1,49 +1,40 @@
1
1
  <template>
2
- <component
3
- :is="to ? 'RouterLink' : 'div'"
4
- ref="buttonRef"
5
- :to="to"
2
+ <BaseTooltip
3
+ :visible="tooltip"
4
+ :text="tooltipText"
6
5
  :class="classInternal"
7
6
  >
8
- <img
9
- :src="user.avatar_url"
10
- :class="[sizeClass, detailsPosition == 'left' ? 'order-2' : 'order-1']"
11
- class="shrink-0 block overflow-hidden rounded-full object-cover object-center"
7
+ <component
8
+ :is="to ? 'RouterLink' : 'div'"
9
+ :to="to"
10
+ class="flex items-center"
12
11
  >
13
- <div
14
- v-if="showDetails"
15
- class="max-w-[120px] grow leading-tight"
16
- :class="[
17
- textSizeClass,
18
- detailsPosition == 'left' ? 'order-1 text-right' : 'order-2 text-left',
19
- ]"
20
- :style="{
21
- marginLeft: detailsPosition == 'right' ? spacing : '0',
22
- marginRight: detailsPosition == 'left' ? spacing : '0',
23
- }"
24
- >
25
- <div class="truncate">
26
- {{ user.full_name }}
27
- </div>
28
- <div class="truncate font-light opacity-50">
29
- {{ user.email }}
30
- </div>
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
- </p>
41
- <p class="text-xs text-slate-500 leading-tight">
31
+ </div>
32
+ <div class="truncate font-light opacity-50">
42
33
  {{ user.email }}
43
- </p>
34
+ </div>
44
35
  </div>
45
- </BaseTooltip>
46
- </component>
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 buttonRef = ref<HTMLElement | null>(null);
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
- <component
3
- :is="as"
4
- ref="tooltipRef"
2
+ <BaseTooltip
3
+ :visible="tooltip"
4
+ :text="tooltipContent"
5
5
  >
6
- <slot
7
- name="default"
8
- :readable-date="readableDate"
6
+ <component
7
+ :is="as"
8
+ ref="tooltipRef"
9
9
  >
10
- <span class="text-xs text-slate-600">
11
- {{ readableDate }}
12
- </span>
13
- </slot>
14
-
15
- <BaseTooltip
16
- v-if="tooltip"
17
- :target="tooltipRef"
18
- >
19
- <div class="text-xs">
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
- <BaseIcon
10
+ <BaseTooltip
11
11
  v-if="help"
12
- class="block relative text-slate-900 -bottom-[3px] ml-1 mr-1 h-[13px] w-[13px]"
13
- icon="mdi:information-outline"
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
- <Teleport to="body">
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
- <div
25
+ <slot
17
26
  v-if="showTooltip"
18
- class="bg-white shadow-md ring-1 ring-black ring-opacity-10 text-slate-900 rounded-md pt-1.5 pb-2 px-3"
27
+ name="tooltip"
19
28
  >
20
- <slot />
21
- </div>
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
- const props = defineProps<{
31
- target: HTMLElement | null;
32
- }>();
43
+ defineOptions({
44
+ inheritAttrs: false,
45
+ });
33
46
 
34
- const targetInternal = computed(() => props.target ?? null);
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
 
@@ -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,