pukaad-ui-lib 1.381.0 → 1.382.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.381.0",
4
+ "version": "1.382.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -81,9 +81,9 @@
81
81
  :key="color.name"
82
82
  class="w-[40px] h-[40px] cursor-pointer transition-all"
83
83
  :class="
84
- selectedColor === color.name ? 'p-[4px] bg-white shadow-xl rounded-[4px]' : ''
84
+ selectedColor === color.hex ? 'p-[4px] bg-white shadow-xl rounded-[4px]' : ''
85
85
  "
86
- @click="selectedColor = color.name"
86
+ @click="selectedColor = color.hex"
87
87
  >
88
88
  <div
89
89
  :style="{ backgroundColor: color.hex }"
@@ -159,22 +159,16 @@ import { ref, computed, watch } from "vue";
159
159
  import { useNuxtApp } from "nuxt/app";
160
160
  import { useApi } from "../../composables/useApi";
161
161
  import { usePresignedUpload } from "../../composables/usePresignedUpload";
162
+ import { CONTENT_COVER_COLORS } from "../../composables/useContentCard";
162
163
  const emit = defineEmits(["success", "saveDraft"]);
163
164
  const { $toast, $alert } = useNuxtApp();
164
165
  const api = useApi();
165
166
  const { uploadFiles } = usePresignedUpload();
