sprintify-ui 0.2.1 → 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 +3921 -3644
- 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 +1 -1
- package/src/assets/flatpickr.css +238 -0
- package/src/assets/main.css +1 -0
- package/src/components/BaseDatePicker.vue +4 -100
- package/src/components/BasePWAPrompt.stories.js +51 -0
- package/src/components/BasePWAPrompt.vue +107 -0
- package/src/components/index.ts +6 -0
- package/src/lang/en.json +5 -0
- package/src/lang/fr.json +5 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
@import 'flatpickr/dist/flatpickr.min.css';
|
|
2
|
+
|
|
3
|
+
/* Customise flatpickr */
|
|
4
|
+
* {
|
|
5
|
+
--calendarPadding: 10px;
|
|
6
|
+
--daySize: 36px;
|
|
7
|
+
--daysWidth: calc(var(--daySize)*7);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@keyframes fpFadeInDown {
|
|
11
|
+
from {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
transform: translate3d(0, -8px, 0);
|
|
14
|
+
}
|
|
15
|
+
to {
|
|
16
|
+
opacity: 1;
|
|
17
|
+
transform: translate3d(0, 0, 0);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.flatpickr-calendar {
|
|
22
|
+
border: inherit;
|
|
23
|
+
@apply bg-white dark:bg-slate-800 rounded shadow-lg border border-slate-200 dark:border-slate-700 left-1/2;
|
|
24
|
+
padding: var(--calendarPadding);
|
|
25
|
+
width: calc(var(--daysWidth) + calc(var(--calendarPadding)*2));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@screen lg {
|
|
29
|
+
.flatpickr-calendar {
|
|
30
|
+
@apply left-0 right-auto;
|
|
31
|
+
margin-left: 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.flatpickr-right.flatpickr-calendar {
|
|
36
|
+
@apply right-0 left-auto;
|
|
37
|
+
margin-left: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.flatpickr-calendar.animate.open {
|
|
41
|
+
animation: fpFadeInDown 200ms ease-out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.flatpickr-calendar.static {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: calc(100% + 4px);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.flatpickr-calendar.static.open {
|
|
50
|
+
z-index: 20;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.flatpickr-days {
|
|
54
|
+
width: var(--daysWidth);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.dayContainer {
|
|
58
|
+
width: var(--daysWidth);
|
|
59
|
+
min-width: var(--daysWidth);
|
|
60
|
+
max-width: var(--daysWidth);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.flatpickr-day {
|
|
64
|
+
@apply bg-slate-50 dark:bg-slate-700/20 text-sm font-medium text-slate-600 dark:text-slate-100;
|
|
65
|
+
max-width: var(--daySize);
|
|
66
|
+
height: var(--daySize);
|
|
67
|
+
line-height: var(--daySize);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.flatpickr-day,
|
|
71
|
+
.flatpickr-day.prevMonthDay,
|
|
72
|
+
.flatpickr-day.nextMonthDay {
|
|
73
|
+
border: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.flatpickr-day.flatpickr-disabled,
|
|
77
|
+
.flatpickr-day.flatpickr-disabled:hover,
|
|
78
|
+
.flatpickr-day.prevMonthDay,
|
|
79
|
+
.flatpickr-day.nextMonthDay,
|
|
80
|
+
.flatpickr-day.notAllowed,
|
|
81
|
+
.flatpickr-day.notAllowed.prevMonthDay,
|
|
82
|
+
.flatpickr-day.notAllowed.nextMonthDay {
|
|
83
|
+
@apply bg-transparent;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.flatpickr-day,
|
|
87
|
+
.flatpickr-day.prevMonthDay,
|
|
88
|
+
.flatpickr-day.nextMonthDay,
|
|
89
|
+
.flatpickr-day.selected.startRange,
|
|
90
|
+
.flatpickr-day.startRange.startRange,
|
|
91
|
+
.flatpickr-day.endRange.startRange,
|
|
92
|
+
.flatpickr-day.selected.endRange,
|
|
93
|
+
.flatpickr-day.startRange.endRange,
|
|
94
|
+
.flatpickr-day.endRange.endRange,
|
|
95
|
+
.flatpickr-day.selected.startRange.endRange,
|
|
96
|
+
.flatpickr-day.startRange.startRange.endRange,
|
|
97
|
+
.flatpickr-day.endRange.startRange.endRange {
|
|
98
|
+
border-radius: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.flatpickr-day.flatpickr-disabled,
|
|
102
|
+
.flatpickr-day.flatpickr-disabled:hover,
|
|
103
|
+
.flatpickr-day.prevMonthDay,
|
|
104
|
+
.flatpickr-day.nextMonthDay,
|
|
105
|
+
.flatpickr-day.notAllowed,
|
|
106
|
+
.flatpickr-day.notAllowed.prevMonthDay,
|
|
107
|
+
.flatpickr-day.notAllowed.nextMonthDay {
|
|
108
|
+
@apply text-slate-400 dark:text-slate-500;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.rangeMode .flatpickr-day {
|
|
112
|
+
margin: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.flatpickr-day.selected,
|
|
116
|
+
.flatpickr-day.startRange,
|
|
117
|
+
.flatpickr-day.endRange,
|
|
118
|
+
.flatpickr-day.selected.inRange,
|
|
119
|
+
.flatpickr-day.startRange.inRange,
|
|
120
|
+
.flatpickr-day.endRange.inRange,
|
|
121
|
+
.flatpickr-day.selected:focus,
|
|
122
|
+
.flatpickr-day.startRange:focus,
|
|
123
|
+
.flatpickr-day.endRange:focus,
|
|
124
|
+
.flatpickr-day.selected:hover,
|
|
125
|
+
.flatpickr-day.startRange:hover,
|
|
126
|
+
.flatpickr-day.endRange:hover,
|
|
127
|
+
.flatpickr-day.selected.prevMonthDay,
|
|
128
|
+
.flatpickr-day.startRange.prevMonthDay,
|
|
129
|
+
.flatpickr-day.endRange.prevMonthDay,
|
|
130
|
+
.flatpickr-day.selected.nextMonthDay,
|
|
131
|
+
.flatpickr-day.startRange.nextMonthDay,
|
|
132
|
+
.flatpickr-day.endRange.nextMonthDay {
|
|
133
|
+
@apply bg-primary-500 text-primary-50;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.flatpickr-day.inRange,
|
|
137
|
+
.flatpickr-day.prevMonthDay.inRange,
|
|
138
|
+
.flatpickr-day.nextMonthDay.inRange,
|
|
139
|
+
.flatpickr-day.today.inRange,
|
|
140
|
+
.flatpickr-day.prevMonthDay.today.inRange,
|
|
141
|
+
.flatpickr-day.nextMonthDay.today.inRange,
|
|
142
|
+
.flatpickr-day:hover,
|
|
143
|
+
.flatpickr-day.prevMonthDay:hover,
|
|
144
|
+
.flatpickr-day.nextMonthDay:hover,
|
|
145
|
+
.flatpickr-day:focus,
|
|
146
|
+
.flatpickr-day.prevMonthDay:focus,
|
|
147
|
+
.flatpickr-day.nextMonthDay:focus,
|
|
148
|
+
.flatpickr-day.today:hover,
|
|
149
|
+
.flatpickr-day.today:focus {
|
|
150
|
+
@apply bg-primary-400 text-primary-50;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.flatpickr-day.inRange,
|
|
154
|
+
.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),
|
|
155
|
+
.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),
|
|
156
|
+
.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {
|
|
157
|
+
box-shadow: none;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.flatpickr-months {
|
|
161
|
+
align-items: center;
|
|
162
|
+
margin-top: -8px;
|
|
163
|
+
margin-bottom: 6px;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.flatpickr-months .flatpickr-prev-month,
|
|
167
|
+
.flatpickr-months .flatpickr-next-month {
|
|
168
|
+
position: static;
|
|
169
|
+
height: auto;
|
|
170
|
+
@apply text-slate-600 hover:text-slate-900 dark:text-slate-500 dark:hover:text-slate-300;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.flatpickr-months .flatpickr-prev-month svg,
|
|
174
|
+
.flatpickr-months .flatpickr-next-month svg {
|
|
175
|
+
width: 7px;
|
|
176
|
+
height: 11px;
|
|
177
|
+
fill: currentColor;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.flatpickr-months .flatpickr-prev-month:hover svg,
|
|
181
|
+
.flatpickr-months .flatpickr-next-month:hover svg {
|
|
182
|
+
@apply fill-current;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.flatpickr-months .flatpickr-prev-month {
|
|
186
|
+
margin-left: -10px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.flatpickr-months .flatpickr-next-month {
|
|
190
|
+
margin-right: -10px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.flatpickr-months .flatpickr-month {
|
|
194
|
+
@apply text-slate-800 dark:text-slate-100;
|
|
195
|
+
height: auto;
|
|
196
|
+
line-height: inherit;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.flatpickr-current-month {
|
|
200
|
+
@apply text-sm font-medium;
|
|
201
|
+
position: static;
|
|
202
|
+
height: auto;
|
|
203
|
+
width: auto;
|
|
204
|
+
left: auto;
|
|
205
|
+
padding: 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.flatpickr-current-month span.cur-month {
|
|
209
|
+
@apply font-medium m-0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.flatpickr-current-month span.cur-month:hover {
|
|
213
|
+
background: none;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.flatpickr-current-month input.cur-year {
|
|
217
|
+
font-weight: inherit;
|
|
218
|
+
box-shadow: none !important;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.numInputWrapper:hover {
|
|
222
|
+
background: none;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.numInputWrapper span {
|
|
226
|
+
display: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
span.flatpickr-weekday {
|
|
230
|
+
@apply text-slate-400 dark:text-slate-500 font-medium text-xs;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.flatpickr-calendar.arrowTop::before,
|
|
234
|
+
.flatpickr-calendar.arrowTop::after,
|
|
235
|
+
.flatpickr-calendar.arrowBottom::before,
|
|
236
|
+
.flatpickr-calendar.arrowBottom::after {
|
|
237
|
+
display: none;
|
|
238
|
+
}
|
package/src/assets/main.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="
|
|
2
|
+
<div class="relative">
|
|
3
3
|
<div
|
|
4
4
|
class="pointer-events-none absolute top-0 left-0 flex h-[42px] items-center justify-center pl-2.5"
|
|
5
5
|
>
|
|
@@ -42,7 +42,6 @@ import { DateTime } from 'luxon';
|
|
|
42
42
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
43
43
|
import { useField } from '@/composables/field';
|
|
44
44
|
import flatpickr from 'flatpickr';
|
|
45
|
-
import 'flatpickr/dist/flatpickr.css';
|
|
46
45
|
|
|
47
46
|
import { t } from '@/i18n';
|
|
48
47
|
import { French } from 'flatpickr/dist/l10n/fr';
|
|
@@ -160,6 +159,7 @@ const flatpickrConfig = computed(() => {
|
|
|
160
159
|
dateFormat: formatInternal.value,
|
|
161
160
|
mode: props.mode,
|
|
162
161
|
locale: locale.value,
|
|
162
|
+
monthSelectorType: 'static',
|
|
163
163
|
minDate: props.minDate ?? undefined,
|
|
164
164
|
maxDate: props.maxDate ?? undefined,
|
|
165
165
|
noCalendar: props.noCalendar,
|
|
@@ -167,6 +167,8 @@ const flatpickrConfig = computed(() => {
|
|
|
167
167
|
inline: props.inline,
|
|
168
168
|
animate: false,
|
|
169
169
|
time_24hr: true,
|
|
170
|
+
prevArrow: '<svg class="fill-current" width="7" height="11" viewBox="0 0 7 11"><path d="M5.4 10.8l1.4-1.4-4-4 4-4L5.4 0 0 5.4z" /></svg>',
|
|
171
|
+
nextArrow: '<svg class="fill-current" width="7" height="11" viewBox="0 0 7 11"><path d="M1.4 10.8L0 9.4l4-4-4-4L1.4 0l5.4 5.4z" /></svg>',
|
|
170
172
|
} as any;
|
|
171
173
|
});
|
|
172
174
|
|
|
@@ -277,101 +279,3 @@ function clear() {
|
|
|
277
279
|
emitUpdate(null);
|
|
278
280
|
}
|
|
279
281
|
</script>
|
|
280
|
-
|
|
281
|
-
<style lang="postcss">
|
|
282
|
-
body .flatpickr-calendar {
|
|
283
|
-
width: 280px;
|
|
284
|
-
box-shadow: 1px 0 0 #cbd5e1, -1px 0 0 #cbd5e1, 0 1px 0 #cbd5e1,
|
|
285
|
-
0 -1px 0 #cbd5e1, 0 3px 13px rgb(0 0 0 / 10%);
|
|
286
|
-
|
|
287
|
-
&.inline {
|
|
288
|
-
width: 260px;
|
|
289
|
-
box-shadow: none;
|
|
290
|
-
border: none;
|
|
291
|
-
padding: 0;
|
|
292
|
-
|
|
293
|
-
.flatpickr-months {
|
|
294
|
-
width: 260px;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
.flatpickr-innerContainer {
|
|
298
|
-
padding: 0;
|
|
299
|
-
width: 260px;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.dayContainer {
|
|
304
|
-
width: 260px;
|
|
305
|
-
max-width: 260px;
|
|
306
|
-
min-width: 260px;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
.flatpickr-day {
|
|
310
|
-
height: 36px;
|
|
311
|
-
line-height: 36px;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.flatpickr-months {
|
|
315
|
-
width: 280px;
|
|
316
|
-
padding-top: 10px;
|
|
317
|
-
|
|
318
|
-
.flatpickr-prev-month,
|
|
319
|
-
.flatpickr-next-month {
|
|
320
|
-
top: 5px;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.flatpickr-prev-month {
|
|
324
|
-
left: 2px;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.flatpickr-next-month {
|
|
328
|
-
right: 2px;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
.flatpickr-prev-month:hover svg,
|
|
332
|
-
.flatpickr-next-month:hover svg {
|
|
333
|
-
fill: #888;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.flatpickr-current-month {
|
|
338
|
-
padding-top: 1px;
|
|
339
|
-
|
|
340
|
-
.flatpickr-monthDropdown-months {
|
|
341
|
-
font-weight: 400;
|
|
342
|
-
height: 25px;
|
|
343
|
-
&:focus {
|
|
344
|
-
box-shadow: none;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
input.cur-year {
|
|
349
|
-
font-weight: 400;
|
|
350
|
-
height: 25px;
|
|
351
|
-
&:focus {
|
|
352
|
-
box-shadow: none;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.flatpickr-innerContainer {
|
|
358
|
-
padding: 10px;
|
|
359
|
-
padding-top: 0;
|
|
360
|
-
width: 280px;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.flatpickr-rContainer {
|
|
364
|
-
width: 260px;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
.numInput {
|
|
368
|
-
&:focus {
|
|
369
|
-
box-shadow: none;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
.flatpickr-calendar span.flatpickr-weekday {
|
|
375
|
-
@apply font-medium text-slate-400;
|
|
376
|
-
}
|
|
377
|
-
</style>
|
|
@@ -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>
|
package/src/components/index.ts
CHANGED
|
@@ -65,6 +65,7 @@ import BasePagination from './BasePagination.vue';
|
|
|
65
65
|
import BasePanel from './BasePanel.vue';
|
|
66
66
|
import BasePassword from './BasePassword.vue';
|
|
67
67
|
import BaseProgressCircle from './BaseProgressCircle.vue';
|
|
68
|
+
import BasePWAPrompt from './BasePWAPrompt.vue';
|
|
68
69
|
import BaseRadioGroup from './BaseRadioGroup.vue';
|
|
69
70
|
import BaseReadMore from './BaseReadMore.vue';
|
|
70
71
|
import BaseRichText from './BaseRichText.vue';
|
|
@@ -74,6 +75,8 @@ import BaseSideNavigation from './BaseSideNavigation.vue';
|
|
|
74
75
|
import BaseSideNavigationItem from './BaseSideNavigationItem.vue';
|
|
75
76
|
import BaseSkeleton from './BaseSkeleton.vue';
|
|
76
77
|
import BaseStatistic from './BaseStatistic.vue';
|
|
78
|
+
import BaseStepper from './BaseStepper.vue';
|
|
79
|
+
import BaseStepperItem from './BaseStepperItem.vue';
|
|
77
80
|
import BaseSwitch from './BaseSwitch.vue';
|
|
78
81
|
import BaseSystemAlert from './BaseSystemAlert.vue';
|
|
79
82
|
import BaseTabs from './BaseTabs.vue';
|
|
@@ -160,6 +163,7 @@ export {
|
|
|
160
163
|
BasePanel,
|
|
161
164
|
BasePassword,
|
|
162
165
|
BaseProgressCircle,
|
|
166
|
+
BasePWAPrompt,
|
|
163
167
|
BaseRadioGroup,
|
|
164
168
|
BaseReadMore,
|
|
165
169
|
BaseRichText,
|
|
@@ -169,6 +173,8 @@ export {
|
|
|
169
173
|
BaseSideNavigationItem,
|
|
170
174
|
BaseSkeleton,
|
|
171
175
|
BaseStatistic,
|
|
176
|
+
BaseStepper,
|
|
177
|
+
BaseStepperItem,
|
|
172
178
|
BaseSwitch,
|
|
173
179
|
BaseSystemAlert,
|
|
174
180
|
BaseTabs,
|
package/src/lang/en.json
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"file_must_be_of_type": "The file must be of type",
|
|
35
35
|
"filters": "Filters",
|
|
36
36
|
"go_to_page": "Go to ",
|
|
37
|
+
"install": "Install",
|
|
37
38
|
"invalid_value": "Invalid value",
|
|
38
39
|
"just_now": "Just now",
|
|
39
40
|
"maximum_x_decimal_places": "Maximum 1 decimal place|Maximum {count} decimal places",
|
|
@@ -53,6 +54,10 @@
|
|
|
53
54
|
"postal_code_zip_code": "Postal Code / Zip Code",
|
|
54
55
|
"previous": "Previous",
|
|
55
56
|
"previous_month": "Previous month",
|
|
57
|
+
"pwa_add_to_home_screen": "then 'Add to Home Screen'",
|
|
58
|
+
"pwa_description": "Install this application on your home screen for faster access",
|
|
59
|
+
"pwa_share_button": "Share button",
|
|
60
|
+
"pwa_tap": "Just tap",
|
|
56
61
|
"read_more": "Read more",
|
|
57
62
|
"region": "State / Province",
|
|
58
63
|
"remove": "Remove",
|
package/src/lang/fr.json
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"file_must_be_of_type": "Le fichier doit être de type",
|
|
35
35
|
"filters": "Filtres",
|
|
36
36
|
"go_to_page": "Page",
|
|
37
|
+
"install": "Installer",
|
|
37
38
|
"invalid_value": "Valeur invalide",
|
|
38
39
|
"just_now": "à l’instant",
|
|
39
40
|
"maximum_x_decimal_places": "Maximum 1 décimale|Maximum {count} décimales",
|
|
@@ -53,6 +54,10 @@
|
|
|
53
54
|
"postal_code_zip_code": "Code postal",
|
|
54
55
|
"previous": "Précédent",
|
|
55
56
|
"previous_month": "Mois précédent",
|
|
57
|
+
"pwa_add_to_home_screen": "puis 'Sur l'écran d'accueil'",
|
|
58
|
+
"pwa_description": "Installer cette application sur votre écran d'accueil pour un accès ",
|
|
59
|
+
"pwa_share_button": "Bouton de partage",
|
|
60
|
+
"pwa_tap": "Appuyez sur",
|
|
56
61
|
"read_more": "Lire la suite",
|
|
57
62
|
"region": "État / Province",
|
|
58
63
|
"remove": "Retirer",
|