pukaad-ui-lib 1.436.0 → 1.438.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.
Files changed (27) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/card/card-blog.d.vue.ts +1 -1
  3. package/dist/runtime/components/card/card-blog.vue.d.ts +1 -1
  4. package/dist/runtime/components/card/card-profile/card-profile-header.d.vue.ts +1 -1
  5. package/dist/runtime/components/card/card-profile/card-profile-header.vue.d.ts +1 -1
  6. package/dist/runtime/components/chat/chat-conversation-item.d.vue.ts +3 -3
  7. package/dist/runtime/components/chat/chat-conversation-item.vue.d.ts +3 -3
  8. package/dist/runtime/components/input/input-address.d.vue.ts +1 -1
  9. package/dist/runtime/components/input/input-address.vue.d.ts +1 -1
  10. package/dist/runtime/components/input/input-file.d.vue.ts +1 -1
  11. package/dist/runtime/components/input/input-file.vue.d.ts +1 -1
  12. package/dist/runtime/components/input/input-id-card.d.vue.ts +45 -0
  13. package/dist/runtime/components/input/input-id-card.vue +114 -0
  14. package/dist/runtime/components/input/input-id-card.vue.d.ts +45 -0
  15. package/dist/runtime/components/input/input-passport.d.vue.ts +25 -0
  16. package/dist/runtime/components/input/input-passport.vue +80 -0
  17. package/dist/runtime/components/input/input-passport.vue.d.ts +25 -0
  18. package/dist/runtime/components/input/input-password.d.vue.ts +1 -1
  19. package/dist/runtime/components/input/input-password.vue.d.ts +1 -1
  20. package/dist/runtime/components/input/input-personal-card-id-selfie.d.vue.ts +25 -0
  21. package/dist/runtime/components/input/input-personal-card-id-selfie.vue +80 -0
  22. package/dist/runtime/components/input/input-personal-card-id-selfie.vue.d.ts +25 -0
  23. package/dist/runtime/components/modal/modal-password-confirmed.d.vue.ts +1 -1
  24. package/dist/runtime/components/modal/modal-password-confirmed.vue.d.ts +1 -1
  25. package/dist/runtime/components/modal/modal-password-verify.d.vue.ts +1 -1
  26. package/dist/runtime/components/modal/modal-password-verify.vue.d.ts +1 -1
  27. package/package.json +1 -1
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.436.0",
4
+ "version": "1.438.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -38,8 +38,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
38
38
  "onBlog-updated"?: ((id: string, data: any) => any) | undefined;
39
39
  "onBlog-deleted"?: ((id: string) => any) | undefined;
