@memobit/libs 3.33.0 → 3.35.0
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/MenuHamburger/MenuHamburger2.js +22 -20
- package/dist/components/PageShell/AppFrame.js +48 -25
- package/dist/components/PageShell/FilterField.css +1 -1
- package/dist/components/PageShell/FilterField2.js +164 -131
- package/dist/components/PageShell/PageParts.js +104 -70
- package/dist/components/PageShell/PageShell.css +1 -1
- package/dist/components/PageShell/WorkbenchPhone.js +55 -52
- package/dist/components/PageShell/WorkbenchShell.js +86 -81
- package/dist/components/PageShell/filterRules.js +76 -51
- package/dist/components/PageShell/filterValues.js +24 -17
- package/dist/components/PageShell/liveCounts.js +21 -0
- package/dist/components/PageShell/menuItems.js +7 -6
- package/dist/components/PageShell/shellText.js +6 -5
- package/dist/components/PageShell/useSummaryMessages.js +2 -0
- package/dist/components/RouterAppFrame/RouterAppFrame.js +15 -12
- package/dist/contexts/LanguageContext/libMessages.js +2 -0
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +98 -5
- package/dist/index.js +135 -132
- package/dist/router.d.ts +13 -0
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +1 -1
|
@@ -1,51 +1,53 @@
|
|
|
1
1
|
import './MenuHamburger.css';
|
|
2
2
|
import { Icon as H } from "../Icon/Icon2.js";
|
|
3
|
-
import { Button as
|
|
3
|
+
import { Button as t } from "../Button/Button2.js";
|
|
4
4
|
import { ContextMenu as v } from "../ContextMenu/ContextMenu2.js";
|
|
5
5
|
import { useBreakpoint as f } from "../../hooks/useBreakpoint.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { useState as N } from "react";
|
|
8
8
|
import { jsx as n, jsxs as i } from "react/jsx-runtime";
|
|
9
|
-
var I = ({ icon:
|
|
9
|
+
var I = ({ icon: g = "menu-hamburger", isCompact: s, items: l, label: o, showLabel: c = !0, disableResponsive: p = !1 }) => {
|
|
10
10
|
const { isAtLeast: M } = f(), [u, m] = N(null), h = (e) => {
|
|
11
11
|
m(e.currentTarget);
|
|
12
|
-
},
|
|
12
|
+
}, d = () => {
|
|
13
13
|
m(null);
|
|
14
|
-
},
|
|
15
|
-
if (
|
|
16
|
-
const e =
|
|
14
|
+
}, r = p ? !0 : M("tablet");
|
|
15
|
+
if (l.length === 1) {
|
|
16
|
+
const e = l[0], a = r && c;
|
|
17
17
|
return /* @__PURE__ */ n("div", {
|
|
18
18
|
className: "MenuHamburger",
|
|
19
|
-
children: /* @__PURE__ */ n(
|
|
20
|
-
variant:
|
|
19
|
+
children: /* @__PURE__ */ n(t, {
|
|
20
|
+
variant: s || !r ? "plain" : "default",
|
|
21
21
|
onClick: e.onClick,
|
|
22
22
|
icon: e.icon,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
disabled: e.disabled,
|
|
24
|
+
className: `MenuHamburger_single-item ${a ? "" : "MenuHamburger_single-item--icon-only"} ${e.isActive ? "MenuHamburger_item--active" : ""}`,
|
|
25
|
+
children: a ? e.label : ""
|
|
25
26
|
})
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
const _ = (e) => {
|
|
29
|
-
e.onClick(),
|
|
30
|
-
}, b =
|
|
30
|
+
e.onClick(), d();
|
|
31
|
+
}, b = r && c && !!o;
|
|
31
32
|
return /* @__PURE__ */ i("div", {
|
|
32
33
|
className: "MenuHamburger",
|
|
33
|
-
children: [/* @__PURE__ */ n(
|
|
34
|
-
variant:
|
|
34
|
+
children: [/* @__PURE__ */ n(t, {
|
|
35
|
+
variant: s || !r ? "plain" : "default",
|
|
35
36
|
onClick: h,
|
|
36
|
-
icon:
|
|
37
|
+
icon: g,
|
|
37
38
|
className: b ? "" : "MenuHamburger_opener--icon-only",
|
|
38
|
-
children: b ?
|
|
39
|
+
children: b ? o : ""
|
|
39
40
|
}), u && /* @__PURE__ */ n(v, {
|
|
40
41
|
target: u,
|
|
41
|
-
onClose:
|
|
42
|
+
onClose: d,
|
|
42
43
|
children: /* @__PURE__ */ n("div", {
|
|
43
44
|
className: "MenuHamburger_dropdown",
|
|
44
|
-
children:
|
|
45
|
+
children: l.map((e, a) => /* @__PURE__ */ i("div", {
|
|
45
46
|
className: "MenuHamburger_entry",
|
|
46
|
-
children: [e.separator &&
|
|
47
|
+
children: [e.separator && a > 0 && /* @__PURE__ */ n("div", { className: "MenuHamburger_separator" }), /* @__PURE__ */ i(t, {
|
|
47
48
|
variant: "plain",
|
|
48
49
|
className: `MenuHamburger_item ${e.isActive ? "MenuHamburger_item--active" : ""}`,
|
|
50
|
+
disabled: e.disabled,
|
|
49
51
|
onClick: () => _(e),
|
|
50
52
|
children: [/* @__PURE__ */ n("span", {
|
|
51
53
|
className: "MenuHamburger_item__icon",
|
|
@@ -55,7 +57,7 @@ var I = ({ icon: d = "menu-hamburger", isCompact: o, items: t, label: c, showLab
|
|
|
55
57
|
children: e.label
|
|
56
58
|
})]
|
|
57
59
|
})]
|
|
58
|
-
},
|
|
60
|
+
}, a))
|
|
59
61
|
})
|
|
60
62
|
})]
|
|
61
63
|
});
|
|
@@ -1,32 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { ThemeSettings as u } from "../ThemeSettings/ThemeSettings2.js";
|
|
2
|
+
import { useAccountMenu as c } from "../../hooks/useAccountMenu.js";
|
|
3
|
+
import { AppFrameContext as l } from "./useAppFrame.js";
|
|
4
|
+
import { useMemo as f, useState as A } from "react";
|
|
5
|
+
import { jsx as o, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
var s = ({ app: e, nav: t, menuItems: r, status: m, children: n }) => {
|
|
7
|
+
const i = f(() => ({
|
|
8
|
+
app: e,
|
|
9
|
+
nav: t,
|
|
10
|
+
menuItems: r,
|
|
11
|
+
status: m
|
|
10
12
|
}), [
|
|
11
|
-
r,
|
|
12
13
|
e,
|
|
13
|
-
|
|
14
|
+
t,
|
|
15
|
+
r,
|
|
16
|
+
m
|
|
14
17
|
]);
|
|
15
|
-
return /* @__PURE__ */
|
|
16
|
-
value:
|
|
17
|
-
children:
|
|
18
|
+
return /* @__PURE__ */ o(l.Provider, {
|
|
19
|
+
value: i,
|
|
20
|
+
children: n
|
|
21
|
+
});
|
|
22
|
+
}, h = ({ account: e, menuItems: t = [], children: r, ...m }) => {
|
|
23
|
+
const n = c(e);
|
|
24
|
+
return /* @__PURE__ */ a(s, {
|
|
25
|
+
...m,
|
|
26
|
+
menuItems: [...t, ...n.items],
|
|
27
|
+
children: [r, n.modals]
|
|
18
28
|
});
|
|
19
|
-
},
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
}, v = ({ theme: e, menuItems: t = [], children: r, ...m }) => {
|
|
30
|
+
const [n, i] = A(!1), p = {
|
|
31
|
+
label: e.label ?? "Theme",
|
|
32
|
+
icon: "theme-picker",
|
|
33
|
+
onClick: () => i(!0),
|
|
34
|
+
isActive: !1,
|
|
35
|
+
separator: !0
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ a(s, {
|
|
38
|
+
...m,
|
|
39
|
+
menuItems: [...t, p],
|
|
40
|
+
children: [r, /* @__PURE__ */ o(u, {
|
|
41
|
+
isOpen: n,
|
|
42
|
+
onClose: () => i(!1),
|
|
43
|
+
currentApp: e.appName
|
|
44
|
+
})]
|
|
25
45
|
});
|
|
26
|
-
},
|
|
27
|
-
account:
|
|
28
|
-
...
|
|
29
|
-
}) : /* @__PURE__ */
|
|
46
|
+
}, I = ({ account: e, theme: t, ...r }) => e ? /* @__PURE__ */ o(h, {
|
|
47
|
+
account: e,
|
|
48
|
+
...r
|
|
49
|
+
}) : t ? /* @__PURE__ */ o(v, {
|
|
50
|
+
theme: t,
|
|
51
|
+
...r
|
|
52
|
+
}) : /* @__PURE__ */ o(s, { ...r });
|
|
30
53
|
export {
|
|
31
|
-
|
|
54
|
+
I as AppFrame
|
|
32
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.filter-field,.filter-field__stack{gap:var(--spacing-8);flex-direction:column;min-width:0;display:flex}.filter-field__segmented{gap:var(--spacing-2);padding:var(--spacing-2);border:1px solid var(--form-control-border-color);border-radius:var(--radius);background-color:var(--form-control-background-color);display:flex}.filter-field__segment{min-width:0;padding:var(--spacing-4) var(--spacing-8);border-radius:var(--radius-sm);color:var(--body-color-muted);font:inherit;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);white-space:nowrap;cursor:pointer;transition:background-color var(--transition-fast), color var(--transition-fast);text-overflow:ellipsis;white-space:nowrap;background-color:#0000;border:0;flex:auto;overflow:hidden}.filter-field__segment:hover{color:var(--body-color)}.filter-field__segment--selected,.filter-field__segment--selected:hover{background-color:var(--chip-selected-background-color);color:var(--chip-selected-color)}.filter-field__chips{gap:var(--spacing-6);flex-wrap:wrap;display:flex}.filter-field__rows,.filter-field__options{flex-direction:column;display:flex}.filter-field__options{max-height:var(--spacing-300);overflow-y:auto}.filter-field__row{align-items:center;gap:var(--spacing-8);width:100%;padding:var(--spacing-6) var(--spacing-4);border-radius:var(--radius-sm);color:var(--body-color);font:inherit;font-size:var(--font-size-sm);text-align:left;cursor:pointer;background-color:#0000;border:0;display:flex}.filter-field__row:hover{background-color:var(--list-hover-background-color)}.filter-field__row--empty{color:var(--body-color-muted)}.filter-field__mark{width:var(--spacing-16);height:var(--spacing-16);border:1px solid var(--form-control-border-color);color:var(--card-background-color);flex:none;justify-content:center;align-items:center;display:flex}.filter-field__mark--radio{border-radius:var(--radius-full)}.filter-field__mark--check{border-radius:var(--radius-sm)}.filter-field__row--selected .filter-field__mark{border-color:var(--body-accent-color);background-color:var(--body-accent-color)}.filter-field__row--selected .filter-field__mark--radio{padding:var(--spacing-2);background-clip:content-box}.filter-field__row-label{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}.filter-field__count{color:var(--body-color-muted);font-size:var(--font-size-xs);font-variant-numeric:tabular-nums;flex:none}.filter-field__divider{height:1px;margin:var(--spacing-4) 0;background-color:var(--delimiter-color);flex:none}.filter-field__empty{padding:var(--spacing-8) var(--spacing-4);color:var(--body-color-muted);font-size:var(--font-size-sm)}.filter-field__link{padding:var(--spacing-2) 0;color:var(--links-color);font:inherit;font-size:var(--font-size-sm);cursor:pointer;background:0 0;border:0;align-self:flex-start}.filter-field__link:hover{color:var(--links-hover-color)}.filter-field__rating{align-items:center;gap:var(--spacing-8);flex-wrap:wrap;display:flex}.filter-field__switch-row{flex-direction:row;justify-content:space-between;align-items:center}.filter-field__switch-label{min-width:0;padding:var(--spacing-4) 0;color:var(--body-color);font:inherit;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);text-align:left;cursor:pointer;background:0 0;border:0;flex:auto}.filter-field--sheet .filter-field__segment{padding:var(--spacing-8) var(--spacing-6);font-size:var(--font-size-md)}.filter-field--sheet .filter-field__row{padding:var(--spacing-12) var(--spacing-4);font-size:var(--font-size-md)}.filter-field--sheet .filter-field__options{max-height:none}.filter-field--sheet .filter-field__switch-label{padding:var(--spacing-8) 0;font-size:var(--font-size-md)}
|
|
1
|
+
.filter-field,.filter-field__stack{gap:var(--spacing-8);flex-direction:column;min-width:0;display:flex}.filter-field__segmented{gap:var(--spacing-2);padding:var(--spacing-2);border:1px solid var(--form-control-border-color);border-radius:var(--radius);background-color:var(--form-control-background-color);display:flex}.filter-field__segment{min-width:0;padding:var(--spacing-4) var(--spacing-8);border-radius:var(--radius-sm);color:var(--body-color-muted);font:inherit;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);white-space:nowrap;cursor:pointer;transition:background-color var(--transition-fast), color var(--transition-fast);text-overflow:ellipsis;white-space:nowrap;background-color:#0000;border:0;flex:auto;overflow:hidden}.filter-field__segment:hover{color:var(--body-color)}.filter-field__segment--selected,.filter-field__segment--selected:hover{background-color:var(--chip-selected-background-color);color:var(--chip-selected-color)}.filter-field__chips{gap:var(--spacing-6);flex-wrap:wrap;display:flex}.filter-field__chips .filter-field__chip--empty{opacity:.6}.filter-field__rows,.filter-field__options{flex-direction:column;display:flex}.filter-field__options{max-height:var(--spacing-300);overflow-y:auto}.filter-field__row{align-items:center;gap:var(--spacing-8);width:100%;padding:var(--spacing-6) var(--spacing-4);border-radius:var(--radius-sm);color:var(--body-color);font:inherit;font-size:var(--font-size-sm);text-align:left;cursor:pointer;background-color:#0000;border:0;display:flex}.filter-field__row:hover{background-color:var(--list-hover-background-color)}.filter-field__row--empty{color:var(--body-color-muted)}.filter-field__mark{width:var(--spacing-16);height:var(--spacing-16);border:1px solid var(--form-control-border-color);color:var(--card-background-color);flex:none;justify-content:center;align-items:center;display:flex}.filter-field__mark--radio{border-radius:var(--radius-full)}.filter-field__mark--check{border-radius:var(--radius-sm)}.filter-field__row--selected .filter-field__mark{border-color:var(--body-accent-color);background-color:var(--body-accent-color)}.filter-field__row--selected .filter-field__mark--radio{padding:var(--spacing-2);background-clip:content-box}.filter-field__row-label{text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:0;overflow:hidden}.filter-field__count{color:var(--body-color-muted);font-size:var(--font-size-xs);font-variant-numeric:tabular-nums;flex:none}.filter-field__divider{height:1px;margin:var(--spacing-4) 0;background-color:var(--delimiter-color);flex:none}.filter-field__empty{padding:var(--spacing-8) var(--spacing-4);color:var(--body-color-muted);font-size:var(--font-size-sm)}.filter-field__link{padding:var(--spacing-2) 0;color:var(--links-color);font:inherit;font-size:var(--font-size-sm);cursor:pointer;background:0 0;border:0;align-self:flex-start}.filter-field__link:hover{color:var(--links-hover-color)}.filter-field__rating{align-items:center;gap:var(--spacing-8);flex-wrap:wrap;display:flex}.filter-field__switch-row{flex-direction:row;justify-content:space-between;align-items:center}.filter-field__switch-label{min-width:0;padding:var(--spacing-4) 0;color:var(--body-color);font:inherit;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);text-align:left;cursor:pointer;background:0 0;border:0;flex:auto}.filter-field--sheet .filter-field__segment{padding:var(--spacing-8) var(--spacing-6);font-size:var(--font-size-md)}.filter-field--sheet .filter-field__row{padding:var(--spacing-12) var(--spacing-4);font-size:var(--font-size-md)}.filter-field--sheet .filter-field__options{max-height:none}.filter-field--sheet .filter-field__switch-label{padding:var(--spacing-8) 0;font-size:var(--font-size-md)}
|
|
@@ -1,114 +1,115 @@
|
|
|
1
1
|
import './FilterField.css';
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { libMessages as
|
|
4
|
-
import { useMessages as
|
|
5
|
-
import { formatDate as
|
|
6
|
-
import { Chip as
|
|
7
|
-
import { DatePicker as
|
|
2
|
+
import { Icon as M } from "../Icon/Icon2.js";
|
|
3
|
+
import { libMessages as v } from "../../contexts/LanguageContext/libMessages.js";
|
|
4
|
+
import { useMessages as g } from "../../hooks/useLanguage.js";
|
|
5
|
+
import { formatDate as w } from "../../helpers/Datetime.js";
|
|
6
|
+
import { Chip as z } from "../Chip/Chip2.js";
|
|
7
|
+
import { DatePicker as R } from "../DatePicker/DatePicker2.js";
|
|
8
8
|
import { InputSearch as F } from "../InputSearch/InputSearch2.js";
|
|
9
9
|
import { Rating as C } from "../Rating/Rating2.js";
|
|
10
10
|
import { ToggleSwitch as T } from "../ToggleSwitch/ToggleSwitch2.js";
|
|
11
11
|
import { RangeSlider as W } from "../RangeSlider/RangeSlider2.js";
|
|
12
|
-
import { getTextModes as
|
|
12
|
+
import { getTextModes as I, pickControl as O, toDateRange as B, toList as E, toNumber as V, toRange as q, toScalar as $, toText as P } from "./filterRules.js";
|
|
13
13
|
/* empty css */
|
|
14
|
-
import { useEffect as
|
|
15
|
-
import { jsx as
|
|
16
|
-
var
|
|
14
|
+
import { useEffect as Q, useState as y } from "react";
|
|
15
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
16
|
+
var D = ({ items: e, value: a, onSelect: n }) => /* @__PURE__ */ l("div", {
|
|
17
17
|
className: "filter-field__segmented",
|
|
18
|
-
children: e.map((
|
|
18
|
+
children: e.map((t) => /* @__PURE__ */ l("button", {
|
|
19
19
|
type: "button",
|
|
20
|
-
className: ["filter-field__segment",
|
|
21
|
-
onClick: () => n(
|
|
22
|
-
children:
|
|
23
|
-
}, String(
|
|
24
|
-
}), x = ({ label: e, mark:
|
|
20
|
+
className: ["filter-field__segment", t.value === a ? "filter-field__segment--selected" : ""].filter(Boolean).join(" "),
|
|
21
|
+
onClick: () => n(t.value),
|
|
22
|
+
children: t.label
|
|
23
|
+
}, String(t.value)))
|
|
24
|
+
}), x = ({ label: e, mark: a, selected: n, count: t, icon: r, onClick: c }) => /* @__PURE__ */ u("button", {
|
|
25
25
|
type: "button",
|
|
26
26
|
className: [
|
|
27
27
|
"filter-field__row",
|
|
28
28
|
n ? "filter-field__row--selected" : "",
|
|
29
|
-
|
|
29
|
+
t === 0 && !n ? "filter-field__row--empty" : ""
|
|
30
30
|
].filter(Boolean).join(" "),
|
|
31
31
|
onClick: c,
|
|
32
32
|
children: [
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
className: `filter-field__mark filter-field__mark--${
|
|
35
|
-
children:
|
|
33
|
+
/* @__PURE__ */ l("span", {
|
|
34
|
+
className: `filter-field__mark filter-field__mark--${a}`,
|
|
35
|
+
children: a === "check" && n && /* @__PURE__ */ l(M, {
|
|
36
36
|
name: "checkmark",
|
|
37
37
|
size: "sm"
|
|
38
38
|
})
|
|
39
39
|
}),
|
|
40
|
-
|
|
41
|
-
name:
|
|
40
|
+
r && /* @__PURE__ */ l(M, {
|
|
41
|
+
name: r,
|
|
42
42
|
size: "sm"
|
|
43
43
|
}),
|
|
44
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ l("span", {
|
|
45
45
|
className: "filter-field__row-label",
|
|
46
46
|
children: e
|
|
47
47
|
}),
|
|
48
|
-
|
|
48
|
+
t !== void 0 && /* @__PURE__ */ l("span", {
|
|
49
49
|
className: "filter-field__count",
|
|
50
|
-
children:
|
|
50
|
+
children: t
|
|
51
51
|
})
|
|
52
52
|
]
|
|
53
|
-
}),
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
|
|
53
|
+
}), G = (e, a) => e.includes(a) ? e.filter((n) => n !== a) : [...e, a], J = ({ spec: e, value: a, context: n, onChange: t }) => {
|
|
54
|
+
const r = g(v), [c, d] = y(""), [s, o] = y(!1), f = O(e, n), k = e.kind === "single", b = k ? [$(a)].filter((i) => i !== null) : E(a), h = (i) => b.includes(i.value), S = (i) => {
|
|
55
|
+
if (!k) {
|
|
56
|
+
t(G(b, i.value));
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
t(h(i) && f !== "radio" ? null : i.value);
|
|
60
60
|
};
|
|
61
61
|
if (f === "segmented") {
|
|
62
62
|
const i = [{
|
|
63
63
|
value: null,
|
|
64
|
-
label:
|
|
64
|
+
label: r.pageAny
|
|
65
65
|
}, ...e.options.map((m) => ({
|
|
66
66
|
value: m.value,
|
|
67
67
|
label: m.label
|
|
68
68
|
}))];
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ l(D, {
|
|
70
70
|
items: i,
|
|
71
|
-
value:
|
|
72
|
-
onSelect: (m) =>
|
|
71
|
+
value: b[0] ?? null,
|
|
72
|
+
onSelect: (m) => t(m)
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
-
if (f === "chips") return /* @__PURE__ */
|
|
75
|
+
if (f === "chips") return /* @__PURE__ */ l("div", {
|
|
76
76
|
className: "filter-field__chips",
|
|
77
|
-
children: e.options.map((i) => /* @__PURE__ */
|
|
77
|
+
children: e.options.map((i) => /* @__PURE__ */ l(z, {
|
|
78
|
+
className: i.count === 0 && !h(i) ? "filter-field__chip--empty" : void 0,
|
|
78
79
|
color: i.color,
|
|
79
80
|
count: i.count,
|
|
80
81
|
icon: i.icon,
|
|
81
82
|
selected: h(i),
|
|
82
83
|
size: n === "sheet" ? "medium" : "small",
|
|
83
|
-
onClick: () =>
|
|
84
|
+
onClick: () => S(i),
|
|
84
85
|
children: i.label
|
|
85
86
|
}, i.value))
|
|
86
87
|
});
|
|
87
|
-
const
|
|
88
|
+
const L = k ? "radio" : "check", N = (i) => /* @__PURE__ */ l(x, {
|
|
88
89
|
label: i.label,
|
|
89
|
-
mark:
|
|
90
|
+
mark: L,
|
|
90
91
|
selected: h(i),
|
|
91
92
|
count: i.count,
|
|
92
93
|
icon: i.icon,
|
|
93
|
-
onClick: () =>
|
|
94
|
+
onClick: () => S(i)
|
|
94
95
|
}, i.value);
|
|
95
96
|
if (f === "search-list") {
|
|
96
|
-
const i = c.trim().toLowerCase(), m = e.options.filter(h),
|
|
97
|
+
const i = c.trim().toLowerCase(), m = e.options.filter(h), p = e.options.filter((Y) => !h(Y) && (!i || Y.label.toLowerCase().includes(i)));
|
|
97
98
|
return /* @__PURE__ */ u("div", {
|
|
98
99
|
className: "filter-field__stack",
|
|
99
|
-
children: [/* @__PURE__ */
|
|
100
|
+
children: [/* @__PURE__ */ l(F, {
|
|
100
101
|
value: c,
|
|
101
|
-
placeholder:
|
|
102
|
+
placeholder: r.pageSearchOptions(e.label),
|
|
102
103
|
onChange: d
|
|
103
104
|
}), /* @__PURE__ */ u("div", {
|
|
104
105
|
className: "filter-field__options",
|
|
105
106
|
children: [
|
|
106
|
-
m.map(
|
|
107
|
-
m.length > 0 &&
|
|
108
|
-
|
|
109
|
-
m.length === 0 &&
|
|
107
|
+
m.map(N),
|
|
108
|
+
m.length > 0 && p.length > 0 && /* @__PURE__ */ l("div", { className: "filter-field__divider" }),
|
|
109
|
+
p.map(N),
|
|
110
|
+
m.length === 0 && p.length === 0 && /* @__PURE__ */ l("span", {
|
|
110
111
|
className: "filter-field__empty",
|
|
111
|
-
children:
|
|
112
|
+
children: r.pageNoMatches
|
|
112
113
|
})
|
|
113
114
|
]
|
|
114
115
|
})]
|
|
@@ -116,31 +117,31 @@ var N = ({ items: e, value: r, onSelect: n }) => /* @__PURE__ */ t("div", {
|
|
|
116
117
|
}
|
|
117
118
|
if (f === "radio") return /* @__PURE__ */ u("div", {
|
|
118
119
|
className: "filter-field__rows",
|
|
119
|
-
children: [/* @__PURE__ */
|
|
120
|
-
label:
|
|
120
|
+
children: [/* @__PURE__ */ l(x, {
|
|
121
|
+
label: r.pageAny,
|
|
121
122
|
mark: "radio",
|
|
122
|
-
selected:
|
|
123
|
-
onClick: () =>
|
|
124
|
-
}), e.options.map(
|
|
123
|
+
selected: b.length === 0,
|
|
124
|
+
onClick: () => t(null)
|
|
125
|
+
}), e.options.map(N)]
|
|
125
126
|
});
|
|
126
|
-
const
|
|
127
|
+
const A = e.options.length > 7, j = A && !s ? e.options.filter((i, m) => m < 6 || h(i)) : e.options;
|
|
127
128
|
return /* @__PURE__ */ u("div", {
|
|
128
129
|
className: "filter-field__stack",
|
|
129
|
-
children: [/* @__PURE__ */
|
|
130
|
+
children: [/* @__PURE__ */ l("div", {
|
|
130
131
|
className: "filter-field__rows",
|
|
131
|
-
children:
|
|
132
|
-
}),
|
|
132
|
+
children: j.map(N)
|
|
133
|
+
}), A && /* @__PURE__ */ l("button", {
|
|
133
134
|
type: "button",
|
|
134
135
|
className: "filter-field__link",
|
|
135
136
|
onClick: () => o(!s),
|
|
136
|
-
children: s ?
|
|
137
|
+
children: s ? r.pageShowFewer : r.pageShowAll(e.options.length)
|
|
137
138
|
})]
|
|
138
139
|
});
|
|
139
|
-
},
|
|
140
|
-
const [
|
|
141
|
-
|
|
140
|
+
}, K = ({ spec: e, value: a, onChange: n }) => {
|
|
141
|
+
const [t, r] = q(a, e.min, e.max), [c, d] = y([t, r]);
|
|
142
|
+
Q(() => d([t, r]), [t, r]);
|
|
142
143
|
const s = ([o, f]) => n(o <= e.min && f >= e.max ? null : [o, f]);
|
|
143
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ l(W, {
|
|
144
145
|
min: e.min,
|
|
145
146
|
max: e.max,
|
|
146
147
|
step: e.step,
|
|
@@ -150,145 +151,177 @@ var N = ({ items: e, value: r, onSelect: n }) => /* @__PURE__ */ t("div", {
|
|
|
150
151
|
onChange: d,
|
|
151
152
|
onChangeEnd: s
|
|
152
153
|
});
|
|
153
|
-
},
|
|
154
|
-
const
|
|
154
|
+
}, U = ({ spec: e, value: a, onChange: n }) => {
|
|
155
|
+
const t = g(v), r = V(a);
|
|
155
156
|
if (e.max <= 5) {
|
|
156
157
|
const c = Array.from({ length: e.max - 1 }, (s, o) => o + 2), d = [{
|
|
157
158
|
value: 0,
|
|
158
|
-
label:
|
|
159
|
+
label: t.pageAny
|
|
159
160
|
}, ...c.map((s) => ({
|
|
160
161
|
value: s,
|
|
161
162
|
label: s === e.max ? `${s}★` : `${s}★+`
|
|
162
163
|
}))];
|
|
163
|
-
return /* @__PURE__ */
|
|
164
|
+
return /* @__PURE__ */ l(D, {
|
|
164
165
|
items: d,
|
|
165
|
-
value:
|
|
166
|
+
value: r,
|
|
166
167
|
onSelect: (s) => n(typeof s == "number" ? s : 0)
|
|
167
168
|
});
|
|
168
169
|
}
|
|
169
170
|
return /* @__PURE__ */ u("div", {
|
|
170
171
|
className: "filter-field__rating",
|
|
171
|
-
children: [/* @__PURE__ */
|
|
172
|
-
rating:
|
|
172
|
+
children: [/* @__PURE__ */ l(C, {
|
|
173
|
+
rating: r,
|
|
173
174
|
maxRate: e.max,
|
|
174
175
|
selectable: !0,
|
|
175
|
-
onSelect: (c) => n(c ===
|
|
176
|
-
}),
|
|
176
|
+
onSelect: (c) => n(c === r ? 0 : c)
|
|
177
|
+
}), r > 0 && /* @__PURE__ */ l("button", {
|
|
177
178
|
type: "button",
|
|
178
179
|
className: "filter-field__link",
|
|
179
180
|
onClick: () => n(0),
|
|
180
|
-
children:
|
|
181
|
+
children: t.pageAny
|
|
181
182
|
})]
|
|
182
183
|
});
|
|
183
|
-
},
|
|
184
|
-
const
|
|
185
|
-
anyWord:
|
|
186
|
-
allWords:
|
|
184
|
+
}, X = ({ spec: e, value: a, onChange: n }) => {
|
|
185
|
+
const t = g(v), { text: r, mode: c } = P(a), d = I(e, {
|
|
186
|
+
anyWord: t.pageAnyWord,
|
|
187
|
+
allWords: t.pageAllWords
|
|
187
188
|
}), s = c ?? d?.[0]?.value;
|
|
188
189
|
return /* @__PURE__ */ u("div", {
|
|
189
190
|
className: "filter-field__stack",
|
|
190
|
-
children: [/* @__PURE__ */
|
|
191
|
-
value:
|
|
191
|
+
children: [/* @__PURE__ */ l(F, {
|
|
192
|
+
value: r,
|
|
192
193
|
placeholder: e.placeholder,
|
|
193
194
|
onChange: (o) => n({
|
|
194
195
|
text: o,
|
|
195
196
|
mode: s
|
|
196
197
|
})
|
|
197
|
-
}), d && /* @__PURE__ */
|
|
198
|
+
}), d && /* @__PURE__ */ l(D, {
|
|
198
199
|
items: d.map((o) => ({
|
|
199
200
|
value: o.value,
|
|
200
201
|
label: o.label
|
|
201
202
|
})),
|
|
202
203
|
value: s ?? null,
|
|
203
204
|
onSelect: (o) => n({
|
|
204
|
-
text:
|
|
205
|
+
text: r,
|
|
205
206
|
mode: o === null ? void 0 : String(o)
|
|
206
207
|
})
|
|
207
208
|
})]
|
|
208
209
|
});
|
|
209
|
-
},
|
|
210
|
+
}, _ = (e) => {
|
|
210
211
|
if (e === null) return;
|
|
211
|
-
const [
|
|
212
|
-
return
|
|
213
|
-
},
|
|
214
|
-
const
|
|
215
|
-
return /* @__PURE__ */
|
|
216
|
-
value:
|
|
217
|
-
|
|
212
|
+
const [a, n, t] = String(e).split("-").map(Number);
|
|
213
|
+
return a && n && t ? new Date(a, n - 1, t) : void 0;
|
|
214
|
+
}, Z = ({ spec: e, value: a, onChange: n }) => {
|
|
215
|
+
const t = g(v);
|
|
216
|
+
return /* @__PURE__ */ l(R, {
|
|
217
|
+
value: _($(a)),
|
|
218
|
+
minDate: _(e.min ?? null),
|
|
219
|
+
maxDate: _(e.max ?? null),
|
|
220
|
+
placeholder: t.selectDate,
|
|
218
221
|
clearable: !0,
|
|
219
|
-
onChange: (
|
|
222
|
+
onChange: (r) => n(r instanceof Date ? w(r, "YYYY-MM-DD") : null)
|
|
220
223
|
});
|
|
221
|
-
},
|
|
222
|
-
const a =
|
|
224
|
+
}, H = ({ spec: e, value: a, onChange: n }) => {
|
|
225
|
+
const t = g(v), [r, c] = B(a), d = _(r || null), s = _(c || null);
|
|
226
|
+
return /* @__PURE__ */ l(R, {
|
|
227
|
+
mode: "range",
|
|
228
|
+
value: d && s ? {
|
|
229
|
+
start: d,
|
|
230
|
+
end: s
|
|
231
|
+
} : void 0,
|
|
232
|
+
minDate: _(e.min ?? null),
|
|
233
|
+
maxDate: _(e.max ?? null),
|
|
234
|
+
placeholder: t.selectDate,
|
|
235
|
+
clearable: !0,
|
|
236
|
+
onChange: (o) => n(o && !(o instanceof Date) && !Array.isArray(o) ? [w(o.start, "YYYY-MM-DD"), w(o.end, "YYYY-MM-DD")] : null)
|
|
237
|
+
});
|
|
238
|
+
}, he = ({ spec: e, value: a, context: n, onChange: t }) => {
|
|
239
|
+
const r = `filter-field filter-field--${n}`;
|
|
223
240
|
switch (e.kind) {
|
|
224
241
|
case "single":
|
|
225
242
|
case "multi":
|
|
226
|
-
return /* @__PURE__ */
|
|
227
|
-
className:
|
|
228
|
-
children: /* @__PURE__ */
|
|
243
|
+
return /* @__PURE__ */ l("div", {
|
|
244
|
+
className: r,
|
|
245
|
+
children: /* @__PURE__ */ l(J, {
|
|
229
246
|
spec: e,
|
|
230
|
-
value:
|
|
247
|
+
value: a,
|
|
231
248
|
context: n,
|
|
232
|
-
onChange:
|
|
249
|
+
onChange: t
|
|
233
250
|
})
|
|
234
251
|
});
|
|
235
252
|
case "range":
|
|
236
|
-
return /* @__PURE__ */
|
|
237
|
-
className:
|
|
238
|
-
children: /* @__PURE__ */
|
|
253
|
+
return /* @__PURE__ */ l("div", {
|
|
254
|
+
className: r,
|
|
255
|
+
children: /* @__PURE__ */ l(K, {
|
|
239
256
|
spec: e,
|
|
240
|
-
value:
|
|
241
|
-
onChange:
|
|
257
|
+
value: a,
|
|
258
|
+
onChange: t
|
|
242
259
|
})
|
|
243
260
|
});
|
|
244
261
|
case "rating":
|
|
245
|
-
return /* @__PURE__ */
|
|
246
|
-
className:
|
|
247
|
-
children: /* @__PURE__ */
|
|
262
|
+
return /* @__PURE__ */ l("div", {
|
|
263
|
+
className: r,
|
|
264
|
+
children: /* @__PURE__ */ l(U, {
|
|
248
265
|
spec: e,
|
|
249
|
-
value:
|
|
250
|
-
onChange:
|
|
266
|
+
value: a,
|
|
267
|
+
onChange: t
|
|
251
268
|
})
|
|
252
269
|
});
|
|
253
270
|
case "toggle": {
|
|
254
|
-
const c =
|
|
271
|
+
const c = a === !0;
|
|
255
272
|
return /* @__PURE__ */ u("div", {
|
|
256
|
-
className: `${
|
|
257
|
-
children: [
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
273
|
+
className: `${r} filter-field__switch-row`,
|
|
274
|
+
children: [
|
|
275
|
+
/* @__PURE__ */ l("button", {
|
|
276
|
+
type: "button",
|
|
277
|
+
className: "filter-field__switch-label",
|
|
278
|
+
onClick: () => t(!c),
|
|
279
|
+
children: e.label
|
|
280
|
+
}),
|
|
281
|
+
e.count !== void 0 && /* @__PURE__ */ l("span", {
|
|
282
|
+
className: "filter-field__count",
|
|
283
|
+
children: e.count
|
|
284
|
+
}),
|
|
285
|
+
/* @__PURE__ */ l(T, {
|
|
286
|
+
checked: c,
|
|
287
|
+
size: "small",
|
|
288
|
+
showLabels: !1,
|
|
289
|
+
onChange: t
|
|
290
|
+
})
|
|
291
|
+
]
|
|
268
292
|
});
|
|
269
293
|
}
|
|
270
294
|
case "text":
|
|
271
|
-
return /* @__PURE__ */
|
|
272
|
-
className:
|
|
273
|
-
children: /* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ l("div", {
|
|
296
|
+
className: r,
|
|
297
|
+
children: /* @__PURE__ */ l(X, {
|
|
274
298
|
spec: e,
|
|
275
|
-
value:
|
|
276
|
-
onChange:
|
|
299
|
+
value: a,
|
|
300
|
+
onChange: t
|
|
277
301
|
})
|
|
278
302
|
});
|
|
279
303
|
case "date":
|
|
280
|
-
return /* @__PURE__ */
|
|
281
|
-
className:
|
|
282
|
-
children: /* @__PURE__ */
|
|
304
|
+
return /* @__PURE__ */ l("div", {
|
|
305
|
+
className: r,
|
|
306
|
+
children: /* @__PURE__ */ l(Z, {
|
|
307
|
+
spec: e,
|
|
308
|
+
value: a,
|
|
309
|
+
onChange: t
|
|
310
|
+
})
|
|
311
|
+
});
|
|
312
|
+
case "date-range":
|
|
313
|
+
return /* @__PURE__ */ l("div", {
|
|
314
|
+
className: r,
|
|
315
|
+
children: /* @__PURE__ */ l(H, {
|
|
283
316
|
spec: e,
|
|
284
|
-
value:
|
|
285
|
-
onChange:
|
|
317
|
+
value: a,
|
|
318
|
+
onChange: t
|
|
286
319
|
})
|
|
287
320
|
});
|
|
288
321
|
}
|
|
289
322
|
};
|
|
290
323
|
export {
|
|
291
|
-
|
|
324
|
+
he as FilterField,
|
|
292
325
|
x as OptionRow,
|
|
293
|
-
|
|
326
|
+
D as Segmented
|
|
294
327
|
};
|