@privyid/persona 1.0.0-rc.3 → 1.0.0-rc.4
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/components/accordion/AccordionItems.vue +1 -1
- package/dist/components/avatar/AvatarTruncate.vue.d.ts +2 -2
- package/dist/components/banner/Banner.vue +28 -4
- package/dist/components/calendar/Calendar.vue +4 -2
- package/dist/components/calendar/adapter/date.mjs +3 -2
- package/dist/components/calendar/adapter/month.mjs +2 -1
- package/dist/components/calendar/adapter/year.mjs +2 -1
- package/dist/components/contextual-bar/ContextualBar.vue +33 -4
- package/dist/components/cropper/Cropper.vue +2 -0
- package/dist/components/dialog/Dialog.vue +35 -2
- package/dist/components/dialog/index.d.ts +4 -1
- package/dist/components/filterbar/pinned/PinnedSelect.vue.d.ts +2 -2
- package/dist/components/filterbar/pinned/PinnedToggle.vue.d.ts +6 -6
- package/dist/components/input-file/InputFile.vue +4 -1
- package/dist/components/input-pin/InputPin.vue +15 -13
- package/dist/components/markdown/index.d.ts +4 -0
- package/dist/components/markdown/index.mjs +5 -1
- package/dist/components/meta.json +21 -20
- package/dist/components/pdf-text/PdfText.vue +4 -0
- package/dist/components/pdf-viewer/utils/use-viewer.mjs +2 -2
- package/dist/components/popup/Popup.vue +2 -13
- package/dist/components/popup/index.d.ts +6 -0
- package/dist/components/popup/index.mjs +10 -0
- package/dist/components/qrcode/Qrcode.vue +174 -0
- package/dist/components/qrcode/index.d.ts +1 -0
- package/dist/components/qrcode/index.mjs +0 -0
- package/dist/components/shimmer/Shimmer.vue +1 -1
- package/dist/components/signature-text/SignatureText.vue +3 -3
- package/dist/components/utils/date.mjs +1 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.mjs +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +0 -1
- package/package.json +15 -15
|
@@ -37,7 +37,7 @@ export default defineComponent({
|
|
|
37
37
|
return items.map((item, i) => {
|
|
38
38
|
const isExpand = props.multiple && Array.isArray(props.modelValue) ? props.modelValue.includes(i) : props.modelValue === i;
|
|
39
39
|
return h(item, {
|
|
40
|
-
"noCaret": item.props
|
|
40
|
+
"noCaret": item.props?.noCaret ?? props.noCaret,
|
|
41
41
|
"modelValue": isExpand,
|
|
42
42
|
"onUpdate:modelValue": (value) => {
|
|
43
43
|
setValue(value, i);
|
|
@@ -10,7 +10,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
10
10
|
default: string;
|
|
11
11
|
};
|
|
12
12
|
length: {
|
|
13
|
-
type: (
|
|
13
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
14
14
|
default: number;
|
|
15
15
|
};
|
|
16
16
|
}, () => import("vue-demi").VNode<import("vue-demi").RendererNode, import("vue-demi").RendererElement, {
|
|
@@ -21,7 +21,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
21
21
|
default: string;
|
|
22
22
|
};
|
|
23
23
|
length: {
|
|
24
|
-
type: (
|
|
24
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
25
25
|
default: number;
|
|
26
26
|
};
|
|
27
27
|
}>>, {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
v-if="show"
|
|
4
4
|
data-testid="banner"
|
|
5
5
|
:class="classNames"
|
|
6
|
-
:style="
|
|
6
|
+
:style="styleBg">
|
|
7
7
|
<div
|
|
8
8
|
v-if="!noIcon"
|
|
9
9
|
class="banner__icon"
|
|
@@ -32,7 +32,11 @@
|
|
|
32
32
|
import IconInfo from '@privyid/persona-icon/vue/information-circle-solid/20.vue'
|
|
33
33
|
import IconDanger from '@privyid/persona-icon/vue/exclamation-circle-solid/20.vue'
|
|
34
34
|
import IconClose from '@privyid/persona-icon/vue/close/16.vue'
|
|
35
|
-
import type {
|
|
35
|
+
import type {
|
|
36
|
+
PropType,
|
|
37
|
+
StyleValue,
|
|
38
|
+
VNode,
|
|
39
|
+
} from 'vue-demi'
|
|
36
40
|
import { ref, computed } from 'vue-demi'
|
|
37
41
|
import type { StyleVariant } from '.'
|
|
38
42
|
|
|
@@ -58,6 +62,10 @@ const props = defineProps({
|
|
|
58
62
|
type : String,
|
|
59
63
|
default: undefined,
|
|
60
64
|
},
|
|
65
|
+
backgroundDarkUrl: {
|
|
66
|
+
type : String,
|
|
67
|
+
default: undefined,
|
|
68
|
+
},
|
|
61
69
|
backgroundOverlay: {
|
|
62
70
|
type : Boolean,
|
|
63
71
|
default: false,
|
|
@@ -85,6 +93,19 @@ const classNames = computed(() => {
|
|
|
85
93
|
return result
|
|
86
94
|
})
|
|
87
95
|
|
|
96
|
+
const styleBg = computed<StyleValue>(() => {
|
|
97
|
+
const result: StyleValue = {}
|
|
98
|
+
|
|
99
|
+
if (props.backgroundUrl) {
|
|
100
|
+
result['--p-banner-bg-image'] = `url("${props.backgroundUrl}")`
|
|
101
|
+
result['--p-banner-bg-dark-image'] = props.backgroundDarkUrl
|
|
102
|
+
? `url("${props.backgroundDarkUrl}")`
|
|
103
|
+
: `url("${props.backgroundUrl}")`
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return result
|
|
107
|
+
})
|
|
108
|
+
|
|
88
109
|
const icon = computed(() => {
|
|
89
110
|
return BannerIcons[props.variant]
|
|
90
111
|
})
|
|
@@ -105,8 +126,11 @@ defineSlots<{
|
|
|
105
126
|
|
|
106
127
|
<style lang="postcss">
|
|
107
128
|
.banner {
|
|
108
|
-
|
|
109
|
-
|
|
129
|
+
--p-banner-bg-image: none;
|
|
130
|
+
--p-banner-bg-dark-image: none;
|
|
131
|
+
|
|
132
|
+
@apply p-4 flex space-x-2 rounded text-subtle bg-[image:var(--p-banner-bg-image)];
|
|
133
|
+
@apply dark:text-dark-subtle dark:bg-[image:var(--p-banner-bg-dark-image)];
|
|
110
134
|
|
|
111
135
|
a {
|
|
112
136
|
&:not(.btn) {
|
|
@@ -102,11 +102,13 @@ import {
|
|
|
102
102
|
startOfMonth,
|
|
103
103
|
min as minDate,
|
|
104
104
|
max as maxDate,
|
|
105
|
-
minTime as MIN_TIME,
|
|
106
|
-
maxTime as MAX_TIME,
|
|
107
105
|
add,
|
|
108
106
|
sub,
|
|
109
107
|
} from 'date-fns'
|
|
108
|
+
import {
|
|
109
|
+
minTime as MIN_TIME,
|
|
110
|
+
maxTime as MAX_TIME,
|
|
111
|
+
} from 'date-fns/constants'
|
|
110
112
|
import { syncRef } from '@vueuse/core'
|
|
111
113
|
|
|
112
114
|
const Adapters: Record<CalendarMode, CalendarAdapter> = {
|
|
@@ -11,7 +11,8 @@ import {
|
|
|
11
11
|
isAfter,
|
|
12
12
|
isBefore,
|
|
13
13
|
isWithinInterval,
|
|
14
|
-
set
|
|
14
|
+
set,
|
|
15
|
+
isDate
|
|
15
16
|
} from "date-fns";
|
|
16
17
|
import { defineAdapter } from "./adapter.mjs";
|
|
17
18
|
import { formatDate } from "../../utils/date.mjs";
|
|
@@ -76,7 +77,7 @@ export default defineAdapter({
|
|
|
76
77
|
return !min || isAfter(date, min) || isWithinInterval(min, { start, end });
|
|
77
78
|
},
|
|
78
79
|
setValue(value, lastValue) {
|
|
79
|
-
return lastValue ? set(lastValue, {
|
|
80
|
+
return isDate(lastValue) ? set(lastValue, {
|
|
80
81
|
year: value.getFullYear(),
|
|
81
82
|
month: value.getMonth(),
|
|
82
83
|
date: value.getDate()
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
endOfYear,
|
|
5
5
|
isAfter,
|
|
6
6
|
isBefore,
|
|
7
|
+
isDate,
|
|
7
8
|
isSameMonth,
|
|
8
9
|
isWithinInterval,
|
|
9
10
|
set,
|
|
@@ -57,7 +58,7 @@ export default defineAdapter({
|
|
|
57
58
|
return !min || isAfter(date, min) || isWithinInterval(min, getInterval(date));
|
|
58
59
|
},
|
|
59
60
|
setValue(value, lastValue) {
|
|
60
|
-
return lastValue ? set(lastValue, {
|
|
61
|
+
return isDate(lastValue) ? set(lastValue, {
|
|
61
62
|
year: value.getFullYear(),
|
|
62
63
|
month: value.getMonth()
|
|
63
64
|
}) : value;
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
addYears,
|
|
4
4
|
eachYearOfInterval,
|
|
5
5
|
endOfDecade,
|
|
6
|
+
isDate,
|
|
6
7
|
isAfter,
|
|
7
8
|
isBefore,
|
|
8
9
|
isSameYear,
|
|
@@ -57,6 +58,6 @@ export default defineAdapter({
|
|
|
57
58
|
return !min || isAfter(date, min) || isWithinInterval(min, getInterval(date));
|
|
58
59
|
},
|
|
59
60
|
setValue(value, lastValue) {
|
|
60
|
-
return lastValue ? set(lastValue, { year: value.getFullYear() }) : value;
|
|
61
|
+
return isDate(lastValue) ? set(lastValue, { year: value.getFullYear() }) : value;
|
|
61
62
|
}
|
|
62
63
|
});
|
|
@@ -11,10 +11,14 @@
|
|
|
11
11
|
class="contextual-bar"
|
|
12
12
|
v-bind="$attrs"
|
|
13
13
|
:class="classNames"
|
|
14
|
-
:style="
|
|
14
|
+
:style="styleBg">
|
|
15
15
|
<div
|
|
16
16
|
data-testid="contextual-bar-wrapper"
|
|
17
|
-
|
|
17
|
+
class="contextual-bar__wrapper"
|
|
18
|
+
:class="{
|
|
19
|
+
'contextual-bar__wrapper--with-message': (message || $slots.message),
|
|
20
|
+
'contextual-bar__wrapper--with-action': $slots.action
|
|
21
|
+
}">
|
|
18
22
|
<span
|
|
19
23
|
v-if="$slots.icon"
|
|
20
24
|
data-testid="contextual-bar-icon"
|
|
@@ -65,7 +69,11 @@
|
|
|
65
69
|
</template>
|
|
66
70
|
|
|
67
71
|
<script lang="ts" setup>
|
|
68
|
-
import type {
|
|
72
|
+
import type {
|
|
73
|
+
PropType,
|
|
74
|
+
StyleValue,
|
|
75
|
+
VNode,
|
|
76
|
+
} from 'vue-demi'
|
|
69
77
|
import {
|
|
70
78
|
computed,
|
|
71
79
|
onMounted,
|
|
@@ -89,6 +97,10 @@ const props = defineProps({
|
|
|
89
97
|
type : String,
|
|
90
98
|
default: undefined,
|
|
91
99
|
},
|
|
100
|
+
backgroundDarkUrl: {
|
|
101
|
+
type : String,
|
|
102
|
+
default: undefined,
|
|
103
|
+
},
|
|
92
104
|
dismissable: {
|
|
93
105
|
type : Boolean,
|
|
94
106
|
default: true,
|
|
@@ -142,6 +154,19 @@ const classNames = computed(() => {
|
|
|
142
154
|
return result
|
|
143
155
|
})
|
|
144
156
|
|
|
157
|
+
const styleBg = computed<StyleValue>(() => {
|
|
158
|
+
const result: StyleValue = {}
|
|
159
|
+
|
|
160
|
+
if (props.backgroundUrl) {
|
|
161
|
+
result['--p-contextual-bar-bg-image'] = `url("${props.backgroundUrl}")`
|
|
162
|
+
result['--p-contextual-bar-bg-dark-image'] = props.backgroundDarkUrl
|
|
163
|
+
? `url("${props.backgroundDarkUrl}")`
|
|
164
|
+
: `url("${props.backgroundUrl}")`
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return result
|
|
168
|
+
})
|
|
169
|
+
|
|
145
170
|
function onEnter (target: HTMLDivElement) {
|
|
146
171
|
target.style.setProperty('transform', `translateY(-${target.clientHeight}px)`)
|
|
147
172
|
|
|
@@ -178,6 +203,9 @@ defineSlots<{
|
|
|
178
203
|
|
|
179
204
|
<style lang="postcss">
|
|
180
205
|
.contextual-bar {
|
|
206
|
+
--p-contextual-bar-bg-image: none;
|
|
207
|
+
--p-contextual-bar-bg-dark-image: none;
|
|
208
|
+
|
|
181
209
|
@apply fixed z-50 top-0 left-0 p-6 w-full max-w-[100vw];
|
|
182
210
|
|
|
183
211
|
&__body {
|
|
@@ -207,7 +235,8 @@ defineSlots<{
|
|
|
207
235
|
* are available
|
|
208
236
|
*/
|
|
209
237
|
&--background-image {
|
|
210
|
-
@apply bg-no-repeat bg-cover bg-[top_center];
|
|
238
|
+
@apply bg-no-repeat bg-cover bg-[top_center] bg-[image:var(--p-contextual-bar-bg-image)];
|
|
239
|
+
@apply dark:bg-[image:var(--p-contextual-bar-bg-dark-image)]
|
|
211
240
|
}
|
|
212
241
|
|
|
213
242
|
/**
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
@hide="onModalHide"
|
|
15
15
|
@close="onCancel">
|
|
16
16
|
<template #header>
|
|
17
|
+
<template v-if="dialogIcon">
|
|
18
|
+
<div class="dialog__icon">
|
|
19
|
+
<component
|
|
20
|
+
:is="dialogIcon"
|
|
21
|
+
:class="context.iconClass"
|
|
22
|
+
v-bind="context.iconAttrs" />
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
17
25
|
<Heading
|
|
18
26
|
v-p-md.inline="context.title"
|
|
19
27
|
class="modal__title"
|
|
@@ -49,7 +57,13 @@
|
|
|
49
57
|
</template>
|
|
50
58
|
|
|
51
59
|
<script lang="ts" setup>
|
|
52
|
-
import {
|
|
60
|
+
import {
|
|
61
|
+
h,
|
|
62
|
+
ref,
|
|
63
|
+
computed,
|
|
64
|
+
nextTick,
|
|
65
|
+
shallowRef,
|
|
66
|
+
} from 'vue-demi'
|
|
53
67
|
import Modal from '../modal/Modal.vue'
|
|
54
68
|
import Heading from '../heading/Heading.vue'
|
|
55
69
|
import DialogFooter from './DialogFooter.vue'
|
|
@@ -60,7 +74,22 @@ import { until } from '@vueuse/core'
|
|
|
60
74
|
const id = ref<symbol>()
|
|
61
75
|
const modal = ref(false)
|
|
62
76
|
const processing = ref(false)
|
|
63
|
-
const context =
|
|
77
|
+
const context = shallowRef<DialogContext>()
|
|
78
|
+
|
|
79
|
+
const dialogIcon = computed(() => {
|
|
80
|
+
if (context.value.icon) {
|
|
81
|
+
if (typeof context.value.icon === 'string') {
|
|
82
|
+
return () => h('img', {
|
|
83
|
+
'src' : context.value.icon,
|
|
84
|
+
'width' : 20,
|
|
85
|
+
'height' : 20,
|
|
86
|
+
'data-testid': 'dialog-icon-image',
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return context.value.icon
|
|
91
|
+
}
|
|
92
|
+
})
|
|
64
93
|
|
|
65
94
|
async function show (options: DialogContext) {
|
|
66
95
|
id.value = Symbol('DialogId')
|
|
@@ -112,5 +141,9 @@ defineExpose({
|
|
|
112
141
|
<style lang="postcss">
|
|
113
142
|
.dialog {
|
|
114
143
|
--p-modal-z-index: theme(zIndex.dialog);
|
|
144
|
+
|
|
145
|
+
&__icon {
|
|
146
|
+
@apply mt-1 mr-2;
|
|
147
|
+
}
|
|
115
148
|
}
|
|
116
149
|
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SizeVariant } from '../modal';
|
|
2
2
|
import type { SizeVariant as InputSizeVariant, StyleVariant as FooterButtonStyleVariant, ColorVariant as FooterButtonColorVariant } from '../button';
|
|
3
|
-
import type { VNode } from 'vue-demi';
|
|
3
|
+
import type { VNode, Component, HTMLAttributes } from 'vue-demi';
|
|
4
4
|
import type { AcceptVariant } from '../input';
|
|
5
5
|
import type { AdditionalAttr } from '../global/types';
|
|
6
6
|
export type FooterAlignVariant = 'start' | 'end';
|
|
@@ -15,6 +15,9 @@ interface DialogButton {
|
|
|
15
15
|
}
|
|
16
16
|
export interface DialogOptions {
|
|
17
17
|
title: string;
|
|
18
|
+
icon?: string | Component;
|
|
19
|
+
iconClass?: HTMLAttributes['class'];
|
|
20
|
+
iconAttrs?: AdditionalAttr;
|
|
18
21
|
text?: string;
|
|
19
22
|
size?: SizeVariant;
|
|
20
23
|
centered?: boolean;
|
|
@@ -11,7 +11,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
11
11
|
default: () => never[];
|
|
12
12
|
};
|
|
13
13
|
modelValue: {
|
|
14
|
-
type: (BooleanConstructor | ArrayConstructor | StringConstructor |
|
|
14
|
+
type: (NumberConstructor | BooleanConstructor | ArrayConstructor | StringConstructor | ObjectConstructor | DateConstructor)[];
|
|
15
15
|
default: undefined;
|
|
16
16
|
};
|
|
17
17
|
}, {
|
|
@@ -30,7 +30,7 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
30
30
|
default: () => never[];
|
|
31
31
|
};
|
|
32
32
|
modelValue: {
|
|
33
|
-
type: (BooleanConstructor | ArrayConstructor | StringConstructor |
|
|
33
|
+
type: (NumberConstructor | BooleanConstructor | ArrayConstructor | StringConstructor | ObjectConstructor | DateConstructor)[];
|
|
34
34
|
default: undefined;
|
|
35
35
|
};
|
|
36
36
|
}>> & {
|
|
@@ -6,15 +6,15 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
6
6
|
required: true;
|
|
7
7
|
};
|
|
8
8
|
modelValue: {
|
|
9
|
-
type: (BooleanConstructor | ArrayConstructor | StringConstructor |
|
|
9
|
+
type: (NumberConstructor | BooleanConstructor | ArrayConstructor | StringConstructor | ObjectConstructor | DateConstructor)[];
|
|
10
10
|
default: boolean;
|
|
11
11
|
};
|
|
12
12
|
value: {
|
|
13
|
-
type: (BooleanConstructor | ArrayConstructor | StringConstructor |
|
|
13
|
+
type: (NumberConstructor | BooleanConstructor | ArrayConstructor | StringConstructor | ObjectConstructor | DateConstructor)[];
|
|
14
14
|
default: boolean;
|
|
15
15
|
};
|
|
16
16
|
uncheckedValue: {
|
|
17
|
-
type: (BooleanConstructor | ArrayConstructor | StringConstructor |
|
|
17
|
+
type: (NumberConstructor | BooleanConstructor | ArrayConstructor | StringConstructor | ObjectConstructor | DateConstructor)[];
|
|
18
18
|
default: boolean;
|
|
19
19
|
};
|
|
20
20
|
checked: {
|
|
@@ -30,15 +30,15 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
30
30
|
required: true;
|
|
31
31
|
};
|
|
32
32
|
modelValue: {
|
|
33
|
-
type: (BooleanConstructor | ArrayConstructor | StringConstructor |
|
|
33
|
+
type: (NumberConstructor | BooleanConstructor | ArrayConstructor | StringConstructor | ObjectConstructor | DateConstructor)[];
|
|
34
34
|
default: boolean;
|
|
35
35
|
};
|
|
36
36
|
value: {
|
|
37
|
-
type: (BooleanConstructor | ArrayConstructor | StringConstructor |
|
|
37
|
+
type: (NumberConstructor | BooleanConstructor | ArrayConstructor | StringConstructor | ObjectConstructor | DateConstructor)[];
|
|
38
38
|
default: boolean;
|
|
39
39
|
};
|
|
40
40
|
uncheckedValue: {
|
|
41
|
-
type: (BooleanConstructor | ArrayConstructor | StringConstructor |
|
|
41
|
+
type: (NumberConstructor | BooleanConstructor | ArrayConstructor | StringConstructor | ObjectConstructor | DateConstructor)[];
|
|
42
42
|
default: boolean;
|
|
43
43
|
};
|
|
44
44
|
checked: {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
:error="error"
|
|
18
18
|
@keydown="onKeyDown($event)"
|
|
19
19
|
@beforeinput.prevent="setValue(i - 1, $event)"
|
|
20
|
-
@
|
|
21
|
-
@
|
|
20
|
+
@keydown.left.stop.prevent="prevFocus"
|
|
21
|
+
@keydown.right.stop.prevent="nextFocus" />
|
|
22
22
|
</div>
|
|
23
23
|
</template>
|
|
24
24
|
|
|
@@ -100,7 +100,10 @@ const classNames = computed(() => {
|
|
|
100
100
|
return result
|
|
101
101
|
})
|
|
102
102
|
|
|
103
|
-
const {
|
|
103
|
+
const {
|
|
104
|
+
next: nextFocus,
|
|
105
|
+
prev: prevFocus,
|
|
106
|
+
} = useFocus(root, false)
|
|
104
107
|
|
|
105
108
|
const model = computed<string[]>({
|
|
106
109
|
get () {
|
|
@@ -138,19 +141,18 @@ function setValue (index: number, event: InputEvent) {
|
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
function onKeyDown (event: KeyboardEvent) {
|
|
141
|
-
|
|
144
|
+
if (!props.readonly && !props.disabled) {
|
|
145
|
+
const target = event.target as HTMLInputElement
|
|
142
146
|
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
if (target.value && [...event.key].length === 1 && !event.ctrlKey && !event.metaKey) {
|
|
148
|
+
event.preventDefault()
|
|
145
149
|
|
|
146
|
-
|
|
147
|
-
event.
|
|
150
|
+
target.dispatchEvent(new InputEvent('beforeinput', { inputType: 'insertText', data: event.key }))
|
|
151
|
+
} else if (event.key === 'Backspace') {
|
|
152
|
+
event.preventDefault()
|
|
148
153
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
event.preventDefault()
|
|
152
|
-
|
|
153
|
-
target.dispatchEvent(new InputEvent('beforeinput', { inputType: 'deleteContentBackward' }))
|
|
154
|
+
target.dispatchEvent(new InputEvent('beforeinput', { inputType: 'deleteContentBackward' }))
|
|
155
|
+
}
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
</script>
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { parse, parseInline } from "marked";
|
|
2
2
|
import { sanitize } from "@jill64/universal-sanitizer";
|
|
3
3
|
import defu from "defu";
|
|
4
|
+
import { escape } from "html-escaper";
|
|
4
5
|
export function markdown(text = "", _option = {}) {
|
|
5
6
|
const options = defu(_option, {
|
|
6
7
|
inline: false,
|
|
8
|
+
escape: false,
|
|
7
9
|
unsecure: false,
|
|
8
10
|
marked: { mangle: false, headerIds: false }
|
|
9
11
|
});
|
|
10
|
-
const
|
|
12
|
+
const value = options.escape ? escape(text) : text;
|
|
13
|
+
const html = options.inline ? parseInline(value, options.marked) : parse(value, options.marked);
|
|
11
14
|
if (html && !options.unsecure)
|
|
12
15
|
return sanitize(html);
|
|
13
16
|
return html;
|
|
14
17
|
}
|
|
15
18
|
export const pMd = (el, { value, modifiers }) => {
|
|
16
19
|
el.innerHTML = markdown(value, {
|
|
20
|
+
escape: modifiers.escape,
|
|
17
21
|
inline: modifiers.inline,
|
|
18
22
|
unsecure: modifiers.unsecure
|
|
19
23
|
});
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"PAccordion": "components/accordion/Accordion.vue",
|
|
3
|
-
"PAccordionItem": "components/accordion/AccordionItem.vue",
|
|
4
|
-
"PAccordionItems": "components/accordion/AccordionItems.vue",
|
|
5
2
|
"PAvatar": "components/avatar/Avatar.vue",
|
|
6
3
|
"PAvatarGroup": "components/avatar/AvatarGroup.vue",
|
|
7
4
|
"PAvatarTruncate": "components/avatar/AvatarTruncate.vue",
|
|
8
5
|
"PBadge": "components/badge/Badge.vue",
|
|
6
|
+
"PAccordion": "components/accordion/Accordion.vue",
|
|
7
|
+
"PAccordionItem": "components/accordion/AccordionItem.vue",
|
|
8
|
+
"PAccordionItems": "components/accordion/AccordionItems.vue",
|
|
9
9
|
"PBanner": "components/banner/Banner.vue",
|
|
10
|
+
"PButton": "components/button/Button.vue",
|
|
11
|
+
"PCalendar": "components/calendar/Calendar.vue",
|
|
12
|
+
"PButtonGroup": "components/button-group/ButtonGroup.vue",
|
|
10
13
|
"PBreadcrumb": "components/breadcrumbs/Breadcrumb.vue",
|
|
11
14
|
"PBreadcrumbItem": "components/breadcrumbs/BreadcrumbItem.vue",
|
|
12
15
|
"PBreadcrumbItemDropdown": "components/breadcrumbs/BreadcrumbItemDropdown.vue",
|
|
13
|
-
"PButton": "components/button/Button.vue",
|
|
14
|
-
"PButtonGroup": "components/button-group/ButtonGroup.vue",
|
|
15
|
-
"PCalendar": "components/calendar/Calendar.vue",
|
|
16
|
-
"PCamera": "components/camera/Camera.vue",
|
|
17
16
|
"PCaption": "components/caption/Caption.vue",
|
|
17
|
+
"PCamera": "components/camera/Camera.vue",
|
|
18
18
|
"PCard": "components/card/Card.vue",
|
|
19
19
|
"PCardSection": "components/card/CardSection.vue",
|
|
20
20
|
"PCarousel": "components/carousel/Carousel.vue",
|
|
@@ -24,35 +24,34 @@
|
|
|
24
24
|
"PChart": "components/chart/Chart.vue",
|
|
25
25
|
"PChartSet": "components/chart/ChartSet.vue",
|
|
26
26
|
"PChartVal": "components/chart/ChartVal.vue",
|
|
27
|
-
"PCollapse": "components/collapse/Collapse.vue",
|
|
28
27
|
"PContextualBar": "components/contextual-bar/ContextualBar.vue",
|
|
29
|
-
"
|
|
28
|
+
"PCollapse": "components/collapse/Collapse.vue",
|
|
30
29
|
"PDatepicker": "components/datepicker/Datepicker.vue",
|
|
30
|
+
"PCropper": "components/cropper/Cropper.vue",
|
|
31
31
|
"PDialog": "components/dialog/Dialog.vue",
|
|
32
32
|
"PDialogFooter": "components/dialog/DialogFooter.vue",
|
|
33
33
|
"PDivider": "components/divider/Divider.vue",
|
|
34
|
-
"PDot": "components/dot/Dot.vue",
|
|
35
34
|
"PDropdown": "components/dropdown/Dropdown.vue",
|
|
36
35
|
"PDropdownHeader": "components/dropdown/DropdownHeader.vue",
|
|
37
36
|
"PDropdownItem": "components/dropdown/DropdownItem.vue",
|
|
37
|
+
"PDot": "components/dot/Dot.vue",
|
|
38
38
|
"PDropdownSubitem": "components/dropdown-subitem/DropdownSubitem.vue",
|
|
39
|
-
"PDropzone": "components/dropzone/Dropzone.vue",
|
|
40
39
|
"PFilterbar": "components/filterbar/Filterbar.vue",
|
|
41
40
|
"PFormGroup": "components/form-group/FormGroup.vue",
|
|
41
|
+
"PDropzone": "components/dropzone/Dropzone.vue",
|
|
42
42
|
"PHeading": "components/heading/Heading.vue",
|
|
43
43
|
"PInput": "components/input/Input.vue",
|
|
44
44
|
"PinputColor": "components/input-color/inputColor.vue",
|
|
45
|
-
"PInputFile": "components/input-file/InputFile.vue",
|
|
46
45
|
"PInputGroup": "components/input-group/InputGroup.vue",
|
|
47
46
|
"PInputGroupAddon": "components/input-group/InputGroupAddon.vue",
|
|
47
|
+
"PInputFile": "components/input-file/InputFile.vue",
|
|
48
48
|
"PInputPassword": "components/input-password/InputPassword.vue",
|
|
49
|
-
"PInputPin": "components/input-pin/InputPin.vue",
|
|
50
49
|
"PInputRange": "components/input-range/InputRange.vue",
|
|
50
|
+
"PInputPin": "components/input-pin/InputPin.vue",
|
|
51
51
|
"PLabel": "components/label/Label.vue",
|
|
52
52
|
"PListGroup": "components/list-group/ListGroup.vue",
|
|
53
53
|
"PListGroupItem": "components/list-group/ListGroupItem.vue",
|
|
54
54
|
"PMain": "components/main/Main.vue",
|
|
55
|
-
"PModal": "components/modal/Modal.vue",
|
|
56
55
|
"PNav": "components/nav/Nav.vue",
|
|
57
56
|
"PNavCollapse": "components/nav/NavCollapse.vue",
|
|
58
57
|
"PNavForm": "components/nav/NavForm.vue",
|
|
@@ -60,23 +59,24 @@
|
|
|
60
59
|
"PNavItemDropdown": "components/nav/NavItemDropdown.vue",
|
|
61
60
|
"PNavSubItem": "components/nav/NavSubItem.vue",
|
|
62
61
|
"PNavText": "components/nav/NavText.vue",
|
|
62
|
+
"PModal": "components/modal/Modal.vue",
|
|
63
63
|
"PNavbar": "components/navbar/Navbar.vue",
|
|
64
64
|
"PNavbarBrand": "components/navbar/NavbarBrand.vue",
|
|
65
65
|
"PNavbarNav": "components/navbar/NavbarNav.vue",
|
|
66
66
|
"PNavbarToggle": "components/navbar/NavbarToggle.vue",
|
|
67
|
-
"PNavbarNavMenu": "components/navbar-menu/NavbarNavMenu.vue",
|
|
68
67
|
"PNotify": "components/notify/Notify.vue",
|
|
69
68
|
"PNotifyGroup": "components/notify/NotifyGroup.vue",
|
|
70
69
|
"PNotifyItem": "components/notify/NotifyItem.vue",
|
|
70
|
+
"PNavbarNavMenu": "components/navbar-menu/NavbarNavMenu.vue",
|
|
71
71
|
"POverlay": "components/overlay/Overlay.vue",
|
|
72
72
|
"PPage": "components/page/Page.vue",
|
|
73
73
|
"PPagination": "components/pagination/Pagination.vue",
|
|
74
|
-
"PPdfHelipad": "components/pdf-helipad/PdfHelipad.vue",
|
|
75
74
|
"PPdfObject": "components/pdf-object/PdfObject.vue",
|
|
76
75
|
"PPdfObjectAddon": "components/pdf-object/PdfObjectAddon.vue",
|
|
77
76
|
"PPdfObjectDebugger": "components/pdf-object/PdfObjectDebugger.vue",
|
|
78
77
|
"PPdfObjects": "components/pdf-object/PdfObjects.vue",
|
|
79
78
|
"PPdfText": "components/pdf-text/PdfText.vue",
|
|
79
|
+
"PPdfHelipad": "components/pdf-helipad/PdfHelipad.vue",
|
|
80
80
|
"PPdfError": "components/pdf-viewer/PdfError.vue",
|
|
81
81
|
"PPdfLoading": "components/pdf-viewer/PdfLoading.vue",
|
|
82
82
|
"PPdfNavigation": "components/pdf-viewer/PdfNavigation.vue",
|
|
@@ -87,8 +87,9 @@
|
|
|
87
87
|
"PProgressItem": "components/progress/ProgressItem.vue",
|
|
88
88
|
"PProgressIndicator": "components/progress-indicator/ProgressIndicator.vue",
|
|
89
89
|
"PProgressbar": "components/progressbar/Progressbar.vue",
|
|
90
|
-
"PRingbar": "components/ringbar/Ringbar.vue",
|
|
91
90
|
"PRadio": "components/radio/Radio.vue",
|
|
91
|
+
"PQrcode": "components/qrcode/Qrcode.vue",
|
|
92
|
+
"PRingbar": "components/ringbar/Ringbar.vue",
|
|
92
93
|
"PSelect": "components/select/Select.vue",
|
|
93
94
|
"PSelectInput": "components/select/SelectInput.vue",
|
|
94
95
|
"PSelectTags": "components/select/SelectTags.vue",
|
|
@@ -108,24 +109,24 @@
|
|
|
108
109
|
"PSpinnerRing": "components/spinner/SpinnerRing.vue",
|
|
109
110
|
"PSpinnerRinggo": "components/spinner/SpinnerRinggo.vue",
|
|
110
111
|
"PSpread": "components/spread/Spread.vue",
|
|
112
|
+
"PStrengthbar": "components/strengthbar/Strengthbar.vue",
|
|
111
113
|
"PStep": "components/steps/Step.vue",
|
|
112
114
|
"PStepSlider": "components/steps/StepSlider.vue",
|
|
113
115
|
"PSteps": "components/steps/Steps.vue",
|
|
114
|
-
"PStrengthbar": "components/strengthbar/Strengthbar.vue",
|
|
115
116
|
"PSubheading": "components/subheading/Subheading.vue",
|
|
116
117
|
"PTable": "components/table/Table.vue",
|
|
117
|
-
"PTableFlex": "components/table-flex/TableFlex.vue",
|
|
118
118
|
"PTableStatic": "components/table-static/TableStatic.vue",
|
|
119
119
|
"PTableStaticRoot": "components/table-static/TableStaticRoot.vue",
|
|
120
|
+
"PTableFlex": "components/table-flex/TableFlex.vue",
|
|
120
121
|
"PTab": "components/tabs/Tab.vue",
|
|
121
122
|
"PTabContent": "components/tabs/TabContent.vue",
|
|
122
123
|
"PTabs": "components/tabs/Tabs.vue",
|
|
123
124
|
"PText": "components/text/Text.vue",
|
|
124
125
|
"PTextarea": "components/textarea/Textarea.vue",
|
|
126
|
+
"PTimepicker": "components/timepicker/Timepicker.vue",
|
|
125
127
|
"PTime": "components/time/Time.vue",
|
|
126
128
|
"PTimeItem": "components/time/TimeItem.vue",
|
|
127
129
|
"PToast": "components/toast/Toast.vue",
|
|
128
|
-
"PTimepicker": "components/timepicker/Timepicker.vue",
|
|
129
130
|
"PToggle": "components/toggle/Toggle.vue",
|
|
130
131
|
"PTooltip": "components/tooltip/Tooltip.vue",
|
|
131
132
|
"PTooltipContainer": "components/tooltip/TooltipContainer.vue",
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
watch
|
|
7
7
|
} from "vue-demi";
|
|
8
8
|
import useLoading from "../../overlay/utils/use-loading.mjs";
|
|
9
|
-
import { useClamp } from "@vueuse/math";
|
|
9
|
+
import { useClamp, useMax } from "@vueuse/math";
|
|
10
10
|
import { createEventHook } from "@vueuse/core";
|
|
11
11
|
import {
|
|
12
12
|
createEventBus,
|
|
@@ -23,7 +23,7 @@ export function useViewer(container, viewer) {
|
|
|
23
23
|
const pdfLinkService = shallowRef();
|
|
24
24
|
const totalPage = computed(() => pdfDoc.value?.numPages ?? 0);
|
|
25
25
|
const scale = useClamp(1, 0.1, 2);
|
|
26
|
-
const page = useClamp(1, 1, totalPage);
|
|
26
|
+
const page = useClamp(1, 1, useMax(totalPage, 1));
|
|
27
27
|
const loading = useLoading();
|
|
28
28
|
const ready = shallowRef(false);
|
|
29
29
|
const error = shallowRef();
|
|
@@ -52,29 +52,18 @@ import type { Component, PropType } from 'vue-demi'
|
|
|
52
52
|
import {
|
|
53
53
|
computed,
|
|
54
54
|
h,
|
|
55
|
-
markRaw,
|
|
56
55
|
} from 'vue-demi'
|
|
57
56
|
import type {
|
|
58
57
|
PopupActionOption,
|
|
59
58
|
PopupStyleVariant,
|
|
60
59
|
PopupTypeVariant,
|
|
61
60
|
} from '.'
|
|
62
|
-
import IconInfo from '@privyid/persona-icon/vue/information-circle-solid/20.vue'
|
|
63
|
-
import IconSuccess from '@privyid/persona-icon/vue/checkmark/20.vue'
|
|
64
|
-
import IconWarning from '@privyid/persona-icon/vue/exclamation-circle-solid/20.vue'
|
|
65
|
-
import IconError from '@privyid/persona-icon/vue/exclamation-triangle-solid/20.vue'
|
|
66
61
|
import IconClose from '@privyid/persona-icon/vue/close/16.vue'
|
|
67
62
|
import { vPMd } from '../markdown'
|
|
68
63
|
import type { ColorVariant } from '../button'
|
|
69
64
|
import type { AdditionalAttr } from '../global/types'
|
|
70
65
|
import { useNotifyItem } from '../notify'
|
|
71
|
-
|
|
72
|
-
const ToastIcons = {
|
|
73
|
-
info : markRaw(IconInfo),
|
|
74
|
-
success: markRaw(IconSuccess),
|
|
75
|
-
warning: markRaw(IconWarning),
|
|
76
|
-
error : markRaw(IconError),
|
|
77
|
-
}
|
|
66
|
+
import { PopupIcons } from '.'
|
|
78
67
|
|
|
79
68
|
const props = defineProps({
|
|
80
69
|
title: {
|
|
@@ -155,7 +144,7 @@ const classIcon = computed(() => {
|
|
|
155
144
|
|
|
156
145
|
const toastIcon = computed(() => {
|
|
157
146
|
if (!props.icon)
|
|
158
|
-
return
|
|
147
|
+
return PopupIcons[props.type]
|
|
159
148
|
|
|
160
149
|
if (typeof props.icon === 'string') {
|
|
161
150
|
return () => h('img', {
|
|
@@ -26,6 +26,12 @@ interface Option extends Omit<NotifyOption, 'component'> {
|
|
|
26
26
|
dismissable?: boolean;
|
|
27
27
|
actions?: PopupActionOption[];
|
|
28
28
|
}
|
|
29
|
+
export declare const PopupIcons: {
|
|
30
|
+
info: any;
|
|
31
|
+
success: any;
|
|
32
|
+
warning: any;
|
|
33
|
+
error: any;
|
|
34
|
+
};
|
|
29
35
|
export type PopupOption = RequireAtLeastOne<Option, 'text' | 'title'>;
|
|
30
36
|
declare function showPopup(text: string, title?: string, type?: PopupTypeVariant, variant?: PopupStyleVariant): Promise<PopupInstance>;
|
|
31
37
|
declare function showPopup(option: PopupOption): Promise<PopupInstance>;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { markRaw } from "vue-demi";
|
|
2
2
|
import { showNotify } from "../notify/index.mjs";
|
|
3
|
+
import IconInfo from "@privyid/persona-icon/vue/information-circle-solid/20.vue";
|
|
4
|
+
import IconSuccess from "@privyid/persona-icon/vue/checkmark/20.vue";
|
|
5
|
+
import IconWarning from "@privyid/persona-icon/vue/exclamation-circle-solid/20.vue";
|
|
6
|
+
import IconError from "@privyid/persona-icon/vue/exclamation-triangle-solid/20.vue";
|
|
7
|
+
export const PopupIcons = {
|
|
8
|
+
info: markRaw(IconInfo),
|
|
9
|
+
success: markRaw(IconSuccess),
|
|
10
|
+
warning: markRaw(IconWarning),
|
|
11
|
+
error: markRaw(IconError)
|
|
12
|
+
};
|
|
3
13
|
async function showPopup(textOrOption, title, type, variant) {
|
|
4
14
|
if (typeof textOrOption === "string") {
|
|
5
15
|
return await showPopup({
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<img
|
|
3
|
+
data-testid="qrcode"
|
|
4
|
+
class="qrcode"
|
|
5
|
+
:width="size"
|
|
6
|
+
:height="size"
|
|
7
|
+
:src="preview"
|
|
8
|
+
:alt="String(data)">
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts" setup>
|
|
12
|
+
import type { PropType } from 'vue-demi'
|
|
13
|
+
import {
|
|
14
|
+
computed,
|
|
15
|
+
onMounted,
|
|
16
|
+
shallowRef,
|
|
17
|
+
} from 'vue-demi'
|
|
18
|
+
import type QRCode from 'qr-code-styling'
|
|
19
|
+
import type {
|
|
20
|
+
Options,
|
|
21
|
+
ErrorCorrectionLevel,
|
|
22
|
+
TypeNumber,
|
|
23
|
+
Mode,
|
|
24
|
+
} from 'qr-code-styling'
|
|
25
|
+
import type { StyleVariant } from '.'
|
|
26
|
+
import type { ModelModifier } from '../dropzone'
|
|
27
|
+
import { defuFn } from 'defu'
|
|
28
|
+
import { usePreview } from '../cropper/utils/use-preview'
|
|
29
|
+
import { useVModel } from '../input'
|
|
30
|
+
import { createSpinner } from '../avatar/utils/create-image'
|
|
31
|
+
import { fromBase64 } from '../utils/base64'
|
|
32
|
+
import { toDataURL } from '../signature-draw/utils/canvas'
|
|
33
|
+
import { watchDebounced } from '@vueuse/core'
|
|
34
|
+
|
|
35
|
+
const props = defineProps({
|
|
36
|
+
modelValue: {
|
|
37
|
+
type : [String, globalThis.File],
|
|
38
|
+
default: undefined,
|
|
39
|
+
},
|
|
40
|
+
modelModifiers: {
|
|
41
|
+
type : Object as PropType<ModelModifier>,
|
|
42
|
+
default: () => ({} as ModelModifier),
|
|
43
|
+
},
|
|
44
|
+
data: {
|
|
45
|
+
type : undefined as PropType<any>,
|
|
46
|
+
default: undefined,
|
|
47
|
+
},
|
|
48
|
+
variant: {
|
|
49
|
+
type : String as PropType<StyleVariant>,
|
|
50
|
+
default: 'square',
|
|
51
|
+
},
|
|
52
|
+
size: {
|
|
53
|
+
type : [Number, String],
|
|
54
|
+
default: 200,
|
|
55
|
+
},
|
|
56
|
+
logo: {
|
|
57
|
+
type : String,
|
|
58
|
+
default: undefined,
|
|
59
|
+
},
|
|
60
|
+
logoSize: {
|
|
61
|
+
type : [Number, String],
|
|
62
|
+
default: 0.8,
|
|
63
|
+
},
|
|
64
|
+
logoMargin: {
|
|
65
|
+
type : [Number, String],
|
|
66
|
+
default: 8,
|
|
67
|
+
},
|
|
68
|
+
color: {
|
|
69
|
+
type : String,
|
|
70
|
+
default: '#000000',
|
|
71
|
+
},
|
|
72
|
+
bgColor: {
|
|
73
|
+
type : String,
|
|
74
|
+
default: '#ffffff',
|
|
75
|
+
},
|
|
76
|
+
ecc: {
|
|
77
|
+
type : String as PropType<ErrorCorrectionLevel>,
|
|
78
|
+
default: 'M',
|
|
79
|
+
},
|
|
80
|
+
typeNumber: {
|
|
81
|
+
type : Number as PropType<TypeNumber>,
|
|
82
|
+
default: 0,
|
|
83
|
+
},
|
|
84
|
+
mode: {
|
|
85
|
+
type : String as PropType<Mode>,
|
|
86
|
+
default: undefined,
|
|
87
|
+
},
|
|
88
|
+
options: {
|
|
89
|
+
type : Object as PropType<Options>,
|
|
90
|
+
default: undefined,
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const model = useVModel(props)
|
|
95
|
+
const preview = usePreview(model, createSpinner(Number(props.size)))
|
|
96
|
+
const qrCode = shallowRef<QRCode>()
|
|
97
|
+
|
|
98
|
+
const qrOptions = computed(() => {
|
|
99
|
+
return defuFn<Options, [Options]>(props.options, {
|
|
100
|
+
type : 'canvas',
|
|
101
|
+
data : props.data,
|
|
102
|
+
width : props.size as number,
|
|
103
|
+
height : props.size as number,
|
|
104
|
+
image : props.logo,
|
|
105
|
+
dotsOptions: {
|
|
106
|
+
type : props.variant,
|
|
107
|
+
color: props.color,
|
|
108
|
+
},
|
|
109
|
+
cornersDotOptions : { type: props.variant === 'dots' ? 'dot' : undefined },
|
|
110
|
+
cornersSquareOptions: { type: props.variant === 'dots' ? 'extra-rounded' : undefined },
|
|
111
|
+
qrOptions : {
|
|
112
|
+
mode : props.mode,
|
|
113
|
+
typeNumber : props.typeNumber,
|
|
114
|
+
errorCorrectionLevel: props.ecc,
|
|
115
|
+
},
|
|
116
|
+
imageOptions: {
|
|
117
|
+
margin : props.logoMargin as number,
|
|
118
|
+
imageSize: props.logoSize as number,
|
|
119
|
+
},
|
|
120
|
+
backgroundOptions: { color: props.bgColor },
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
watchDebounced(() => [
|
|
125
|
+
props.data,
|
|
126
|
+
props.variant,
|
|
127
|
+
props.size,
|
|
128
|
+
props.logo,
|
|
129
|
+
props.logoSize,
|
|
130
|
+
props.logoMargin,
|
|
131
|
+
props.color,
|
|
132
|
+
props.bgColor,
|
|
133
|
+
props.ecc,
|
|
134
|
+
props.typeNumber,
|
|
135
|
+
props.mode,
|
|
136
|
+
props.options,
|
|
137
|
+
], () => {
|
|
138
|
+
load()
|
|
139
|
+
}, { debounce: 300 })
|
|
140
|
+
|
|
141
|
+
onMounted(() => {
|
|
142
|
+
load()
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
async function load () {
|
|
146
|
+
if (props.data) {
|
|
147
|
+
if (qrCode.value)
|
|
148
|
+
qrCode.value.update(qrOptions.value)
|
|
149
|
+
else {
|
|
150
|
+
const { default: QRStyling } = await import('qr-code-styling')
|
|
151
|
+
|
|
152
|
+
qrCode.value = new QRStyling(qrOptions.value)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const canvas = await qrCode.value._getElement('png')
|
|
156
|
+
const result = toDataURL(canvas as HTMLCanvasElement, 'image/png')
|
|
157
|
+
const value = props.modelModifiers.base64
|
|
158
|
+
? result
|
|
159
|
+
: fromBase64(result)
|
|
160
|
+
|
|
161
|
+
model.value = value
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
defineEmits<{
|
|
166
|
+
'update:modelValue': [unknown],
|
|
167
|
+
}>()
|
|
168
|
+
</script>
|
|
169
|
+
|
|
170
|
+
<style lang="postcss">
|
|
171
|
+
.qrcode {
|
|
172
|
+
@apply max-w-full h-auto;
|
|
173
|
+
}
|
|
174
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type StyleVariant = 'square' | 'rounded' | 'dots';
|
|
File without changes
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
ref,
|
|
15
15
|
computed,
|
|
16
16
|
onMounted,
|
|
17
|
-
watch,
|
|
18
17
|
} from 'vue-demi'
|
|
19
18
|
import { useVModel } from '../input'
|
|
20
19
|
import { createSpinner } from '../avatar/utils/create-image'
|
|
@@ -23,6 +22,7 @@ import generate from './utils/generate-text'
|
|
|
23
22
|
import { usePreview } from '../cropper'
|
|
24
23
|
import type { ModelModifier } from '../dropzone'
|
|
25
24
|
import { fromBase64 } from '../utils/base64'
|
|
25
|
+
import { watchDebounced } from '@vueuse/core'
|
|
26
26
|
|
|
27
27
|
const props = defineProps({
|
|
28
28
|
modelValue: {
|
|
@@ -93,7 +93,7 @@ const name = computed(() => {
|
|
|
93
93
|
)
|
|
94
94
|
})
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
watchDebounced(() => [
|
|
97
97
|
props.text,
|
|
98
98
|
props.font,
|
|
99
99
|
props.color,
|
|
@@ -103,7 +103,7 @@ watch(() => [
|
|
|
103
103
|
props.maxlength,
|
|
104
104
|
], () => {
|
|
105
105
|
load()
|
|
106
|
-
})
|
|
106
|
+
}, { debounce: 300 })
|
|
107
107
|
|
|
108
108
|
onMounted(() => {
|
|
109
109
|
load()
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { useSingleton, removeSingleton, resetInstance, } from '../components/glo
|
|
|
2
2
|
export { hideOverlay, showOverlay, } from '../components/overlay';
|
|
3
3
|
export { hideTooltip, showTooltip, toggleTooltip, } from '../components/tooltip';
|
|
4
4
|
export { default as toast, } from '../components/toast';
|
|
5
|
-
export { default as popup, } from '../components/popup';
|
|
5
|
+
export { default as popup, PopupIcons, } from '../components/popup';
|
|
6
6
|
export { default as notify, useNotifyItem, } from '../components/notify';
|
|
7
7
|
export * as dialog from '../components/dialog';
|
|
8
8
|
export { type SelectItem, defineOptions, } from '../components/select';
|
package/dist/core/index.mjs
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -9,7 +9,6 @@ const module = defineNuxtModule({
|
|
|
9
9
|
defaults: { font: true, prefix: "p" },
|
|
10
10
|
async setup(options, nuxt) {
|
|
11
11
|
const { resolve } = createResolver(import.meta.url);
|
|
12
|
-
nuxt.options.alias["date-fns/locale"] = "date-fns/esm/locale";
|
|
13
12
|
if (options.font) {
|
|
14
13
|
nuxt.options.app.head.link?.push(
|
|
15
14
|
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privyid/persona",
|
|
3
3
|
"description": "Persona core package",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"url": "https://github.com/privy-open-source/design-system.git",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"import": "./dist/directive/index.mjs",
|
|
29
29
|
"types": "./dist/directive/index.d.ts"
|
|
30
30
|
},
|
|
31
|
-
"./components
|
|
31
|
+
"./components/": "./dist/components/"
|
|
32
32
|
},
|
|
33
33
|
"typesVersions": {
|
|
34
34
|
"*": {
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"scripts": {
|
|
53
53
|
"prepack": "yarn build",
|
|
54
54
|
"prepare": "yarn dev:prepare",
|
|
55
|
-
"build": "nuxt-module-build",
|
|
55
|
+
"build": "nuxt-module-build build",
|
|
56
56
|
"dev": "nuxi dev playground",
|
|
57
57
|
"dev:build": "nuxi build playground",
|
|
58
58
|
"dev:prepare": "nuxt-module-build --stub && nuxi prepare playground"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@floating-ui/dom": "1.6.3",
|
|
62
|
-
"@jill64/universal-sanitizer": "
|
|
62
|
+
"@jill64/universal-sanitizer": "1.2.7",
|
|
63
63
|
"@juggle/resize-observer": "3.4.0",
|
|
64
|
-
"@nuxt/kit": "3.
|
|
64
|
+
"@nuxt/kit": "3.11.1",
|
|
65
65
|
"@splidejs/splide": "4.1.4",
|
|
66
66
|
"@testing-library/dom": "9.3.4",
|
|
67
67
|
"@testing-library/user-event": "14.5.2",
|
|
@@ -71,13 +71,13 @@
|
|
|
71
71
|
"@zxing/library": "0.20.0",
|
|
72
72
|
"chart.js": "4.4.2",
|
|
73
73
|
"core-js": "3",
|
|
74
|
-
"date-fns": "
|
|
74
|
+
"date-fns": "3.6.0",
|
|
75
75
|
"defu": "6.1.4",
|
|
76
|
-
"fast-equals": "
|
|
76
|
+
"fast-equals": "5.0.1",
|
|
77
77
|
"fuse.js": "7.0.0",
|
|
78
|
-
"interactjs": "1.10.
|
|
78
|
+
"interactjs": "1.10.27",
|
|
79
79
|
"lodash-es": "4.17.21",
|
|
80
|
-
"marked": "
|
|
80
|
+
"marked": "12.0.1",
|
|
81
81
|
"nanodelay": "2.0.2",
|
|
82
82
|
"pdfjs-dist": "3.11.174",
|
|
83
83
|
"scroll-into-view": "1.16.2",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"extends @privyid/browserslist-config"
|
|
93
93
|
],
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@privyid/browserslist-config": "^1.0.0-rc.
|
|
96
|
-
"@privyid/tailwind-preset": "^1.0.0-rc.
|
|
95
|
+
"@privyid/browserslist-config": "^1.0.0-rc.4",
|
|
96
|
+
"@privyid/tailwind-preset": "^1.0.0-rc.4",
|
|
97
97
|
"postcss-custom-properties": "^12.1.11 || ^13.0.0",
|
|
98
98
|
"postcss-hexrgba": "^2.1.0",
|
|
99
99
|
"postcss-lighten-darken": "^0.9.0",
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@nuxt/module-builder": "^0.5.0",
|
|
105
|
-
"@nuxt/schema": "3.
|
|
105
|
+
"@nuxt/schema": "3.11.1",
|
|
106
106
|
"@nuxtjs/tailwindcss": "^6.2.0",
|
|
107
|
-
"@privyid/browserslist-config": "^1.0.0-rc.
|
|
108
|
-
"@privyid/tailwind-preset": "^1.0.0-rc.
|
|
107
|
+
"@privyid/browserslist-config": "^1.0.0-rc.4",
|
|
108
|
+
"@privyid/tailwind-preset": "^1.0.0-rc.4",
|
|
109
109
|
"@types/sanitize-html": "^2",
|
|
110
110
|
"browserslist-to-esbuild": "^2.0.0",
|
|
111
|
-
"nuxt": "3.
|
|
111
|
+
"nuxt": "3.11.1",
|
|
112
112
|
"postcss-custom-properties": "^13.0.0",
|
|
113
113
|
"postcss-hexrgba": "^2.1.0",
|
|
114
114
|
"postcss-lighten-darken": "^0.9.0",
|