vue-hotel-search-widget 1.0.0 → 1.0.1

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.1",
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()"
@@ -866,6 +868,20 @@ const nationalityQuery = ref('')
866
868
  const isDestinationDropdownOpen = ref(false)
867
869
  const isNationalityDropdownOpen = ref(false)
868
870
  const isRoomsGuestsMenuOpen = ref(false)
871
+ const isCalendarVisible = ref(false)
872
+
873
+ // Functions to set dropdown states
874
+ const setIsDestinationDropdownOpen = (value) => {
875
+ isDestinationDropdownOpen.value = value
876
+ }
877
+
878
+ const setIsNationalityDropdownOpen = (value) => {
879
+ isNationalityDropdownOpen.value = value
880
+ }
881
+
882
+ const setIsRoomsGuestsMenuOpen = (value) => {
883
+ isRoomsGuestsMenuOpen.value = value
884
+ }
869
885
 
870
886
  const destinationDropdownRef = ref(null)
871
887
  const nationalityDropdownRef = ref(null)
@@ -1138,18 +1154,14 @@ const handleDateRangeChange = (value) => {
1138
1154
  handleInputChange('checkOut', end)
1139
1155
 
1140
1156
  if (start && end) {
1141
- if (calendarRef.value) {
1142
- calendarRef.value.hide()
1143
- }
1157
+ isCalendarVisible.value = false
1144
1158
  fieldErrors.value.checkIn = false
1145
1159
  fieldErrors.value.checkOut = false
1146
1160
  }
1147
1161
  }
1148
1162
 
1149
1163
  const showCalendar = () => {
1150
- if (calendarRef.value) {
1151
- calendarRef.value.show()
1152
- }
1164
+ isCalendarVisible.value = true
1153
1165
  }
1154
1166
 
1155
1167
  const validateRequiredFields = () => {
@@ -1386,6 +1398,20 @@ const handleClickOutside = (event) => {
1386
1398
  ) {
1387
1399
  isRoomsGuestsMenuOpen.value = false
1388
1400
  }
1401
+
1402
+ // Close calendar if clicking outside
1403
+ const calendarContainer = target.closest('.sw-com-cal')
1404
+ const isCalendarInput = target.closest('#checkIn') || target.closest('#checkOut')
1405
+ const isCalendarElement = target.closest('.p-calendar') || target.closest('.p-datepicker')
1406
+
1407
+ if (
1408
+ isCalendarVisible.value &&
1409
+ !isCalendarInput &&
1410
+ !isCalendarElement &&
1411
+ (!calendarContainer || !calendarContainer.querySelector('.p-calendar'))
1412
+ ) {
1413
+ isCalendarVisible.value = false
1414
+ }
1389
1415
  }
1390
1416
 
1391
1417
  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')