166
- const colors = [
167
- { hex: "#E6DEFF", name: "purple-info" },
168
- { hex: "#C9E8FF", name: "blue-info" },
169
- { hex: "#DEFFE1", name: "green-info" },
170
- { hex: "#FFF5C2", name: "yellow-info" },
171
- { hex: "#FDD", name: "red-info" },
172
- { hex: "#FFE6F4", name: "pink-info" }
173
- ];
167
+ const colors = CONTENT_COVER_COLORS;
174
168
  const props = defineProps({
175
169
  item: { type: Object, required: false, default: () => ({
176
170
  coverText: "",
177
- coverColor: "purple-info",
171
+ coverColor: "#E6DEFF",
178
172
  coverFiles: [],
179
173
  posterFiles: [],
180
174
  description: "",
@@ -185,7 +179,7 @@ const props = defineProps({
185
179
  });
186
180
  const modelValue = defineModel({ type: Boolean });
187
181
  const currentId = ref(void 0);
188
- const selectedColor = ref(colors[0].name);
182
+ const selectedColor = ref(colors[0].hex);
189
183
  const coverText = ref("");
190
184
  const coverFiles = ref([]);
191
185
  const posterFiles = ref([]);
@@ -202,9 +196,6 @@ const drawerTitle = computed(() => isEditMode.value ? "\u0E41\u0E01\u0E49\u0E44\
202
196
  const previewLocation = computed(() => selectedPlaces.value[0]?.address);
203
197
  const hasCoverText = computed(() => !!coverText.value?.trim());
204
198
  const hasCoverFile = computed(() => coverFiles.value.length > 0);
205
- const selectedColorHex = computed(
206
- () => colors.find((c) => c.name === selectedColor.value)?.hex
207
- );
208
199
  const coverFileType = computed(() => {
209
200
  const first = coverFiles.value[0];
210
201
  if (!first) return null;
@@ -253,7 +244,7 @@ const previewItem = computed(() => {
253
244
  id: "preview",
254
245
  type: "postIt",
255
246
  content: coverText.value,
256
- backgroundColor: selectedColorHex.value,
247
+ backgroundColor: selectedColor.value,
257
248
  location: previewLocation.value
258
249
  };
259
250
  }
@@ -286,7 +277,7 @@ const deleteDraft = async (draftId) => {
286
277
  const applyItem = (item) => {
287
278
  currentId.value = item.id;
288
279
  coverText.value = item.coverText ?? "";
289
- selectedColor.value = item.coverColor || colors[0].name;
280
+ selectedColor.value = item.coverColor || colors[0].hex;
290
281
  coverFiles.value = (item.coverFiles ?? []).map((f) => ({ ...f }));
291
282
  posterFiles.value = (item.posterFiles ?? []).map((f) => ({ ...f }));
292
283
  description.value = item.description ?? "";
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
64
64
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
65
65
  src: string;
66
66
  center: boolean;
67
+ background: boolean;
68
+ modal: boolean;
67
69
  responsive: boolean;
68
70
  restore: boolean;
69
71
  checkCrossOrigin: boolean;
70
72
  checkOrientation: boolean;
71
73
  crossorigin: "" | "anonymous" | "use-credentials";
72
- modal: boolean;
73
74
  guides: boolean;
74
75
  highlight: boolean;
75
- background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
@@ -64,15 +64,15 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
64
64
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImageCropperProps> & Readonly<{}>, {
65
65
  src: string;
66
66
  center: boolean;
67
+ background: boolean;
68
+ modal: boolean;
67
69
  responsive: boolean;
68
70
  restore: boolean;
69
71
  checkCrossOrigin: boolean;
70
72
  checkOrientation: boolean;
71
73
  crossorigin: "" | "anonymous" | "use-credentials";
72
- modal: boolean;
73
74
  guides: boolean;
74
75
  highlight: boolean;
75
- background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
@@ -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;
@@ -35,8 +35,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
35
35
  fullHeight: boolean;
36
36
  fullWidth: boolean;
37
37
  limit: number;
38
- accept: string;
39
38
  disabledErrorMessage: boolean;
39
+ accept: string;
40
40
  labelIcon: string;
41
41
  disabledDrop: boolean;
42
42
  column: boolean;
@@ -35,8 +35,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
35
35
  fullHeight: boolean;
36
36
  fullWidth: boolean;
37
37
  limit: number;
38
- accept: string;
39
38
  disabledErrorMessage: boolean;
39
+ accept: string;
40
40
  labelIcon: string;
41
41
  disabledDrop: boolean;
42
42
  column: boolean;
@@ -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;
@@ -11,12 +11,12 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
12
  "update:modelValue": (value: File | null) => any;
13
13
  } & {
14
- complete: (file: File) => any;
15
14
  remove: () => any;
15
+ complete: (file: File) => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
17
  "onUpdate:modelValue"?: ((value: File | null) => any) | undefined;
18
- onComplete?: ((file: File) => any) | undefined;
19
18
  onRemove?: (() => any) | undefined;
19
+ onComplete?: ((file: File) => any) | undefined;
20
20
  }>, {
21
21
  name: string;
22
22
  disabledErrorMessage: boolean;
@@ -11,12 +11,12 @@ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
12
  "update:modelValue": (value: File | null) => any;
13
13
  } & {
14
- complete: (file: File) => any;
15
14
  remove: () => any;
15
+ complete: (file: File) => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
17
  "onUpdate:modelValue"?: ((value: File | null) => any) | undefined;
18
- onComplete?: ((file: File) => any) | undefined;
19
18
  onRemove?: (() => any) | undefined;
19
+ onComplete?: ((file: File) => any) | undefined;
20
20
  }>, {
21
21
  name: string;
22
22
  disabledErrorMessage: boolean;
@@ -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;
@@ -0,0 +1,25 @@
1
+ import type { CardContentItem } from "#pukaad-ui/types/components/card/card-content";
2
+ export interface ContentCoverColor {
3
+ name: string;
4
+ hex: string;
5
+ }
6
+ export declare const CONTENT_COVER_COLORS: ContentCoverColor[];
7
+ export interface RawContentCard {
8
+ id: string;
9
+ content_type: string;
10
+ cover_text?: string;
11
+ cover_color?: string;
12
+ video_poster_url?: string;
13
+ description?: string;
14
+ media?: {
15
+ media_type: string;
16
+ url: string;
17
+ }[];
18
+ places?: {
19
+ name: string;
20
+ address: string;
21
+ }[];
22
+ is_pinned?: boolean;
23
+ is_liked?: boolean;
24
+ }
25
+ export declare const mapContentToCard: (raw: RawContentCard) => CardContentItem;
@@ -0,0 +1,31 @@
1
+ export const CONTENT_COVER_COLORS = [
2
+ { hex: "#E6DEFF", name: "purple-info" },
3
+ { hex: "#C9E8FF", name: "blue-info" },
4
+ { hex: "#DEFFE1", name: "green-info" },
5
+ { hex: "#FFF5C2", name: "yellow-info" },
6
+ { hex: "#FDD", name: "red-info" },
7
+ { hex: "#FFE6F4", name: "pink-info" }
8
+ ];
9
+ export const mapContentToCard = (raw) => {
10
+ const type = raw.content_type === "post_it" ? "postIt" : raw.content_type;
11
+ const firstMedia = raw.media?.[0];
12
+ const place = raw.places?.[0];
13
+ const item = {
14
+ id: raw.id,
15
+ type,
16
+ location: place?.address || place?.name,
17
+ pinned: !!raw.is_pinned,
18
+ bookmarked: !!raw.is_liked
19
+ };
20
+ if (type === "postIt") {
21
+ item.content = raw.cover_text;
22
+ item.backgroundColor = raw.cover_color;
23
+ } else if (type === "image") {
24
+ item.content = raw.description;
25
+ item.image = firstMedia?.url;
26
+ } else if (type === "video") {
27
+ item.title = raw.description;
28
+ item.video = { src: firstMedia?.url ?? "", poster: raw.video_poster_url };
29
+ }
30
+ return item;
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.381.0",
3
+ "version": "1.382.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",