pukaad-ui-lib 1.111.0 → 1.112.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.111.0",
4
+ "version": "1.112.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -27,8 +27,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
27
27
  fullHeight: boolean;
28
28
  name: string;
29
29
  limit: number;
30
- accept: string;
31
30
  disabledErrorMessage: boolean;
31
+ accept: string;
32
32
  labelIcon: string;
33
33
  disabledDrop: boolean;
34
34
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -27,8 +27,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
27
27
  fullHeight: boolean;
28
28
  name: string;
29
29
  limit: number;
30
- accept: string;
31
30
  disabledErrorMessage: boolean;
31
+ accept: string;
32
32
  labelIcon: string;
33
33
  disabledDrop: boolean;
34
34
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,10 +1,27 @@
1
+ interface Province {
2
+ id: number;
3
+ name_th: string;
4
+ name_en: string;
5
+ domain: string;
6
+ image_cover_url: string | null;
7
+ }
8
+ type __VLS_Props = {
9
+ items?: Province[];
10
+ itemsPopular?: Province[];
11
+ };
1
12
  type __VLS_ModelProps = {
2
- modelValue?: string;
13
+ modelValue?: Province;
3
14
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
- "update:modelValue": (value: string | undefined) => any;
6
- }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
7
- "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
8
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ select: (province: Province) => any;
18
+ "update:modelValue": (value: Province | undefined) => any;
19
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
+ onSelect?: ((province: Province) => any) | undefined;
21
+ "onUpdate:modelValue"?: ((value: Province | undefined) => any) | undefined;
22
+ }>, {
23
+ items: Province[];
24
+ itemsPopular: Province[];
25
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
26
  declare const _default: typeof __VLS_export;
10
27
  export default _default;
@@ -24,10 +24,10 @@
24
24
  <ShadCarousel>
25
25
  <ShadCarouselContent>
26
26
  <ShadCarouselItem
27
- v-for="province in provinces"
28
- :key="province.value"
27
+ v-for="province in itemsPopular"
28
+ :key="province.id"
29
29
  class="flex cursor-pointer basis-1/3.5"
30
- @click="selectProvince(province.value)"
30
+ @click="selectProvince(province)"
31
31
  >
32
32
  <Card
33
33
  class="relative overflow-hidden bg-mercury w-[140px] h-[180px]"
@@ -35,7 +35,7 @@
35
35
  <!-- No image state -->
36
36
  <template v-if="province.image_cover_url === null">
37
37
  <div class="font-medium">
38
- {{ province.label }}
38
+ {{ province.name_th }}
39
39
  </div>
40
40
  <div
41
41
  class="flex flex-col items-center justify-center gap-[4px] h-full mt-2"
@@ -56,7 +56,7 @@
56
56
  <div
57
57
  class="absolute top-0 left-0 right-0 p-2 font-medium text-white bg-gradient-to-b from-black/70 to-transparent"
58
58
  >
59
- {{ province.label }}
59
+ {{ province.name_th }}
60
60
  </div>
61
61
  </template>
62
62
  </Card>
@@ -70,16 +70,16 @@
70
70
  <ShadCommandGroup>
71
71
  <ShadCommandItem
72
72
  v-for="province in filteredProvinces"
73
- :key="province.value"
74
- :value="province.label"
75
- @select="selectProvince(province.value)"
73
+ :key="province.id"
74
+ :value="province.name_th"
75
+ @select="selectProvince(province)"
76
76
  class="flex items-center justify-between"
77
77
  >
78
78
  <span>
79
- {{ province.label }}
79
+ {{ province.name_th }}
80
80
  </span>
81
81
  <Icon
82
- v-if="modelValue === province.value"
82
+ v-if="modelValue?.id === province.id"
83
83
  name="lucide:check"
84
84
  class="h-4 w-4"
85
85
  />
@@ -96,51 +96,26 @@
96
96
  </template>
97
97
 
98
98
  <script setup>
99
- import { ref, computed, onMounted } from "vue";
100
- import { useFetch, useNuxtApp, useRuntimeConfig } from "nuxt/app";
101
- const { BASE_URL_API } = useRuntimeConfig().public;
102
- const modelValue = defineModel({ type: String });
99
+ import { ref, computed } from "vue";
100
+ const props = defineProps({
101
+ items: { type: Array, required: false, default: () => [] },
102
+ itemsPopular: { type: Array, required: false, default: () => [] }
103
+ });
104
+ const emit = defineEmits(["select"]);
105
+ const modelValue = defineModel({ type: Object });
103
106
  const open = ref(false);
104
107
  const search = ref("");
105
- const provinces = ref([]);
106
- const fetchProvinces = async () => {
107
- try {
108
- const response = await $fetch(
109
- `${BASE_URL_API}/api/master/address/provinces`,
110
- { credentials: "include" }
111
- );
112
- const data = response.data ?? response;
113
- if (data && Array.isArray(data)) {
114
- provinces.value = data.filter((p) => p.is_active === true).map((p) => ({
115
- value: String(p.id),
116
- label: p.name_th,
117
- image_cover_url: p.image_cover_url ?? null,
118
- domain: p.domain ?? null
119
- }));
120
- }
121
- } catch (error) {
122
- console.error("Failed to fetch provinces:", error);
123
- }
124
- };
125
108
  const selectedLabel = computed(() => {
126
- const found = provinces.value.find((p) => p.value === modelValue.value);
127
- return found?.label || "";
109
+ return modelValue.value?.name_th || "";
128
110
  });
129
111
  const filteredProvinces = computed(() => {
130
- if (!search.value) return provinces.value;
112
+ if (!search.value) return props.items;
131
113
  const query = search.value.toLowerCase();
132
- return provinces.value.filter((p) => p.label.toLowerCase().includes(query));
114
+ return props.items.filter((p) => p.name_th.toLowerCase().includes(query));
133
115
  });
134
- const selectProvince = (value) => {
135
- modelValue.value = value;
116
+ const selectProvince = (province) => {
117
+ modelValue.value = province;
136
118
  open.value = false;
137
- const selected = provinces.value.find((p) => p.value === value);
138
- if (selected?.domain) {
139
- const url = selected.domain.startsWith("http") ? selected.domain : `https://${selected.domain}`;
140
- window.location.href = url;
141
- }
119
+ emit("select", province);
142
120
  };
143
- onMounted(() => {
144
- fetchProvinces();
145
- });
146
121
  </script>
@@ -1,10 +1,27 @@
1
+ interface Province {
2
+ id: number;
3
+ name_th: string;
4
+ name_en: string;
5
+ domain: string;
6
+ image_cover_url: string | null;
7
+ }
8
+ type __VLS_Props = {
9
+ items?: Province[];
10
+ itemsPopular?: Province[];
11
+ };
1
12
  type __VLS_ModelProps = {
2
- modelValue?: string;
13
+ modelValue?: Province;
3
14
  };
4
- declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
- "update:modelValue": (value: string | undefined) => any;
6
- }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
7
- "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
8
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ select: (province: Province) => any;
18
+ "update:modelValue": (value: Province | undefined) => any;
19
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
+ onSelect?: ((province: Province) => any) | undefined;
21
+ "onUpdate:modelValue"?: ((value: Province | undefined) => any) | undefined;
22
+ }>, {
23
+ items: Province[];
24
+ itemsPopular: Province[];
25
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
26
  declare const _default: typeof __VLS_export;
10
27
  export default _default;
@@ -45,11 +45,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
45
45
  name: string;
46
46
  disabled: boolean;
47
47
  limit: number;
48
- resize: "none" | "both" | "horizontal" | "vertical";
49
48
  disabledErrorMessage: boolean;
50
49
  disabledBorder: boolean;
51
50
  showCounter: boolean;
52
51
  readonly: boolean;
52
+ resize: "none" | "both" | "horizontal" | "vertical";
53
53
  rows: number;
54
54
  heightScroll: boolean;
55
55
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -45,11 +45,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
45
45
  name: string;
46
46
  disabled: boolean;
47
47
  limit: number;
48
- resize: "none" | "both" | "horizontal" | "vertical";
49
48
  disabledErrorMessage: boolean;
50
49
  disabledBorder: boolean;
51
50
  showCounter: boolean;
52
51
  readonly: boolean;
52
+ resize: "none" | "both" | "horizontal" | "vertical";
53
53
  rows: number;
54
54
  heightScroll: boolean;
55
55
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -59,7 +59,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
59
59
  'aria-colindex'?: (string | number) | undefined;
60
60
  'aria-colspan'?: (string | number) | undefined;
61
61
  'aria-controls'?: string | undefined | undefined;
62
- 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
62
+ 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
63
63
  'aria-describedby'?: string | undefined | undefined;
64
64
  'aria-details'?: string | undefined | undefined;
65
65
  'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -253,7 +253,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
253
253
  'aria-colindex'?: (string | number) | undefined;
254
254
  'aria-colspan'?: (string | number) | undefined;
255
255
  'aria-controls'?: string | undefined | undefined;
256
- 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
256
+ 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
257
257
  'aria-describedby'?: string | undefined | undefined;
258
258
  'aria-details'?: string | undefined | undefined;
259
259
  'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -59,7 +59,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
59
59
  'aria-colindex'?: (string | number) | undefined;
60
60
  'aria-colspan'?: (string | number) | undefined;
61
61
  'aria-controls'?: string | undefined | undefined;
62
- 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
62
+ 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
63
63
  'aria-describedby'?: string | undefined | undefined;
64
64
  'aria-details'?: string | undefined | undefined;
65
65
  'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -253,7 +253,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
253
253
  'aria-colindex'?: (string | number) | undefined;
254
254
  'aria-colspan'?: (string | number) | undefined;
255
255
  'aria-controls'?: string | undefined | undefined;
256
- 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
256
+ 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
257
257
  'aria-describedby'?: string | undefined | undefined;
258
258
  'aria-details'?: string | undefined | undefined;
259
259
  'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -61,7 +61,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
61
61
  'aria-colindex'?: (string | number) | undefined;
62
62
  'aria-colspan'?: (string | number) | undefined;
63
63
  'aria-controls'?: string | undefined | undefined;
64
- 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
64
+ 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
65
65
  'aria-describedby'?: string | undefined | undefined;
66
66
  'aria-details'?: string | undefined | undefined;
67
67
  'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -257,7 +257,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
257
257
  'aria-colindex'?: (string | number) | undefined;
258
258
  'aria-colspan'?: (string | number) | undefined;
259
259
  'aria-controls'?: string | undefined | undefined;
260
- 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
260
+ 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
261
261
  'aria-describedby'?: string | undefined | undefined;
262
262
  'aria-details'?: string | undefined | undefined;
263
263
  'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -61,7 +61,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
61
61
  'aria-colindex'?: (string | number) | undefined;
62
62
  'aria-colspan'?: (string | number) | undefined;
63
63
  'aria-controls'?: string | undefined | undefined;
64
- 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
64
+ 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
65
65
  'aria-describedby'?: string | undefined | undefined;
66
66
  'aria-details'?: string | undefined | undefined;
67
67
  'aria-disabled'?: (boolean | "true" | "false") | undefined;
@@ -257,7 +257,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
257
257
  'aria-colindex'?: (string | number) | undefined;
258
258
  'aria-colspan'?: (string | number) | undefined;
259
259
  'aria-controls'?: string | undefined | undefined;
260
- 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "date" | "step" | "location" | undefined;
260
+ 'aria-current'?: "time" | "page" | (boolean | "true" | "false") | "step" | "location" | "date" | undefined;
261
261
  'aria-describedby'?: string | undefined | undefined;
262
262
  'aria-details'?: string | undefined | undefined;
263
263
  'aria-disabled'?: (boolean | "true" | "false") | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.111.0",
3
+ "version": "1.112.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",