40
40
  }>, {
41
- isMyProfile: boolean;
42
41
  disabledMenu: boolean;
42
+ isMyProfile: boolean;
43
43
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
45
45
  export default _default;
@@ -38,8 +38,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
38
38
  "onBlog-updated"?: ((id: string, data: any) => any) | undefined;
39
39
  "onBlog-deleted"?: ((id: string) => any) | undefined;
40
40
  }>, {
41
- isMyProfile: boolean;
42
41
  disabledMenu: boolean;
42
+ isMyProfile: boolean;
43
43
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
45
45
  export default _default;
@@ -7,8 +7,8 @@ declare const __VLS_export: import("vue").DefineComponent<CardProfileAboutProps,
7
7
  onChat?: (() => any) | undefined;
8
8
  }>, {
9
9
  type: "article" | "media" | "sale-info";
10
- disabledPadding: boolean;
11
10
  preview: boolean;
11
+ disabledPadding: boolean;
12
12
  optionMenuButtonType: "solid" | "text";
13
13
  actionsHidden: boolean;
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -7,8 +7,8 @@ declare const __VLS_export: import("vue").DefineComponent<CardProfileAboutProps,
7
7
  onChat?: (() => any) | undefined;
8
8
  }>, {
9
9
  type: "article" | "media" | "sale-info";
10
- disabledPadding: boolean;
11
10
  preview: boolean;
11
+ disabledPadding: boolean;
12
12
  optionMenuButtonType: "solid" | "text";
13
13
  actionsHidden: boolean;
14
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -26,13 +26,13 @@ declare const __VLS_export: import("vue").DefineComponent<ChatConversationItemPr
26
26
  name: string;
27
27
  avatar: string | null;
28
28
  muted: boolean;
29
- disabledMenu: boolean;
30
- unreadCount: number;
31
- pinned: boolean;
32
29
  preview: string;
33
30
  to: string;
34
31
  active: boolean;
35
32
  typing: boolean;
33
+ unreadCount: number;
34
+ pinned: boolean;
35
+ disabledMenu: boolean;
36
36
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
37
  declare const _default: typeof __VLS_export;
38
38
  export default _default;
@@ -26,13 +26,13 @@ declare const __VLS_export: import("vue").DefineComponent<ChatConversationItemPr
26
26
  name: string;
27
27
  avatar: string | null;
28
28
  muted: boolean;
29
- disabledMenu: boolean;
30
- unreadCount: number;
31
- pinned: boolean;
32
29
  preview: string;
33
30
  to: string;
34
31
  active: boolean;
35
32
  typing: boolean;
33
+ unreadCount: number;
34
+ pinned: boolean;
35
+ disabledMenu: boolean;
36
36
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
37
  declare const _default: typeof __VLS_export;
38
38
  export default _default;
@@ -50,10 +50,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
50
50
  name: string;
51
51
  required: boolean;
52
52
  placeholder: string;
53
- gap: string;
54
53
  labelDetail: string;
55
54
  placeholderDetail: string;
56
55
  requiredDetail: boolean;
56
+ gap: string;
57
57
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
58
58
  declare const _default: typeof __VLS_export;
59
59
  export default _default;
@@ -50,10 +50,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
50
50
  name: string;
51
51
  required: boolean;
52
52
  placeholder: string;
53
- gap: string;
54
53
  labelDetail: string;
55
54
  placeholderDetail: string;
56
55
  requiredDetail: boolean;
56
+ gap: string;
57
57
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
58
58
  declare const _default: typeof __VLS_export;
59
59
  export default _default;
@@ -37,8 +37,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
37
37
  fullHeight: boolean;
38
38
  fullWidth: boolean;
39
39
  limit: number;
40
- accept: string;
41
40
  disabledErrorMessage: boolean;
41
+ accept: string;
42
42
  labelIcon: string;
43
43
  disabledDrop: boolean;
44
44
  column: boolean;
@@ -37,8 +37,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
37
37
  fullHeight: boolean;
38
38
  fullWidth: boolean;
39
39
  limit: number;
40
- accept: string;
41
40
  disabledErrorMessage: boolean;
41
+ accept: string;
42
42
  labelIcon: string;
43
43
  disabledDrop: boolean;
44
44
  column: boolean;
@@ -0,0 +1,45 @@
1
+ type ValidationRule = (value: string) => boolean | string | Promise<boolean | string>;
2
+ export interface InputIdCardProps {
3
+ id?: string;
4
+ name?: string;
5
+ label?: string;
6
+ required?: boolean;
7
+ rules?: ValidationRule | ValidationRule[] | object | string;
8
+ disabled?: boolean;
9
+ error?: string;
10
+ }
11
+ type __VLS_Props = InputIdCardProps;
12
+ type __VLS_ModelProps = {
13
+ modelValue?: string;
14
+ };
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare var __VLS_21: {};
17
+ type __VLS_Slots = {} & {
18
+ label?: (props: typeof __VLS_21) => any;
19
+ };
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
21
+ setErrors: (messages: string[]) => void;
22
+ validate: () => Promise<any>;
23
+ fieldRef: import("vue").Ref<any, any>;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ "update:modelValue": (value: string) => any;
26
+ complete: (value: string) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
28
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
29
+ onComplete?: ((value: string) => any) | undefined;
30
+ }>, {
31
+ label: string;
32
+ disabled: boolean;
33
+ error: string;
34
+ id: string;
35
+ name: string;
36
+ required: boolean;
37
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
39
+ declare const _default: typeof __VLS_export;
40
+ export default _default;
41
+ type __VLS_WithSlots<T, S> = T & {
42
+ new (): {
43
+ $slots: S;
44
+ };
45
+ };
@@ -0,0 +1,114 @@
1
+ <template>
2
+ <ShadFormField
3
+ ref="fieldRef"
4
+ v-model="modelValue"
5
+ :name="props.name"
6
+ :rules="props.rules || defaultRules"
7
+ v-slot="{ errorMessage: formError }"
8
+ >
9
+ <ShadFormItem>
10
+ <ShadFormLabel v-if="props.label || $slots.label" class="w-full">
11
+ <slot name="label">
12
+ {{ props.label }}
13
+ <span v-if="props.required" class="text-destructive">*</span>
14
+ </slot>
15
+ </ShadFormLabel>
16
+
17
+ <div class="max-w-full overflow-x-auto p-[2px]">
18
+ <ShadPinInput
19
+ :id="props.id || props.name"
20
+ v-model="digits"
21
+ type="number"
22
+ placeholder="0"
23
+ :disabled="props.disabled"
24
+ :name="props.name"
25
+ :required="props.required"
26
+ @complete="handleComplete"
27
+ >
28
+ <ShadPinInputGroup class="w-max gap-[8px]">
29
+ <template v-for="index in 13" :key="index">
30
+ <ShadFormControl :index="index - 1">
31
+ <ShadPinInputSlot
32
+ class="h-[48px] w-[40px] rounded-[6px]"
33
+ :class="{
34
+ 'border-destructive': formError || props.error
35
+ }"
36
+ />
37
+ </ShadFormControl>
38
+
39
+ <ShadPinInputSeparator
40
+ v-if="separatorIndexes.includes(index)"
41
+ class="font-body-large text-gray"
42
+ >
43
+ –
44
+ </ShadPinInputSeparator>
45
+ </template>
46
+ </ShadPinInputGroup>
47
+ </ShadPinInput>
48
+ </div>
49
+
50
+ <p
51
+ v-if="formError || props.error"
52
+ class="font-body-small text-destructive"
53
+ >
54
+ {{ formError || props.error }}
55
+ </p>
56
+ </ShadFormItem>
57
+ </ShadFormField>
58
+ </template>
59
+
60
+ <script setup>
61
+ import { ref, watch } from "vue";
62
+ const props = defineProps({
63
+ id: { type: String, required: false, default: "input-id-card" },
64
+ name: { type: String, required: false, default: "input-id-card" },
65
+ label: { type: String, required: false, default: "\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E1B\u0E23\u0E30\u0E0A\u0E32\u0E0A\u0E19" },
66
+ required: { type: Boolean, required: false, default: true },
67
+ rules: { type: [Function, Array, Object, String], required: false },
68
+ disabled: { type: Boolean, required: false, default: false },
69
+ error: { type: String, required: false, default: "" }
70
+ });
71
+ const emit = defineEmits(["complete"]);
72
+ const modelValue = defineModel({ type: String, ...{ default: "" } });
73
+ const digits = ref([]);
74
+ const fieldRef = ref();
75
+ const separatorIndexes = [1, 5, 10, 12];
76
+ const defaultRules = (value) => {
77
+ if (!value && props.required) return "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E01\u0E23\u0E2D\u0E01\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E1B\u0E23\u0E30\u0E0A\u0E32\u0E0A\u0E19";
78
+ if (value && !/^\d{13}$/.test(value)) {
79
+ return "\u0E40\u0E25\u0E02\u0E1A\u0E31\u0E15\u0E23\u0E1B\u0E23\u0E30\u0E0A\u0E32\u0E0A\u0E19\u0E15\u0E49\u0E2D\u0E07\u0E21\u0E35 13 \u0E2B\u0E25\u0E31\u0E01";
80
+ }
81
+ return true;
82
+ };
83
+ const handleComplete = (value) => {
84
+ const idCard = value.join("");
85
+ modelValue.value = idCard;
86
+ emit("complete", idCard);
87
+ };
88
+ watch(
89
+ digits,
90
+ (value) => {
91
+ modelValue.value = value.join("");
92
+ },
93
+ { deep: true }
94
+ );
95
+ watch(
96
+ modelValue,
97
+ (value) => {
98
+ const nextDigits = value.replace(/\D/g, "").slice(0, 13).split("").map(Number);
99
+ if (nextDigits.join("") !== digits.value.join("")) {
100
+ digits.value = nextDigits;
101
+ }
102
+ },
103
+ { immediate: true }
104
+ );
105
+ const setErrors = (messages) => {
106
+ fieldRef.value?.setErrors(messages);
107
+ };
108
+ const validate = async () => fieldRef.value?.validate?.();
109
+ defineExpose({
110
+ setErrors,
111
+ validate,
112
+ fieldRef
113
+ });
114
+ </script>
@@ -0,0 +1,45 @@
1
+ type ValidationRule = (value: string) => boolean | string | Promise<boolean | string>;
2
+ export interface InputIdCardProps {
3
+ id?: string;
4
+ name?: string;
5
+ label?: string;
6
+ required?: boolean;
7
+ rules?: ValidationRule | ValidationRule[] | object | string;
8
+ disabled?: boolean;
9
+ error?: string;
10
+ }
11
+ type __VLS_Props = InputIdCardProps;
12
+ type __VLS_ModelProps = {
13
+ modelValue?: string;
14
+ };
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare var __VLS_21: {};
17
+ type __VLS_Slots = {} & {
18
+ label?: (props: typeof __VLS_21) => any;
19
+ };
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
21
+ setErrors: (messages: string[]) => void;
22
+ validate: () => Promise<any>;
23
+ fieldRef: import("vue").Ref<any, any>;
24
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ "update:modelValue": (value: string) => any;
26
+ complete: (value: string) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
28
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
29
+ onComplete?: ((value: string) => any) | undefined;
30
+ }>, {
31
+ label: string;
32
+ disabled: boolean;
33
+ error: string;
34
+ id: string;
35
+ name: string;
36
+ required: boolean;
37
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
39
+ declare const _default: typeof __VLS_export;
40
+ export default _default;
41
+ type __VLS_WithSlots<T, S> = T & {
42
+ new (): {
43
+ $slots: S;
44
+ };
45
+ };
@@ -0,0 +1,25 @@
1
+ export interface InputPassportProps {
2
+ name?: string;
3
+ disabledErrorMessage?: boolean;
4
+ preview?: string;
5
+ }
6
+ type __VLS_Props = InputPassportProps;
7
+ type __VLS_ModelProps = {
8
+ modelValue?: File | null;
9
+ };
10
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: File | null) => any;
13
+ } & {
14
+ complete: (file: File) => any;
15
+ remove: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: File | null) => any) | undefined;
18
+ onComplete?: ((file: File) => any) | undefined;
19
+ onRemove?: (() => any) | undefined;
20
+ }>, {
21
+ name: string;
22
+ disabledErrorMessage: boolean;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div class="space-y-[4px]">
3
+ <div
4
+ class="relative w-full aspect-[224/126] rounded-[8px] overflow-hidden cursor-pointer group border-2 border-dashed"
5
+ :class="previewUrl ? 'border-transparent bg-cover bg-center' : 'border-mercury bg-white'"
6
+ :style="previewUrl ? { backgroundImage: `url(${previewUrl})` } : void 0"
7
+ @click="isOpenModal = true"
8
+ >
9
+ <div
10
+ v-if="!previewUrl"
11
+ class="absolute inset-0 flex flex-col justify-center items-center gap-[8px] text-primary"
12
+ >
13
+ <Icon name="lucide:upload" :size="24" />
14
+ <div class="font-body-small">คลิกเพื่ออัปโหลด</div>
15
+ </div>
16
+
17
+ <template v-else>
18
+ <div
19
+ class="absolute bottom-0 w-full text-white bg-black/50 flex gap-[8px] items-center justify-center py-[8px]"
20
+ >
21
+ <Icon name="lucide:upload" :size="20" />
22
+ <div class="font-body-medium">อัปโหลดรูปภาพหนังสือเดินทาง</div>
23
+ </div>
24
+ <div
25
+ class="absolute top-[8px] right-[8px] p-[4px] bg-white/80 rounded-full cursor-pointer flex justify-center items-center opacity-0 group-hover:opacity-100 transition-opacity"
26
+ @click.stop="onRemove"
27
+ >
28
+ <Icon name="lucide:x" :size="16" />
29
+ </div>
30
+ </template>
31
+ </div>
32
+
33
+ <div
34
+ v-if="!props.disabledErrorMessage && errorMessage"
35
+ class="font-body-small text-destructive"
36
+ >
37
+ {{ errorMessage }}
38
+ </div>
39
+
40
+ <ModalPassport
41
+ v-model="isOpenModal"
42
+ :item="previewUrl"
43
+ @complete="onComplete"
44
+ />
45
+ </div>
46
+ </template>
47
+
48
+ <script setup>
49
+ import { ref, watch } from "vue";
50
+ import { useField } from "vee-validate";
51
+ const props = defineProps({
52
+ name: { type: String, required: false, default: "input-passport" },
53
+ disabledErrorMessage: { type: Boolean, required: false, default: false },
54
+ preview: { type: String, required: false }
55
+ });
56
+ const emit = defineEmits(["complete", "remove"]);
57
+ const { errorMessage } = useField(props.name);
58
+ const modelValue = defineModel({ type: null, ...{ default: null } });
59
+ const isOpenModal = ref(false);
60
+ const previewUrl = ref(props.preview);
61
+ watch(
62
+ () => props.preview,
63
+ (v) => {
64
+ previewUrl.value = v;
65
+ }
66
+ );
67
+ const onComplete = (file) => {
68
+ previewUrl.value = URL.createObjectURL(file);
69
+ modelValue.value = file;
70
+ emit("complete", file);
71
+ };
72
+ const onRemove = () => {
73
+ if (previewUrl.value?.startsWith("blob:")) {
74
+ URL.revokeObjectURL(previewUrl.value);
75
+ }
76
+ previewUrl.value = void 0;
77
+ modelValue.value = null;
78
+ emit("remove");
79
+ };
80
+ </script>
@@ -0,0 +1,25 @@
1
+ export interface InputPassportProps {
2
+ name?: string;
3
+ disabledErrorMessage?: boolean;
4
+ preview?: string;
5
+ }
6
+ type __VLS_Props = InputPassportProps;
7
+ type __VLS_ModelProps = {
8
+ modelValue?: File | null;
9
+ };
10
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: File | null) => any;
13
+ } & {
14
+ complete: (file: File) => any;
15
+ remove: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: File | null) => any) | undefined;
18
+ onComplete?: ((file: File) => any) | undefined;
19
+ onRemove?: (() => any) | undefined;
20
+ }>, {
21
+ name: string;
22
+ disabledErrorMessage: boolean;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
22
22
  }>, {
23
23
  id: string;
24
24
  name: string;
25
- disabledForgotPassword: boolean;
26
25
  new: boolean;
26
+ disabledForgotPassword: boolean;
27
27
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
28
  declare const _default: typeof __VLS_export;
29
29
  export default _default;
@@ -22,8 +22,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
22
22
  }>, {
23
23
  id: string;
24
24
  name: string;
25
- disabledForgotPassword: boolean;
26
25
  new: boolean;
26
+ disabledForgotPassword: boolean;
27
27
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
28
  declare const _default: typeof __VLS_export;
29
29
  export default _default;
@@ -0,0 +1,25 @@
1
+ export interface InputPersonalCardIdSelfieProps {
2
+ name?: string;
3
+ disabledErrorMessage?: boolean;
4
+ preview?: string;
5
+ }
6
+ type __VLS_Props = InputPersonalCardIdSelfieProps;
7
+ type __VLS_ModelProps = {
8
+ modelValue?: File | null;
9
+ };
10
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: File | null) => any;
13
+ } & {
14
+ complete: (file: File) => any;
15
+ remove: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: File | null) => any) | undefined;
18
+ onComplete?: ((file: File) => any) | undefined;
19
+ onRemove?: (() => any) | undefined;
20
+ }>, {
21
+ name: string;
22
+ disabledErrorMessage: boolean;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div class="space-y-[4px]">
3
+ <div
4
+ class="relative w-full aspect-[224/126] rounded-[8px] overflow-hidden cursor-pointer group border-2 border-dashed"
5
+ :class="previewUrl ? 'border-transparent bg-cover bg-center' : 'border-mercury bg-white'"
6
+ :style="previewUrl ? { backgroundImage: `url(${previewUrl})` } : void 0"
7
+ @click="isOpenModal = true"
8
+ >
9
+ <div
10
+ v-if="!previewUrl"
11
+ class="absolute inset-0 flex flex-col justify-center items-center gap-[8px] text-primary"
12
+ >
13
+ <Icon name="lucide:upload" :size="24" />
14
+ <div class="font-body-small">คลิกเพื่ออัปโหลด</div>
15
+ </div>
16
+
17
+ <template v-else>
18
+ <div
19
+ class="absolute bottom-0 w-full text-white bg-black/50 flex gap-[8px] items-center justify-center py-[8px]"
20
+ >
21
+ <Icon name="lucide:upload" :size="20" />
22
+ <div class="font-body-medium">อัปโหลดรูปใบหน้าและบัตร</div>
23
+ </div>
24
+ <div
25
+ class="absolute top-[8px] right-[8px] p-[4px] bg-white/80 rounded-full cursor-pointer flex justify-center items-center opacity-0 group-hover:opacity-100 transition-opacity"
26
+ @click.stop="onRemove"
27
+ >
28
+ <Icon name="lucide:x" :size="16" />
29
+ </div>
30
+ </template>
31
+ </div>
32
+
33
+ <div
34
+ v-if="!props.disabledErrorMessage && errorMessage"
35
+ class="font-body-small text-destructive"
36
+ >
37
+ {{ errorMessage }}
38
+ </div>
39
+
40
+ <ModalPersonalCardIDSelfie
41
+ v-model="isOpenModal"
42
+ :item="previewUrl"
43
+ @complete="onComplete"
44
+ />
45
+ </div>
46
+ </template>
47
+
48
+ <script setup>
49
+ import { ref, watch } from "vue";
50
+ import { useField } from "vee-validate";
51
+ const props = defineProps({
52
+ name: { type: String, required: false, default: "input-personal-card-id-selfie" },
53
+ disabledErrorMessage: { type: Boolean, required: false, default: false },
54
+ preview: { type: String, required: false }
55
+ });
56
+ const emit = defineEmits(["complete", "remove"]);
57
+ const { errorMessage } = useField(props.name);
58
+ const modelValue = defineModel({ type: null, ...{ default: null } });
59
+ const isOpenModal = ref(false);
60
+ const previewUrl = ref(props.preview);
61
+ watch(
62
+ () => props.preview,
63
+ (v) => {
64
+ previewUrl.value = v;
65
+ }
66
+ );
67
+ const onComplete = (file) => {
68
+ previewUrl.value = URL.createObjectURL(file);
69
+ modelValue.value = file;
70
+ emit("complete", file);
71
+ };
72
+ const onRemove = () => {
73
+ if (previewUrl.value?.startsWith("blob:")) {
74
+ URL.revokeObjectURL(previewUrl.value);
75
+ }
76
+ previewUrl.value = void 0;
77
+ modelValue.value = null;
78
+ emit("remove");
79
+ };
80
+ </script>
@@ -0,0 +1,25 @@
1
+ export interface InputPersonalCardIdSelfieProps {
2
+ name?: string;
3
+ disabledErrorMessage?: boolean;
4
+ preview?: string;
5
+ }
6
+ type __VLS_Props = InputPersonalCardIdSelfieProps;
7
+ type __VLS_ModelProps = {
8
+ modelValue?: File | null;
9
+ };
10
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: File | null) => any;
13
+ } & {
14
+ complete: (file: File) => any;
15
+ remove: () => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: File | null) => any) | undefined;
18
+ onComplete?: ((file: File) => any) | undefined;
19
+ onRemove?: (() => any) | undefined;
20
+ }>, {
21
+ name: string;
22
+ disabledErrorMessage: boolean;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
24
24
  }) => any) | undefined;
25
25
  }>, {
26
26
  title: string;
27
- confirmText: string;
28
27
  disabledForgotPassword: boolean;
28
+ confirmText: string;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: typeof __VLS_export;
31
31
  export default _default;
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
24
24
  }) => any) | undefined;
25
25
  }>, {
26
26
  title: string;
27
- confirmText: string;
28
27
  disabledForgotPassword: boolean;
28
+ confirmText: string;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: typeof __VLS_export;
31
31
  export default _default;
@@ -32,8 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
32
32
  }>, {
33
33
  title: string;
34
34
  mode: "login" | "secure";
35
- confirmText: string;
36
35
  disabledForgotPassword: boolean;
36
+ confirmText: string;
37
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
38
  declare const _default: typeof __VLS_export;
39
39
  export default _default;
@@ -32,8 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
32
32
  }>, {
33
33
  title: string;
34
34
  mode: "login" | "secure";
35
- confirmText: string;
36
35
  disabledForgotPassword: boolean;
36
+ confirmText: string;
37
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
38
  declare const _default: typeof __VLS_export;
39
39
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.436.0",
3
+ "version": "1.438.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",