pukaad-ui-lib 1.66.0 → 1.67.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/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.66.0",
4
+ "version": "1.67.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -106,7 +106,8 @@ const provinces = ref([]);
106
106
  const fetchProvinces = async () => {
107
107
  try {
108
108
  const response = await $fetch(
109
- `${BASE_URL_API}/api/master/address/provinces`
109
+ `${BASE_URL_API}/api/master/address/provinces`,
110
+ { credentials: "include" }
110
111
  );
111
112
  const data = response.data ?? response;
112
113
  if (data && Array.isArray(data)) {
@@ -7,7 +7,7 @@
7
7
  v-model="modelValue"
8
8
  >
9
9
  <ShadFormItem>
10
- <ShadFormLabel class="w-full">
10
+ <ShadFormLabel v-if="props.label || $slots.label" class="w-full">
11
11
  <slot name="label">
12
12
  <div
13
13
  :class="[
@@ -67,6 +67,7 @@ const handleSubmit = async () => {
67
67
  try {
68
68
  const res = await $fetch(`${config.public.BASE_URL_API}${apiPath.value}`, {
69
69
  method: "POST",
70
+ credentials: "include",
70
71
  body: {
71
72
  login_token: props.loginToken,
72
73
  password: password.value,
@@ -1,10 +1,10 @@
1
- interface Props {
2
- item?: File | null;
3
- }
4
- declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
- complete: (file: File) => any;
6
- }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
7
- onComplete?: ((file: File) => any) | undefined;
1
+ type __VLS_ModelProps = {
2
+ modelValue?: File | null;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ "update:modelValue": (value: File | null | undefined) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
7
+ "onUpdate:modelValue"?: ((value: File | null | undefined) => any) | undefined;
8
8
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
9
  declare const _default: typeof __VLS_export;
10
10
  export default _default;
@@ -1,32 +1,29 @@
1
1
  <template>
2
- <Dropdown>
3
- <template #default="{ isOpen }">
4
- <Button
5
- prepend-icon="lucide:camera"
6
- size="small"
7
- variant="flat-outline"
8
- color="black"
9
- >
10
- แก้ไขรูปภาพหน้าปก</Button
11
- >
12
- </template>
13
- <template #content>
14
- <div
15
- class="flex gap-[4px] px-[8px] py-[8px] items-center cursor-pointer hover:bg-gray-100"
2
+ <ShadDropdownMenu>
3
+ <ShadDropdownMenuTrigger as-child>
4
+ <Button variant="outline" class="bg-white"
5
+ ><Icon name="lucide:camera" /> แก้ไขรูปภาพหน้าปก
6
+ </Button>
7
+ </ShadDropdownMenuTrigger>
8
+
9
+ <ShadDropdownMenuContent align="start">
10
+ <ShadDropdownMenuItem
11
+ v-if="originalFile || modelValue"
12
+ class="flex gap-[4px] items-center cursor-pointer"
16
13
  @click="onEditImage"
17
14
  >
18
- <Icon name="lucide:crop" />
19
- <div class="font-body-medium">แก้ไขรูปภาพหน้าปก</div>
20
- </div>
21
- <div
22
- class="flex gap-[4px] px-[8px] py-[8px] items-center cursor-pointer hover:bg-gray-100"
15
+ <Icon name="lucide:crop" :size="16" />
16
+ <span class="font-body-medium">แก้ไขรูปภาพหน้าปก</span>
17
+ </ShadDropdownMenuItem>
18
+ <ShadDropdownMenuItem
19
+ class="flex gap-[4px] items-center cursor-pointer"
23
20
  @click="onUploadImage"
24
21
  >
25
- <Icon name="lucide:upload" />
26
- <div class="font-body-medium">อัปโหลดรูปภาพ</div>
27
- </div>
28
- </template>
29
- </Dropdown>
22
+ <Icon name="lucide:upload" :size="16" />
23
+ <span class="font-body-medium">อัปโหลดรูปภาพ</span>
24
+ </ShadDropdownMenuItem>
25
+ </ShadDropdownMenuContent>
26
+ </ShadDropdownMenu>
30
27
  <input
31
28
  ref="fileInputRef"
32
29
  type="file"
@@ -36,13 +33,11 @@
36
33
  />
37
34
  <Modal
38
35
  title="ปรับแต่งรูปภาพหน้าปก"
39
- :width="632"
36
+ class="min-w-[512px]"
40
37
  v-model="isOpenModal"
41
- divider
42
- disabled-padding-content
43
38
  >
44
39
  <div
45
- class="flex justify-center items-center rounded-[8px] overflow-hidden relative p-[16px]"
40
+ class="flex justify-center items-center rounded-[8px] overflow-hidden relative"
46
41
  >
47
42
  <ImageCropper
48
43
  v-if="imageUrl"
@@ -88,8 +83,10 @@
88
83
 
89
84
  <template #footer>
90
85
  <div class="flex items-center gap-[16px] w-full">
91
- <Button variant="outline" full-width @click="onCancel"> ยกเลิก </Button>
92
- <Button color="primary" full-width @click="onCropImage">
86
+ <Button variant="outline" class="w-full" @click="onCancel">
87
+ ยกเลิก
88
+ </Button>
89
+ <Button color="primary" class="w-full" @click="onCropImage">
93
90
  บันทึก
94
91
  </Button>
95
92
  </div>
@@ -105,12 +102,9 @@ const imageUrl = ref(null);
105
102
  const isOpenModal = ref(false);
106
103
  const selectedFile = ref(null);
107
104
  const originalFile = ref(null);
108
- const props = defineProps({
109
- item: { type: null, required: false }
110
- });
111
- const emit = defineEmits(["complete"]);
105
+ const modelValue = defineModel({ type: null });
112
106
  const onEditImage = () => {
113
- const fileToEdit = originalFile.value || props.item;
107
+ const fileToEdit = originalFile.value || modelValue.value;
114
108
  if (fileToEdit) {
115
109
  selectedFile.value = fileToEdit;
116
110
  if (imageUrl.value) {
@@ -155,7 +149,8 @@ const onCropImage = async () => {
155
149
  "image_cover_crop.jpg",
156
150
  "image/jpeg"
157
151
  );
158
- emit("complete", croppedFile);
152
+ originalFile.value = croppedFile;
153
+ modelValue.value = croppedFile;
159
154
  isOpenModal.value = false;
160
155
  if (imageUrl.value) {
161
156
  URL.revokeObjectURL(imageUrl.value);
@@ -1,10 +1,10 @@
1
- interface Props {
2
- item?: File | null;
3
- }
4
- declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
- complete: (file: File) => any;
6
- }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
7
- onComplete?: ((file: File) => any) | undefined;
1
+ type __VLS_ModelProps = {
2
+ modelValue?: File | null;
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ "update:modelValue": (value: File | null | undefined) => any;
6
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
7
+ "onUpdate:modelValue"?: ((value: File | null | undefined) => any) | undefined;
8
8
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
9
  declare const _default: typeof __VLS_export;
10
10
  export default _default;
@@ -6,7 +6,15 @@ const props = defineProps({
6
6
  </script>
7
7
 
8
8
  <template>
9
- <div data-slot="dialog-footer" :class="cn('flex', props.class)">
9
+ <div
10
+ data-slot="dialog-footer"
11
+ :class="
12
+ cn(
13
+ 'flex w-full gap-4 [&_.w-full]:flex-1 [&_.w-full]:!w-auto [&_.w-full]:min-w-0',
14
+ props.class
15
+ )
16
+ "
17
+ >
10
18
  <slot />
11
19
  </div>
12
20
  </template>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.66.0",
3
+ "version": "1.67.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",