@odynn/awayz-hotels 0.2.18 → 0.2.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Legend/Legend.js +33 -30
- package/package.json +1 -1
|
@@ -1,60 +1,63 @@
|
|
|
1
|
-
import { jsx as r, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as r, Fragment as a, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useMemo as x, useEffect as y } from "react";
|
|
3
|
+
import N from "../Checkbox/Checkbox.js";
|
|
4
4
|
import { HotelChains as n } from "../../definitions/HotelChains.js";
|
|
5
|
-
import { F as
|
|
5
|
+
import { F as P } from "../../index-gse40uZM.js";
|
|
6
6
|
import '../../assets/Legend.css';const j = ({
|
|
7
7
|
hotelResults: d,
|
|
8
8
|
onChange: l,
|
|
9
9
|
value: o,
|
|
10
10
|
onOtherFilters: h
|
|
11
11
|
}) => {
|
|
12
|
-
var
|
|
13
|
-
const [
|
|
14
|
-
const
|
|
15
|
-
return Array.from(new Set(
|
|
16
|
-
},
|
|
17
|
-
() =>
|
|
12
|
+
var C, g;
|
|
13
|
+
const [f, k] = b(!1), p = (e) => {
|
|
14
|
+
const c = e.map((m) => m.hotelGroup);
|
|
15
|
+
return Array.from(new Set(c));
|
|
16
|
+
}, t = x(
|
|
17
|
+
() => p(d),
|
|
18
18
|
[d]
|
|
19
|
-
),
|
|
19
|
+
), L = (e) => {
|
|
20
20
|
if (l) {
|
|
21
|
-
const
|
|
22
|
-
l(
|
|
21
|
+
const c = o != null && o.includes(e) ? o.filter((s) => s !== e) : [...o || [], e];
|
|
22
|
+
l(c);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
-
return
|
|
26
|
-
l(
|
|
27
|
-
}, [d]), !
|
|
28
|
-
/* @__PURE__ */
|
|
25
|
+
return y(() => {
|
|
26
|
+
l(p(d));
|
|
27
|
+
}, [d]), !t || t.length === 0 ? /* @__PURE__ */ r(a, {}) : /* @__PURE__ */ i("div", { className: `hotel-legend ${f ? "" : "is-open"}`, children: [
|
|
28
|
+
/* @__PURE__ */ i(
|
|
29
29
|
"div",
|
|
30
30
|
{
|
|
31
31
|
className: "header",
|
|
32
32
|
onClick: () => {
|
|
33
|
-
|
|
33
|
+
k(!f);
|
|
34
34
|
},
|
|
35
35
|
children: [
|
|
36
36
|
/* @__PURE__ */ r("p", { children: "Legend" }),
|
|
37
|
-
/* @__PURE__ */ r(
|
|
37
|
+
/* @__PURE__ */ r(P, { className: "chevron" })
|
|
38
38
|
]
|
|
39
39
|
}
|
|
40
40
|
),
|
|
41
|
-
/* @__PURE__ */ r("div", { className: "filter-content", children: /* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ r("div", { className: "filter-content", children: /* @__PURE__ */ i("div", { className: "inner", children: [
|
|
42
42
|
/* @__PURE__ */ r("p", { className: "subheader", children: "Supported Loyalty Programs" }),
|
|
43
|
-
(
|
|
44
|
-
|
|
43
|
+
(g = (C = t == null ? void 0 : t.sort((e, c) => {
|
|
44
|
+
const s = n.toProgram(e), m = n.toProgram(c);
|
|
45
|
+
return s.localeCompare(m);
|
|
46
|
+
})) == null ? void 0 : C.filter((e) => n.toList().includes(e))) == null ? void 0 : g.map((e) => /* @__PURE__ */ r("div", { className: "chain", children: /* @__PURE__ */ r(
|
|
47
|
+
N,
|
|
45
48
|
{
|
|
46
49
|
label: n.toProgram(e),
|
|
47
50
|
style: { backgroundColor: n.toColour(e) },
|
|
48
|
-
onChange: () =>
|
|
51
|
+
onChange: () => L(e),
|
|
49
52
|
checked: (o == null ? void 0 : o.includes(e)) || !1
|
|
50
53
|
}
|
|
51
54
|
) }, e)),
|
|
52
|
-
|
|
55
|
+
t.some(
|
|
53
56
|
(e) => !n.toList().includes(e)
|
|
54
|
-
) && /* @__PURE__ */
|
|
57
|
+
) && /* @__PURE__ */ i(a, { children: [
|
|
55
58
|
/* @__PURE__ */ r("hr", {}),
|
|
56
59
|
/* @__PURE__ */ r("div", { className: "chain", children: /* @__PURE__ */ r(
|
|
57
|
-
|
|
60
|
+
N,
|
|
58
61
|
{
|
|
59
62
|
label: "Other Properties",
|
|
60
63
|
style: { backgroundColor: n.toColour("other") },
|
|
@@ -62,17 +65,17 @@ import '../../assets/Legend.css';const j = ({
|
|
|
62
65
|
(e) => !n.toList().includes(e)
|
|
63
66
|
)) || !1,
|
|
64
67
|
onChange: () => {
|
|
65
|
-
const e =
|
|
68
|
+
const e = t.filter(
|
|
66
69
|
(s) => !n.toList().includes(s)
|
|
67
|
-
),
|
|
70
|
+
), c = o != null && o.some(
|
|
68
71
|
(s) => !n.toList().includes(s)
|
|
69
72
|
) ? o.filter((s) => !e.includes(s)) : [...o || [], ...e];
|
|
70
|
-
l(
|
|
73
|
+
l(c);
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
) })
|
|
74
77
|
] }),
|
|
75
|
-
!!h && /* @__PURE__ */
|
|
78
|
+
!!h && /* @__PURE__ */ i(a, { children: [
|
|
76
79
|
/* @__PURE__ */ r("hr", {}),
|
|
77
80
|
/* @__PURE__ */ r("p", { onClick: h, className: "more-filters", children: "More Filters" })
|
|
78
81
|
] })
|