sprintify-ui 0.2.0 → 0.2.3
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 +16 -0
- package/dist/sprintify-ui.es.js +4984 -4707
- package/dist/style.css +1 -1
- package/dist/types/src/components/BaseDatePicker.vue.d.ts +0 -1
- package/dist/types/src/components/BasePWAPrompt.vue.d.ts +46 -0
- package/dist/types/src/components/index.d.ts +4 -1
- package/dist/types/src/index.d.ts +10 -0
- package/package.json +2 -4
- package/src/assets/flatpickr.css +238 -0
- package/src/assets/main.css +4 -3
- package/src/components/BaseActionItem.vue +9 -4
- package/src/components/BaseActionItemButton.vue +1 -1
- package/src/components/BaseAddressForm.vue +6 -5
- package/src/components/BaseAlert.vue +8 -2
- package/src/components/BaseAppNotifications.vue +4 -1
- package/src/components/BaseAutocomplete.vue +18 -9
- package/src/components/BaseAutocompleteDrawer.vue +28 -10
- package/src/components/BaseAutocompleteFetch.vue +14 -3
- package/src/components/BaseAvatar.vue +1 -1
- package/src/components/BaseBadge.vue +1 -2
- package/src/components/BaseBelongsTo.vue +12 -3
- package/src/components/BaseBreadcrumbs.vue +8 -2
- package/src/components/BaseButton.vue +9 -2
- package/src/components/BaseButtonGroup.vue +4 -1
- package/src/components/BaseCharacterCounter.vue +4 -1
- package/src/components/BaseClickOutside.vue +1 -1
- package/src/components/BaseClipboard.vue +5 -2
- package/src/components/BaseColor.vue +4 -1
- package/src/components/BaseCropper.vue +17 -5
- package/src/components/BaseCropperModal.vue +4 -1
- package/src/components/BaseDataIterator.vue +29 -11
- package/src/components/BaseDataIteratorSectionBox.vue +5 -2
- package/src/components/BaseDataIteratorSectionButton.vue +6 -4
- package/src/components/BaseDataIteratorSectionColumns.vue +5 -2
- package/src/components/BaseDataTable.vue +43 -20
- package/src/components/BaseDataTableRowAction.vue +8 -2
- package/src/components/BaseDatePicker.vue +9 -102
- package/src/components/BaseDateSelect.vue +33 -6
- package/src/components/BaseDisplayRelativeTime.vue +4 -1
- package/src/components/BaseDraggable.vue +1 -1
- package/src/components/BaseDropdown.vue +16 -5
- package/src/components/BaseDropdownAutocomplete.vue +8 -4
- package/src/components/BaseField.vue +5 -2
- package/src/components/BaseFieldI18n.vue +10 -2
- package/src/components/BaseFilePicker.vue +6 -2
- package/src/components/BaseFilePickerCrop.vue +4 -1
- package/src/components/BaseForm.vue +9 -2
- package/src/components/BaseHasMany.vue +16 -4
- package/src/components/BaseHeader.vue +4 -1
- package/src/components/BaseIconPicker.vue +14 -4
- package/src/components/BaseInput.vue +10 -7
- package/src/components/BaseInputError.vue +1 -1
- package/src/components/BaseInputLabel.vue +4 -1
- package/src/components/BaseInputPercent.vue +1 -1
- package/src/components/BaseLayoutNotificationDropdown.vue +11 -5
- package/src/components/BaseLayoutNotificationItem.vue +15 -5
- package/src/components/BaseLayoutNotificationItemContent.vue +5 -2
- package/src/components/BaseLayoutSidebar.vue +22 -5
- package/src/components/BaseLayoutSidebarConfigurable.vue +19 -5
- package/src/components/BaseLayoutStackedConfigurable.vue +24 -7
- package/src/components/BaseMediaGallery.vue +4 -1
- package/src/components/BaseMediaGalleryItem.vue +13 -4
- package/src/components/BaseMediaItem.vue +12 -3
- package/src/components/BaseMediaLibrary.vue +10 -5
- package/src/components/BaseMediaList.vue +1 -1
- package/src/components/BaseMediaListItem.vue +15 -6
- package/src/components/BaseMediaPictures.vue +1 -1
- package/src/components/BaseMediaPicturesItem.vue +9 -3
- package/src/components/BaseMediaPreview.vue +2 -2
- package/src/components/BaseMenu.vue +37 -9
- package/src/components/BaseMenuItem.vue +14 -3
- package/src/components/BaseModalCenter.vue +4 -1
- package/src/components/BaseNavbarItemContent.vue +14 -3
- package/src/components/BaseNavbarSideItem.vue +4 -1
- package/src/components/BaseNavbarSideItemContent.vue +9 -2
- package/src/components/BaseNumber.vue +7 -4
- package/src/components/BasePWAPrompt.stories.js +51 -0
- package/src/components/BasePWAPrompt.vue +107 -0
- package/src/components/BasePagination.vue +2 -2
- package/src/components/BasePanel.vue +4 -1
- package/src/components/BasePassword.vue +6 -2
- package/src/components/BaseProgressCircle.vue +4 -1
- package/src/components/BaseRadioGroup.vue +5 -2
- package/src/components/BaseRichText.vue +1 -2
- package/src/components/BaseSelect.vue +6 -2
- package/src/components/BaseShortcut.vue +11 -4
- package/src/components/BaseSideNavigation.vue +4 -1
- package/src/components/BaseSideNavigationItem.vue +5 -2
- package/src/components/BaseSkeleton.vue +2 -2
- package/src/components/BaseStatistic.vue +15 -4
- package/src/components/BaseStepper.vue +4 -1
- package/src/components/BaseSwitch.stories.js +0 -1
- package/src/components/BaseSwitch.vue +8 -2
- package/src/components/BaseSystemAlert.vue +4 -1
- package/src/components/BaseTabItem.vue +5 -2
- package/src/components/BaseTable.vue +19 -9
- package/src/components/BaseTagAutocomplete.vue +13 -4
- package/src/components/BaseTagAutocompleteFetch.vue +18 -4
- package/src/components/BaseTextareaAutoresize.vue +6 -2
- package/src/components/BaseTimeline.vue +8 -2
- package/src/components/index.ts +6 -0
- package/src/lang/en.json +5 -0
- package/src/lang/fr.json +5 -0
- package/src/svg/BaseEmptyState.vue +5 -1
- package/src/svg/BaseSpinnerLarge.vue +15 -3
- package/src/svg/BaseSpinnerSmall.vue +8 -2
|
@@ -42,7 +42,9 @@
|
|
|
42
42
|
</p>
|
|
43
43
|
|
|
44
44
|
<div class="mt-1 text-xs leading-tight text-slate-500">
|
|
45
|
-
<p v-if="maxFileText">
|
|
45
|
+
<p v-if="maxFileText">
|
|
46
|
+
{{ maxFileText }}
|
|
47
|
+
</p>
|
|
46
48
|
<p>{{ maxFileSize }}</p>
|
|
47
49
|
</div>
|
|
48
50
|
</div>
|
|
@@ -52,7 +54,10 @@
|
|
|
52
54
|
</template>
|
|
53
55
|
</BaseFileUploader>
|
|
54
56
|
|
|
55
|
-
<div
|
|
57
|
+
<div
|
|
58
|
+
v-if="normalizedModelValue.length"
|
|
59
|
+
class="mt-5"
|
|
60
|
+
>
|
|
56
61
|
<slot
|
|
57
62
|
:model-value="normalizedModelValue"
|
|
58
63
|
name="list"
|
|
@@ -69,7 +74,7 @@
|
|
|
69
74
|
:draggable="draggable"
|
|
70
75
|
@update:model-value="sync"
|
|
71
76
|
@remove="promptRemove($event)"
|
|
72
|
-
|
|
77
|
+
/>
|
|
73
78
|
|
|
74
79
|
<BaseMediaList
|
|
75
80
|
v-else-if="layout == 'list'"
|
|
@@ -79,7 +84,7 @@
|
|
|
79
84
|
:draggable="draggable"
|
|
80
85
|
@update:model-value="sync"
|
|
81
86
|
@remove="promptRemove($event)"
|
|
82
|
-
|
|
87
|
+
/>
|
|
83
88
|
|
|
84
89
|
<BaseMediaGallery
|
|
85
90
|
v-else-if="layout == 'gallery'"
|
|
@@ -89,7 +94,7 @@
|
|
|
89
94
|
:draggable="draggable"
|
|
90
95
|
@update:model-value="sync"
|
|
91
96
|
@remove="promptRemove($event)"
|
|
92
|
-
|
|
97
|
+
/>
|
|
93
98
|
</slot>
|
|
94
99
|
</div>
|
|
95
100
|
</div>
|
|
@@ -3,14 +3,20 @@
|
|
|
3
3
|
class="group flex h-10 items-center justify-between"
|
|
4
4
|
:class="[draggable ? 'pr-2' : 'px-2']"
|
|
5
5
|
>
|
|
6
|
-
<div
|
|
7
|
-
|
|
6
|
+
<div
|
|
7
|
+
v-if="draggable && !disabled"
|
|
8
|
+
class="handle shrink-0 cursor-move px-1"
|
|
9
|
+
>
|
|
10
|
+
<BaseIcon
|
|
11
|
+
icon="mdi:drag"
|
|
12
|
+
class="h-5 w-5 text-slate-400"
|
|
13
|
+
/>
|
|
8
14
|
</div>
|
|
9
15
|
<div class="mr-2 shrink-0">
|
|
10
16
|
<BaseIcon
|
|
11
17
|
icon="heroicons-solid:paper-clip"
|
|
12
18
|
class="h-5 w-5 shrink-0 text-slate-400"
|
|
13
|
-
|
|
19
|
+
/>
|
|
14
20
|
</div>
|
|
15
21
|
<div class="flex grow items-center gap-3 overflow-hidden">
|
|
16
22
|
<div
|
|
@@ -31,12 +37,15 @@
|
|
|
31
37
|
<BaseIcon
|
|
32
38
|
icon="heroicons-solid:pencil"
|
|
33
39
|
class="h-5 w-5 shrink-0 text-slate-400"
|
|
34
|
-
|
|
40
|
+
/>
|
|
35
41
|
</div>
|
|
36
42
|
</button>
|
|
37
43
|
</div>
|
|
38
44
|
|
|
39
|
-
<div
|
|
45
|
+
<div
|
|
46
|
+
v-else
|
|
47
|
+
class="flex grow items-center py-1"
|
|
48
|
+
>
|
|
40
49
|
<input
|
|
41
50
|
ref="inputRef"
|
|
42
51
|
class="h-8 w-full max-w-md rounded border border-slate-300 px-2 py-0 focus:ring-0"
|
|
@@ -46,7 +55,7 @@
|
|
|
46
55
|
@input="onNameChange"
|
|
47
56
|
@keydown.enter.prevent="saveName"
|
|
48
57
|
@keydown.escape.prevent="viewMode = 'show'"
|
|
49
|
-
|
|
58
|
+
>
|
|
50
59
|
|
|
51
60
|
<div class="flex shrink-0 items-center">
|
|
52
61
|
<button
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
height: size + 'px',
|
|
17
17
|
}"
|
|
18
18
|
class="overflow-hidden rounded-lg object-cover"
|
|
19
|
-
|
|
19
|
+
>
|
|
20
20
|
<div class="absolute -top-2 -right-2 flex gap-1">
|
|
21
21
|
<a
|
|
22
22
|
v-if="url"
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
target="_blank"
|
|
25
25
|
class="btn btn-white rounded-full p-1 shadow-sm ring-1 ring-black ring-opacity-10"
|
|
26
26
|
>
|
|
27
|
-
<BaseIcon
|
|
27
|
+
<BaseIcon
|
|
28
|
+
class="h-4 w-4"
|
|
29
|
+
icon="mdi:download"
|
|
30
|
+
/>
|
|
28
31
|
</a>
|
|
29
32
|
<button
|
|
30
33
|
v-if="showRemove"
|
|
@@ -33,7 +36,10 @@
|
|
|
33
36
|
class="btn btn-white rounded-full p-1 shadow-sm ring-1 ring-black ring-opacity-10 disabled:bg-white disabled:opacity-70"
|
|
34
37
|
@click="$emit('remove')"
|
|
35
38
|
>
|
|
36
|
-
<BaseIcon
|
|
39
|
+
<BaseIcon
|
|
40
|
+
class="h-4 w-4"
|
|
41
|
+
icon="mdi:close"
|
|
42
|
+
/>
|
|
37
43
|
</button>
|
|
38
44
|
</div>
|
|
39
45
|
</div>
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
:src="url"
|
|
13
13
|
class="h-full w-full bg-black object-contain object-center"
|
|
14
14
|
:alt="name"
|
|
15
|
-
|
|
15
|
+
>
|
|
16
16
|
<img
|
|
17
17
|
v-else-if="type == 'image' && 'data_url' in media && previewImage"
|
|
18
18
|
:src="media.data_url"
|
|
19
19
|
class="h-full w-full bg-black object-contain object-center"
|
|
20
20
|
:alt="name"
|
|
21
|
-
|
|
21
|
+
>
|
|
22
22
|
<div
|
|
23
23
|
v-else
|
|
24
24
|
class="flex h-full w-full items-center justify-center bg-slate-100"
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
>
|
|
8
8
|
<div>
|
|
9
9
|
<MenuButton :class="twButton">
|
|
10
|
-
<slot
|
|
10
|
+
<slot
|
|
11
|
+
name="button"
|
|
12
|
+
:open="open"
|
|
13
|
+
/>
|
|
11
14
|
</MenuButton>
|
|
12
15
|
</div>
|
|
13
16
|
|
|
@@ -24,13 +27,31 @@
|
|
|
24
27
|
:class="twMerge('w-48', twMenu)"
|
|
25
28
|
class="absolute z-menu mt-2 rounded-md bg-white p-1 shadow-lg outline-none ring-1 ring-black ring-opacity-10 focus:outline-none"
|
|
26
29
|
>
|
|
27
|
-
<slot
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
<slot
|
|
31
|
+
name="items"
|
|
32
|
+
:items="items"
|
|
33
|
+
>
|
|
34
|
+
<template
|
|
35
|
+
v-for="item in items"
|
|
36
|
+
:key="item.label + 'link'"
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
v-if="item.line"
|
|
40
|
+
class="-mx-1 my-1 flex h-px bg-slate-200"
|
|
41
|
+
/>
|
|
30
42
|
|
|
31
|
-
<MenuItem
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
<MenuItem
|
|
44
|
+
v-else-if="item.to"
|
|
45
|
+
v-slot="{ active, close }"
|
|
46
|
+
>
|
|
47
|
+
<RouterLink
|
|
48
|
+
:to="item.to"
|
|
49
|
+
@mouseup="close"
|
|
50
|
+
>
|
|
51
|
+
<slot
|
|
52
|
+
name="item"
|
|
53
|
+
:item="item"
|
|
54
|
+
>
|
|
34
55
|
<BaseMenuItem
|
|
35
56
|
:label="item.label"
|
|
36
57
|
:count="item.count"
|
|
@@ -49,7 +70,10 @@
|
|
|
49
70
|
as="a"
|
|
50
71
|
:href="item.href"
|
|
51
72
|
>
|
|
52
|
-
<slot
|
|
73
|
+
<slot
|
|
74
|
+
name="item"
|
|
75
|
+
:item="item"
|
|
76
|
+
>
|
|
53
77
|
<BaseMenuItem
|
|
54
78
|
:label="item.label"
|
|
55
79
|
:count="item.count"
|
|
@@ -69,7 +93,11 @@
|
|
|
69
93
|
class="w-full"
|
|
70
94
|
@click="item.action"
|
|
71
95
|
>
|
|
72
|
-
<slot
|
|
96
|
+
<slot
|
|
97
|
+
name="item"
|
|
98
|
+
:item="item"
|
|
99
|
+
:active="active"
|
|
100
|
+
>
|
|
73
101
|
<BaseMenuItem
|
|
74
102
|
:label="item.label"
|
|
75
103
|
:count="item.count"
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="buttonClasses">
|
|
3
3
|
<div class="flex items-center">
|
|
4
|
-
<BaseIcon
|
|
4
|
+
<BaseIcon
|
|
5
|
+
v-if="icon"
|
|
6
|
+
:icon="icon"
|
|
7
|
+
:class="iconClasses"
|
|
8
|
+
/>
|
|
5
9
|
<span :class="textSize">{{ label }}</span>
|
|
6
10
|
</div>
|
|
7
|
-
<div
|
|
8
|
-
|
|
11
|
+
<div
|
|
12
|
+
v-if="count"
|
|
13
|
+
class="relative -top-px ml-[5px]"
|
|
14
|
+
>
|
|
15
|
+
<BaseCounter
|
|
16
|
+
:count="count"
|
|
17
|
+
:max-digit="2"
|
|
18
|
+
:color="color"
|
|
19
|
+
/>
|
|
9
20
|
</div>
|
|
10
21
|
</div>
|
|
11
22
|
</template>
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="classes">
|
|
3
3
|
<div class="group flex grow items-center">
|
|
4
|
-
<BaseIcon
|
|
4
|
+
<BaseIcon
|
|
5
|
+
v-if="icon"
|
|
6
|
+
:icon="icon"
|
|
7
|
+
:class="iconClasses"
|
|
8
|
+
/>
|
|
5
9
|
<span :class="[sizeClasses]">{{ label }}</span>
|
|
6
10
|
</div>
|
|
7
|
-
<div
|
|
8
|
-
|
|
11
|
+
<div
|
|
12
|
+
v-if="count"
|
|
13
|
+
class="relative -top-px ml-[5px]"
|
|
14
|
+
>
|
|
15
|
+
<BaseCounter
|
|
16
|
+
:count="count"
|
|
17
|
+
:max-digit="2"
|
|
18
|
+
:color="'primary'"
|
|
19
|
+
/>
|
|
9
20
|
</div>
|
|
10
21
|
</div>
|
|
11
22
|
</template>
|
|
@@ -24,7 +24,10 @@
|
|
|
24
24
|
v-if="showSubActions && item.actions && item.actions.length"
|
|
25
25
|
class="mt-2 mb-3"
|
|
26
26
|
>
|
|
27
|
-
<div
|
|
27
|
+
<div
|
|
28
|
+
v-for="subItem in item.actions"
|
|
29
|
+
:key="subItem.label"
|
|
30
|
+
>
|
|
28
31
|
<BaseActionItem
|
|
29
32
|
:to="subItem.to"
|
|
30
33
|
:href="subItem.href"
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="classes">
|
|
3
3
|
<div class="group flex grow items-center">
|
|
4
|
-
<BaseIcon
|
|
4
|
+
<BaseIcon
|
|
5
|
+
v-if="icon"
|
|
6
|
+
:icon="icon"
|
|
7
|
+
:class="iconClasses"
|
|
8
|
+
/>
|
|
5
9
|
<span>{{ label }}</span>
|
|
6
10
|
</div>
|
|
7
|
-
<div
|
|
11
|
+
<div
|
|
12
|
+
v-if="count"
|
|
13
|
+
class="relative -top-px ml-[5px]"
|
|
14
|
+
>
|
|
8
15
|
<BaseCounter
|
|
9
16
|
:size="size"
|
|
10
17
|
:count="count"
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
leave-from-class="transform scale-100 opacity-100"
|
|
9
9
|
leave-to-class="transform scale-90 opacity-0"
|
|
10
10
|
>
|
|
11
|
-
<div
|
|
11
|
+
<div
|
|
12
|
+
v-if="showInvalidInput"
|
|
13
|
+
class="absolute left-0 top-full z-[1]"
|
|
14
|
+
>
|
|
12
15
|
<div
|
|
13
16
|
class="mt-1 ml-1 rounded bg-red-500 px-2 py-1 text-xs font-medium text-white"
|
|
14
17
|
>
|
|
@@ -47,7 +50,7 @@
|
|
|
47
50
|
@blur="onBlur"
|
|
48
51
|
@focus="onFocus"
|
|
49
52
|
@keydown="onKeydown"
|
|
50
|
-
|
|
53
|
+
>
|
|
51
54
|
<div class="border-l border-slate-300">
|
|
52
55
|
<button
|
|
53
56
|
type="button"
|
|
@@ -56,7 +59,7 @@
|
|
|
56
59
|
:disabled="disabled"
|
|
57
60
|
@click="increment"
|
|
58
61
|
>
|
|
59
|
-
<BaseIcon icon="mdi:chevron-up"
|
|
62
|
+
<BaseIcon icon="mdi:chevron-up" />
|
|
60
63
|
</button>
|
|
61
64
|
<button
|
|
62
65
|
type="button"
|
|
@@ -65,7 +68,7 @@
|
|
|
65
68
|
:disabled="disabled"
|
|
66
69
|
@click="decrement"
|
|
67
70
|
>
|
|
68
|
-
<BaseIcon icon="mdi:chevron-down"
|
|
71
|
+
<BaseIcon icon="mdi:chevron-down" />
|
|
69
72
|
</button>
|
|
70
73
|
</div>
|
|
71
74
|
</div>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import BasePWAPrompt from './BasePWAPrompt.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Components/BasePWAPrompt',
|
|
5
|
+
component: BasePWAPrompt,
|
|
6
|
+
argTypes: {
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = (args) => ({
|
|
11
|
+
components: { BasePWAPrompt },
|
|
12
|
+
setup() {
|
|
13
|
+
return { args };
|
|
14
|
+
},
|
|
15
|
+
template: `
|
|
16
|
+
<BasePWAPrompt v-bind="args">
|
|
17
|
+
|
|
18
|
+
</BasePWAPrompt>
|
|
19
|
+
`,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const TemplateWithFooter = (args) => ({
|
|
23
|
+
components: { BasePWAPrompt },
|
|
24
|
+
setup() {
|
|
25
|
+
return { args };
|
|
26
|
+
},
|
|
27
|
+
template: `
|
|
28
|
+
<BasePWAPrompt v-bind="args">
|
|
29
|
+
<template #footer>
|
|
30
|
+
<div class="bg-red-500 p-4 text-center text-white">
|
|
31
|
+
Custom footer
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
</BasePWAPrompt>
|
|
35
|
+
`,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const Demo = Template.bind({});
|
|
39
|
+
Demo.args = {
|
|
40
|
+
appName: 'Witify',
|
|
41
|
+
srcLogo: 'https://media.licdn.com/dms/image/D4E0BAQGYgsAV7tho4Q/company-logo_100_100/0/1685653464675?e=1694044800&v=beta&t=0cnsfS5qXUVgnDPQhB9WUgYa5UkKqWKcxzDYBbe9kb0',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
export const WithSlotFooter = TemplateWithFooter.bind({});
|
|
47
|
+
WithSlotFooter.args = {
|
|
48
|
+
appName: 'Witify',
|
|
49
|
+
srcLogo: 'https://media.licdn.com/dms/image/D4E0BAQGYgsAV7tho4Q/company-logo_100_100/0/1685653464675?e=1694044800&v=beta&t=0cnsfS5qXUVgnDPQhB9WUgYa5UkKqWKcxzDYBbe9kb0',
|
|
50
|
+
};
|
|
51
|
+
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BaseModalCenter
|
|
3
|
+
v-model="active"
|
|
4
|
+
clipped
|
|
5
|
+
>
|
|
6
|
+
<div class="">
|
|
7
|
+
<div class="text-center py-4 px-8">
|
|
8
|
+
<div class="flex justify-center p-2">
|
|
9
|
+
<img :src="srcLogo" :alt="appName" class="h-16 w-16 rounded-lg shadow-md my-4" />
|
|
10
|
+
</div>
|
|
11
|
+
<h2 class="mb-4 text-lg">
|
|
12
|
+
<div v-if="title">
|
|
13
|
+
{{ title }}
|
|
14
|
+
</div>
|
|
15
|
+
<div v-else>
|
|
16
|
+
{{ t('sui.install') + ' ' + appName }}
|
|
17
|
+
</div>
|
|
18
|
+
</h2>
|
|
19
|
+
<p class="text-gray-600">
|
|
20
|
+
{{ description }}
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<slot name="footer">
|
|
25
|
+
<div class="flex items-center justify-center bg-slate-100 p-4 text-sm text-slate-600">
|
|
26
|
+
{{ $t('sui.pwa_tap') }}
|
|
27
|
+
<BaseIcon icon="heroicons:arrow-up-on-square" class="h-6 w-6 mx-1"/>
|
|
28
|
+
|
|
29
|
+
{{ $t('sui.pwa_add_to_home_screen') }}
|
|
30
|
+
</div>
|
|
31
|
+
</slot>
|
|
32
|
+
</div>
|
|
33
|
+
</BaseModalCenter>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script lang="ts" setup>
|
|
37
|
+
import { DateTime } from 'luxon';
|
|
38
|
+
import { t } from '@/i18n';
|
|
39
|
+
import BaseModalCenter from './BaseModalCenter.vue';
|
|
40
|
+
import { Icon as BaseIcon } from '@iconify/vue';
|
|
41
|
+
|
|
42
|
+
const props = defineProps({
|
|
43
|
+
appName: {
|
|
44
|
+
required: true,
|
|
45
|
+
type: String,
|
|
46
|
+
},
|
|
47
|
+
srcLogo: {
|
|
48
|
+
required: true,
|
|
49
|
+
type: String,
|
|
50
|
+
},
|
|
51
|
+
title: {
|
|
52
|
+
default: '',
|
|
53
|
+
type: String,
|
|
54
|
+
},
|
|
55
|
+
description: {
|
|
56
|
+
default: t('sui.pwa_description'),
|
|
57
|
+
type: String,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const active = ref(false)
|
|
62
|
+
|
|
63
|
+
function close() {
|
|
64
|
+
hide();
|
|
65
|
+
active.value = false;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
watch(
|
|
69
|
+
() => active.value,
|
|
70
|
+
() => {
|
|
71
|
+
if (!active.value) {
|
|
72
|
+
hide()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
const KEY = 'lastPwaPrompt';
|
|
78
|
+
|
|
79
|
+
function hide() {
|
|
80
|
+
const now = DateTime.now().toISO() as string;
|
|
81
|
+
localStorage.setItem(KEY, now);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function canShow() {
|
|
85
|
+
if ((navigator as any).standalone) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const today = DateTime.now();
|
|
90
|
+
let days = Number.MAX_SAFE_INTEGER;
|
|
91
|
+
|
|
92
|
+
const lastPrompt = localStorage.getItem(KEY);
|
|
93
|
+
if (lastPrompt) {
|
|
94
|
+
const lastPromptDateTime = DateTime.fromISO(lastPrompt);
|
|
95
|
+
days = lastPromptDateTime.diff(today, 'days').days;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const isApple = ['iPhone', 'iPad', 'iPod'].includes(navigator.platform);
|
|
99
|
+
return (isNaN(days) || days > 14) //&& isApple;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
onMounted(() => {
|
|
103
|
+
if (canShow()) {
|
|
104
|
+
active.value = true;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
</script>
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
@keydown.enter="onManualPageMobileEnter"
|
|
54
54
|
@input="onManualPageMobileInput"
|
|
55
55
|
@blur="setPageFromManualPageMobile"
|
|
56
|
-
|
|
56
|
+
>
|
|
57
57
|
<span class="ml-2 text-sm font-normal text-slate-500">
|
|
58
58
|
{{ t('sui.of') }} {{ lastPage }}
|
|
59
59
|
</span>
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
@keydown.enter="onManualPageEnter"
|
|
89
89
|
@input="onManualPageInput"
|
|
90
90
|
@blur="setPageFromManualPage"
|
|
91
|
-
|
|
91
|
+
>
|
|
92
92
|
</div>
|
|
93
93
|
</nav>
|
|
94
94
|
</template>
|
|
@@ -7,7 +7,10 @@
|
|
|
7
7
|
<h3 class="text-base font-semibold leading-6 text-slate-900">
|
|
8
8
|
{{ title }}
|
|
9
9
|
</h3>
|
|
10
|
-
<p
|
|
10
|
+
<p
|
|
11
|
+
v-if="description"
|
|
12
|
+
class="mt-1 text-sm leading-normal text-slate-600"
|
|
13
|
+
>
|
|
11
14
|
{{ description }}
|
|
12
15
|
</p>
|
|
13
16
|
</div>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
:required="requiredInternal"
|
|
17
17
|
class="grow rounded-l rounded-r-none border-none focus:ring-2 focus:ring-primary-500 disabled:cursor-not-allowed"
|
|
18
18
|
@input="onInput"
|
|
19
|
-
|
|
19
|
+
>
|
|
20
20
|
<div class="flex shrink-0 pl-3">
|
|
21
21
|
<button
|
|
22
22
|
tabindex="-1"
|
|
@@ -30,7 +30,11 @@
|
|
|
30
30
|
icon="heroicons:eye-slash-20-solid"
|
|
31
31
|
class="h-5 w-5"
|
|
32
32
|
/>
|
|
33
|
-
<BaseIcon
|
|
33
|
+
<BaseIcon
|
|
34
|
+
v-else
|
|
35
|
+
icon="heroicons:eye-20-solid"
|
|
36
|
+
class="h-5 w-5"
|
|
37
|
+
/>
|
|
34
38
|
</button>
|
|
35
39
|
</div>
|
|
36
40
|
</div>
|
|
@@ -20,9 +20,12 @@
|
|
|
20
20
|
:value="option.value"
|
|
21
21
|
:class="twInput"
|
|
22
22
|
@input="emitUpdate(option.value)"
|
|
23
|
-
|
|
23
|
+
>
|
|
24
24
|
|
|
25
|
-
<slot
|
|
25
|
+
<slot
|
|
26
|
+
name="option"
|
|
27
|
+
:option="option"
|
|
28
|
+
>
|
|
26
29
|
<span class="text-sm">{{ option.label }}</span>
|
|
27
30
|
</slot>
|
|
28
31
|
</label>
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
@change="onChange($event)"
|
|
14
14
|
>
|
|
15
15
|
<template v-if="requiredInternal">
|
|
16
|
-
<option
|
|
16
|
+
<option
|
|
17
|
+
disabled
|
|
18
|
+
hidden
|
|
19
|
+
:value="EMPTY_VALUE_INTERNAL"
|
|
20
|
+
>
|
|
17
21
|
{{ placeholder ? placeholder : t('sui.select_an_option') }}
|
|
18
22
|
</option>
|
|
19
23
|
</template>
|
|
@@ -101,7 +105,7 @@ const { nameInternal, requiredInternal, hasErrorInternal, emitUpdate } =
|
|
|
101
105
|
emit: emit,
|
|
102
106
|
});
|
|
103
107
|
|
|
104
|
-
const options = ref
|
|
108
|
+
const options = ref<HTMLOptionElement[]>([]);
|
|
105
109
|
|
|
106
110
|
function isEmptyExternal(value: string | number | null | undefined) {
|
|
107
111
|
if (value === undefined || value === EMPTY_VALUE_EXTERNAL) {
|