@privyid/persona 0.25.2 → 0.26.0
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/checkbox/index.mjs +4 -6
- package/dist/components/dropdown/Dropdown.vue +4 -2
- package/dist/components/heading/Heading.vue.d.ts +1 -1
- package/dist/components/meta.json +13 -12
- package/dist/components/popover/Popover.vue +131 -0
- package/dist/components/popover/index.d.ts +17 -0
- package/dist/components/popover/index.mjs +52 -0
- package/dist/components/radio/index.mjs +2 -3
- package/dist/components/select/Select.vue +61 -49
- package/dist/components/signature-draw/SignatureDrawDesktop.vue +3 -1
- package/dist/components/signature-draw/SignatureDrawMobile.vue +9 -1
- package/dist/components/signature-draw/utils/image.d.ts +7 -0
- package/dist/components/signature-draw/utils/{rotate-image.mjs → image.mjs} +12 -1
- package/dist/components/text/Text.vue.d.ts +1 -1
- package/dist/components/tooltip/Tooltip.vue +1 -1
- package/dist/components/tooltip/TooltipContainer.vue +3 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.mjs +3 -0
- package/dist/module.json +1 -1
- package/dist/types.d.mts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +9 -9
- package/dist/components/signature-draw/utils/rotate-image.d.ts +0 -6
|
@@ -12,21 +12,19 @@ function isChecked(modelValue, checked) {
|
|
|
12
12
|
}
|
|
13
13
|
export function useVModel(props) {
|
|
14
14
|
const { emit } = getCurrentInstance();
|
|
15
|
-
const
|
|
16
|
-
const unchecked = props.uncheckedValue;
|
|
17
|
-
const localValue = ref(isChecked(props.modelValue, checked) || props.checked);
|
|
15
|
+
const localValue = ref(isChecked(props.modelValue, props.value) || props.checked);
|
|
18
16
|
const model = computed({
|
|
19
17
|
get() {
|
|
20
|
-
return isChecked(props.modelValue,
|
|
18
|
+
return isChecked(props.modelValue, props.value) || props.checked;
|
|
21
19
|
},
|
|
22
20
|
set(value) {
|
|
23
|
-
const newValue = value ?
|
|
21
|
+
const newValue = value ? props.value : props.uncheckedValue;
|
|
24
22
|
if (Array.isArray(props.modelValue)) {
|
|
25
23
|
if (value) {
|
|
26
24
|
if (!valueIn(props.modelValue, newValue))
|
|
27
25
|
emit("update:modelValue", [...props.modelValue, newValue]);
|
|
28
26
|
} else
|
|
29
|
-
emit("update:modelValue", props.modelValue.filter((old) => !isEqual(old,
|
|
27
|
+
emit("update:modelValue", props.modelValue.filter((old) => !isEqual(old, props.value)));
|
|
30
28
|
} else
|
|
31
29
|
emit("update:modelValue", newValue);
|
|
32
30
|
emit("change", value);
|
|
@@ -197,8 +197,10 @@ defineEmits<{
|
|
|
197
197
|
}>()
|
|
198
198
|
|
|
199
199
|
const slots = defineSlots<{
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
'activator'(props: { isOpen: boolean, open: () => void, close: () => void, toggle: () => void }): VNode[],
|
|
201
|
+
'button-content'(): VNode[],
|
|
202
|
+
'prepend'(): VNode[],
|
|
203
|
+
'append'(): VNode[],
|
|
202
204
|
}>()
|
|
203
205
|
|
|
204
206
|
const root = ref<HTMLDivElement>()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"PAccordion": "components/accordion/Accordion.vue",
|
|
3
3
|
"PAccordionItem": "components/accordion/AccordionItem.vue",
|
|
4
|
-
"PAvatar": "components/avatar/Avatar.vue",
|
|
5
4
|
"PBadge": "components/badge/Badge.vue",
|
|
5
|
+
"PAvatar": "components/avatar/Avatar.vue",
|
|
6
|
+
"PBanner": "components/banner/Banner.vue",
|
|
6
7
|
"PBreadcrumb": "components/breadcrumbs/Breadcrumb.vue",
|
|
7
8
|
"PBreadcrumbItem": "components/breadcrumbs/BreadcrumbItem.vue",
|
|
8
9
|
"PBreadcrumbItemDropdown": "components/breadcrumbs/BreadcrumbItemDropdown.vue",
|
|
9
|
-
"PBanner": "components/banner/Banner.vue",
|
|
10
10
|
"PButton": "components/button/Button.vue",
|
|
11
11
|
"PButtonGroup": "components/button-group/ButtonGroup.vue",
|
|
12
12
|
"PCalendar": "components/calendar/Calendar.vue",
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
"PContextualBar": "components/contextual-bar/ContextualBar.vue",
|
|
26
26
|
"PCropper": "components/cropper/Cropper.vue",
|
|
27
27
|
"PDatepicker": "components/datepicker/Datepicker.vue",
|
|
28
|
-
"PDivider": "components/divider/Divider.vue",
|
|
29
28
|
"PDialog": "components/dialog/Dialog.vue",
|
|
30
29
|
"PDialogFooter": "components/dialog/DialogFooter.vue",
|
|
30
|
+
"PDivider": "components/divider/Divider.vue",
|
|
31
31
|
"PDot": "components/dot/Dot.vue",
|
|
32
32
|
"PDropdown": "components/dropdown/Dropdown.vue",
|
|
33
33
|
"PDropdownHeader": "components/dropdown/DropdownHeader.vue",
|
|
34
34
|
"PDropdownItem": "components/dropdown/DropdownItem.vue",
|
|
35
35
|
"PDropdownSubitem": "components/dropdown-subitem/DropdownSubitem.vue",
|
|
36
36
|
"PDropzone": "components/dropzone/Dropzone.vue",
|
|
37
|
-
"PFilterbar": "components/filterbar/Filterbar.vue",
|
|
38
37
|
"PFormGroup": "components/form-group/FormGroup.vue",
|
|
38
|
+
"PFilterbar": "components/filterbar/Filterbar.vue",
|
|
39
39
|
"PHeading": "components/heading/Heading.vue",
|
|
40
40
|
"PInput": "components/input/Input.vue",
|
|
41
41
|
"PInputFile": "components/input-file/InputFile.vue",
|
|
42
|
+
"PInputPassword": "components/input-password/InputPassword.vue",
|
|
42
43
|
"PInputGroup": "components/input-group/InputGroup.vue",
|
|
43
44
|
"PInputGroupAddon": "components/input-group/InputGroupAddon.vue",
|
|
44
|
-
"PInputPassword": "components/input-password/InputPassword.vue",
|
|
45
45
|
"PInputPin": "components/input-pin/InputPin.vue",
|
|
46
46
|
"PInputRange": "components/input-range/InputRange.vue",
|
|
47
47
|
"PLabel": "components/label/Label.vue",
|
|
@@ -61,29 +61,30 @@
|
|
|
61
61
|
"PNavbarNav": "components/navbar/NavbarNav.vue",
|
|
62
62
|
"PNavbarToggle": "components/navbar/NavbarToggle.vue",
|
|
63
63
|
"PNavbarNavMenu": "components/navbar-menu/NavbarNavMenu.vue",
|
|
64
|
-
"POverlay": "components/overlay/Overlay.vue",
|
|
65
64
|
"PPage": "components/page/Page.vue",
|
|
66
|
-
"
|
|
65
|
+
"POverlay": "components/overlay/Overlay.vue",
|
|
67
66
|
"PPdfHelipad": "components/pdf-helipad/PdfHelipad.vue",
|
|
67
|
+
"PPagination": "components/pagination/Pagination.vue",
|
|
68
|
+
"PPdfText": "components/pdf-text/PdfText.vue",
|
|
68
69
|
"PPdfObject": "components/pdf-object/PdfObject.vue",
|
|
69
70
|
"PPdfObjectAddon": "components/pdf-object/PdfObjectAddon.vue",
|
|
70
71
|
"PPdfObjectDebugger": "components/pdf-object/PdfObjectDebugger.vue",
|
|
71
72
|
"PPdfObjects": "components/pdf-object/PdfObjects.vue",
|
|
72
|
-
"
|
|
73
|
+
"PPopover": "components/popover/Popover.vue",
|
|
73
74
|
"PPdfError": "components/pdf-viewer/PdfError.vue",
|
|
74
75
|
"PPdfLoading": "components/pdf-viewer/PdfLoading.vue",
|
|
75
76
|
"PPdfNavigation": "components/pdf-viewer/PdfNavigation.vue",
|
|
76
77
|
"PPdfViewer": "components/pdf-viewer/PdfViewer.vue",
|
|
77
|
-
"PProgress": "components/progress/Progress.vue",
|
|
78
|
-
"PProgressItem": "components/progress/ProgressItem.vue",
|
|
79
78
|
"PProgressIndicator": "components/progress-indicator/ProgressIndicator.vue",
|
|
80
79
|
"PProgressbar": "components/progressbar/Progressbar.vue",
|
|
80
|
+
"PProgress": "components/progress/Progress.vue",
|
|
81
|
+
"PProgressItem": "components/progress/ProgressItem.vue",
|
|
81
82
|
"PRadio": "components/radio/Radio.vue",
|
|
83
|
+
"PSheet": "components/sheet/Sheet.vue",
|
|
82
84
|
"PRingbar": "components/ringbar/Ringbar.vue",
|
|
83
85
|
"PSelect": "components/select/Select.vue",
|
|
84
86
|
"PSelectInput": "components/select/SelectInput.vue",
|
|
85
87
|
"PSelectTags": "components/select/SelectTags.vue",
|
|
86
|
-
"PSheet": "components/sheet/Sheet.vue",
|
|
87
88
|
"PSidebar": "components/sidebar/Sidebar.vue",
|
|
88
89
|
"PSidebarBrand": "components/sidebar/SidebarBrand.vue",
|
|
89
90
|
"PSidebarContent": "components/sidebar/SidebarContent.vue",
|
|
@@ -118,10 +119,10 @@
|
|
|
118
119
|
"PToggle": "components/toggle/Toggle.vue",
|
|
119
120
|
"PTooltip": "components/tooltip/Tooltip.vue",
|
|
120
121
|
"PTooltipContainer": "components/tooltip/TooltipContainer.vue",
|
|
122
|
+
"PTruncate": "components/truncate/Truncate.vue",
|
|
121
123
|
"PTour": "components/tour/Tour.vue",
|
|
122
124
|
"PTourDialog": "components/tour/TourDialog.vue",
|
|
123
125
|
"PTourHighlight": "components/tour/TourHighlight.vue",
|
|
124
|
-
"PTruncate": "components/truncate/Truncate.vue",
|
|
125
126
|
"PWizard": "components/wizard/Wizard.vue",
|
|
126
127
|
"PWizardBody": "components/wizard/WizardBody.vue",
|
|
127
128
|
"PWizardHeader": "components/wizard/WizardHeader.vue",
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
data-testid="popover"
|
|
5
|
+
class="popover">
|
|
6
|
+
<slot
|
|
7
|
+
name="activator"
|
|
8
|
+
:is-show="isShow"
|
|
9
|
+
:toggle="toggle"
|
|
10
|
+
:show="show"
|
|
11
|
+
:hide="hide" />
|
|
12
|
+
|
|
13
|
+
<p-tooltip
|
|
14
|
+
ref="tooltip"
|
|
15
|
+
v-model="isShow"
|
|
16
|
+
class="popover__tooltip"
|
|
17
|
+
data-testid="popover-tooltip"
|
|
18
|
+
:color="color"
|
|
19
|
+
:placement="placement"
|
|
20
|
+
:target="root"
|
|
21
|
+
@show="$emit('show')"
|
|
22
|
+
@hide="$emit('hide')">
|
|
23
|
+
<slot
|
|
24
|
+
:is-show="isShow"
|
|
25
|
+
:toggle="toggle"
|
|
26
|
+
:show="show"
|
|
27
|
+
:hide="hide" />
|
|
28
|
+
</p-tooltip>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script lang="ts" setup>
|
|
33
|
+
import type { PropType, VNode } from 'vue-demi'
|
|
34
|
+
import type { Placement } from '@floating-ui/dom'
|
|
35
|
+
import type { ColorVariant } from '../tooltip'
|
|
36
|
+
import {
|
|
37
|
+
ref,
|
|
38
|
+
provide,
|
|
39
|
+
computed,
|
|
40
|
+
} from 'vue-demi'
|
|
41
|
+
import pTooltip from '../tooltip/Tooltip.vue'
|
|
42
|
+
import { useVModel } from '../input'
|
|
43
|
+
import { onClickOutside } from '@vueuse/core'
|
|
44
|
+
import { POPOVER_CONTEXT } from '.'
|
|
45
|
+
|
|
46
|
+
const props = defineProps({
|
|
47
|
+
modelValue: {
|
|
48
|
+
type : Boolean,
|
|
49
|
+
default: false,
|
|
50
|
+
},
|
|
51
|
+
color: {
|
|
52
|
+
type : String as PropType<ColorVariant>,
|
|
53
|
+
default: 'white',
|
|
54
|
+
},
|
|
55
|
+
placement: {
|
|
56
|
+
type : String as PropType<Placement>,
|
|
57
|
+
default: 'top',
|
|
58
|
+
},
|
|
59
|
+
disabled: {
|
|
60
|
+
type : Boolean,
|
|
61
|
+
default: false,
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const root = ref<HTMLDivElement>()
|
|
66
|
+
const tooltip = ref<InstanceType<typeof pTooltip>>()
|
|
67
|
+
const isShow = useVModel(props)
|
|
68
|
+
|
|
69
|
+
const tooltipEl = computed<HTMLElement>(() => tooltip.value.$el)
|
|
70
|
+
|
|
71
|
+
onClickOutside(tooltipEl, () => {
|
|
72
|
+
if (isShow.value) {
|
|
73
|
+
// Add little delay too prevent race condition with v-model changing
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
hide()
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
}, { ignore: [root] })
|
|
79
|
+
|
|
80
|
+
function toggle () {
|
|
81
|
+
if (!props.disabled) {
|
|
82
|
+
if (isShow.value)
|
|
83
|
+
hide()
|
|
84
|
+
else
|
|
85
|
+
show()
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function show () {
|
|
90
|
+
if (!props.disabled)
|
|
91
|
+
isShow.value = true
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function hide () {
|
|
95
|
+
if (!props.disabled)
|
|
96
|
+
isShow.value = false
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
defineEmits<{
|
|
100
|
+
'show': [],
|
|
101
|
+
'hide': [],
|
|
102
|
+
'update:modelValue': [boolean],
|
|
103
|
+
}>()
|
|
104
|
+
|
|
105
|
+
defineSlots<{
|
|
106
|
+
'activator'(props: { isShow: boolean, show: () => void, hide: () => void, toggle: () => void }): VNode[],
|
|
107
|
+
'default'(props: { isShow: boolean, show: () => void, hide: () => void, toggle: () => void }): VNode[],
|
|
108
|
+
}>()
|
|
109
|
+
|
|
110
|
+
defineExpose({
|
|
111
|
+
isShow,
|
|
112
|
+
show,
|
|
113
|
+
hide,
|
|
114
|
+
toggle,
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
provide(POPOVER_CONTEXT, {
|
|
118
|
+
isShow,
|
|
119
|
+
show,
|
|
120
|
+
hide,
|
|
121
|
+
toggle,
|
|
122
|
+
})
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
<style lang="postcss">
|
|
126
|
+
.popover {
|
|
127
|
+
& > &__tooltip.tooltip {
|
|
128
|
+
@apply text-base;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type InjectionKey, type Ref } from 'vue-demi';
|
|
2
|
+
interface PopoverContext {
|
|
3
|
+
hide: () => void;
|
|
4
|
+
show: () => void;
|
|
5
|
+
toggle: () => void;
|
|
6
|
+
isShow: Ref<boolean>;
|
|
7
|
+
}
|
|
8
|
+
export declare const POPOVER_CONTEXT: InjectionKey<PopoverContext>;
|
|
9
|
+
export declare function usePopoverPromise<R = any>(): {
|
|
10
|
+
start: () => Promise<R | undefined>;
|
|
11
|
+
finish: (result?: R | Error) => void;
|
|
12
|
+
bind: () => {
|
|
13
|
+
modelValue: boolean;
|
|
14
|
+
'onUpdate:modelValue'(value: boolean): void;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ref
|
|
3
|
+
} from "vue-demi";
|
|
4
|
+
export const POPOVER_CONTEXT = Symbol("POPOVER_CONTEXT");
|
|
5
|
+
export function usePopoverPromise() {
|
|
6
|
+
const promise = ref();
|
|
7
|
+
const resolve = ref();
|
|
8
|
+
const reject = ref();
|
|
9
|
+
const isShow = ref(false);
|
|
10
|
+
function bind() {
|
|
11
|
+
return {
|
|
12
|
+
modelValue: isShow.value,
|
|
13
|
+
"onUpdate:modelValue"(value) {
|
|
14
|
+
if (resolve.value && !value)
|
|
15
|
+
finish();
|
|
16
|
+
isShow.value = value;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
async function start() {
|
|
21
|
+
if (!promise.value) {
|
|
22
|
+
promise.value = new Promise((_resolve, _reject) => {
|
|
23
|
+
resolve.value = _resolve;
|
|
24
|
+
reject.value = _reject;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
let result;
|
|
28
|
+
try {
|
|
29
|
+
isShow.value = true;
|
|
30
|
+
result = await promise.value;
|
|
31
|
+
} finally {
|
|
32
|
+
promise.value = void 0;
|
|
33
|
+
resolve.value = void 0;
|
|
34
|
+
reject.value = void 0;
|
|
35
|
+
isShow.value = false;
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
function finish(result) {
|
|
40
|
+
if (resolve.value && reject.value) {
|
|
41
|
+
if (result instanceof Error)
|
|
42
|
+
reject.value(result);
|
|
43
|
+
else
|
|
44
|
+
resolve.value(result);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
start,
|
|
49
|
+
finish,
|
|
50
|
+
bind
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -2,15 +2,14 @@ import { computed, getCurrentInstance } from "vue-demi";
|
|
|
2
2
|
import { isEqual } from "../utils/value.mjs";
|
|
3
3
|
export function useVModel(props) {
|
|
4
4
|
const { emit } = getCurrentInstance();
|
|
5
|
-
const checked = props.value;
|
|
6
5
|
const model = computed({
|
|
7
6
|
get() {
|
|
8
|
-
return isEqual(props.modelValue,
|
|
7
|
+
return isEqual(props.modelValue, props.value) || props.checked;
|
|
9
8
|
},
|
|
10
9
|
set(value) {
|
|
11
10
|
emit("change", value);
|
|
12
11
|
if (value)
|
|
13
|
-
emit("update:modelValue",
|
|
12
|
+
emit("update:modelValue", props.value);
|
|
14
13
|
}
|
|
15
14
|
});
|
|
16
15
|
return model;
|
|
@@ -13,57 +13,61 @@
|
|
|
13
13
|
:no-animation="noAnimation"
|
|
14
14
|
@show="onOpened"
|
|
15
15
|
@hide="onClosed">
|
|
16
|
-
<template #activator>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
<template #activator="dropdownAttrs">
|
|
17
|
+
<slot
|
|
18
|
+
name="activator"
|
|
19
|
+
v-bind="dropdownAttrs">
|
|
20
|
+
<SelectInput
|
|
21
|
+
data-testid="select-activator"
|
|
22
|
+
class="select__activator"
|
|
23
|
+
:size="size"
|
|
24
|
+
:placeholder="placeholder"
|
|
25
|
+
:disabled="disabled"
|
|
26
|
+
:readonly="readonly"
|
|
27
|
+
:error="error"
|
|
28
|
+
@focus="onFocus">
|
|
29
|
+
<template #default>
|
|
30
|
+
<template v-if="hasValue">
|
|
31
|
+
<slot
|
|
32
|
+
name="selected"
|
|
33
|
+
:item="localModel"
|
|
34
|
+
:multiple="multiple">
|
|
35
|
+
<template v-if="props.multiple && Array.isArray(localModel)">
|
|
36
|
+
<SelectTags
|
|
37
|
+
:items="localModel"
|
|
38
|
+
:display-limit="displayLimit"
|
|
39
|
+
:limit-text="limitText" />
|
|
40
|
+
</template>
|
|
41
|
+
<template v-else>
|
|
42
|
+
{{ (localModel as SelectItem)?.text }}
|
|
43
|
+
</template>
|
|
44
|
+
</slot>
|
|
45
|
+
</template>
|
|
46
|
+
<template v-else>
|
|
47
|
+
<div data-testid="select-placeholder">
|
|
48
|
+
<slot name="placeholder">
|
|
49
|
+
<span class="input__form__placeholder">
|
|
50
|
+
{{ placeholder }}
|
|
51
|
+
</span>
|
|
52
|
+
</slot>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
</template>
|
|
56
|
+
<template
|
|
57
|
+
v-if="!noCaret"
|
|
58
|
+
#append>
|
|
28
59
|
<slot
|
|
29
|
-
name="
|
|
30
|
-
:
|
|
31
|
-
:
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
:limit-text="limitText" />
|
|
37
|
-
</template>
|
|
38
|
-
<template v-else>
|
|
39
|
-
{{ (localModel as SelectItem)?.text }}
|
|
40
|
-
</template>
|
|
60
|
+
name="caret"
|
|
61
|
+
:is-open="isOpen"
|
|
62
|
+
:toggle="toggle">
|
|
63
|
+
<IconArrow
|
|
64
|
+
class="select__caret"
|
|
65
|
+
data-testid="select-caret-icon"
|
|
66
|
+
@click="toggle" />
|
|
41
67
|
</slot>
|
|
42
68
|
</template>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
<slot name="placeholder">
|
|
46
|
-
<span class="input__form__placeholder">
|
|
47
|
-
{{ placeholder }}
|
|
48
|
-
</span>
|
|
49
|
-
</slot>
|
|
50
|
-
</div>
|
|
51
|
-
</template>
|
|
52
|
-
</template>
|
|
53
|
-
<template
|
|
54
|
-
v-if="!noCaret"
|
|
55
|
-
#append>
|
|
56
|
-
<slot
|
|
57
|
-
name="caret"
|
|
58
|
-
:is-open="isOpen"
|
|
59
|
-
:toggle="toggleOpen">
|
|
60
|
-
<IconArrow
|
|
61
|
-
class="select__caret"
|
|
62
|
-
data-testid="select-caret-icon"
|
|
63
|
-
@click="toggleOpen" />
|
|
64
|
-
</slot>
|
|
65
|
-
</template>
|
|
66
|
-
</SelectInput>
|
|
69
|
+
</SelectInput>
|
|
70
|
+
</slot>
|
|
67
71
|
</template>
|
|
68
72
|
|
|
69
73
|
<template #prepend>
|
|
@@ -333,7 +337,7 @@ const localModel = ref<SelectItem | SelectItem[]>(
|
|
|
333
337
|
: findSelected(items.value, props.modelValue),
|
|
334
338
|
)
|
|
335
339
|
|
|
336
|
-
const
|
|
340
|
+
const toggle = () => {
|
|
337
341
|
if (!props.disabled && !props.readonly)
|
|
338
342
|
isOpen.value = !isOpen.value
|
|
339
343
|
}
|
|
@@ -447,6 +451,14 @@ onStartTyping(() => {
|
|
|
447
451
|
inputEl.value.focus()
|
|
448
452
|
}
|
|
449
453
|
})
|
|
454
|
+
|
|
455
|
+
defineExpose({
|
|
456
|
+
keyword,
|
|
457
|
+
isOpen,
|
|
458
|
+
isLoading,
|
|
459
|
+
menuEl,
|
|
460
|
+
toggle,
|
|
461
|
+
})
|
|
450
462
|
</script>
|
|
451
463
|
|
|
452
464
|
<style lang="postcss">
|
|
@@ -103,7 +103,9 @@ export default defineComponent({
|
|
|
103
103
|
function setColor(color) {
|
|
104
104
|
if (!isBlank.value) {
|
|
105
105
|
replaceColor(canvas.value, color);
|
|
106
|
-
|
|
106
|
+
const result = toDataURL(canvas.value);
|
|
107
|
+
const value = props.modelModifiers.base64 ? result : fromBase64(result);
|
|
108
|
+
model.value = value;
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
watch(() => props.color, setColor);
|
|
@@ -66,7 +66,7 @@ import {
|
|
|
66
66
|
import Button from "../button/Button.vue";
|
|
67
67
|
import { useVModel } from "../input";
|
|
68
68
|
import SignatureDrawDesktop from "./SignatureDrawDesktop.vue";
|
|
69
|
-
import rotateImage from "./utils/
|
|
69
|
+
import { replaceColor, rotateImage } from "./utils/image";
|
|
70
70
|
import IconEdit from "@privyid/persona-icon/vue/edit/20.vue";
|
|
71
71
|
import { pAspectRatio } from "../aspect-ratio";
|
|
72
72
|
import { usePreview } from "../cropper";
|
|
@@ -153,6 +153,14 @@ export default defineComponent({
|
|
|
153
153
|
model.value = value;
|
|
154
154
|
isOpen.value = false;
|
|
155
155
|
}
|
|
156
|
+
watch(() => props.color, async (color) => {
|
|
157
|
+
if (!isOpen.value && preview.value) {
|
|
158
|
+
const result = await replaceColor(preview.value, color);
|
|
159
|
+
const value = props.modelModifiers.base64 ? result : fromBase64(result);
|
|
160
|
+
model.value = value;
|
|
161
|
+
isOpen.value = false;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
156
164
|
watch(isOpen, (value) => {
|
|
157
165
|
if (value)
|
|
158
166
|
document.body.style.setProperty("overflow-y", "hidden");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import loadImage from "../../avatar/utils/load-image.mjs";
|
|
2
|
-
|
|
2
|
+
import { replaceColor as canvasReplaceColor } from "./canvas.mjs";
|
|
3
|
+
export async function rotateImage(url, degrees) {
|
|
3
4
|
const canvas = document.createElement("canvas");
|
|
4
5
|
const context = canvas.getContext("2d");
|
|
5
6
|
const image = await loadImage(url);
|
|
@@ -10,3 +11,13 @@ export default async function rotateImage(url, degrees) {
|
|
|
10
11
|
context.drawImage(image, image.width / -2, image.height / -2);
|
|
11
12
|
return canvas.toDataURL();
|
|
12
13
|
}
|
|
14
|
+
export async function replaceColor(url, color) {
|
|
15
|
+
const canvas = document.createElement("canvas");
|
|
16
|
+
const context = canvas.getContext("2d");
|
|
17
|
+
const image = await loadImage(url);
|
|
18
|
+
canvas.width = image.width;
|
|
19
|
+
canvas.height = image.height;
|
|
20
|
+
context.drawImage(image, 0, 0);
|
|
21
|
+
canvasReplaceColor(canvas, color);
|
|
22
|
+
return canvas.toDataURL();
|
|
23
|
+
}
|
|
@@ -50,8 +50,8 @@ declare const _default: import("vue-demi").DefineComponent<{
|
|
|
50
50
|
}>>, {
|
|
51
51
|
variant: StyleVariant;
|
|
52
52
|
href: RouteLocationRaw;
|
|
53
|
-
element: ElementVariant;
|
|
54
53
|
weight: WeightVariant;
|
|
54
|
+
element: ElementVariant;
|
|
55
55
|
transform: TransformVariant;
|
|
56
56
|
}, {}>;
|
|
57
57
|
export default _default;
|
|
@@ -119,7 +119,7 @@ export default defineComponent({
|
|
|
119
119
|
@apply z-[var(--p-tooltip-z-index)] px-4 py-3 rounded text-xs inline-block absolute drop-shadow-sm;
|
|
120
120
|
|
|
121
121
|
&__arrow {
|
|
122
|
-
@apply absolute after:w-4 after:h-4 after:block after:rounded-[3px] after:rotate-45 after:left-0 after:content-[''] after:z-0;
|
|
122
|
+
@apply absolute text-xs after:w-4 after:h-4 after:block after:rounded-[3px] after:rotate-45 after:left-0 after:content-[''] after:z-0;
|
|
123
123
|
|
|
124
124
|
[data-popper-placement^="left"] > & {
|
|
125
125
|
@apply -right-[6px];
|
package/dist/core/index.d.ts
CHANGED
|
@@ -34,3 +34,4 @@ export { findAllChildren, toBoolean, } from '../components/utils/vnode';
|
|
|
34
34
|
export { createSpinner, createAlias, createText, } from '../components/avatar/utils/create-image';
|
|
35
35
|
export { useSelector, } from '../components/pdf-object/utils/use-selector';
|
|
36
36
|
export { getDocument, } from '../components/pdf-viewer/utils/pdfjs';
|
|
37
|
+
export { usePopoverPromise, } from '../components/popover';
|
package/dist/core/index.mjs
CHANGED
package/dist/module.json
CHANGED
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { ModuleOptions } from './module'
|
|
2
|
+
import type { ModuleOptions } from './module'
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
declare module '@nuxt/schema' {
|
|
5
6
|
interface NuxtConfig { ['persona']?: Partial<ModuleOptions> }
|
|
@@ -12,4 +13,4 @@ declare module 'nuxt/schema' {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
export { ModuleOptions, default } from './module'
|
|
16
|
+
export type { ModuleOptions, default } from './module'
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { ModuleOptions } from './module'
|
|
2
|
+
import type { ModuleOptions } from './module'
|
|
3
|
+
|
|
3
4
|
|
|
4
5
|
declare module '@nuxt/schema' {
|
|
5
6
|
interface NuxtConfig { ['persona']?: Partial<ModuleOptions> }
|
|
@@ -12,4 +13,4 @@ declare module 'nuxt/schema' {
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
|
|
15
|
-
export { ModuleOptions, default } from './module'
|
|
16
|
+
export type { ModuleOptions, default } from './module'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@privyid/persona",
|
|
3
3
|
"description": "Persona core package",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"url": "https://github.com/privy-open-source/design-system.git",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@floating-ui/dom": "1.5.3",
|
|
62
62
|
"@juggle/resize-observer": "3.4.0",
|
|
63
|
-
"@nuxt/kit": "3.
|
|
63
|
+
"@nuxt/kit": "3.8.2",
|
|
64
64
|
"@splidejs/splide": "4.1.4",
|
|
65
65
|
"@testing-library/dom": "9.3.3",
|
|
66
66
|
"@testing-library/user-event": "14.5.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"defu": "6.1.3",
|
|
75
75
|
"fast-equals": "^5.0.0",
|
|
76
76
|
"fuse.js": "7.0.0",
|
|
77
|
-
"interactjs": "1.10.
|
|
77
|
+
"interactjs": "1.10.21",
|
|
78
78
|
"lodash-es": "4.17.21",
|
|
79
79
|
"marked": "5.1.2",
|
|
80
80
|
"nanodelay": "2.0.2",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"extends @privyid/browserslist-config"
|
|
93
93
|
],
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@privyid/browserslist-config": "^0.
|
|
96
|
-
"@privyid/tailwind-preset": "^0.
|
|
95
|
+
"@privyid/browserslist-config": "^0.26.0",
|
|
96
|
+
"@privyid/tailwind-preset": "^0.26.0",
|
|
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.8.2",
|
|
106
106
|
"@nuxtjs/tailwindcss": "^6.2.0",
|
|
107
|
-
"@privyid/browserslist-config": "^0.
|
|
108
|
-
"@privyid/tailwind-preset": "^0.
|
|
107
|
+
"@privyid/browserslist-config": "^0.26.0",
|
|
108
|
+
"@privyid/tailwind-preset": "^0.26.0",
|
|
109
109
|
"@types/sanitize-html": "^2",
|
|
110
110
|
"browserslist-to-esbuild": "^1.2.0",
|
|
111
|
-
"nuxt": "3.
|
|
111
|
+
"nuxt": "3.8.2",
|
|
112
112
|
"postcss-custom-properties": "^13.0.0",
|
|
113
113
|
"postcss-hexrgba": "^2.1.0",
|
|
114
114
|
"postcss-lighten-darken": "^0.9.0",
|