vue-hotel-search-widget 1.0.0 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-hotel-search-widget",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A Vue.js hotel search widget component",
5
5
  "type": "module",
6
6
  "main": "./dist/vue-hotel-search-widget.umd.js",
@@ -20,20 +20,20 @@
20
20
  "dev": "vite",
21
21
  "build": "vite build",
22
22
  "preview": "vite preview",
23
- "build:lib": "vite build --mode lib"
23
+ "build:lib": "vite build --mode lib",
24
+ "prepublishOnly": "npm run build:lib"
24
25
  },
25
26
  "dependencies": {
26
- "vue": "^3.5.27",
27
- "primevue": "^4.0.0",
28
27
  "jsencrypt": "^3.3.3"
29
28
  },
30
29
  "peerDependencies": {
31
30
  "vue": "^3.0.0",
32
- "primevue": "^4.0.0"
31
+ "primevue": "^4.5.4",
32
+ "primeicons": "^7.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@vitejs/plugin-vue": "^6.0.3",
36
- "vite": "^7.3.1",
35
+ "@vitejs/plugin-vue": "^5.2.1",
36
+ "vite": "^6.0.5",
37
37
  "vite-plugin-vue-devtools": "^8.0.5"
38
38
  },
39
39
  "engines": {
@@ -45,8 +45,19 @@
45
45
  "hotel",
46
46
  "search",
47
47
  "widget",
48
- "component"
48
+ "component",
49
+ "primevue",
50
+ "travel",
51
+ "booking"
49
52
  ],
50
53
  "author": "",
51
- "license": "MIT"
54
+ "license": "MIT",
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/yourusername/vue-hotel-search-widget.git"
58
+ },
59
+ "bugs": {
60
+ "url": "https://github.com/yourusername/vue-hotel-search-widget/issues"
61
+ },
62
+ "homepage": "https://github.com/yourusername/vue-hotel-search-widget#readme"
52
63
  }
package/src/App.vue ADDED
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <HotelSearchWidget
3
+ :config="widgetConfig"
4
+ :minWidth="1240"
5
+ />
6
+ </template>
7
+
8
+ <script setup>
9
+ import { ref } from 'vue'
10
+ import HotelSearchWidget from './components/HotelSearchWidget.vue'
11
+
12
+ const widgetConfig = ref({
13
+ theme: {
14
+ primary: '#1c6bff',
15
+ secondary: '#00b3a4',
16
+ primaryLight: '#e3f0ff'
17
+ },
18
+ redirectionDomain: 'phoenix.dev.futuretravelplatform.com',
19
+ fontName: 'Montserrat, Segoe UI, system-ui, sans-serif'
20
+ })
21
+ </script>
@@ -266,8 +266,10 @@
266
266
  @click="showCalendar"
267
267
  />
268
268
  <Calendar
269
+ v-if="isCalendarVisible"
269
270
  ref="calendarRef"
270
271
  v-model="dateRange"
272
+ inline
271
273
  selectionMode="range"
272
274
  :numberOfMonths="2"
273
275
  :minDate="new Date()"
@@ -462,6 +464,8 @@
462
464
  <Dropdown
463
465
  :modelValue="room.childAges[childIndex] ?? 0"
464
466
  :options="childAgeOptions"
467
+ optionLabel="label"
468
+ optionValue="value"
465
469
  @update:modelValue="
466
470
  (value) => updateChildAge(index, childIndex, value)
467
471
  "
@@ -866,6 +870,20 @@ const nationalityQuery = ref('')
866
870
  const isDestinationDropdownOpen = ref(false)
867
871
  const isNationalityDropdownOpen = ref(false)
868
872
  const isRoomsGuestsMenuOpen = ref(false)
873
+ const isCalendarVisible = ref(false)
874
+
875
+ // Functions to set dropdown states
876
+ const setIsDestinationDropdownOpen = (value) => {
877
+ isDestinationDropdownOpen.value = value
878
+ }
879
+
880
+ const setIsNationalityDropdownOpen = (value) => {
881
+ isNationalityDropdownOpen.value = value
882
+ }
883
+
884
+ const setIsRoomsGuestsMenuOpen = (value) => {
885
+ isRoomsGuestsMenuOpen.value = value
886
+ }
869
887
 
870
888
  const destinationDropdownRef = ref(null)
871
889
  const nationalityDropdownRef = ref(null)
@@ -1138,18 +1156,14 @@ const handleDateRangeChange = (value) => {
1138
1156
  handleInputChange('checkOut', end)
1139
1157
 
1140
1158
  if (start && end) {
1141
- if (calendarRef.value) {
1142
- calendarRef.value.hide()
1143
- }
1159
+ isCalendarVisible.value = false
1144
1160
  fieldErrors.value.checkIn = false
1145
1161
  fieldErrors.value.checkOut = false
1146
1162
  }
1147
1163
  }
1148
1164
 
1149
1165
  const showCalendar = () => {
1150
- if (calendarRef.value) {
1151
- calendarRef.value.show()
1152
- }
1166
+ isCalendarVisible.value = true
1153
1167
  }
1154
1168
 
1155
1169
  const validateRequiredFields = () => {
@@ -1386,6 +1400,20 @@ const handleClickOutside = (event) => {
1386
1400
  ) {
1387
1401
  isRoomsGuestsMenuOpen.value = false
1388
1402
  }
1403
+
1404
+ // Close calendar if clicking outside
1405
+ const calendarContainer = target.closest('.sw-com-cal')
1406
+ const isCalendarInput = target.closest('#checkIn') || target.closest('#checkOut')
1407
+ const isCalendarElement = target.closest('.p-calendar') || target.closest('.p-datepicker')
1408
+
1409
+ if (
1410
+ isCalendarVisible.value &&
1411
+ !isCalendarInput &&
1412
+ !isCalendarElement &&
1413
+ (!calendarContainer || !calendarContainer.querySelector('.p-calendar'))
1414
+ ) {
1415
+ isCalendarVisible.value = false
1416
+ }
1389
1417
  }
1390
1418
 
1391
1419
  onMounted(() => {
package/src/main.js ADDED
@@ -0,0 +1,11 @@
1
+ import { createApp } from 'vue'
2
+ import PrimeVue from 'primevue/config'
3
+ import 'primeicons/primeicons.css'
4
+ import App from './App.vue'
5
+
6
+ const app = createApp(App)
7
+
8
+ // Configure PrimeVue
9
+ app.use(PrimeVue)
10
+
11
+ app.mount('#app')