@hotelcard/ui 0.0.9 → 0.0.12
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.
Potentially problematic release.
This version of @hotelcard/ui might be problematic. Click here for more details.
- package/README.md +136 -0
- package/dist/index.cjs +1068 -243
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +658 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +248 -2
- package/dist/index.d.ts +248 -2
- package/dist/index.js +994 -178
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
|
+
// src/context/UIContext.tsx
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var defaultValue = {
|
|
5
|
+
locale: "de",
|
|
6
|
+
currency: "CHF",
|
|
7
|
+
isDesktop: false
|
|
8
|
+
};
|
|
9
|
+
var UIContext = createContext(defaultValue);
|
|
10
|
+
var HotelCardUIProvider = ({
|
|
11
|
+
locale = "de",
|
|
12
|
+
currency = "CHF",
|
|
13
|
+
isDesktop = false,
|
|
14
|
+
children
|
|
15
|
+
}) => {
|
|
16
|
+
const value = { locale, currency, isDesktop };
|
|
17
|
+
return /* @__PURE__ */ jsx(UIContext.Provider, { value, children });
|
|
18
|
+
};
|
|
19
|
+
var useUIContext = () => {
|
|
20
|
+
return useContext(UIContext);
|
|
21
|
+
};
|
|
22
|
+
|
|
1
23
|
// src/components/Button/Button.tsx
|
|
2
24
|
import { forwardRef } from "react";
|
|
3
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
4
26
|
var cx = (className) => `hc-btn-${className}`;
|
|
5
27
|
var Button = forwardRef(({
|
|
6
28
|
variant = "primary",
|
|
@@ -32,7 +54,7 @@ var Button = forwardRef(({
|
|
|
32
54
|
classes.push(cx(variant));
|
|
33
55
|
return classes.join(" ");
|
|
34
56
|
};
|
|
35
|
-
return /* @__PURE__ */
|
|
57
|
+
return /* @__PURE__ */ jsx2(
|
|
36
58
|
"button",
|
|
37
59
|
{
|
|
38
60
|
ref,
|
|
@@ -41,9 +63,9 @@ var Button = forwardRef(({
|
|
|
41
63
|
disabled,
|
|
42
64
|
...props,
|
|
43
65
|
children: iconOnly ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
-
leftIcon && /* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
rightIcon && /* @__PURE__ */
|
|
66
|
+
leftIcon && /* @__PURE__ */ jsx2("span", { className: cx("icon-wrapper"), children: leftIcon }),
|
|
67
|
+
/* @__PURE__ */ jsx2("span", { className: cx("text-wrapper"), children }),
|
|
68
|
+
rightIcon && /* @__PURE__ */ jsx2("span", { className: cx("icon-wrapper"), children: rightIcon })
|
|
47
69
|
] })
|
|
48
70
|
}
|
|
49
71
|
);
|
|
@@ -51,7 +73,7 @@ var Button = forwardRef(({
|
|
|
51
73
|
Button.displayName = "Button";
|
|
52
74
|
|
|
53
75
|
// src/components/Badge/Badge.tsx
|
|
54
|
-
import { jsx as
|
|
76
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
55
77
|
var cx2 = (className) => `hc-badge-${className}`;
|
|
56
78
|
var Badge = ({
|
|
57
79
|
color = "primary",
|
|
@@ -77,22 +99,22 @@ var Badge = ({
|
|
|
77
99
|
size === "large" && icon ? cx2("text--largeWithIcon") : ""
|
|
78
100
|
].filter(Boolean).join(" ");
|
|
79
101
|
return /* @__PURE__ */ jsxs2("div", { className: badgeClasses, children: [
|
|
80
|
-
icon && /* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
102
|
+
icon && /* @__PURE__ */ jsx3("div", { className: iconClasses }),
|
|
103
|
+
/* @__PURE__ */ jsx3("div", { className: textClasses, children })
|
|
82
104
|
] });
|
|
83
105
|
};
|
|
84
106
|
Badge.displayName = "Badge";
|
|
85
107
|
|
|
86
108
|
// src/components/Rating/Rating.tsx
|
|
87
|
-
import { jsx as
|
|
109
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
88
110
|
var cx3 = (className) => `hc-rating-${className}`;
|
|
89
111
|
var StarIcon = () => /* @__PURE__ */ jsxs3("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
112
|
+
/* @__PURE__ */ jsx4("g", { clipPath: "url(#clip0_full)", children: /* @__PURE__ */ jsx4("path", { d: "M12.0004 0.5C12.393 0.5 12.7551 0.723172 12.9339 1.07325L16.1402 7.38333L23.1155 8.49482C23.5037 8.55608 23.8265 8.83176 23.9487 9.20809C24.0708 9.58442 23.9705 9.99576 23.6957 10.2758L18.7008 15.2863L19.8045 22.2834C19.8656 22.6728 19.7042 23.0667 19.3857 23.2986C19.0673 23.5305 18.6441 23.5655 18.2951 23.3861L12.0004 20.1742L5.70561 23.3861C5.35663 23.5655 4.93349 23.5305 4.61504 23.2986C4.29659 23.0667 4.13519 22.6772 4.19626 22.2834L5.29555 15.2863L0.305106 10.2758C0.0259198 9.99576 -0.0700504 9.58442 0.0520935 9.20809C0.174237 8.83176 0.492684 8.55608 0.885289 8.49482L7.86058 7.38333L11.0712 1.07325C11.2501 0.723172 11.6121 0.5 12.0047 0.5H12.0004Z", fill: "#FBB041" }) }),
|
|
113
|
+
/* @__PURE__ */ jsx4("defs", { children: /* @__PURE__ */ jsx4("clipPath", { id: "clip0_full", children: /* @__PURE__ */ jsx4("rect", { width: "24", height: "24", fill: "white" }) }) })
|
|
92
114
|
] });
|
|
93
115
|
var HalfStarIcon = () => /* @__PURE__ */ jsxs3("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ jsx4("defs", { children: /* @__PURE__ */ jsx4("clipPath", { id: "half", children: /* @__PURE__ */ jsx4("rect", { x: "0", y: "0", width: "12", height: "24" }) }) }),
|
|
117
|
+
/* @__PURE__ */ jsx4(
|
|
96
118
|
"path",
|
|
97
119
|
{
|
|
98
120
|
clipPath: "url(#half)",
|
|
@@ -100,7 +122,7 @@ var HalfStarIcon = () => /* @__PURE__ */ jsxs3("svg", { xmlns: "http://www.w3.or
|
|
|
100
122
|
fill: "#FBB041"
|
|
101
123
|
}
|
|
102
124
|
),
|
|
103
|
-
/* @__PURE__ */
|
|
125
|
+
/* @__PURE__ */ jsx4(
|
|
104
126
|
"path",
|
|
105
127
|
{
|
|
106
128
|
d: "M12.0004 0.5C12.393 0.5 12.7551 0.723172 12.9339 1.07325L16.1402 7.38333L23.1155 8.49482C23.5037 8.55608 23.8265 8.83176 23.9487 9.20809C24.0708 9.58442 23.9705 9.99576 23.6957 10.2758L18.7008 15.2863L19.8045 22.2834C19.8656 22.6728 19.7042 23.0667 19.3857 23.2986C19.0673 23.5305 18.6441 23.5655 18.2951 23.3861L12.0004 20.1742L5.70561 23.3861C5.35663 23.5655 4.93349 23.5305 4.61504 23.2986C4.29659 23.0667 4.13519 22.6772 4.19626 22.2834L5.29555 15.2863L0.305106 10.2758C0.0259198 9.99576 -0.0700504 9.58442 0.0520935 9.20809C0.174237 8.83176 0.492684 8.55608 0.885289 8.49482L7.86058 7.38333L11.0712 1.07325C11.2501 0.723172 11.6121 0.5 12.0047 0.5H12.0004ZM12.0004 3.86071L9.47898 8.81426C9.3263 9.11182 9.04275 9.32187 8.71122 9.37438L3.23656 10.2496L7.15389 14.1835C7.38945 14.4198 7.49851 14.7568 7.44616 15.0893L6.58243 20.5811L11.5249 18.0606C11.8215 17.9074 12.1749 17.9074 12.4759 18.0606L17.4183 20.5811L16.5546 15.0893C16.5023 14.7568 16.6113 14.4198 16.8469 14.1835L20.7642 10.2496L15.2895 9.37438C14.958 9.32187 14.6745 9.11182 14.5218 8.81426L12.0004 3.86071Z",
|
|
@@ -109,8 +131,8 @@ var HalfStarIcon = () => /* @__PURE__ */ jsxs3("svg", { xmlns: "http://www.w3.or
|
|
|
109
131
|
)
|
|
110
132
|
] });
|
|
111
133
|
var EmptyStarIcon = () => /* @__PURE__ */ jsxs3("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
|
|
112
|
-
/* @__PURE__ */
|
|
113
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ jsx4("g", { clipPath: "url(#clip0_empty)", children: /* @__PURE__ */ jsx4("path", { d: "M12.0004 0.5C12.393 0.5 12.7551 0.723172 12.9339 1.07325L16.1402 7.38333L23.1155 8.49482C23.5037 8.55608 23.8265 8.83176 23.9487 9.20809C24.0708 9.58442 23.9705 9.99576 23.6957 10.2758L18.7008 15.2863L19.8045 22.2834C19.8656 22.6728 19.7042 23.0667 19.3857 23.2986C19.0673 23.5305 18.6441 23.5655 18.2951 23.3861L12.0004 20.1742L5.70561 23.3861C5.35663 23.5655 4.93349 23.5305 4.61504 23.2986C4.29659 23.0667 4.13519 22.6772 4.19626 22.2834L5.29555 15.2863L0.305106 10.2758C0.0259198 9.99576 -0.0700504 9.58442 0.0520935 9.20809C0.174237 8.83176 0.492684 8.55608 0.885289 8.49482L7.86058 7.38333L11.0712 1.07325C11.2501 0.723172 11.6121 0.5 12.0047 0.5H12.0004ZM12.0004 3.86071L9.47898 8.81426C9.3263 9.11182 9.04275 9.32187 8.71122 9.37438L3.23656 10.2496L7.15389 14.1835C7.38945 14.4198 7.49851 14.7568 7.44616 15.0893L6.58243 20.5811L11.5249 18.0606C11.8215 17.9074 12.1749 17.9074 12.4759 18.0606L17.4183 20.5811L16.5546 15.0893C16.5023 14.7568 16.6113 14.4198 16.8469 14.1835L20.7642 10.2496L15.2895 9.37438C14.958 9.32187 14.6745 9.11182 14.5218 8.81426L12.0004 3.86071Z", fill: "#9A5A00" }) }),
|
|
135
|
+
/* @__PURE__ */ jsx4("defs", { children: /* @__PURE__ */ jsx4("clipPath", { id: "clip0_empty", children: /* @__PURE__ */ jsx4("rect", { width: "24", height: "24", fill: "white" }) }) })
|
|
114
136
|
] });
|
|
115
137
|
var Rating = ({
|
|
116
138
|
variant = "stars",
|
|
@@ -135,17 +157,17 @@ var Rating = ({
|
|
|
135
157
|
const stars = [];
|
|
136
158
|
for (let i = 0; i < fullStars; i++) {
|
|
137
159
|
stars.push(
|
|
138
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ jsx4("span", { className: starClasses, children: /* @__PURE__ */ jsx4(StarIcon, {}) }, `full-${i}`)
|
|
139
161
|
);
|
|
140
162
|
}
|
|
141
163
|
if (hasHalfStar) {
|
|
142
164
|
stars.push(
|
|
143
|
-
/* @__PURE__ */
|
|
165
|
+
/* @__PURE__ */ jsx4("span", { className: starClasses, children: /* @__PURE__ */ jsx4(HalfStarIcon, {}) }, "half")
|
|
144
166
|
);
|
|
145
167
|
}
|
|
146
168
|
for (let i = 0; i < emptyStars; i++) {
|
|
147
169
|
stars.push(
|
|
148
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ jsx4("span", { className: starClasses, children: /* @__PURE__ */ jsx4(EmptyStarIcon, {}) }, `empty-${i}`)
|
|
149
171
|
);
|
|
150
172
|
}
|
|
151
173
|
return stars;
|
|
@@ -153,33 +175,33 @@ var Rating = ({
|
|
|
153
175
|
if (variant === "stars") {
|
|
154
176
|
const containerClasses2 = [cx3("starsContainer"), className].filter(Boolean).join(" ");
|
|
155
177
|
return /* @__PURE__ */ jsxs3("div", { className: containerClasses2, children: [
|
|
156
|
-
/* @__PURE__ */
|
|
157
|
-
showValue && /* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ jsx4("div", { className: cx3("starContainer"), children: renderStars() }),
|
|
179
|
+
showValue && /* @__PURE__ */ jsx4("span", { className: cx3("valueDisplay"), children: clampedValue.toLocaleString("de-CH") })
|
|
158
180
|
] });
|
|
159
181
|
}
|
|
160
182
|
if (variant === "result") {
|
|
161
183
|
const containerClasses2 = [cx3("resultContainer"), className].filter(Boolean).join(" ");
|
|
162
184
|
return /* @__PURE__ */ jsxs3("div", { className: containerClasses2, children: [
|
|
163
|
-
/* @__PURE__ */
|
|
164
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ jsx4("span", { className: cx3("resultChar"), children: "N" }),
|
|
186
|
+
/* @__PURE__ */ jsx4("div", { children: renderStars() })
|
|
165
187
|
] });
|
|
166
188
|
}
|
|
167
189
|
const containerClasses = [cx3("blockContainer"), className].filter(Boolean).join(" ");
|
|
168
190
|
return /* @__PURE__ */ jsxs3("div", { className: containerClasses, children: [
|
|
169
191
|
/* @__PURE__ */ jsxs3("div", { className: cx3("blockHeader"), children: [
|
|
170
192
|
/* @__PURE__ */ jsxs3("div", { className: cx3("blockHeaderLeft"), children: [
|
|
171
|
-
name && /* @__PURE__ */
|
|
172
|
-
/* @__PURE__ */
|
|
193
|
+
name && /* @__PURE__ */ jsx4("span", { className: cx3("blockName"), children: name }),
|
|
194
|
+
/* @__PURE__ */ jsx4("div", { children: renderStars() })
|
|
173
195
|
] }),
|
|
174
|
-
date && /* @__PURE__ */
|
|
196
|
+
date && /* @__PURE__ */ jsx4("span", { className: cx3("blockDate"), children: date })
|
|
175
197
|
] }),
|
|
176
|
-
quote && /* @__PURE__ */
|
|
198
|
+
quote && /* @__PURE__ */ jsx4("p", { className: cx3("blockQuote"), children: quote })
|
|
177
199
|
] });
|
|
178
200
|
};
|
|
179
201
|
Rating.displayName = "Rating";
|
|
180
202
|
|
|
181
203
|
// src/components/Divider/Divider.tsx
|
|
182
|
-
import { jsx as
|
|
204
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
183
205
|
var cx4 = (className) => `hc-divider-${className}`;
|
|
184
206
|
var Divider = ({
|
|
185
207
|
label,
|
|
@@ -189,7 +211,7 @@ var Divider = ({
|
|
|
189
211
|
const isHorizontal = orientation === "horizontal";
|
|
190
212
|
if (!label) {
|
|
191
213
|
const lineClass2 = isHorizontal ? cx4("lineStandalone--horizontal") : cx4("lineStandalone--vertical");
|
|
192
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ jsx5(
|
|
193
215
|
"div",
|
|
194
216
|
{
|
|
195
217
|
className: [lineClass2, className].filter(Boolean).join(" "),
|
|
@@ -213,9 +235,9 @@ var Divider = ({
|
|
|
213
235
|
"aria-orientation": orientation,
|
|
214
236
|
"aria-label": typeof label === "string" ? label : void 0,
|
|
215
237
|
children: [
|
|
216
|
-
/* @__PURE__ */
|
|
217
|
-
/* @__PURE__ */
|
|
218
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ jsx5("div", { className: lineClass }),
|
|
239
|
+
/* @__PURE__ */ jsx5("span", { className: cx4("label"), children: label }),
|
|
240
|
+
/* @__PURE__ */ jsx5("div", { className: lineClass })
|
|
219
241
|
]
|
|
220
242
|
}
|
|
221
243
|
);
|
|
@@ -223,11 +245,11 @@ var Divider = ({
|
|
|
223
245
|
Divider.displayName = "Divider";
|
|
224
246
|
|
|
225
247
|
// src/components/Chip/Chip.tsx
|
|
226
|
-
import { jsx as
|
|
248
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
227
249
|
var cx5 = (className) => `hc-chip-${className}`;
|
|
228
250
|
var CloseIcon = () => /* @__PURE__ */ jsxs5("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
251
|
+
/* @__PURE__ */ jsx6("g", { clipPath: "url(#clip0_chip_close)", children: /* @__PURE__ */ jsx6("path", { d: "M12 2.25C14.5859 2.25 17.0658 3.27723 18.8943 5.10571C20.7228 6.93419 21.75 9.41414 21.75 12C21.75 14.5859 20.7228 17.0658 18.8943 18.8943C17.0658 20.7228 14.5859 21.75 12 21.75C9.41414 21.75 6.93419 20.7228 5.10571 18.8943C3.27723 17.0658 2.25 14.5859 2.25 12C2.25 9.41414 3.27723 6.93419 5.10571 5.10571C6.93419 3.27723 9.41414 2.25 12 2.25ZM12 24C15.1826 24 18.2348 22.7357 20.4853 20.4853C22.7357 18.2348 24 15.1826 24 12C24 8.8174 22.7357 5.76516 20.4853 3.51472C18.2348 1.26428 15.1826 0 12 0C8.8174 0 5.76516 1.26428 3.51472 3.51472C1.26428 5.76516 0 8.8174 0 12C0 15.1826 1.26428 18.2348 3.51472 20.4853C5.76516 22.7357 8.8174 24 12 24ZM7.82812 7.82812C7.3875 8.26875 7.3875 8.98125 7.82812 9.41719L10.4062 11.9953L7.82812 14.5734C7.3875 15.0141 7.3875 15.7266 7.82812 16.1625C8.26875 16.5984 8.98125 16.6031 9.41719 16.1625L11.9953 13.5844L14.5734 16.1625C15.0141 16.6031 15.7266 16.6031 16.1625 16.1625C16.5984 15.7219 16.6031 15.0094 16.1625 14.5734L13.5844 11.9953L16.1625 9.41719C16.6031 8.97656 16.6031 8.26406 16.1625 7.82812C15.7219 7.39219 15.0094 7.3875 14.5734 7.82812L11.9953 10.4062L9.41719 7.82812C8.97656 7.3875 8.26406 7.3875 7.82812 7.82812Z", fill: "currentColor" }) }),
|
|
252
|
+
/* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsx6("clipPath", { id: "clip0_chip_close", children: /* @__PURE__ */ jsx6("rect", { width: "24", height: "24", fill: "white" }) }) })
|
|
231
253
|
] });
|
|
232
254
|
var Chip = ({
|
|
233
255
|
label,
|
|
@@ -278,9 +300,9 @@ var Chip = ({
|
|
|
278
300
|
disabled,
|
|
279
301
|
"aria-label": removable ? `Remove filter: ${label}` : label,
|
|
280
302
|
children: [
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
count !== void 0 && /* @__PURE__ */
|
|
283
|
-
removable && /* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ jsx6("span", { className: labelClasses, children: label }),
|
|
304
|
+
count !== void 0 && /* @__PURE__ */ jsx6("span", { className: countBadgeClasses, children: count }),
|
|
305
|
+
removable && /* @__PURE__ */ jsx6("span", { className: cx5("closeIcon"), "aria-hidden": "true", children: /* @__PURE__ */ jsx6(CloseIcon, {}) })
|
|
284
306
|
]
|
|
285
307
|
}
|
|
286
308
|
);
|
|
@@ -289,7 +311,7 @@ Chip.displayName = "Chip";
|
|
|
289
311
|
|
|
290
312
|
// src/components/Checkbox/Checkbox.tsx
|
|
291
313
|
import { useState } from "react";
|
|
292
|
-
import { jsx as
|
|
314
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
293
315
|
var cx6 = (className) => `hc-checkbox-${className}`;
|
|
294
316
|
var Checkbox = ({
|
|
295
317
|
label,
|
|
@@ -346,8 +368,8 @@ var Checkbox = ({
|
|
|
346
368
|
].filter(Boolean).join(" ");
|
|
347
369
|
return /* @__PURE__ */ jsxs6("label", { className: containerClasses, children: [
|
|
348
370
|
/* @__PURE__ */ jsxs6("div", { className: wrapperClasses, children: [
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
371
|
+
/* @__PURE__ */ jsx7("div", { className: boxClasses }),
|
|
372
|
+
/* @__PURE__ */ jsx7(
|
|
351
373
|
"input",
|
|
352
374
|
{
|
|
353
375
|
type: "checkbox",
|
|
@@ -362,14 +384,14 @@ var Checkbox = ({
|
|
|
362
384
|
"aria-invalid": error
|
|
363
385
|
}
|
|
364
386
|
),
|
|
365
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ jsx7(
|
|
366
388
|
"svg",
|
|
367
389
|
{
|
|
368
390
|
className: checkmarkClasses,
|
|
369
391
|
viewBox: "0 0 12 12",
|
|
370
392
|
fill: "none",
|
|
371
393
|
xmlns: "http://www.w3.org/2000/svg",
|
|
372
|
-
children: /* @__PURE__ */
|
|
394
|
+
children: /* @__PURE__ */ jsx7(
|
|
373
395
|
"path",
|
|
374
396
|
{
|
|
375
397
|
d: "M2.5 6L5 8.5L9.5 3.5",
|
|
@@ -382,13 +404,13 @@ var Checkbox = ({
|
|
|
382
404
|
}
|
|
383
405
|
)
|
|
384
406
|
] }),
|
|
385
|
-
label && /* @__PURE__ */
|
|
407
|
+
label && /* @__PURE__ */ jsx7("span", { className: labelClasses, children: label })
|
|
386
408
|
] });
|
|
387
409
|
};
|
|
388
410
|
Checkbox.displayName = "Checkbox";
|
|
389
411
|
|
|
390
412
|
// src/components/RadioButton/RadioButton.tsx
|
|
391
|
-
import { jsx as
|
|
413
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
392
414
|
var cx7 = (className) => `hc-radio-${className}`;
|
|
393
415
|
var RadioButton = ({
|
|
394
416
|
id,
|
|
@@ -440,7 +462,7 @@ var RadioButton = ({
|
|
|
440
462
|
"aria-disabled": disabled,
|
|
441
463
|
children: [
|
|
442
464
|
/* @__PURE__ */ jsxs7("div", { className: cx7("wrapper"), children: [
|
|
443
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ jsx8(
|
|
444
466
|
"input",
|
|
445
467
|
{
|
|
446
468
|
id,
|
|
@@ -455,10 +477,10 @@ var RadioButton = ({
|
|
|
455
477
|
className: cx7("hiddenInput")
|
|
456
478
|
}
|
|
457
479
|
),
|
|
458
|
-
/* @__PURE__ */
|
|
459
|
-
/* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ jsx8("div", { className: outerCircleClasses }),
|
|
481
|
+
/* @__PURE__ */ jsx8("div", { className: innerDotClasses })
|
|
460
482
|
] }),
|
|
461
|
-
label && /* @__PURE__ */
|
|
483
|
+
label && /* @__PURE__ */ jsx8("label", { htmlFor: id, className: cx7("label"), children: label })
|
|
462
484
|
]
|
|
463
485
|
}
|
|
464
486
|
);
|
|
@@ -466,9 +488,9 @@ var RadioButton = ({
|
|
|
466
488
|
RadioButton.displayName = "RadioButton";
|
|
467
489
|
|
|
468
490
|
// src/components/SectionHeader/SectionHeader.tsx
|
|
469
|
-
import { jsx as
|
|
491
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
470
492
|
var cx8 = (className) => `hc-section-${className}`;
|
|
471
|
-
var ChevronRightIcon = () => /* @__PURE__ */
|
|
493
|
+
var ChevronRightIcon = () => /* @__PURE__ */ jsx9(
|
|
472
494
|
"svg",
|
|
473
495
|
{
|
|
474
496
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -480,7 +502,7 @@ var ChevronRightIcon = () => /* @__PURE__ */ jsx8(
|
|
|
480
502
|
strokeWidth: "2",
|
|
481
503
|
strokeLinecap: "round",
|
|
482
504
|
strokeLinejoin: "round",
|
|
483
|
-
children: /* @__PURE__ */
|
|
505
|
+
children: /* @__PURE__ */ jsx9("polyline", { points: "9 18 15 12 9 6" })
|
|
484
506
|
}
|
|
485
507
|
);
|
|
486
508
|
var SectionHeader = ({
|
|
@@ -491,10 +513,10 @@ var SectionHeader = ({
|
|
|
491
513
|
}) => {
|
|
492
514
|
const headerClasses = [cx8("header"), className].filter(Boolean).join(" ");
|
|
493
515
|
return /* @__PURE__ */ jsxs8("div", { className: headerClasses, children: [
|
|
494
|
-
/* @__PURE__ */
|
|
516
|
+
/* @__PURE__ */ jsx9("h2", { className: cx8("title"), children: title }),
|
|
495
517
|
showAllLabel && onShowAllClick && /* @__PURE__ */ jsxs8("button", { className: cx8("showAllButton"), onClick: onShowAllClick, children: [
|
|
496
|
-
/* @__PURE__ */
|
|
497
|
-
/* @__PURE__ */
|
|
518
|
+
/* @__PURE__ */ jsx9("span", { children: showAllLabel }),
|
|
519
|
+
/* @__PURE__ */ jsx9(ChevronRightIcon, {})
|
|
498
520
|
] })
|
|
499
521
|
] });
|
|
500
522
|
};
|
|
@@ -503,9 +525,9 @@ SectionHeader.displayName = "SectionHeader";
|
|
|
503
525
|
// src/components/Modal/Modal.tsx
|
|
504
526
|
import { useEffect, useRef } from "react";
|
|
505
527
|
import { createPortal } from "react-dom";
|
|
506
|
-
import { jsx as
|
|
528
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
507
529
|
var cx9 = (className) => `hc-modal-${className}`;
|
|
508
|
-
var CloseIcon2 = () => /* @__PURE__ */
|
|
530
|
+
var CloseIcon2 = () => /* @__PURE__ */ jsx10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: /* @__PURE__ */ jsx10(
|
|
509
531
|
"path",
|
|
510
532
|
{
|
|
511
533
|
d: "M0.330469 1.91953C-0.110156 1.47891 -0.110156 0.766406 0.330469 0.330469C0.771094 -0.105469 1.48359 -0.110156 1.91953 0.330469L8.99766 7.40859L16.0758 0.330469C16.5164 -0.110156 17.2289 -0.110156 17.6648 0.330469C18.1008 0.771094 18.1055 1.48359 17.6648 1.91953L10.5867 8.99766L17.6648 16.0758C18.1055 16.5164 18.1055 17.2289 17.6648 17.6648C17.2242 18.1008 16.5117 18.1055 16.0758 17.6648L8.99766 10.5867L1.91953 17.6648C1.47891 18.1055 0.766406 18.1055 0.330469 17.6648C-0.105469 17.2242 -0.110156 16.5117 0.330469 16.0758L7.40859 8.99766L0.330469 1.91953Z",
|
|
@@ -544,20 +566,20 @@ var Modal = ({
|
|
|
544
566
|
};
|
|
545
567
|
if (!isOpen) return null;
|
|
546
568
|
const modalClasses = [cx9("content"), className].filter(Boolean).join(" ");
|
|
547
|
-
const modalContent = /* @__PURE__ */
|
|
569
|
+
const modalContent = /* @__PURE__ */ jsx10("div", { className: cx9("backdrop"), onClick: handleBackdropClick, children: /* @__PURE__ */ jsxs9(
|
|
548
570
|
"div",
|
|
549
571
|
{
|
|
550
572
|
ref: modalRef,
|
|
551
573
|
className: modalClasses,
|
|
552
574
|
style: { maxWidth: width },
|
|
553
575
|
children: [
|
|
554
|
-
showCloseButton && /* @__PURE__ */
|
|
576
|
+
showCloseButton && /* @__PURE__ */ jsx10(
|
|
555
577
|
"button",
|
|
556
578
|
{
|
|
557
579
|
className: cx9("closeButton"),
|
|
558
580
|
onClick: onClose,
|
|
559
581
|
"aria-label": "Close modal",
|
|
560
|
-
children: /* @__PURE__ */
|
|
582
|
+
children: /* @__PURE__ */ jsx10(CloseIcon2, {})
|
|
561
583
|
}
|
|
562
584
|
),
|
|
563
585
|
children
|
|
@@ -572,19 +594,19 @@ var Modal = ({
|
|
|
572
594
|
Modal.displayName = "Modal";
|
|
573
595
|
|
|
574
596
|
// src/components/Card/Card.tsx
|
|
575
|
-
import { Fragment as Fragment2, jsx as
|
|
597
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
576
598
|
var cx10 = (className) => `hc-card-${className}`;
|
|
577
599
|
var StarIcon2 = () => /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "9", height: "9", viewBox: "0 0 9 9", fill: "none", children: [
|
|
578
|
-
/* @__PURE__ */
|
|
600
|
+
/* @__PURE__ */ jsx11("g", { clipPath: "url(#clip0_card_star)", children: /* @__PURE__ */ jsx11(
|
|
579
601
|
"path",
|
|
580
602
|
{
|
|
581
603
|
d: "M4.80018 0.366577C4.93104 0.366577 5.05173 0.440968 5.11135 0.557659L6.18011 2.66102L8.50521 3.03152C8.63462 3.05194 8.74222 3.14383 8.78294 3.26927C8.82365 3.39472 8.79021 3.53183 8.6986 3.62518L7.03366 5.29533L7.40155 7.6277C7.42191 7.75752 7.3681 7.88879 7.26195 7.9661C7.15581 8.04341 7.01476 8.05508 6.89843 7.99528L4.80018 6.92463L2.70192 7.99528C2.58559 8.05508 2.44454 8.04341 2.33839 7.9661C2.23225 7.88879 2.17844 7.75898 2.1988 7.6277L2.56523 5.29533L0.901751 3.62518C0.808689 3.53183 0.776699 3.39472 0.817413 3.26927C0.858128 3.14383 0.964277 3.05194 1.09515 3.03152L3.42024 2.66102L4.49045 0.557659C4.55007 0.440968 4.67076 0.366577 4.80163 0.366577H4.80018Z",
|
|
582
604
|
fill: "#1F2937"
|
|
583
605
|
}
|
|
584
606
|
) }),
|
|
585
|
-
/* @__PURE__ */
|
|
607
|
+
/* @__PURE__ */ jsx11("defs", { children: /* @__PURE__ */ jsx11("clipPath", { id: "clip0_card_star", children: /* @__PURE__ */ jsx11("rect", { width: "8", height: "8", fill: "white", transform: "translate(0.800049 0.199951)" }) }) })
|
|
586
608
|
] });
|
|
587
|
-
var CommentIcon = () => /* @__PURE__ */
|
|
609
|
+
var CommentIcon = () => /* @__PURE__ */ jsx11("svg", { width: "24", height: "24", viewBox: "0 0 36 38", fill: "#478EFA", className: cx10("ratingSvg"), children: /* @__PURE__ */ jsx11("path", { d: "M4 0C1.79086 0 0 1.79086 0 4V32V38L9 32H32C34.2091 32 36 30.2091 36 28V0H4Z" }) });
|
|
588
610
|
var PLACEHOLDER = 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="100" height="100" fill="%23e5e7eb"%3E%3Crect width="100" height="100" /%3E%3C/svg%3E';
|
|
589
611
|
var repeat = (n, renderFn) => Array.from({ length: n }, (_, i) => renderFn(i));
|
|
590
612
|
var Card = ({
|
|
@@ -642,9 +664,9 @@ var Card = ({
|
|
|
642
664
|
const renderRatingInfo = () => {
|
|
643
665
|
if (!ratingInfo) return null;
|
|
644
666
|
return /* @__PURE__ */ jsxs10("span", { className: cx10("ratingInfo"), children: [
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
/* @__PURE__ */
|
|
647
|
-
/* @__PURE__ */
|
|
667
|
+
/* @__PURE__ */ jsx11(CommentIcon, {}),
|
|
668
|
+
/* @__PURE__ */ jsx11("span", { className: cx10("ratingLabel"), children: ratingInfo.label }),
|
|
669
|
+
/* @__PURE__ */ jsx11("span", { className: cx10("ratingValue"), children: ratingInfo.value })
|
|
648
670
|
] });
|
|
649
671
|
};
|
|
650
672
|
return /* @__PURE__ */ jsxs10(
|
|
@@ -657,7 +679,7 @@ var Card = ({
|
|
|
657
679
|
tabIndex: onClick ? 0 : void 0,
|
|
658
680
|
children: [
|
|
659
681
|
/* @__PURE__ */ jsxs10("div", { className: cx10("imageContainer"), children: [
|
|
660
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ jsx11(
|
|
661
683
|
"img",
|
|
662
684
|
{
|
|
663
685
|
src: displayImage,
|
|
@@ -666,8 +688,8 @@ var Card = ({
|
|
|
666
688
|
loading: "lazy"
|
|
667
689
|
}
|
|
668
690
|
),
|
|
669
|
-
/* @__PURE__ */
|
|
670
|
-
badge && /* @__PURE__ */
|
|
691
|
+
/* @__PURE__ */ jsx11("div", { className: cx10("shadowOverlay") }),
|
|
692
|
+
badge && /* @__PURE__ */ jsx11("div", { className: cx10("badgeWrapper"), children: /* @__PURE__ */ jsx11(
|
|
671
693
|
Badge,
|
|
672
694
|
{
|
|
673
695
|
color: badge.variant || "primary",
|
|
@@ -677,19 +699,19 @@ var Card = ({
|
|
|
677
699
|
) })
|
|
678
700
|
] }),
|
|
679
701
|
/* @__PURE__ */ jsxs10("div", { className: cx10("textContainer"), children: [
|
|
680
|
-
/* @__PURE__ */
|
|
702
|
+
/* @__PURE__ */ jsx11("div", { className: starsRowClasses, children: stars !== void 0 && stars > 0 ? /* @__PURE__ */ jsx11(Fragment2, { children: stars === 6 ? /* @__PURE__ */ jsx11("span", { className: cx10("swissLodge"), children: swissLodgeLabel }) : /* @__PURE__ */ jsx11(Fragment2, { children: isDesktop ? /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
681
703
|
/* @__PURE__ */ jsxs10("div", { className: cx10("starsContainer"), children: [
|
|
682
|
-
repeat(Math.floor(stars), (i) => /* @__PURE__ */
|
|
683
|
-
isSuperior && /* @__PURE__ */
|
|
704
|
+
repeat(Math.floor(stars), (i) => /* @__PURE__ */ jsx11(StarIcon2, {}, i)),
|
|
705
|
+
isSuperior && /* @__PURE__ */ jsx11("span", { className: cx10("superiorBadge"), children: "(s)" })
|
|
684
706
|
] }),
|
|
685
|
-
/* @__PURE__ */
|
|
707
|
+
/* @__PURE__ */ jsx11("div", { children: renderRatingInfo() })
|
|
686
708
|
] }) : /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
isSuperior && /* @__PURE__ */
|
|
709
|
+
/* @__PURE__ */ jsx11("div", { className: cx10("starsContainer"), children: repeat(Math.floor(stars), (i) => /* @__PURE__ */ jsx11(StarIcon2, {}, i)) }),
|
|
710
|
+
isSuperior && /* @__PURE__ */ jsx11("span", { className: cx10("superiorBadge"), children: "(s)" }),
|
|
689
711
|
renderRatingInfo()
|
|
690
|
-
] }) }) }) : /* @__PURE__ */
|
|
691
|
-
label && /* @__PURE__ */
|
|
692
|
-
price && /* @__PURE__ */
|
|
712
|
+
] }) }) }) : /* @__PURE__ */ jsx11("div", { className: cx10("starsPlaceholder"), children: "\xA0" }) }),
|
|
713
|
+
label && /* @__PURE__ */ jsx11("div", { className: labelClasses, children: label }),
|
|
714
|
+
price && /* @__PURE__ */ jsx11("div", { className: priceClasses, children: price })
|
|
693
715
|
] })
|
|
694
716
|
]
|
|
695
717
|
}
|
|
@@ -698,17 +720,17 @@ var Card = ({
|
|
|
698
720
|
Card.displayName = "Card";
|
|
699
721
|
|
|
700
722
|
// src/components/CompactCard/CompactCard.tsx
|
|
701
|
-
import { Fragment as Fragment3, jsx as
|
|
723
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
702
724
|
var cx11 = (className) => `hc-compact-${className}`;
|
|
703
725
|
var StarIcon3 = () => /* @__PURE__ */ jsxs11("svg", { xmlns: "http://www.w3.org/2000/svg", width: "9", height: "9", viewBox: "0 0 9 9", fill: "none", children: [
|
|
704
|
-
/* @__PURE__ */
|
|
726
|
+
/* @__PURE__ */ jsx12("g", { clipPath: "url(#clip0_compact_star)", children: /* @__PURE__ */ jsx12(
|
|
705
727
|
"path",
|
|
706
728
|
{
|
|
707
729
|
d: "M4.80018 0.366577C4.93104 0.366577 5.05173 0.440968 5.11135 0.557659L6.18011 2.66102L8.50521 3.03152C8.63462 3.05194 8.74222 3.14383 8.78294 3.26927C8.82365 3.39472 8.79021 3.53183 8.6986 3.62518L7.03366 5.29533L7.40155 7.6277C7.42191 7.75752 7.3681 7.88879 7.26195 7.9661C7.15581 8.04341 7.01476 8.05508 6.89843 7.99528L4.80018 6.92463L2.70192 7.99528C2.58559 8.05508 2.44454 8.04341 2.33839 7.9661C2.23225 7.88879 2.17844 7.75898 2.1988 7.6277L2.56523 5.29533L0.901751 3.62518C0.808689 3.53183 0.776699 3.39472 0.817413 3.26927C0.858128 3.14383 0.964277 3.05194 1.09515 3.03152L3.42024 2.66102L4.49045 0.557659C4.55007 0.440968 4.67076 0.366577 4.80163 0.366577H4.80018Z",
|
|
708
730
|
fill: "#1F2937"
|
|
709
731
|
}
|
|
710
732
|
) }),
|
|
711
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ jsx12("defs", { children: /* @__PURE__ */ jsx12("clipPath", { id: "clip0_compact_star", children: /* @__PURE__ */ jsx12("rect", { width: "8", height: "8", fill: "white", transform: "translate(0.800049 0.199951)" }) }) })
|
|
712
734
|
] });
|
|
713
735
|
var PLACEHOLDER2 = 'data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="100" height="100" fill="%23e5e7eb"%3E%3Crect width="100" height="100" /%3E%3C/svg%3E';
|
|
714
736
|
var repeat2 = (n, renderFn) => Array.from({ length: n }, (_, i) => renderFn(i));
|
|
@@ -755,7 +777,7 @@ var CompactCard = ({
|
|
|
755
777
|
tabIndex: onClick ? 0 : void 0,
|
|
756
778
|
children: [
|
|
757
779
|
/* @__PURE__ */ jsxs11("div", { className: cx11("imageContainer"), children: [
|
|
758
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ jsx12(
|
|
759
781
|
"img",
|
|
760
782
|
{
|
|
761
783
|
src: displayImage,
|
|
@@ -764,8 +786,8 @@ var CompactCard = ({
|
|
|
764
786
|
loading: "lazy"
|
|
765
787
|
}
|
|
766
788
|
),
|
|
767
|
-
/* @__PURE__ */
|
|
768
|
-
badge && /* @__PURE__ */
|
|
789
|
+
/* @__PURE__ */ jsx12("div", { className: cx11("shadowOverlay") }),
|
|
790
|
+
badge && /* @__PURE__ */ jsx12("div", { className: cx11("badgeWrapper"), children: /* @__PURE__ */ jsx12(
|
|
769
791
|
"span",
|
|
770
792
|
{
|
|
771
793
|
className: `${cx11("badge")} ${badge.variant === "secondary" ? cx11("badge--secondary") : cx11("badge--primary")}`,
|
|
@@ -774,15 +796,15 @@ var CompactCard = ({
|
|
|
774
796
|
) })
|
|
775
797
|
] }),
|
|
776
798
|
/* @__PURE__ */ jsxs11("div", { className: cx11("textContainer"), children: [
|
|
777
|
-
/* @__PURE__ */
|
|
778
|
-
/* @__PURE__ */
|
|
779
|
-
isSuperior && /* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ jsx12("div", { className: cx11("starsRow"), children: stars !== void 0 && stars > 0 ? /* @__PURE__ */ jsx12(Fragment3, { children: stars === 6 ? /* @__PURE__ */ jsx12("span", { className: cx11("swissLodge"), children: swissLodgeLabel }) : /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
800
|
+
/* @__PURE__ */ jsx12("div", { className: cx11("starsContainer"), children: repeat2(Math.floor(stars), (i) => /* @__PURE__ */ jsx12(StarIcon3, {}, i)) }),
|
|
801
|
+
isSuperior && /* @__PURE__ */ jsx12("span", { className: cx11("superiorBadge"), children: "(s)" })
|
|
780
802
|
] }) }) : (
|
|
781
803
|
// Empty space to maintain alignment
|
|
782
|
-
/* @__PURE__ */
|
|
804
|
+
/* @__PURE__ */ jsx12("div", { className: cx11("starsPlaceholder"), children: "\xA0" })
|
|
783
805
|
) }),
|
|
784
|
-
label && /* @__PURE__ */
|
|
785
|
-
price && /* @__PURE__ */
|
|
806
|
+
label && /* @__PURE__ */ jsx12("div", { className: labelClasses, children: label }),
|
|
807
|
+
price && /* @__PURE__ */ jsx12("div", { className: priceClasses, children: price })
|
|
786
808
|
] })
|
|
787
809
|
]
|
|
788
810
|
}
|
|
@@ -792,9 +814,9 @@ CompactCard.displayName = "CompactCard";
|
|
|
792
814
|
|
|
793
815
|
// src/components/Dropdown/Dropdown.tsx
|
|
794
816
|
import { useState as useState2, useRef as useRef2, useEffect as useEffect2 } from "react";
|
|
795
|
-
import { jsx as
|
|
817
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
796
818
|
var cx12 = (className) => `hc-dropdown-${className}`;
|
|
797
|
-
var ChevronIcon = () => /* @__PURE__ */
|
|
819
|
+
var ChevronIcon = () => /* @__PURE__ */ jsx13("svg", { width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsx13(
|
|
798
820
|
"path",
|
|
799
821
|
{
|
|
800
822
|
d: "M1 1L6 6L11 1",
|
|
@@ -808,7 +830,7 @@ var Dropdown = ({
|
|
|
808
830
|
options = [],
|
|
809
831
|
disabled = false,
|
|
810
832
|
error = false,
|
|
811
|
-
defaultValue,
|
|
833
|
+
defaultValue: defaultValue2,
|
|
812
834
|
value,
|
|
813
835
|
onChange,
|
|
814
836
|
className = "",
|
|
@@ -816,7 +838,7 @@ var Dropdown = ({
|
|
|
816
838
|
id,
|
|
817
839
|
placeholder = "Select..."
|
|
818
840
|
}) => {
|
|
819
|
-
const [localValue, setLocalValue] = useState2(
|
|
841
|
+
const [localValue, setLocalValue] = useState2(defaultValue2 || "");
|
|
820
842
|
const [isOpen, setIsOpen] = useState2(false);
|
|
821
843
|
const [isFocused, setIsFocused] = useState2(false);
|
|
822
844
|
const dropdownRef = useRef2(null);
|
|
@@ -882,12 +904,12 @@ var Dropdown = ({
|
|
|
882
904
|
"aria-expanded": isOpen,
|
|
883
905
|
"aria-disabled": disabled,
|
|
884
906
|
children: [
|
|
885
|
-
/* @__PURE__ */
|
|
886
|
-
/* @__PURE__ */
|
|
907
|
+
/* @__PURE__ */ jsx13("span", { children: selectedLabel }),
|
|
908
|
+
/* @__PURE__ */ jsx13("span", { className: chevronClasses, children: /* @__PURE__ */ jsx13(ChevronIcon, {}) })
|
|
887
909
|
]
|
|
888
910
|
}
|
|
889
911
|
),
|
|
890
|
-
/* @__PURE__ */
|
|
912
|
+
/* @__PURE__ */ jsx13("ul", { role: "listbox", className: listClasses, children: options.map((option) => /* @__PURE__ */ jsx13(
|
|
891
913
|
"li",
|
|
892
914
|
{
|
|
893
915
|
role: "option",
|
|
@@ -908,8 +930,8 @@ var Dropdown = ({
|
|
|
908
930
|
disabled,
|
|
909
931
|
className: cx12("hiddenSelect"),
|
|
910
932
|
children: [
|
|
911
|
-
!actualValue && /* @__PURE__ */
|
|
912
|
-
options.map((opt) => /* @__PURE__ */
|
|
933
|
+
!actualValue && /* @__PURE__ */ jsx13("option", { value: "", children: placeholder }),
|
|
934
|
+
options.map((opt) => /* @__PURE__ */ jsx13("option", { value: opt.value, children: opt.label }, opt.value))
|
|
913
935
|
]
|
|
914
936
|
}
|
|
915
937
|
)
|
|
@@ -919,14 +941,14 @@ Dropdown.displayName = "Dropdown";
|
|
|
919
941
|
|
|
920
942
|
// src/components/Input/Input.tsx
|
|
921
943
|
import { useState as useState3, useRef as useRef3 } from "react";
|
|
922
|
-
import { jsx as
|
|
944
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
923
945
|
var cx13 = (className) => `hc-input-${className}`;
|
|
924
946
|
var Input = ({
|
|
925
947
|
label,
|
|
926
948
|
placeholder = "Placeholder",
|
|
927
949
|
helper,
|
|
928
950
|
value,
|
|
929
|
-
defaultValue = "",
|
|
951
|
+
defaultValue: defaultValue2 = "",
|
|
930
952
|
onChange,
|
|
931
953
|
onFocus,
|
|
932
954
|
onBlur,
|
|
@@ -947,7 +969,7 @@ var Input = ({
|
|
|
947
969
|
readOnly = false,
|
|
948
970
|
inputProps
|
|
949
971
|
}) => {
|
|
950
|
-
const [localValue, setLocalValue] = useState3(
|
|
972
|
+
const [localValue, setLocalValue] = useState3(defaultValue2);
|
|
951
973
|
const [isFocused, setIsFocused] = useState3(false);
|
|
952
974
|
const inputRef = useRef3(null);
|
|
953
975
|
const actualValue = value !== void 0 ? value : localValue;
|
|
@@ -989,16 +1011,16 @@ var Input = ({
|
|
|
989
1011
|
(disabled || readOnly) && cx13("helper--disabled")
|
|
990
1012
|
].filter(Boolean).join(" ");
|
|
991
1013
|
return /* @__PURE__ */ jsxs13("div", { className: containerClasses, children: [
|
|
992
|
-
label && /* @__PURE__ */
|
|
1014
|
+
label && /* @__PURE__ */ jsx14("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
993
1015
|
/* @__PURE__ */ jsxs13(
|
|
994
1016
|
"div",
|
|
995
1017
|
{
|
|
996
1018
|
className: wrapperClasses,
|
|
997
1019
|
onClick: () => !disabled && !readOnly && inputRef.current?.focus(),
|
|
998
1020
|
children: [
|
|
999
|
-
leftIcon && /* @__PURE__ */
|
|
1000
|
-
prefix && /* @__PURE__ */
|
|
1001
|
-
/* @__PURE__ */
|
|
1021
|
+
leftIcon && /* @__PURE__ */ jsx14("div", { className: cx13("icon"), children: leftIcon }),
|
|
1022
|
+
prefix && /* @__PURE__ */ jsx14("div", { className: cx13("prefix"), children: prefix }),
|
|
1023
|
+
/* @__PURE__ */ jsx14(
|
|
1002
1024
|
"input",
|
|
1003
1025
|
{
|
|
1004
1026
|
ref: inputRef,
|
|
@@ -1023,13 +1045,13 @@ var Input = ({
|
|
|
1023
1045
|
]
|
|
1024
1046
|
}
|
|
1025
1047
|
),
|
|
1026
|
-
helper && /* @__PURE__ */
|
|
1048
|
+
helper && /* @__PURE__ */ jsx14("div", { className: helperClasses, children: helper })
|
|
1027
1049
|
] });
|
|
1028
1050
|
};
|
|
1029
1051
|
Input.displayName = "Input";
|
|
1030
1052
|
|
|
1031
1053
|
// src/components/Block/Block.tsx
|
|
1032
|
-
import { jsx as
|
|
1054
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1033
1055
|
var cx14 = (className) => `hc-block-${className}`;
|
|
1034
1056
|
var Block = ({
|
|
1035
1057
|
variant = "icon",
|
|
@@ -1056,10 +1078,10 @@ var Block = ({
|
|
|
1056
1078
|
role: onClick ? "button" : void 0,
|
|
1057
1079
|
tabIndex: onClick ? 0 : void 0,
|
|
1058
1080
|
children: [
|
|
1059
|
-
/* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ jsx15("div", { className: iconContainerClass, children: visual }),
|
|
1060
1082
|
/* @__PURE__ */ jsxs14("div", { className: cx14("text-container"), children: [
|
|
1061
|
-
/* @__PURE__ */
|
|
1062
|
-
description && /* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ jsx15("div", { className: cx14("icon-label"), children: label }),
|
|
1084
|
+
description && /* @__PURE__ */ jsx15("div", { className: cx14("icon-description"), children: description })
|
|
1063
1085
|
] })
|
|
1064
1086
|
]
|
|
1065
1087
|
}
|
|
@@ -1078,10 +1100,10 @@ var Block = ({
|
|
|
1078
1100
|
role: onClick ? "button" : void 0,
|
|
1079
1101
|
tabIndex: onClick ? 0 : void 0,
|
|
1080
1102
|
children: [
|
|
1081
|
-
/* @__PURE__ */
|
|
1103
|
+
/* @__PURE__ */ jsx15("div", { className: cx14("image-container"), children: visual }),
|
|
1082
1104
|
/* @__PURE__ */ jsxs14("div", { className: cx14("footer"), children: [
|
|
1083
|
-
/* @__PURE__ */
|
|
1084
|
-
showArrow && /* @__PURE__ */
|
|
1105
|
+
/* @__PURE__ */ jsx15("span", { className: cx14("image-label"), children: label }),
|
|
1106
|
+
showArrow && /* @__PURE__ */ jsx15("span", { className: cx14("arrow"), children: "\u2192" })
|
|
1085
1107
|
] })
|
|
1086
1108
|
]
|
|
1087
1109
|
}
|
|
@@ -1090,7 +1112,7 @@ var Block = ({
|
|
|
1090
1112
|
Block.displayName = "Block";
|
|
1091
1113
|
|
|
1092
1114
|
// src/components/ReviewCard/ReviewCard.tsx
|
|
1093
|
-
import { jsx as
|
|
1115
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1094
1116
|
var cx15 = (className) => `hc-review-${className}`;
|
|
1095
1117
|
var ReviewCard = ({
|
|
1096
1118
|
name,
|
|
@@ -1101,26 +1123,26 @@ var ReviewCard = ({
|
|
|
1101
1123
|
}) => {
|
|
1102
1124
|
const containerClasses = [cx15("container"), className].filter(Boolean).join(" ");
|
|
1103
1125
|
return /* @__PURE__ */ jsxs15("div", { className: containerClasses, children: [
|
|
1104
|
-
/* @__PURE__ */
|
|
1126
|
+
/* @__PURE__ */ jsx16("div", { className: cx15("name"), children: name }),
|
|
1105
1127
|
/* @__PURE__ */ jsxs15("div", { className: cx15("frame"), children: [
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
-
/* @__PURE__ */
|
|
1128
|
+
/* @__PURE__ */ jsx16("div", { className: cx15("stars"), children: /* @__PURE__ */ jsx16(Rating, { variant: "stars", value: rating, size: "medium" }) }),
|
|
1129
|
+
/* @__PURE__ */ jsx16("div", { className: cx15("quote"), children: quote })
|
|
1108
1130
|
] }),
|
|
1109
|
-
/* @__PURE__ */
|
|
1131
|
+
/* @__PURE__ */ jsx16("div", { className: cx15("date"), children: date })
|
|
1110
1132
|
] });
|
|
1111
1133
|
};
|
|
1112
1134
|
ReviewCard.displayName = "ReviewCard";
|
|
1113
1135
|
|
|
1114
1136
|
// src/components/FAQ/FAQ.tsx
|
|
1115
1137
|
import { useState as useState4 } from "react";
|
|
1116
|
-
import { jsx as
|
|
1138
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1117
1139
|
var cx16 = (className) => `hc-faq-${className}`;
|
|
1118
1140
|
var ChevronIcon2 = ({ isOpen }) => {
|
|
1119
1141
|
const iconClasses = [
|
|
1120
1142
|
cx16("chevron"),
|
|
1121
1143
|
isOpen && cx16("chevron--open")
|
|
1122
1144
|
].filter(Boolean).join(" ");
|
|
1123
|
-
return /* @__PURE__ */
|
|
1145
|
+
return /* @__PURE__ */ jsx17(
|
|
1124
1146
|
"svg",
|
|
1125
1147
|
{
|
|
1126
1148
|
width: "24",
|
|
@@ -1129,7 +1151,7 @@ var ChevronIcon2 = ({ isOpen }) => {
|
|
|
1129
1151
|
fill: "none",
|
|
1130
1152
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1131
1153
|
className: iconClasses,
|
|
1132
|
-
children: /* @__PURE__ */
|
|
1154
|
+
children: /* @__PURE__ */ jsx17(
|
|
1133
1155
|
"path",
|
|
1134
1156
|
{
|
|
1135
1157
|
d: "M6 9L12 15L18 9",
|
|
@@ -1166,11 +1188,11 @@ var FAQ = ({
|
|
|
1166
1188
|
});
|
|
1167
1189
|
};
|
|
1168
1190
|
const containerClasses = [cx16("container"), className].filter(Boolean).join(" ");
|
|
1169
|
-
return /* @__PURE__ */
|
|
1191
|
+
return /* @__PURE__ */ jsx17("div", { className: containerClasses, children: items.map((item, index) => {
|
|
1170
1192
|
const isOpen = openIndices.has(index);
|
|
1171
1193
|
const answerClasses = isOpen ? cx16("answer--open") : cx16("answer");
|
|
1172
1194
|
return /* @__PURE__ */ jsxs16("div", { className: cx16("item"), children: [
|
|
1173
|
-
/* @__PURE__ */
|
|
1195
|
+
/* @__PURE__ */ jsx17(
|
|
1174
1196
|
Button,
|
|
1175
1197
|
{
|
|
1176
1198
|
variant: "link",
|
|
@@ -1179,18 +1201,18 @@ var FAQ = ({
|
|
|
1179
1201
|
onClick: () => toggleItem(index),
|
|
1180
1202
|
"aria-expanded": isOpen,
|
|
1181
1203
|
"aria-controls": `faq-answer-${index}`,
|
|
1182
|
-
rightIcon: /* @__PURE__ */
|
|
1183
|
-
children: /* @__PURE__ */
|
|
1204
|
+
rightIcon: /* @__PURE__ */ jsx17("div", { className: cx16("icon-container"), children: /* @__PURE__ */ jsx17(ChevronIcon2, { isOpen }) }),
|
|
1205
|
+
children: /* @__PURE__ */ jsx17("span", { className: cx16("question-text"), children: item.question })
|
|
1184
1206
|
}
|
|
1185
1207
|
),
|
|
1186
|
-
/* @__PURE__ */
|
|
1208
|
+
/* @__PURE__ */ jsx17("div", { id: `faq-answer-${index}`, className: answerClasses, children: /* @__PURE__ */ jsx17("p", { className: cx16("answer-text"), children: item.answer }) })
|
|
1187
1209
|
] }, index);
|
|
1188
1210
|
}) });
|
|
1189
1211
|
};
|
|
1190
1212
|
FAQ.displayName = "FAQ";
|
|
1191
1213
|
|
|
1192
1214
|
// src/components/Benefits/Benefits.tsx
|
|
1193
|
-
import { jsx as
|
|
1215
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1194
1216
|
var cx17 = (className) => `hc-benefits-${className}`;
|
|
1195
1217
|
var Benefits = ({
|
|
1196
1218
|
title = "Ihre Vorteile mit HotelCard",
|
|
@@ -1220,19 +1242,19 @@ var Benefits = ({
|
|
|
1220
1242
|
className
|
|
1221
1243
|
}) => {
|
|
1222
1244
|
const sectionClasses = [cx17("section"), className].filter(Boolean).join(" ");
|
|
1223
|
-
return /* @__PURE__ */
|
|
1245
|
+
return /* @__PURE__ */ jsx18("section", { className: sectionClasses, children: /* @__PURE__ */ jsxs17("div", { className: cx17("container"), children: [
|
|
1224
1246
|
/* @__PURE__ */ jsxs17("div", { className: cx17("header"), children: [
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
subtitle && /* @__PURE__ */
|
|
1247
|
+
/* @__PURE__ */ jsx18("h2", { className: cx17("title"), children: title }),
|
|
1248
|
+
subtitle && /* @__PURE__ */ jsx18("p", { className: cx17("subtitle"), children: subtitle })
|
|
1227
1249
|
] }),
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1230
|
-
benefit.description && /* @__PURE__ */
|
|
1250
|
+
/* @__PURE__ */ jsx18("div", { className: cx17("grid"), children: benefits.map((benefit, index) => /* @__PURE__ */ jsxs17("div", { className: cx17("item"), children: [
|
|
1251
|
+
/* @__PURE__ */ jsx18("h3", { className: cx17("item-title"), children: benefit.title }),
|
|
1252
|
+
benefit.description && /* @__PURE__ */ jsx18("p", { className: cx17("item-description"), children: benefit.description })
|
|
1231
1253
|
] }, index)) }),
|
|
1232
1254
|
contactTitle && /* @__PURE__ */ jsxs17("div", { className: cx17("contact-card"), children: [
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
contactDescription && /* @__PURE__ */
|
|
1235
|
-
contactButtonText && /* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ jsx18("h3", { className: cx17("contact-title"), children: contactTitle }),
|
|
1256
|
+
contactDescription && /* @__PURE__ */ jsx18("p", { className: cx17("contact-description"), children: contactDescription }),
|
|
1257
|
+
contactButtonText && /* @__PURE__ */ jsx18(
|
|
1236
1258
|
Button,
|
|
1237
1259
|
{
|
|
1238
1260
|
variant: "secondary",
|
|
@@ -1249,9 +1271,9 @@ Benefits.displayName = "Benefits";
|
|
|
1249
1271
|
|
|
1250
1272
|
// src/components/Pin/Pin.tsx
|
|
1251
1273
|
import { forwardRef as forwardRef2 } from "react";
|
|
1252
|
-
import { Fragment as Fragment4, jsx as
|
|
1274
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1253
1275
|
var cx18 = (className) => `hc-pin-${className}`;
|
|
1254
|
-
var HeartIcon = ({ className }) => /* @__PURE__ */
|
|
1276
|
+
var HeartIcon = ({ className }) => /* @__PURE__ */ jsx19(
|
|
1255
1277
|
"svg",
|
|
1256
1278
|
{
|
|
1257
1279
|
className,
|
|
@@ -1260,10 +1282,10 @@ var HeartIcon = ({ className }) => /* @__PURE__ */ jsx18(
|
|
|
1260
1282
|
viewBox: "0 0 16 16",
|
|
1261
1283
|
fill: "currentColor",
|
|
1262
1284
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1263
|
-
children: /* @__PURE__ */
|
|
1285
|
+
children: /* @__PURE__ */ jsx19("path", { d: "M8 14.2333L6.96667 13.2933C3.6 10.24 1.33333 8.18667 1.33333 5.66667C1.33333 3.61333 2.94667 2 5 2C6.16 2 7.27333 2.54 8 3.39333C8.72667 2.54 9.84 2 11 2C13.0533 2 14.6667 3.61333 14.6667 5.66667C14.6667 8.18667 12.4 10.24 9.03333 13.2933L8 14.2333Z" })
|
|
1264
1286
|
}
|
|
1265
1287
|
);
|
|
1266
|
-
var HomeIcon = ({ className }) => /* @__PURE__ */
|
|
1288
|
+
var HomeIcon = ({ className }) => /* @__PURE__ */ jsx19(
|
|
1267
1289
|
"svg",
|
|
1268
1290
|
{
|
|
1269
1291
|
className,
|
|
@@ -1272,7 +1294,7 @@ var HomeIcon = ({ className }) => /* @__PURE__ */ jsx18(
|
|
|
1272
1294
|
viewBox: "0 0 16 16",
|
|
1273
1295
|
fill: "currentColor",
|
|
1274
1296
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1275
|
-
children: /* @__PURE__ */
|
|
1297
|
+
children: /* @__PURE__ */ jsx19("path", { d: "M6.66667 13.3333V9.33333H9.33333V13.3333H12.6667V8H14.6667L8 2L1.33333 8H3.33333V13.3333H6.66667Z" })
|
|
1276
1298
|
}
|
|
1277
1299
|
);
|
|
1278
1300
|
var Pin = forwardRef2(
|
|
@@ -1303,12 +1325,12 @@ var Pin = forwardRef2(
|
|
|
1303
1325
|
disabled,
|
|
1304
1326
|
onClick,
|
|
1305
1327
|
children: [
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
/* @__PURE__ */
|
|
1308
|
-
/* @__PURE__ */
|
|
1309
|
-
showFavorite && /* @__PURE__ */
|
|
1310
|
-
] }) : /* @__PURE__ */
|
|
1311
|
-
/* @__PURE__ */
|
|
1328
|
+
/* @__PURE__ */ jsx19("div", { className: cx18("body"), children: variant === "price" ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
|
|
1329
|
+
/* @__PURE__ */ jsx19("span", { className: cx18("currency"), children: currency }),
|
|
1330
|
+
/* @__PURE__ */ jsx19("span", { className: cx18("price"), children: formattedPrice }),
|
|
1331
|
+
showFavorite && /* @__PURE__ */ jsx19("div", { className: cx18("favorite-container"), children: /* @__PURE__ */ jsx19(HeartIcon, { className: cx18("favorite-icon") }) })
|
|
1332
|
+
] }) : /* @__PURE__ */ jsx19(HomeIcon, { className: cx18("hotel-icon") }) }),
|
|
1333
|
+
/* @__PURE__ */ jsx19("div", { className: cx18("pointer"), children: /* @__PURE__ */ jsx19("div", { className: cx18("pointer-inner") }) })
|
|
1312
1334
|
]
|
|
1313
1335
|
}
|
|
1314
1336
|
);
|
|
@@ -1316,9 +1338,805 @@ var Pin = forwardRef2(
|
|
|
1316
1338
|
);
|
|
1317
1339
|
Pin.displayName = "Pin";
|
|
1318
1340
|
|
|
1341
|
+
// src/components/DateSelector/DateSelector.tsx
|
|
1342
|
+
import { useState as useState9, useRef as useRef4, useEffect as useEffect6, useMemo } from "react";
|
|
1343
|
+
|
|
1344
|
+
// src/hooks/useDebounce.ts
|
|
1345
|
+
import { useState as useState5, useEffect as useEffect3 } from "react";
|
|
1346
|
+
var useDebounce = (value, delay) => {
|
|
1347
|
+
const [debouncedValue, setDebouncedValue] = useState5(value);
|
|
1348
|
+
useEffect3(() => {
|
|
1349
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
1350
|
+
return () => clearTimeout(timer);
|
|
1351
|
+
}, [value, delay]);
|
|
1352
|
+
return debouncedValue;
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
// src/hooks/useResponsive.ts
|
|
1356
|
+
import { useState as useState6, useEffect as useEffect4 } from "react";
|
|
1357
|
+
var useResponsive = () => {
|
|
1358
|
+
const [width, setWidth] = useState6(
|
|
1359
|
+
typeof window !== "undefined" ? window.innerWidth : 1024
|
|
1360
|
+
);
|
|
1361
|
+
useEffect4(() => {
|
|
1362
|
+
const handleResize = () => {
|
|
1363
|
+
setWidth(window.innerWidth);
|
|
1364
|
+
};
|
|
1365
|
+
handleResize();
|
|
1366
|
+
window.addEventListener("resize", handleResize);
|
|
1367
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
1368
|
+
}, []);
|
|
1369
|
+
return {
|
|
1370
|
+
isDesktop: width >= 1024
|
|
1371
|
+
};
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
// src/hooks/useWindowData.ts
|
|
1375
|
+
var useWindowData = () => {
|
|
1376
|
+
const { locale, currency } = useUIContext();
|
|
1377
|
+
return { locale, currency };
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
// src/hooks/useTranslation.ts
|
|
1381
|
+
import { useTranslation as useI18nTranslation } from "react-i18next";
|
|
1382
|
+
var useTranslation = (namespace) => {
|
|
1383
|
+
const { t: i18nT, i18n } = useI18nTranslation(namespace);
|
|
1384
|
+
const t = (key, options, fallback) => {
|
|
1385
|
+
const result = i18nT(key, options ?? {});
|
|
1386
|
+
const resultStr = String(result);
|
|
1387
|
+
if (resultStr === key && fallback !== void 0) {
|
|
1388
|
+
return fallback;
|
|
1389
|
+
}
|
|
1390
|
+
return resultStr;
|
|
1391
|
+
};
|
|
1392
|
+
return { t, i18n };
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
// src/components/DateSelector/WhenContent.tsx
|
|
1396
|
+
import { useState as useState8, useEffect as useEffect5 } from "react";
|
|
1397
|
+
|
|
1398
|
+
// src/components/DateSelector/DualCalendar.tsx
|
|
1399
|
+
import { useState as useState7 } from "react";
|
|
1400
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1401
|
+
var cx19 = (name) => `hc-dual-calendar${name ? `__${name}` : ""}`;
|
|
1402
|
+
var cxMod = (base, mod) => `hc-dual-calendar__${base}--${mod}`;
|
|
1403
|
+
var DualCalendar = ({
|
|
1404
|
+
startDate,
|
|
1405
|
+
endDate,
|
|
1406
|
+
onDateSelect,
|
|
1407
|
+
minDate,
|
|
1408
|
+
locale = "de-CH"
|
|
1409
|
+
}) => {
|
|
1410
|
+
const { isDesktop } = useResponsive();
|
|
1411
|
+
const [currentMonth, setCurrentMonth] = useState7(/* @__PURE__ */ new Date());
|
|
1412
|
+
const isStartDate = (dateStr) => startDate === dateStr;
|
|
1413
|
+
const isEndDate = (dateStr) => endDate === dateStr;
|
|
1414
|
+
const isMidDate = (dateStr) => {
|
|
1415
|
+
if (!startDate || !endDate) return false;
|
|
1416
|
+
return dateStr > startDate && dateStr < endDate;
|
|
1417
|
+
};
|
|
1418
|
+
const endOfMonth = (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
1419
|
+
const getDaysInMonth = (date) => {
|
|
1420
|
+
return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
1421
|
+
};
|
|
1422
|
+
const getFirstDayOfMonth = (date) => {
|
|
1423
|
+
const day = new Date(date.getFullYear(), date.getMonth(), 1).getDay();
|
|
1424
|
+
return day === 0 ? 6 : day - 1;
|
|
1425
|
+
};
|
|
1426
|
+
const formatMonthYear = (date) => {
|
|
1427
|
+
return date.toLocaleDateString(locale, { month: "long", year: "numeric" });
|
|
1428
|
+
};
|
|
1429
|
+
const getWeekDays = () => {
|
|
1430
|
+
const days = [];
|
|
1431
|
+
const baseDate = new Date(2020, 0, 6);
|
|
1432
|
+
for (let i = 0; i < 7; i++) {
|
|
1433
|
+
const date = new Date(baseDate);
|
|
1434
|
+
date.setDate(baseDate.getDate() + i);
|
|
1435
|
+
days.push(date.toLocaleDateString(locale, { weekday: "short" }).slice(0, 2));
|
|
1436
|
+
}
|
|
1437
|
+
return days;
|
|
1438
|
+
};
|
|
1439
|
+
const weekDays = getWeekDays();
|
|
1440
|
+
const isDateDisabled = (dateStr) => {
|
|
1441
|
+
const today2 = /* @__PURE__ */ new Date();
|
|
1442
|
+
const oneYearFromToday = new Date(today2.getFullYear() + 1, today2.getMonth(), today2.getDate());
|
|
1443
|
+
const dateParts = dateStr.split("-").map(Number);
|
|
1444
|
+
const date = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]);
|
|
1445
|
+
if (minDate) {
|
|
1446
|
+
const minParts = minDate.split("-").map(Number);
|
|
1447
|
+
const min = new Date(minParts[0], minParts[1] - 1, minParts[2]);
|
|
1448
|
+
if (date < min) return true;
|
|
1449
|
+
}
|
|
1450
|
+
if (date > oneYearFromToday) return true;
|
|
1451
|
+
return false;
|
|
1452
|
+
};
|
|
1453
|
+
const generateCalendar = (monthOffset) => {
|
|
1454
|
+
const date = new Date(currentMonth.getFullYear(), currentMonth.getMonth() + monthOffset, 1);
|
|
1455
|
+
const daysInMonth = getDaysInMonth(date);
|
|
1456
|
+
const firstDay = getFirstDayOfMonth(date);
|
|
1457
|
+
const days = [];
|
|
1458
|
+
for (let i = 0; i < firstDay; i++) {
|
|
1459
|
+
days.push(/* @__PURE__ */ jsx20("div", { className: cx19("day") }, `empty-${i}`));
|
|
1460
|
+
}
|
|
1461
|
+
for (let day = 1; day <= daysInMonth; day++) {
|
|
1462
|
+
const dateStr = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(day).padStart(2, "0")}`;
|
|
1463
|
+
const disabled = isDateDisabled(dateStr);
|
|
1464
|
+
const start = isStartDate(dateStr);
|
|
1465
|
+
const end = isEndDate(dateStr);
|
|
1466
|
+
const inRange = isMidDate(dateStr);
|
|
1467
|
+
const classes = [
|
|
1468
|
+
cx19("day"),
|
|
1469
|
+
cx19("day-button"),
|
|
1470
|
+
disabled && cxMod("day-button", "disabled"),
|
|
1471
|
+
start && cxMod("day-button", "start"),
|
|
1472
|
+
end && cxMod("day-button", "end"),
|
|
1473
|
+
inRange && cxMod("day-button", "in-range")
|
|
1474
|
+
].filter(Boolean).join(" ");
|
|
1475
|
+
days.push(
|
|
1476
|
+
/* @__PURE__ */ jsx20(
|
|
1477
|
+
"button",
|
|
1478
|
+
{
|
|
1479
|
+
type: "button",
|
|
1480
|
+
className: classes,
|
|
1481
|
+
onClick: () => !disabled && onDateSelect(dateStr),
|
|
1482
|
+
disabled,
|
|
1483
|
+
children: day
|
|
1484
|
+
},
|
|
1485
|
+
day
|
|
1486
|
+
)
|
|
1487
|
+
);
|
|
1488
|
+
}
|
|
1489
|
+
return days;
|
|
1490
|
+
};
|
|
1491
|
+
const handlePrevMonth = () => {
|
|
1492
|
+
setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1));
|
|
1493
|
+
};
|
|
1494
|
+
const handleNextMonth = () => {
|
|
1495
|
+
setCurrentMonth(new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1));
|
|
1496
|
+
};
|
|
1497
|
+
const prevMonth = new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1);
|
|
1498
|
+
const isPrevDisabled = minDate ? endOfMonth(prevMonth) < new Date(minDate) : false;
|
|
1499
|
+
const today = /* @__PURE__ */ new Date();
|
|
1500
|
+
const maxMonth = new Date(today.getFullYear() + 1, today.getMonth(), 1);
|
|
1501
|
+
const nextMonth = new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1);
|
|
1502
|
+
const isNextDisabled = nextMonth >= maxMonth;
|
|
1503
|
+
const PrevArrow = () => /* @__PURE__ */ jsx20("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx20("path", { d: "M6.09652 9.36666C5.74908 9.71647 5.74908 10.2821 6.09652 10.6282L11.8223 16.4043C12.1698 16.7541 12.7316 16.7541 13.0754 16.4043C13.4191 16.0545 13.4228 15.4888 13.0754 15.1428L7.97791 9.9993L13.0754 4.85584C13.4228 4.50603 13.4228 3.94038 13.0754 3.59429C12.7279 3.2482 12.1661 3.24448 11.8223 3.59429L6.09652 9.36666Z", fill: "#1F2937" }) });
|
|
1504
|
+
const NextArrow = () => /* @__PURE__ */ jsx20("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx20("path", { d: "M13.9035 9.36666C14.2509 9.71647 14.2509 10.2821 13.9035 10.6282L8.17767 16.4043C7.83023 16.7541 7.2684 16.7541 6.92465 16.4043C6.5809 16.0545 6.5772 15.4888 6.92465 15.1428L12.0221 9.9993L6.92465 4.85584C6.5772 4.50603 6.5772 3.94038 6.92465 3.59429C7.27209 3.2482 7.83392 3.24448 8.17767 3.59429L13.9035 9.37039V9.36666Z", fill: "#1F2937" }) });
|
|
1505
|
+
const navButtonClasses = (disabled) => [
|
|
1506
|
+
cx19("nav-button"),
|
|
1507
|
+
disabled && cxMod("nav-button", "disabled")
|
|
1508
|
+
].filter(Boolean).join(" ");
|
|
1509
|
+
return /* @__PURE__ */ jsxs19("div", { className: `${cx19("")} ${!isDesktop ? cxMod("", "mobile") : ""}`, children: [
|
|
1510
|
+
!isDesktop && /* @__PURE__ */ jsxs19("div", { className: cx19("navigation"), children: [
|
|
1511
|
+
/* @__PURE__ */ jsx20(
|
|
1512
|
+
"button",
|
|
1513
|
+
{
|
|
1514
|
+
type: "button",
|
|
1515
|
+
className: navButtonClasses(isPrevDisabled),
|
|
1516
|
+
onClick: handlePrevMonth,
|
|
1517
|
+
disabled: isPrevDisabled,
|
|
1518
|
+
children: /* @__PURE__ */ jsx20(PrevArrow, {})
|
|
1519
|
+
}
|
|
1520
|
+
),
|
|
1521
|
+
/* @__PURE__ */ jsx20("h3", { className: `${cx19("month-title")} ${cx19("month-title--mobile")}`, children: formatMonthYear(currentMonth) }),
|
|
1522
|
+
/* @__PURE__ */ jsx20(
|
|
1523
|
+
"button",
|
|
1524
|
+
{
|
|
1525
|
+
type: "button",
|
|
1526
|
+
className: navButtonClasses(isNextDisabled),
|
|
1527
|
+
onClick: handleNextMonth,
|
|
1528
|
+
disabled: isNextDisabled,
|
|
1529
|
+
children: /* @__PURE__ */ jsx20(NextArrow, {})
|
|
1530
|
+
}
|
|
1531
|
+
)
|
|
1532
|
+
] }),
|
|
1533
|
+
isDesktop ? /* @__PURE__ */ jsxs19("div", { className: cx19("desktop-layout"), children: [
|
|
1534
|
+
/* @__PURE__ */ jsx20(
|
|
1535
|
+
"button",
|
|
1536
|
+
{
|
|
1537
|
+
type: "button",
|
|
1538
|
+
className: navButtonClasses(isPrevDisabled),
|
|
1539
|
+
onClick: handlePrevMonth,
|
|
1540
|
+
disabled: isPrevDisabled,
|
|
1541
|
+
children: /* @__PURE__ */ jsx20(PrevArrow, {})
|
|
1542
|
+
}
|
|
1543
|
+
),
|
|
1544
|
+
/* @__PURE__ */ jsxs19("div", { className: cx19("calendars"), children: [
|
|
1545
|
+
/* @__PURE__ */ jsxs19("div", { className: cx19("calendar"), children: [
|
|
1546
|
+
/* @__PURE__ */ jsx20("h3", { className: cx19("month-title"), children: formatMonthYear(currentMonth) }),
|
|
1547
|
+
/* @__PURE__ */ jsx20("div", { className: cx19("weekdays"), children: weekDays.map((day, i) => /* @__PURE__ */ jsx20("div", { className: `${cx19("weekday")} ${i >= 5 ? cxMod("weekday", "weekend") : ""}`, children: day }, day)) }),
|
|
1548
|
+
/* @__PURE__ */ jsx20("div", { className: cx19("days"), children: generateCalendar(0) })
|
|
1549
|
+
] }),
|
|
1550
|
+
/* @__PURE__ */ jsxs19("div", { className: cx19("calendar"), children: [
|
|
1551
|
+
/* @__PURE__ */ jsx20("h3", { className: cx19("month-title"), children: formatMonthYear(nextMonth) }),
|
|
1552
|
+
/* @__PURE__ */ jsx20("div", { className: cx19("weekdays"), children: weekDays.map((day, i) => /* @__PURE__ */ jsx20("div", { className: `${cx19("weekday")} ${i >= 5 ? cxMod("weekday", "weekend") : ""}`, children: day }, day)) }),
|
|
1553
|
+
/* @__PURE__ */ jsx20("div", { className: cx19("days"), children: generateCalendar(1) })
|
|
1554
|
+
] })
|
|
1555
|
+
] }),
|
|
1556
|
+
/* @__PURE__ */ jsx20(
|
|
1557
|
+
"button",
|
|
1558
|
+
{
|
|
1559
|
+
type: "button",
|
|
1560
|
+
className: navButtonClasses(isNextDisabled),
|
|
1561
|
+
onClick: handleNextMonth,
|
|
1562
|
+
disabled: isNextDisabled,
|
|
1563
|
+
children: /* @__PURE__ */ jsx20(NextArrow, {})
|
|
1564
|
+
}
|
|
1565
|
+
)
|
|
1566
|
+
] }) : (
|
|
1567
|
+
/* Mobile: Single calendar */
|
|
1568
|
+
/* @__PURE__ */ jsx20("div", { className: `${cx19("calendars")} ${cxMod("calendars", "mobile")}`, children: /* @__PURE__ */ jsxs19("div", { className: cx19("calendar"), children: [
|
|
1569
|
+
/* @__PURE__ */ jsx20("div", { className: cx19("weekdays"), children: weekDays.map((day, i) => /* @__PURE__ */ jsx20("div", { className: `${cx19("weekday")} ${i >= 5 ? cxMod("weekday", "weekend") : ""}`, children: day }, day)) }),
|
|
1570
|
+
/* @__PURE__ */ jsx20("div", { className: cx19("days"), children: generateCalendar(0) })
|
|
1571
|
+
] }) })
|
|
1572
|
+
)
|
|
1573
|
+
] });
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
// src/components/DateSelector/WhenContent.tsx
|
|
1577
|
+
import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1578
|
+
var cx20 = (name) => `hc-when-content${name ? `__${name}` : ""}`;
|
|
1579
|
+
var cxMod2 = (base, mod) => `hc-when-content__${base}--${mod}`;
|
|
1580
|
+
var getDateLocale = (locale) => {
|
|
1581
|
+
const localeMap = {
|
|
1582
|
+
de: "de-CH",
|
|
1583
|
+
en: "en-GB",
|
|
1584
|
+
fr: "fr-CH",
|
|
1585
|
+
it: "it-CH"
|
|
1586
|
+
};
|
|
1587
|
+
return localeMap[locale] || "de-CH";
|
|
1588
|
+
};
|
|
1589
|
+
var defaultLabels = {
|
|
1590
|
+
when: "When",
|
|
1591
|
+
dates: "Dates",
|
|
1592
|
+
flexible: "Flexible",
|
|
1593
|
+
apply: "Apply",
|
|
1594
|
+
selectMonths: "Select months",
|
|
1595
|
+
anytime: "Anytime"
|
|
1596
|
+
};
|
|
1597
|
+
var WhenContent = ({
|
|
1598
|
+
initialDateRange = { start: null, end: null },
|
|
1599
|
+
initialMonthFilter = null,
|
|
1600
|
+
onChange,
|
|
1601
|
+
onMonthFilterChange,
|
|
1602
|
+
variant = "dropdown",
|
|
1603
|
+
showApplyButton = true,
|
|
1604
|
+
onApply,
|
|
1605
|
+
className = "",
|
|
1606
|
+
labels: labelsProp,
|
|
1607
|
+
locale: localeProp
|
|
1608
|
+
}) => {
|
|
1609
|
+
const { locale: contextLocale } = useWindowData();
|
|
1610
|
+
const { isDesktop } = useResponsive();
|
|
1611
|
+
const locale = localeProp || contextLocale;
|
|
1612
|
+
const dateLocale = getDateLocale(locale);
|
|
1613
|
+
const labels = { ...defaultLabels, ...labelsProp };
|
|
1614
|
+
const [dateRange, setDateRange] = useState8(initialDateRange);
|
|
1615
|
+
const [mode, setMode] = useState8(
|
|
1616
|
+
initialDateRange.start ? "dates" : "anytime"
|
|
1617
|
+
);
|
|
1618
|
+
const selectedMonths = initialMonthFilter || [];
|
|
1619
|
+
const isAnytimeSelected = selectedMonths.length === 0;
|
|
1620
|
+
useEffect5(() => {
|
|
1621
|
+
if (initialDateRange.start || initialDateRange.end) {
|
|
1622
|
+
setDateRange(initialDateRange);
|
|
1623
|
+
setMode("dates");
|
|
1624
|
+
} else {
|
|
1625
|
+
setDateRange(initialDateRange);
|
|
1626
|
+
if (initialMonthFilter && initialMonthFilter.length > 0) {
|
|
1627
|
+
setMode("anytime");
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
}, [initialDateRange, initialMonthFilter]);
|
|
1631
|
+
const generateMonths = () => {
|
|
1632
|
+
const months2 = [];
|
|
1633
|
+
const now = /* @__PURE__ */ new Date();
|
|
1634
|
+
for (let i = 0; i < 12; i++) {
|
|
1635
|
+
const date = new Date(now.getFullYear(), now.getMonth() + i, 1);
|
|
1636
|
+
months2.push({
|
|
1637
|
+
label: date.toLocaleDateString(dateLocale, { month: "long" }),
|
|
1638
|
+
year: date.getFullYear(),
|
|
1639
|
+
value: `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}`,
|
|
1640
|
+
disabled: false
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
return months2;
|
|
1644
|
+
};
|
|
1645
|
+
const months = generateMonths();
|
|
1646
|
+
const handleAnytimeClick = () => {
|
|
1647
|
+
setDateRange({ start: null, end: null });
|
|
1648
|
+
onChange?.(null);
|
|
1649
|
+
onMonthFilterChange?.(null);
|
|
1650
|
+
};
|
|
1651
|
+
const handleMonthToggle = (monthValue) => {
|
|
1652
|
+
const newSelectedMonths = selectedMonths.includes(monthValue) ? selectedMonths.filter((m) => m !== monthValue) : [...selectedMonths, monthValue];
|
|
1653
|
+
setDateRange({ start: null, end: null });
|
|
1654
|
+
onChange?.(null);
|
|
1655
|
+
if (newSelectedMonths.length === 0) {
|
|
1656
|
+
onMonthFilterChange?.(null);
|
|
1657
|
+
} else {
|
|
1658
|
+
onMonthFilterChange?.(newSelectedMonths);
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
const handleApply = () => {
|
|
1662
|
+
if (mode === "anytime") {
|
|
1663
|
+
if (selectedMonths.length === 0) {
|
|
1664
|
+
onChange?.(null);
|
|
1665
|
+
}
|
|
1666
|
+
} else {
|
|
1667
|
+
if (dateRange.start && dateRange.end) {
|
|
1668
|
+
onChange?.(dateRange);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
onApply?.();
|
|
1672
|
+
};
|
|
1673
|
+
const handleModeSwitch = (newMode) => {
|
|
1674
|
+
setMode(newMode);
|
|
1675
|
+
if (newMode === "anytime") {
|
|
1676
|
+
setDateRange({ start: null, end: null });
|
|
1677
|
+
onChange?.(null);
|
|
1678
|
+
onMonthFilterChange?.(null);
|
|
1679
|
+
} else {
|
|
1680
|
+
onMonthFilterChange?.(null);
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
const getTodayDate = () => {
|
|
1684
|
+
return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
1685
|
+
};
|
|
1686
|
+
const getNextDate = (dateString) => {
|
|
1687
|
+
const date = new Date(dateString);
|
|
1688
|
+
date.setDate(date.getDate() + 1);
|
|
1689
|
+
return date.toISOString().split("T")[0];
|
|
1690
|
+
};
|
|
1691
|
+
const handleDateSelect = (date) => {
|
|
1692
|
+
if (!dateRange.start || dateRange.start && dateRange.end) {
|
|
1693
|
+
const newRange = { start: date, end: null };
|
|
1694
|
+
setDateRange(newRange);
|
|
1695
|
+
onChange?.(newRange);
|
|
1696
|
+
} else if (date === dateRange.start) {
|
|
1697
|
+
const nextDate = getNextDate(date);
|
|
1698
|
+
const newRange = { start: dateRange.start, end: nextDate };
|
|
1699
|
+
setDateRange(newRange);
|
|
1700
|
+
onChange?.(newRange);
|
|
1701
|
+
} else if (date > dateRange.start) {
|
|
1702
|
+
const newRange = { start: dateRange.start, end: date };
|
|
1703
|
+
setDateRange(newRange);
|
|
1704
|
+
onChange?.(newRange);
|
|
1705
|
+
} else {
|
|
1706
|
+
const newRange = { start: date, end: null };
|
|
1707
|
+
setDateRange(newRange);
|
|
1708
|
+
onChange?.(newRange);
|
|
1709
|
+
}
|
|
1710
|
+
};
|
|
1711
|
+
const containerClasses = [
|
|
1712
|
+
cx20(""),
|
|
1713
|
+
variant === "expanded" && cxMod2("", "expanded"),
|
|
1714
|
+
className
|
|
1715
|
+
].filter(Boolean).join(" ");
|
|
1716
|
+
const monthGridClasses = [
|
|
1717
|
+
cx20("month-grid"),
|
|
1718
|
+
!isDesktop && cxMod2("month-grid", "mobile")
|
|
1719
|
+
].filter(Boolean).join(" ");
|
|
1720
|
+
const contentClasses = [
|
|
1721
|
+
cx20("content"),
|
|
1722
|
+
mode === "dates" && cxMod2("content", "dates")
|
|
1723
|
+
].filter(Boolean).join(" ");
|
|
1724
|
+
return /* @__PURE__ */ jsxs20("div", { className: containerClasses, children: [
|
|
1725
|
+
variant === "expanded" && /* @__PURE__ */ jsx21("h2", { className: cx20("section-title"), children: labels.when }),
|
|
1726
|
+
/* @__PURE__ */ jsxs20("div", { className: cx20("header"), children: [
|
|
1727
|
+
/* @__PURE__ */ jsxs20("div", { className: cx20("tabs"), children: [
|
|
1728
|
+
/* @__PURE__ */ jsx21(
|
|
1729
|
+
"button",
|
|
1730
|
+
{
|
|
1731
|
+
type: "button",
|
|
1732
|
+
className: `${cx20("tab")} ${mode === "dates" ? cxMod2("tab", "active") : ""}`,
|
|
1733
|
+
onClick: () => handleModeSwitch("dates"),
|
|
1734
|
+
children: labels.dates
|
|
1735
|
+
}
|
|
1736
|
+
),
|
|
1737
|
+
/* @__PURE__ */ jsx21(
|
|
1738
|
+
"button",
|
|
1739
|
+
{
|
|
1740
|
+
type: "button",
|
|
1741
|
+
className: `${cx20("tab")} ${mode === "anytime" ? cxMod2("tab", "active") : ""}`,
|
|
1742
|
+
onClick: () => handleModeSwitch("anytime"),
|
|
1743
|
+
children: labels.flexible
|
|
1744
|
+
}
|
|
1745
|
+
)
|
|
1746
|
+
] }),
|
|
1747
|
+
showApplyButton && /* @__PURE__ */ jsx21("div", { className: cx20("apply"), children: /* @__PURE__ */ jsx21(Button, { variant: "secondary", size: "medium", onClick: handleApply, children: labels.apply }) })
|
|
1748
|
+
] }),
|
|
1749
|
+
/* @__PURE__ */ jsx21("div", { className: contentClasses, children: mode === "anytime" ? /* @__PURE__ */ jsxs20("div", { className: cx20("flexible"), children: [
|
|
1750
|
+
/* @__PURE__ */ jsx21("h3", { className: cx20("heading"), children: labels.selectMonths }),
|
|
1751
|
+
/* @__PURE__ */ jsxs20("div", { className: monthGridClasses, children: [
|
|
1752
|
+
/* @__PURE__ */ jsx21(
|
|
1753
|
+
"button",
|
|
1754
|
+
{
|
|
1755
|
+
type: "button",
|
|
1756
|
+
className: `${cx20("month-button")} ${cx20("anytime-button")} ${isAnytimeSelected ? cxMod2("month-button", "selected") : ""}`,
|
|
1757
|
+
onClick: handleAnytimeClick,
|
|
1758
|
+
children: /* @__PURE__ */ jsx21("span", { className: cx20("month-label"), children: labels.anytime })
|
|
1759
|
+
}
|
|
1760
|
+
),
|
|
1761
|
+
months.map((month) => /* @__PURE__ */ jsxs20(
|
|
1762
|
+
"button",
|
|
1763
|
+
{
|
|
1764
|
+
type: "button",
|
|
1765
|
+
className: `${cx20("month-button")} ${selectedMonths.includes(month.value) ? cxMod2("month-button", "selected") : ""} ${month.disabled ? cxMod2("month-button", "disabled") : ""}`,
|
|
1766
|
+
onClick: () => !month.disabled && handleMonthToggle(month.value),
|
|
1767
|
+
disabled: month.disabled,
|
|
1768
|
+
children: [
|
|
1769
|
+
/* @__PURE__ */ jsx21("span", { className: cx20("month-label"), children: month.label }),
|
|
1770
|
+
/* @__PURE__ */ jsx21("span", { className: cx20("month-year"), children: month.year })
|
|
1771
|
+
]
|
|
1772
|
+
},
|
|
1773
|
+
month.value
|
|
1774
|
+
))
|
|
1775
|
+
] })
|
|
1776
|
+
] }) : /* @__PURE__ */ jsx21("div", { className: cx20("dates"), children: /* @__PURE__ */ jsx21(
|
|
1777
|
+
DualCalendar,
|
|
1778
|
+
{
|
|
1779
|
+
startDate: dateRange.start,
|
|
1780
|
+
endDate: dateRange.end,
|
|
1781
|
+
locale: dateLocale,
|
|
1782
|
+
onDateSelect: handleDateSelect,
|
|
1783
|
+
minDate: getTodayDate()
|
|
1784
|
+
}
|
|
1785
|
+
) }) })
|
|
1786
|
+
] });
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
// src/components/DateSelector/DateSelector.tsx
|
|
1790
|
+
import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1791
|
+
var cx21 = (name) => `hc-date-selector${name ? `__${name}` : ""}`;
|
|
1792
|
+
var cxMod3 = (base, mod) => `hc-date-selector__${base}--${mod}`;
|
|
1793
|
+
var getDateLocale2 = (locale) => {
|
|
1794
|
+
const localeMap = {
|
|
1795
|
+
de: "de-CH",
|
|
1796
|
+
en: "en-GB",
|
|
1797
|
+
fr: "fr-CH",
|
|
1798
|
+
it: "it-CH"
|
|
1799
|
+
};
|
|
1800
|
+
return localeMap[locale] || "de-CH";
|
|
1801
|
+
};
|
|
1802
|
+
var CalendarIcon = () => /* @__PURE__ */ jsx22("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx22(
|
|
1803
|
+
"path",
|
|
1804
|
+
{
|
|
1805
|
+
d: "M19 4H18V2H16V4H8V2H6V4H5C3.9 4 3 4.9 3 6V20C3 21.1 3.9 22 5 22H19C20.1 22 21 21.1 21 20V6C21 4.9 20.1 4 19 4ZM19 20H5V9H19V20Z",
|
|
1806
|
+
fill: "currentColor"
|
|
1807
|
+
}
|
|
1808
|
+
) });
|
|
1809
|
+
var DateSelector = ({
|
|
1810
|
+
initialDateRange = { start: null, end: null },
|
|
1811
|
+
initialMonthFilter = null,
|
|
1812
|
+
onChange,
|
|
1813
|
+
onMonthFilterChange,
|
|
1814
|
+
onClose,
|
|
1815
|
+
disabled = false,
|
|
1816
|
+
className,
|
|
1817
|
+
icon
|
|
1818
|
+
}) => {
|
|
1819
|
+
const { t } = useTranslation();
|
|
1820
|
+
const { locale } = useWindowData();
|
|
1821
|
+
const { isDesktop } = useResponsive();
|
|
1822
|
+
const dateLocale = getDateLocale2(locale);
|
|
1823
|
+
const [dateRange, setDateRange] = useState9(initialDateRange);
|
|
1824
|
+
const [isOpen, setIsOpen] = useState9(false);
|
|
1825
|
+
const [selectedMonths, setSelectedMonths] = useState9(initialMonthFilter || []);
|
|
1826
|
+
const dropdownRef = useRef4(null);
|
|
1827
|
+
useEffect6(() => {
|
|
1828
|
+
setDateRange((prev) => {
|
|
1829
|
+
if (prev.start === initialDateRange.start && prev.end === initialDateRange.end) {
|
|
1830
|
+
return prev;
|
|
1831
|
+
}
|
|
1832
|
+
return initialDateRange;
|
|
1833
|
+
});
|
|
1834
|
+
setSelectedMonths((prev) => {
|
|
1835
|
+
const next = initialMonthFilter || [];
|
|
1836
|
+
if (prev.length === next.length && prev.every((m, i) => m === next[i])) {
|
|
1837
|
+
return prev;
|
|
1838
|
+
}
|
|
1839
|
+
return next;
|
|
1840
|
+
});
|
|
1841
|
+
}, [initialDateRange.start, initialDateRange.end, initialMonthFilter]);
|
|
1842
|
+
useEffect6(() => {
|
|
1843
|
+
if (!isOpen) return;
|
|
1844
|
+
const handlePointerDown = (event) => {
|
|
1845
|
+
if (!dropdownRef.current) return;
|
|
1846
|
+
if (!dropdownRef.current.contains(event.target)) {
|
|
1847
|
+
const newDateRange = dateRange.start && dateRange.end ? dateRange : null;
|
|
1848
|
+
const newMonthFilter = selectedMonths.length ? selectedMonths : null;
|
|
1849
|
+
onChange?.(newDateRange);
|
|
1850
|
+
onMonthFilterChange?.(newMonthFilter);
|
|
1851
|
+
setIsOpen(false);
|
|
1852
|
+
onClose?.(newDateRange, newMonthFilter);
|
|
1853
|
+
}
|
|
1854
|
+
};
|
|
1855
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
1856
|
+
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
1857
|
+
}, [isOpen, dateRange, selectedMonths, onChange, onMonthFilterChange, onClose]);
|
|
1858
|
+
const months = useMemo(() => {
|
|
1859
|
+
const now = /* @__PURE__ */ new Date();
|
|
1860
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
1861
|
+
const date = new Date(now.getFullYear(), now.getMonth() + i, 1);
|
|
1862
|
+
return {
|
|
1863
|
+
label: date.toLocaleDateString(dateLocale, { month: "long" }),
|
|
1864
|
+
year: date.getFullYear(),
|
|
1865
|
+
value: `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}`
|
|
1866
|
+
};
|
|
1867
|
+
});
|
|
1868
|
+
}, [dateLocale]);
|
|
1869
|
+
const formatDateDisplay = () => {
|
|
1870
|
+
if (dateRange.start && dateRange.end) {
|
|
1871
|
+
const format2 = (d) => new Date(d).toLocaleDateString(dateLocale, { month: "short", day: "numeric" });
|
|
1872
|
+
return `${format2(dateRange.start)} - ${format2(dateRange.end)}`;
|
|
1873
|
+
}
|
|
1874
|
+
if (selectedMonths.length === 1) {
|
|
1875
|
+
const month = months.find((m) => m.value === selectedMonths[0]);
|
|
1876
|
+
return month ? `${month.label} ${month.year}` : t("search:label.flexible", {}, "Flexible");
|
|
1877
|
+
}
|
|
1878
|
+
if (selectedMonths.length > 1) {
|
|
1879
|
+
return t("search:date_selector.months_selected", { count: selectedMonths.length }, `${selectedMonths.length} months`);
|
|
1880
|
+
}
|
|
1881
|
+
return t("search:label.flexible", {}, "Flexible");
|
|
1882
|
+
};
|
|
1883
|
+
const handleDateRangeChange = (range) => {
|
|
1884
|
+
setDateRange(range ?? { start: null, end: null });
|
|
1885
|
+
};
|
|
1886
|
+
const handleMonthFilterChange = (months2) => {
|
|
1887
|
+
setSelectedMonths(months2 || []);
|
|
1888
|
+
};
|
|
1889
|
+
const handleApply = () => {
|
|
1890
|
+
if (dateRange.start && dateRange.end) {
|
|
1891
|
+
onChange?.(dateRange);
|
|
1892
|
+
} else {
|
|
1893
|
+
onChange?.(null);
|
|
1894
|
+
}
|
|
1895
|
+
onMonthFilterChange?.(selectedMonths.length ? selectedMonths : null);
|
|
1896
|
+
setIsOpen(false);
|
|
1897
|
+
};
|
|
1898
|
+
const handleBackdropClick = () => {
|
|
1899
|
+
const newDateRange = dateRange.start && dateRange.end ? dateRange : null;
|
|
1900
|
+
const newMonthFilter = selectedMonths.length ? selectedMonths : null;
|
|
1901
|
+
onChange?.(newDateRange);
|
|
1902
|
+
onMonthFilterChange?.(newMonthFilter);
|
|
1903
|
+
setIsOpen(false);
|
|
1904
|
+
onClose?.(newDateRange, newMonthFilter);
|
|
1905
|
+
};
|
|
1906
|
+
const buttonClasses = [
|
|
1907
|
+
cx21("button"),
|
|
1908
|
+
disabled && cxMod3("button", "disabled"),
|
|
1909
|
+
className
|
|
1910
|
+
].filter(Boolean).join(" ");
|
|
1911
|
+
const dropdownClasses = [
|
|
1912
|
+
cx21("dropdown"),
|
|
1913
|
+
isOpen && cxMod3("dropdown", "open"),
|
|
1914
|
+
!isDesktop && cxMod3("dropdown", "mobile")
|
|
1915
|
+
].filter(Boolean).join(" ");
|
|
1916
|
+
return /* @__PURE__ */ jsxs21("div", { ref: dropdownRef, className: cx21(""), children: [
|
|
1917
|
+
/* @__PURE__ */ jsxs21(
|
|
1918
|
+
"button",
|
|
1919
|
+
{
|
|
1920
|
+
type: "button",
|
|
1921
|
+
className: buttonClasses,
|
|
1922
|
+
onClick: () => !disabled && setIsOpen((v) => !v),
|
|
1923
|
+
disabled,
|
|
1924
|
+
children: [
|
|
1925
|
+
/* @__PURE__ */ jsx22("span", { className: cx21("icon"), children: icon || /* @__PURE__ */ jsx22(CalendarIcon, {}) }),
|
|
1926
|
+
/* @__PURE__ */ jsx22("span", { className: cx21("label"), children: formatDateDisplay() })
|
|
1927
|
+
]
|
|
1928
|
+
}
|
|
1929
|
+
),
|
|
1930
|
+
isOpen && /* @__PURE__ */ jsx22("div", { className: cx21("backdrop"), onClick: handleBackdropClick, "aria-hidden": "true" }),
|
|
1931
|
+
/* @__PURE__ */ jsx22("div", { className: dropdownClasses, children: /* @__PURE__ */ jsx22(
|
|
1932
|
+
WhenContent,
|
|
1933
|
+
{
|
|
1934
|
+
initialDateRange: dateRange,
|
|
1935
|
+
initialMonthFilter: selectedMonths.length ? selectedMonths : null,
|
|
1936
|
+
onChange: handleDateRangeChange,
|
|
1937
|
+
onMonthFilterChange: handleMonthFilterChange,
|
|
1938
|
+
variant: "dropdown",
|
|
1939
|
+
showApplyButton: true,
|
|
1940
|
+
onApply: handleApply
|
|
1941
|
+
}
|
|
1942
|
+
) })
|
|
1943
|
+
] });
|
|
1944
|
+
};
|
|
1945
|
+
DateSelector.displayName = "DateSelector";
|
|
1946
|
+
|
|
1947
|
+
// src/components/GuestSelector/GuestContent.tsx
|
|
1948
|
+
import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1949
|
+
var MinusIcon = () => /* @__PURE__ */ jsx23("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx23("path", { d: "M0 10C0 9.48047 0.477679 9.0625 1.07143 9.0625H18.9286C19.5223 9.0625 20 9.48047 20 10C20 10.5195 19.5223 10.9375 18.9286 10.9375H1.07143C0.477679 10.9375 0 10.5195 0 10Z", fill: "currentColor" }) });
|
|
1950
|
+
var PlusIcon = () => /* @__PURE__ */ jsx23("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx23("path", { d: "M11.0714 2.1875C11.0714 1.66797 10.5938 1.25 10 1.25C9.40625 1.25 8.92857 1.66797 8.92857 2.1875V9.0625H1.07143C0.477679 9.0625 0 9.48047 0 10C0 10.5195 0.477679 10.9375 1.07143 10.9375H8.92857V17.8125C8.92857 18.332 9.40625 18.75 10 18.75C10.5938 18.75 11.0714 18.332 11.0714 17.8125V10.9375H18.9286C19.5223 10.9375 20 10.5195 20 10C20 9.48047 19.5223 9.0625 18.9286 9.0625H11.0714V2.1875Z", fill: "currentColor" }) });
|
|
1951
|
+
var DropdownIcon = () => /* @__PURE__ */ jsx23(
|
|
1952
|
+
"svg",
|
|
1953
|
+
{
|
|
1954
|
+
className: "hc-guest-content__select-icon",
|
|
1955
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1956
|
+
width: "24",
|
|
1957
|
+
height: "24",
|
|
1958
|
+
viewBox: "0 0 24 24",
|
|
1959
|
+
fill: "none",
|
|
1960
|
+
children: /* @__PURE__ */ jsx23(
|
|
1961
|
+
"path",
|
|
1962
|
+
{
|
|
1963
|
+
d: "M11.24 16.6873C11.6598 17.1042 12.3386 17.1042 12.7539 16.6873L19.6852 9.81633C20.1049 9.39939 20.1049 8.7252 19.6852 8.3127C19.2654 7.9002 18.5866 7.89577 18.1713 8.3127L11.9992 14.4296L5.82701 8.3127C5.40724 7.89577 4.72846 7.89577 4.31316 8.3127C3.89785 8.72964 3.89338 9.40383 4.31316 9.81633L11.2445 16.6873H11.24Z",
|
|
1964
|
+
fill: "#6B7280"
|
|
1965
|
+
}
|
|
1966
|
+
)
|
|
1967
|
+
}
|
|
1968
|
+
);
|
|
1969
|
+
var defaultLabels2 = {
|
|
1970
|
+
adults: "Adults",
|
|
1971
|
+
children: "Children",
|
|
1972
|
+
pet: "Pet",
|
|
1973
|
+
ageOfChild: "Age of child",
|
|
1974
|
+
age: "Age",
|
|
1975
|
+
decreaseAdults: "Decrease adults",
|
|
1976
|
+
increaseAdults: "Increase adults",
|
|
1977
|
+
decreaseChildren: "Decrease children",
|
|
1978
|
+
increaseChildren: "Increase children",
|
|
1979
|
+
togglePets: "Toggle pets"
|
|
1980
|
+
};
|
|
1981
|
+
var GuestContent = ({
|
|
1982
|
+
guests,
|
|
1983
|
+
onChange,
|
|
1984
|
+
petFilter = 0,
|
|
1985
|
+
onPetChange,
|
|
1986
|
+
showPetToggle = true,
|
|
1987
|
+
className = "",
|
|
1988
|
+
childAgeErrors = [],
|
|
1989
|
+
onErrorClear,
|
|
1990
|
+
labels: labelsProp
|
|
1991
|
+
}) => {
|
|
1992
|
+
const labels = { ...defaultLabels2, ...labelsProp };
|
|
1993
|
+
const childrenAges = Array.isArray(guests.childrenAges) ? guests.childrenAges : [];
|
|
1994
|
+
const handleIncrement = (type) => {
|
|
1995
|
+
if (type === "children" && guests.children >= 6) return;
|
|
1996
|
+
if (type === "adults" && guests.adults >= 10) return;
|
|
1997
|
+
const newChildrenAges = type === "children" ? [...childrenAges, null] : childrenAges;
|
|
1998
|
+
onChange({
|
|
1999
|
+
...guests,
|
|
2000
|
+
[type]: guests[type] + 1,
|
|
2001
|
+
childrenAges: newChildrenAges
|
|
2002
|
+
});
|
|
2003
|
+
};
|
|
2004
|
+
const handleDecrement = (type) => {
|
|
2005
|
+
if (type === "adults" && guests.adults <= 1) return;
|
|
2006
|
+
if (type === "children" && guests.children <= 0) return;
|
|
2007
|
+
const newChildrenAges = type === "children" ? childrenAges.slice(0, -1) : childrenAges;
|
|
2008
|
+
onChange({
|
|
2009
|
+
...guests,
|
|
2010
|
+
[type]: guests[type] - 1,
|
|
2011
|
+
childrenAges: newChildrenAges
|
|
2012
|
+
});
|
|
2013
|
+
};
|
|
2014
|
+
const handleAgeChange = (index, value) => {
|
|
2015
|
+
const newChildrenAges = [...childrenAges];
|
|
2016
|
+
newChildrenAges[index] = value === "" ? null : parseInt(value, 10);
|
|
2017
|
+
onChange({
|
|
2018
|
+
...guests,
|
|
2019
|
+
childrenAges: newChildrenAges
|
|
2020
|
+
});
|
|
2021
|
+
onErrorClear?.(index);
|
|
2022
|
+
};
|
|
2023
|
+
const containerClasses = ["hc-guest-content", className].filter(Boolean).join(" ");
|
|
2024
|
+
return /* @__PURE__ */ jsxs22("div", { className: containerClasses, children: [
|
|
2025
|
+
/* @__PURE__ */ jsxs22("div", { className: "hc-guest-content__row", children: [
|
|
2026
|
+
/* @__PURE__ */ jsx23("div", { className: "hc-guest-content__label", children: /* @__PURE__ */ jsx23("span", { className: "hc-guest-content__name", children: labels.adults }) }),
|
|
2027
|
+
/* @__PURE__ */ jsxs22("div", { className: "hc-guest-content__counter", children: [
|
|
2028
|
+
/* @__PURE__ */ jsx23(
|
|
2029
|
+
"button",
|
|
2030
|
+
{
|
|
2031
|
+
type: "button",
|
|
2032
|
+
className: "hc-guest-content__counter-button",
|
|
2033
|
+
onClick: () => handleDecrement("adults"),
|
|
2034
|
+
disabled: guests.adults <= 1,
|
|
2035
|
+
"aria-label": labels.decreaseAdults,
|
|
2036
|
+
children: /* @__PURE__ */ jsx23(MinusIcon, {})
|
|
2037
|
+
}
|
|
2038
|
+
),
|
|
2039
|
+
/* @__PURE__ */ jsx23("span", { className: "hc-guest-content__counter-value", children: guests.adults }),
|
|
2040
|
+
/* @__PURE__ */ jsx23(
|
|
2041
|
+
"button",
|
|
2042
|
+
{
|
|
2043
|
+
type: "button",
|
|
2044
|
+
className: "hc-guest-content__counter-button",
|
|
2045
|
+
onClick: () => handleIncrement("adults"),
|
|
2046
|
+
disabled: guests.adults >= 10,
|
|
2047
|
+
"aria-label": labels.increaseAdults,
|
|
2048
|
+
children: /* @__PURE__ */ jsx23(PlusIcon, {})
|
|
2049
|
+
}
|
|
2050
|
+
)
|
|
2051
|
+
] })
|
|
2052
|
+
] }),
|
|
2053
|
+
/* @__PURE__ */ jsxs22("div", { className: "hc-guest-content__row hc-guest-content__row--children", children: [
|
|
2054
|
+
/* @__PURE__ */ jsxs22("div", { className: "hc-guest-content__row-header", children: [
|
|
2055
|
+
/* @__PURE__ */ jsx23("div", { className: "hc-guest-content__label", children: /* @__PURE__ */ jsx23("span", { className: "hc-guest-content__name", children: labels.children }) }),
|
|
2056
|
+
/* @__PURE__ */ jsxs22("div", { className: "hc-guest-content__counter", children: [
|
|
2057
|
+
/* @__PURE__ */ jsx23(
|
|
2058
|
+
"button",
|
|
2059
|
+
{
|
|
2060
|
+
type: "button",
|
|
2061
|
+
className: "hc-guest-content__counter-button",
|
|
2062
|
+
onClick: () => handleDecrement("children"),
|
|
2063
|
+
disabled: guests.children <= 0,
|
|
2064
|
+
"aria-label": labels.decreaseChildren,
|
|
2065
|
+
children: /* @__PURE__ */ jsx23(MinusIcon, {})
|
|
2066
|
+
}
|
|
2067
|
+
),
|
|
2068
|
+
/* @__PURE__ */ jsx23("span", { className: "hc-guest-content__counter-value", children: guests.children }),
|
|
2069
|
+
/* @__PURE__ */ jsx23(
|
|
2070
|
+
"button",
|
|
2071
|
+
{
|
|
2072
|
+
type: "button",
|
|
2073
|
+
className: "hc-guest-content__counter-button",
|
|
2074
|
+
onClick: () => handleIncrement("children"),
|
|
2075
|
+
disabled: guests.children >= 6,
|
|
2076
|
+
"aria-label": labels.increaseChildren,
|
|
2077
|
+
children: /* @__PURE__ */ jsx23(PlusIcon, {})
|
|
2078
|
+
}
|
|
2079
|
+
)
|
|
2080
|
+
] })
|
|
2081
|
+
] }),
|
|
2082
|
+
guests.children > 0 && /* @__PURE__ */ jsx23(
|
|
2083
|
+
"div",
|
|
2084
|
+
{
|
|
2085
|
+
className: "hc-guest-content__children-dropdowns",
|
|
2086
|
+
style: {
|
|
2087
|
+
gridTemplateColumns: guests.children === 1 ? "1fr" : "repeat(2, 1fr)"
|
|
2088
|
+
},
|
|
2089
|
+
children: Array.from({ length: guests.children }).map((_, index) => {
|
|
2090
|
+
const currentAge = childrenAges[index];
|
|
2091
|
+
const hasError = childAgeErrors.some((error) => error.index === index);
|
|
2092
|
+
const errorMessage = childAgeErrors.find((error) => error.index === index)?.message;
|
|
2093
|
+
return /* @__PURE__ */ jsxs22("div", { className: "hc-guest-content__child-dropdown", children: [
|
|
2094
|
+
/* @__PURE__ */ jsx23("label", { htmlFor: `child-age-${index}`, children: labels.ageOfChild }),
|
|
2095
|
+
/* @__PURE__ */ jsxs22("div", { className: "hc-guest-content__select-wrapper", children: [
|
|
2096
|
+
/* @__PURE__ */ jsxs22(
|
|
2097
|
+
"select",
|
|
2098
|
+
{
|
|
2099
|
+
id: `child-age-${index}`,
|
|
2100
|
+
value: currentAge === null || currentAge === void 0 ? "" : currentAge,
|
|
2101
|
+
onChange: (e) => handleAgeChange(index, e.target.value),
|
|
2102
|
+
className: `hc-guest-content__select ${hasError ? "hc-guest-content__select--error" : ""}`,
|
|
2103
|
+
"aria-invalid": hasError,
|
|
2104
|
+
"aria-describedby": hasError ? `error-${index}` : void 0,
|
|
2105
|
+
children: [
|
|
2106
|
+
/* @__PURE__ */ jsx23("option", { value: "", children: labels.age }),
|
|
2107
|
+
Array.from({ length: 18 }, (_2, age) => /* @__PURE__ */ jsx23("option", { value: age, children: age }, age))
|
|
2108
|
+
]
|
|
2109
|
+
}
|
|
2110
|
+
),
|
|
2111
|
+
/* @__PURE__ */ jsx23(DropdownIcon, {})
|
|
2112
|
+
] }),
|
|
2113
|
+
hasError && /* @__PURE__ */ jsx23("span", { id: `error-${index}`, className: "hc-guest-content__error-text", children: errorMessage })
|
|
2114
|
+
] }, index);
|
|
2115
|
+
})
|
|
2116
|
+
}
|
|
2117
|
+
)
|
|
2118
|
+
] }),
|
|
2119
|
+
showPetToggle && /* @__PURE__ */ jsxs22("div", { className: "hc-guest-content__row", children: [
|
|
2120
|
+
/* @__PURE__ */ jsx23("div", { className: "hc-guest-content__label", children: /* @__PURE__ */ jsx23("span", { className: "hc-guest-content__name", children: labels.pet }) }),
|
|
2121
|
+
/* @__PURE__ */ jsx23("div", { className: "hc-guest-content__toggle-wrapper", children: /* @__PURE__ */ jsxs22("label", { className: "hc-guest-content__toggle", children: [
|
|
2122
|
+
/* @__PURE__ */ jsx23(
|
|
2123
|
+
"input",
|
|
2124
|
+
{
|
|
2125
|
+
type: "checkbox",
|
|
2126
|
+
checked: petFilter === 1,
|
|
2127
|
+
onChange: (e) => onPetChange?.(e.target.checked ? 1 : 0),
|
|
2128
|
+
"aria-label": labels.togglePets
|
|
2129
|
+
}
|
|
2130
|
+
),
|
|
2131
|
+
/* @__PURE__ */ jsx23("span", { className: "hc-guest-content__slider" })
|
|
2132
|
+
] }) })
|
|
2133
|
+
] })
|
|
2134
|
+
] });
|
|
2135
|
+
};
|
|
2136
|
+
|
|
1319
2137
|
// src/components/icons/HeartIcon.tsx
|
|
1320
|
-
import { jsx as
|
|
1321
|
-
var HeartIcon2 = ({ filled = false, className = "", size = 24 }) => /* @__PURE__ */
|
|
2138
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2139
|
+
var HeartIcon2 = ({ filled = false, className = "", size = 24 }) => /* @__PURE__ */ jsx24(
|
|
1322
2140
|
"svg",
|
|
1323
2141
|
{
|
|
1324
2142
|
width: size,
|
|
@@ -1330,14 +2148,14 @@ var HeartIcon2 = ({ filled = false, className = "", size = 24 }) => /* @__PURE__
|
|
|
1330
2148
|
strokeWidth: 2,
|
|
1331
2149
|
strokeLinecap: "round",
|
|
1332
2150
|
strokeLinejoin: "round",
|
|
1333
|
-
children: /* @__PURE__ */
|
|
2151
|
+
children: /* @__PURE__ */ jsx24("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" })
|
|
1334
2152
|
}
|
|
1335
2153
|
);
|
|
1336
2154
|
HeartIcon2.displayName = "HeartIcon";
|
|
1337
2155
|
|
|
1338
2156
|
// src/components/icons/StarIcon.tsx
|
|
1339
|
-
import { jsx as
|
|
1340
|
-
var StarIcon4 = ({ filled = true, className = "", size = 9 }) => /* @__PURE__ */
|
|
2157
|
+
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2158
|
+
var StarIcon4 = ({ filled = true, className = "", size = 9 }) => /* @__PURE__ */ jsxs23(
|
|
1341
2159
|
"svg",
|
|
1342
2160
|
{
|
|
1343
2161
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1347,22 +2165,22 @@ var StarIcon4 = ({ filled = true, className = "", size = 9 }) => /* @__PURE__ */
|
|
|
1347
2165
|
fill: "none",
|
|
1348
2166
|
className,
|
|
1349
2167
|
children: [
|
|
1350
|
-
/* @__PURE__ */
|
|
2168
|
+
/* @__PURE__ */ jsx25("g", { clipPath: "url(#clip0_star_icon)", children: /* @__PURE__ */ jsx25(
|
|
1351
2169
|
"path",
|
|
1352
2170
|
{
|
|
1353
2171
|
d: "M4.80018 0.366577C4.93104 0.366577 5.05173 0.440968 5.11135 0.557659L6.18011 2.66102L8.50521 3.03152C8.63462 3.05194 8.74222 3.14383 8.78294 3.26927C8.82365 3.39472 8.79021 3.53183 8.6986 3.62518L7.03366 5.29533L7.40155 7.6277C7.42191 7.75752 7.3681 7.88879 7.26195 7.9661C7.15581 8.04341 7.01476 8.05508 6.89843 7.99528L4.80018 6.92463L2.70192 7.99528C2.58559 8.05508 2.44454 8.04341 2.33839 7.9661C2.23225 7.88879 2.17844 7.75898 2.1988 7.6277L2.56523 5.29533L0.901751 3.62518C0.808689 3.53183 0.776699 3.39472 0.817413 3.26927C0.858128 3.14383 0.964277 3.05194 1.09515 3.03152L3.42024 2.66102L4.49045 0.557659C4.55007 0.440968 4.67076 0.366577 4.80163 0.366577H4.80018Z",
|
|
1354
2172
|
fill: filled ? "#1F2937" : "#D1D5DB"
|
|
1355
2173
|
}
|
|
1356
2174
|
) }),
|
|
1357
|
-
/* @__PURE__ */
|
|
2175
|
+
/* @__PURE__ */ jsx25("defs", { children: /* @__PURE__ */ jsx25("clipPath", { id: "clip0_star_icon", children: /* @__PURE__ */ jsx25("rect", { width: "8", height: "8", fill: "white", transform: "translate(0.800049 0.199951)" }) }) })
|
|
1358
2176
|
]
|
|
1359
2177
|
}
|
|
1360
2178
|
);
|
|
1361
2179
|
StarIcon4.displayName = "StarIcon";
|
|
1362
2180
|
|
|
1363
2181
|
// src/components/icons/ChevronLeftIcon.tsx
|
|
1364
|
-
import { jsx as
|
|
1365
|
-
var ChevronLeftIcon = ({ className = "", size = 20 }) => /* @__PURE__ */
|
|
2182
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
2183
|
+
var ChevronLeftIcon = ({ className = "", size = 20 }) => /* @__PURE__ */ jsx26(
|
|
1366
2184
|
"svg",
|
|
1367
2185
|
{
|
|
1368
2186
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1375,14 +2193,14 @@ var ChevronLeftIcon = ({ className = "", size = 20 }) => /* @__PURE__ */ jsx21(
|
|
|
1375
2193
|
strokeLinecap: "round",
|
|
1376
2194
|
strokeLinejoin: "round",
|
|
1377
2195
|
className,
|
|
1378
|
-
children: /* @__PURE__ */
|
|
2196
|
+
children: /* @__PURE__ */ jsx26("polyline", { points: "15 18 9 12 15 6" })
|
|
1379
2197
|
}
|
|
1380
2198
|
);
|
|
1381
2199
|
ChevronLeftIcon.displayName = "ChevronLeftIcon";
|
|
1382
2200
|
|
|
1383
2201
|
// src/components/icons/ChevronRightIcon.tsx
|
|
1384
|
-
import { jsx as
|
|
1385
|
-
var ChevronRightIcon2 = ({ className = "", size = 20 }) => /* @__PURE__ */
|
|
2202
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
2203
|
+
var ChevronRightIcon2 = ({ className = "", size = 20 }) => /* @__PURE__ */ jsx27(
|
|
1386
2204
|
"svg",
|
|
1387
2205
|
{
|
|
1388
2206
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1395,14 +2213,14 @@ var ChevronRightIcon2 = ({ className = "", size = 20 }) => /* @__PURE__ */ jsx22
|
|
|
1395
2213
|
strokeLinecap: "round",
|
|
1396
2214
|
strokeLinejoin: "round",
|
|
1397
2215
|
className,
|
|
1398
|
-
children: /* @__PURE__ */
|
|
2216
|
+
children: /* @__PURE__ */ jsx27("polyline", { points: "9 18 15 12 9 6" })
|
|
1399
2217
|
}
|
|
1400
2218
|
);
|
|
1401
2219
|
ChevronRightIcon2.displayName = "ChevronRightIcon";
|
|
1402
2220
|
|
|
1403
2221
|
// src/components/icons/PinIcon.tsx
|
|
1404
|
-
import { jsx as
|
|
1405
|
-
var PinIcon = ({ className = "", size = 16 }) => /* @__PURE__ */
|
|
2222
|
+
import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2223
|
+
var PinIcon = ({ className = "", size = 16 }) => /* @__PURE__ */ jsxs24(
|
|
1406
2224
|
"svg",
|
|
1407
2225
|
{
|
|
1408
2226
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1412,7 +2230,7 @@ var PinIcon = ({ className = "", size = 16 }) => /* @__PURE__ */ jsxs20(
|
|
|
1412
2230
|
fill: "none",
|
|
1413
2231
|
className,
|
|
1414
2232
|
children: [
|
|
1415
|
-
/* @__PURE__ */
|
|
2233
|
+
/* @__PURE__ */ jsx28(
|
|
1416
2234
|
"path",
|
|
1417
2235
|
{
|
|
1418
2236
|
fillRule: "evenodd",
|
|
@@ -1421,7 +2239,7 @@ var PinIcon = ({ className = "", size = 16 }) => /* @__PURE__ */ jsxs20(
|
|
|
1421
2239
|
fill: "currentColor"
|
|
1422
2240
|
}
|
|
1423
2241
|
),
|
|
1424
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ jsx28(
|
|
1425
2243
|
"path",
|
|
1426
2244
|
{
|
|
1427
2245
|
fillRule: "evenodd",
|
|
@@ -1435,17 +2253,6 @@ var PinIcon = ({ className = "", size = 16 }) => /* @__PURE__ */ jsxs20(
|
|
|
1435
2253
|
);
|
|
1436
2254
|
PinIcon.displayName = "PinIcon";
|
|
1437
2255
|
|
|
1438
|
-
// src/hooks/useDebounce.ts
|
|
1439
|
-
import { useState as useState5, useEffect as useEffect3 } from "react";
|
|
1440
|
-
var useDebounce = (value, delay) => {
|
|
1441
|
-
const [debouncedValue, setDebouncedValue] = useState5(value);
|
|
1442
|
-
useEffect3(() => {
|
|
1443
|
-
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
1444
|
-
return () => clearTimeout(timer);
|
|
1445
|
-
}, [value, delay]);
|
|
1446
|
-
return debouncedValue;
|
|
1447
|
-
};
|
|
1448
|
-
|
|
1449
2256
|
// src/utils/formatPrice.ts
|
|
1450
2257
|
var formatPrice = (amount, currency = "CHF", locale = "de-CH") => {
|
|
1451
2258
|
return new Intl.NumberFormat(locale, {
|
|
@@ -1486,10 +2293,14 @@ export {
|
|
|
1486
2293
|
ChevronRightIcon2 as ChevronRightIcon,
|
|
1487
2294
|
Chip,
|
|
1488
2295
|
CompactCard,
|
|
2296
|
+
DateSelector,
|
|
1489
2297
|
Divider,
|
|
1490
2298
|
Dropdown,
|
|
2299
|
+
DualCalendar,
|
|
1491
2300
|
FAQ,
|
|
2301
|
+
GuestContent,
|
|
1492
2302
|
HeartIcon2 as HeartIcon,
|
|
2303
|
+
HotelCardUIProvider,
|
|
1493
2304
|
Input,
|
|
1494
2305
|
Modal,
|
|
1495
2306
|
Pin,
|
|
@@ -1499,10 +2310,15 @@ export {
|
|
|
1499
2310
|
ReviewCard,
|
|
1500
2311
|
SectionHeader,
|
|
1501
2312
|
StarIcon4 as StarIcon,
|
|
2313
|
+
WhenContent,
|
|
1502
2314
|
calculateDiscount,
|
|
1503
2315
|
formatDate,
|
|
1504
2316
|
formatDateRange,
|
|
1505
2317
|
formatPrice,
|
|
1506
|
-
useDebounce
|
|
2318
|
+
useDebounce,
|
|
2319
|
+
useResponsive,
|
|
2320
|
+
useTranslation,
|
|
2321
|
+
useUIContext,
|
|
2322
|
+
useWindowData
|
|
1507
2323
|
};
|
|
1508
2324
|
//# sourceMappingURL=index.js.map
|