@hotelcard/ui 0.0.11 → 0.0.13
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/README.md +99 -2
- package/dist/index.cjs +755 -302
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +531 -146
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +188 -30
- package/dist/index.d.ts +188 -30
- package/dist/index.js +751 -301
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -69,7 +69,6 @@ function App() {
|
|
|
69
69
|
| `Input` | Text input with label, helper text, and validation |
|
|
70
70
|
| `Badge` | Status and discount badges |
|
|
71
71
|
| `Card` | Hotel card component |
|
|
72
|
-
| `CompactCard` | Compact hotel card for carousels |
|
|
73
72
|
| `Chip` | Filter and tag chips |
|
|
74
73
|
| `Checkbox` | Checkbox with label |
|
|
75
74
|
| `RadioButton` | Radio button with label |
|
|
@@ -80,6 +79,8 @@ function App() {
|
|
|
80
79
|
| `SectionHeader` | Section title with "Show all" button |
|
|
81
80
|
| `WhenContent` | Date/month picker for search (accepts labels as props) |
|
|
82
81
|
| `DualCalendar` | Calendar component for date range selection |
|
|
82
|
+
| `GuestContent` | Guest selector with adults, children (with ages), and pet toggle |
|
|
83
|
+
| `HotelCard` | Hotel card for search results with image carousel, rating, and pricing |
|
|
83
84
|
|
|
84
85
|
### Icons
|
|
85
86
|
|
|
@@ -201,6 +202,94 @@ import { WhenContent } from '@hotelcard/ui';
|
|
|
201
202
|
|
|
202
203
|
**Note**: All text labels are passed as props. The consuming app provides translated strings.
|
|
203
204
|
|
|
205
|
+
### GuestContent (Guest Selector)
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
import { GuestContent, type GuestCounts } from '@hotelcard/ui';
|
|
209
|
+
|
|
210
|
+
const [guests, setGuests] = useState<GuestCounts>({
|
|
211
|
+
adults: 2,
|
|
212
|
+
children: 0,
|
|
213
|
+
childrenAges: [],
|
|
214
|
+
});
|
|
215
|
+
const [petFilter, setPetFilter] = useState(0);
|
|
216
|
+
|
|
217
|
+
<GuestContent
|
|
218
|
+
guests={guests}
|
|
219
|
+
onChange={setGuests}
|
|
220
|
+
petFilter={petFilter}
|
|
221
|
+
onPetChange={setPetFilter}
|
|
222
|
+
showPetToggle={true}
|
|
223
|
+
labels={{
|
|
224
|
+
adults: 'Adults',
|
|
225
|
+
children: 'Children',
|
|
226
|
+
pet: 'Pet',
|
|
227
|
+
ageOfChild: 'Age of child',
|
|
228
|
+
age: 'Age',
|
|
229
|
+
decreaseAdults: 'Decrease adults',
|
|
230
|
+
increaseAdults: 'Increase adults',
|
|
231
|
+
decreaseChildren: 'Decrease children',
|
|
232
|
+
increaseChildren: 'Increase children',
|
|
233
|
+
togglePets: 'Toggle pets',
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Note**: All text labels are passed as props. The consuming app provides translated strings.
|
|
239
|
+
|
|
240
|
+
### HotelCard
|
|
241
|
+
|
|
242
|
+
```tsx
|
|
243
|
+
import { HotelCard, type HotelCardHotel } from '@hotelcard/ui';
|
|
244
|
+
|
|
245
|
+
const hotel: HotelCardHotel = {
|
|
246
|
+
id: '123',
|
|
247
|
+
name: 'Grand Hotel Belvedere',
|
|
248
|
+
slug: 'grand-hotel-belvedere',
|
|
249
|
+
stars: 5,
|
|
250
|
+
isSuperior: true,
|
|
251
|
+
rating: 4.5,
|
|
252
|
+
location: 'Lauterbrunnen, Switzerland',
|
|
253
|
+
images: ['/hotel1.jpg', '/hotel2.jpg'],
|
|
254
|
+
isFavorite: false,
|
|
255
|
+
benefits: [
|
|
256
|
+
{ id: 'free-breakfast', label: 'Free breakfast' },
|
|
257
|
+
{ id: 'free-cancellation', label: 'Free cancellation' },
|
|
258
|
+
],
|
|
259
|
+
isAvailable: true,
|
|
260
|
+
currency: 'CHF',
|
|
261
|
+
price: {
|
|
262
|
+
current: 195,
|
|
263
|
+
original: 390,
|
|
264
|
+
discount: 50,
|
|
265
|
+
},
|
|
266
|
+
usp: 'Best price guarantee',
|
|
267
|
+
badges: ['New'],
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
<HotelCard
|
|
271
|
+
hotel={hotel}
|
|
272
|
+
onFavoriteClick={() => toggleFavorite(hotel.id)}
|
|
273
|
+
onContentClick={() => navigate(`/hotel/${hotel.slug}`)}
|
|
274
|
+
labels={{
|
|
275
|
+
priceFrom: t('hotel.priceFrom'),
|
|
276
|
+
notAvailable: t('hotel.notAvailable'),
|
|
277
|
+
ratingExcellent: t('rating.excellent'),
|
|
278
|
+
ratingVeryGood: t('rating.veryGood'),
|
|
279
|
+
ratingGood: t('rating.good'),
|
|
280
|
+
ratingFair: t('rating.fair'),
|
|
281
|
+
rating: t('rating.rating'),
|
|
282
|
+
swissLodge: t('hotel.swissLodge'),
|
|
283
|
+
removeFromFavorites: t('favorites.remove'),
|
|
284
|
+
addToFavorites: t('favorites.add'),
|
|
285
|
+
previousImage: t('navigation.previous'),
|
|
286
|
+
nextImage: t('navigation.next'),
|
|
287
|
+
}}
|
|
288
|
+
/>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Note**: All text labels are passed as props. The consuming app provides translated strings. Navigation and favorite logic are handled by the consuming app via callbacks.
|
|
292
|
+
|
|
204
293
|
### Checkbox & RadioButton
|
|
205
294
|
|
|
206
295
|
```tsx
|
|
@@ -233,7 +322,6 @@ import type {
|
|
|
233
322
|
BadgeProps,
|
|
234
323
|
InputProps,
|
|
235
324
|
CardProps,
|
|
236
|
-
CompactCardProps,
|
|
237
325
|
CheckboxProps,
|
|
238
326
|
RadioButtonProps,
|
|
239
327
|
DropdownProps,
|
|
@@ -245,6 +333,15 @@ import type {
|
|
|
245
333
|
WhenContentProps,
|
|
246
334
|
WhenContentLabels,
|
|
247
335
|
DateRange,
|
|
336
|
+
GuestContentProps,
|
|
337
|
+
GuestContentLabels,
|
|
338
|
+
GuestCounts,
|
|
339
|
+
ChildAgeError,
|
|
340
|
+
HotelCardProps,
|
|
341
|
+
HotelCardLabels,
|
|
342
|
+
HotelCardHotel,
|
|
343
|
+
HotelCardImageProps,
|
|
344
|
+
HotelCardContentProps,
|
|
248
345
|
|
|
249
346
|
// Data Types
|
|
250
347
|
Hotel,
|