@memobit/libs 3.28.2 → 3.30.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/Auth/ChangePasswordModal/ChangePasswordModal2.js +7 -7
- package/dist/components/Auth/Login/Login2.js +4 -4
- package/dist/components/Auth/MfaSetupModal/MfaSetupModal2.js +6 -6
- package/dist/components/DataView/DataView.CardView.js +84 -84
- package/dist/components/MenuHamburger/MenuHamburger2.js +14 -14
- package/dist/components/PageShell/AppFrame.js +32 -0
- package/dist/components/PageShell/AppNav.js +55 -0
- package/dist/components/PageShell/BottomSheet.js +45 -0
- package/dist/components/PageShell/FilterField.css +1 -0
- package/dist/components/PageShell/FilterField2.js +294 -0
- package/dist/components/PageShell/FilterSections.js +86 -0
- package/dist/components/PageShell/PageParts.js +316 -0
- package/dist/components/PageShell/PageShell.css +1 -0
- package/dist/components/PageShell/PageShell2.js +11 -0
- package/dist/components/PageShell/WorkbenchPhone.js +142 -0
- package/dist/components/PageShell/WorkbenchShell.js +160 -0
- package/dist/components/PageShell/filterRules.js +123 -0
- package/dist/components/PageShell/filterValues.js +30 -0
- package/dist/components/PageShell/menuItems.js +17 -0
- package/dist/components/PageShell/shellText.js +39 -0
- package/dist/components/PageShell/useAppFrame.js +6 -0
- package/dist/components/PageShell/usePaging.js +23 -0
- package/dist/components/PageShell/usePruneStaleFilters.js +17 -0
- package/dist/components/PageShell/useSummaryMessages.js +17 -0
- package/dist/components/Pagination/Pagination.css +1 -1
- package/dist/components/Pagination/Pagination2.js +14 -13
- package/dist/components/RouterAppFrame/RouterAppFrame.js +37 -0
- package/dist/components/ScrollToTop/ScrollToTop.css +1 -1
- package/dist/components/ScrollToTop/ScrollToTop2.js +20 -19
- package/dist/contexts/LanguageContext/libMessages.js +57 -7
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/hooks/useAccountMenu.js +6 -6
- package/dist/index.d.ts +335 -0
- package/dist/index.js +235 -213
- package/dist/router.d.ts +68 -0
- package/dist/router.js +4 -2
- package/dist/version.js +1 -1
- package/dist/version.json +4 -4
- package/package.json +147 -147
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import './FilterField.css';
|
|
2
|
+
import { Icon as D } from "../Icon/Icon2.js";
|
|
3
|
+
import { libMessages as g } from "../../contexts/LanguageContext/libMessages.js";
|
|
4
|
+
import { useMessages as b } from "../../hooks/useLanguage.js";
|
|
5
|
+
import { formatDate as L } from "../../helpers/Datetime.js";
|
|
6
|
+
import { Chip as j } from "../Chip/Chip2.js";
|
|
7
|
+
import { DatePicker as z } from "../DatePicker/DatePicker2.js";
|
|
8
|
+
import { InputSearch as F } from "../InputSearch/InputSearch2.js";
|
|
9
|
+
import { Rating as C } from "../Rating/Rating2.js";
|
|
10
|
+
import { ToggleSwitch as T } from "../ToggleSwitch/ToggleSwitch2.js";
|
|
11
|
+
import { RangeSlider as W } from "../RangeSlider/RangeSlider2.js";
|
|
12
|
+
import { getTextModes as Y, pickControl as I, toList as O, toNumber as B, toRange as E, toScalar as M, toText as V } from "./filterRules.js";
|
|
13
|
+
/* empty css */
|
|
14
|
+
import { useEffect as q, useState as w } from "react";
|
|
15
|
+
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
16
|
+
var N = ({ items: e, value: r, onSelect: n }) => /* @__PURE__ */ t("div", {
|
|
17
|
+
className: "filter-field__segmented",
|
|
18
|
+
children: e.map((l) => /* @__PURE__ */ t("button", {
|
|
19
|
+
type: "button",
|
|
20
|
+
className: ["filter-field__segment", l.value === r ? "filter-field__segment--selected" : ""].filter(Boolean).join(" "),
|
|
21
|
+
onClick: () => n(l.value),
|
|
22
|
+
children: l.label
|
|
23
|
+
}, String(l.value)))
|
|
24
|
+
}), x = ({ label: e, mark: r, selected: n, count: l, icon: a, onClick: c }) => /* @__PURE__ */ u("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
className: [
|
|
27
|
+
"filter-field__row",
|
|
28
|
+
n ? "filter-field__row--selected" : "",
|
|
29
|
+
l === 0 && !n ? "filter-field__row--empty" : ""
|
|
30
|
+
].filter(Boolean).join(" "),
|
|
31
|
+
onClick: c,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ t("span", {
|
|
34
|
+
className: `filter-field__mark filter-field__mark--${r}`,
|
|
35
|
+
children: r === "check" && n && /* @__PURE__ */ t(D, {
|
|
36
|
+
name: "checkmark",
|
|
37
|
+
size: "sm"
|
|
38
|
+
})
|
|
39
|
+
}),
|
|
40
|
+
a && /* @__PURE__ */ t(D, {
|
|
41
|
+
name: a,
|
|
42
|
+
size: "sm"
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ t("span", {
|
|
45
|
+
className: "filter-field__row-label",
|
|
46
|
+
children: e
|
|
47
|
+
}),
|
|
48
|
+
l !== void 0 && /* @__PURE__ */ t("span", {
|
|
49
|
+
className: "filter-field__count",
|
|
50
|
+
children: l
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
}), P = (e, r) => e.includes(r) ? e.filter((n) => n !== r) : [...e, r], Q = ({ spec: e, value: r, context: n, onChange: l }) => {
|
|
54
|
+
const a = b(g), [c, d] = w(""), [s, o] = w(!1), f = I(e, n), p = e.kind === "single", _ = p ? [M(r)].filter((i) => i !== null) : O(r), h = (i) => _.includes(i.value), y = (i) => {
|
|
55
|
+
if (!p) {
|
|
56
|
+
l(P(_, i.value));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
l(h(i) && f !== "radio" ? null : i.value);
|
|
60
|
+
};
|
|
61
|
+
if (f === "segmented") {
|
|
62
|
+
const i = [{
|
|
63
|
+
value: null,
|
|
64
|
+
label: a.pageAny
|
|
65
|
+
}, ...e.options.map((m) => ({
|
|
66
|
+
value: m.value,
|
|
67
|
+
label: m.label
|
|
68
|
+
}))];
|
|
69
|
+
return /* @__PURE__ */ t(N, {
|
|
70
|
+
items: i,
|
|
71
|
+
value: _[0] ?? null,
|
|
72
|
+
onSelect: (m) => l(m)
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (f === "chips") return /* @__PURE__ */ t("div", {
|
|
76
|
+
className: "filter-field__chips",
|
|
77
|
+
children: e.options.map((i) => /* @__PURE__ */ t(j, {
|
|
78
|
+
color: i.color,
|
|
79
|
+
count: i.count,
|
|
80
|
+
icon: i.icon,
|
|
81
|
+
selected: h(i),
|
|
82
|
+
size: n === "sheet" ? "medium" : "small",
|
|
83
|
+
onClick: () => y(i),
|
|
84
|
+
children: i.label
|
|
85
|
+
}, i.value))
|
|
86
|
+
});
|
|
87
|
+
const R = p ? "radio" : "check", v = (i) => /* @__PURE__ */ t(x, {
|
|
88
|
+
label: i.label,
|
|
89
|
+
mark: R,
|
|
90
|
+
selected: h(i),
|
|
91
|
+
count: i.count,
|
|
92
|
+
icon: i.icon,
|
|
93
|
+
onClick: () => y(i)
|
|
94
|
+
}, i.value);
|
|
95
|
+
if (f === "search-list") {
|
|
96
|
+
const i = c.trim().toLowerCase(), m = e.options.filter(h), k = e.options.filter((A) => !h(A) && (!i || A.label.toLowerCase().includes(i)));
|
|
97
|
+
return /* @__PURE__ */ u("div", {
|
|
98
|
+
className: "filter-field__stack",
|
|
99
|
+
children: [/* @__PURE__ */ t(F, {
|
|
100
|
+
value: c,
|
|
101
|
+
placeholder: a.pageSearchOptions(e.label),
|
|
102
|
+
onChange: d
|
|
103
|
+
}), /* @__PURE__ */ u("div", {
|
|
104
|
+
className: "filter-field__options",
|
|
105
|
+
children: [
|
|
106
|
+
m.map(v),
|
|
107
|
+
m.length > 0 && k.length > 0 && /* @__PURE__ */ t("div", { className: "filter-field__divider" }),
|
|
108
|
+
k.map(v),
|
|
109
|
+
m.length === 0 && k.length === 0 && /* @__PURE__ */ t("span", {
|
|
110
|
+
className: "filter-field__empty",
|
|
111
|
+
children: a.pageNoMatches
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
})]
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (f === "radio") return /* @__PURE__ */ u("div", {
|
|
118
|
+
className: "filter-field__rows",
|
|
119
|
+
children: [/* @__PURE__ */ t(x, {
|
|
120
|
+
label: a.pageAny,
|
|
121
|
+
mark: "radio",
|
|
122
|
+
selected: _.length === 0,
|
|
123
|
+
onClick: () => l(null)
|
|
124
|
+
}), e.options.map(v)]
|
|
125
|
+
});
|
|
126
|
+
const S = e.options.length > 7, $ = S && !s ? e.options.filter((i, m) => m < 6 || h(i)) : e.options;
|
|
127
|
+
return /* @__PURE__ */ u("div", {
|
|
128
|
+
className: "filter-field__stack",
|
|
129
|
+
children: [/* @__PURE__ */ t("div", {
|
|
130
|
+
className: "filter-field__rows",
|
|
131
|
+
children: $.map(v)
|
|
132
|
+
}), S && /* @__PURE__ */ t("button", {
|
|
133
|
+
type: "button",
|
|
134
|
+
className: "filter-field__link",
|
|
135
|
+
onClick: () => o(!s),
|
|
136
|
+
children: s ? a.pageShowFewer : a.pageShowAll(e.options.length)
|
|
137
|
+
})]
|
|
138
|
+
});
|
|
139
|
+
}, G = ({ spec: e, value: r, onChange: n }) => {
|
|
140
|
+
const [l, a] = E(r, e.min, e.max), [c, d] = w([l, a]);
|
|
141
|
+
q(() => d([l, a]), [l, a]);
|
|
142
|
+
const s = ([o, f]) => n(o <= e.min && f >= e.max ? null : [o, f]);
|
|
143
|
+
return /* @__PURE__ */ t(W, {
|
|
144
|
+
min: e.min,
|
|
145
|
+
max: e.max,
|
|
146
|
+
step: e.step,
|
|
147
|
+
value: c,
|
|
148
|
+
showValues: !0,
|
|
149
|
+
formatValue: (o) => e.unit ? `${o} ${e.unit}` : String(o),
|
|
150
|
+
onChange: d,
|
|
151
|
+
onChangeEnd: s
|
|
152
|
+
});
|
|
153
|
+
}, J = ({ spec: e, value: r, onChange: n }) => {
|
|
154
|
+
const l = b(g), a = B(r);
|
|
155
|
+
if (e.max <= 5) {
|
|
156
|
+
const c = Array.from({ length: e.max - 1 }, (s, o) => o + 2), d = [{
|
|
157
|
+
value: 0,
|
|
158
|
+
label: l.pageAny
|
|
159
|
+
}, ...c.map((s) => ({
|
|
160
|
+
value: s,
|
|
161
|
+
label: s === e.max ? `${s}★` : `${s}★+`
|
|
162
|
+
}))];
|
|
163
|
+
return /* @__PURE__ */ t(N, {
|
|
164
|
+
items: d,
|
|
165
|
+
value: a,
|
|
166
|
+
onSelect: (s) => n(typeof s == "number" ? s : 0)
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return /* @__PURE__ */ u("div", {
|
|
170
|
+
className: "filter-field__rating",
|
|
171
|
+
children: [/* @__PURE__ */ t(C, {
|
|
172
|
+
rating: a,
|
|
173
|
+
maxRate: e.max,
|
|
174
|
+
selectable: !0,
|
|
175
|
+
onSelect: (c) => n(c === a ? 0 : c)
|
|
176
|
+
}), a > 0 && /* @__PURE__ */ t("button", {
|
|
177
|
+
type: "button",
|
|
178
|
+
className: "filter-field__link",
|
|
179
|
+
onClick: () => n(0),
|
|
180
|
+
children: l.pageAny
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
}, K = ({ spec: e, value: r, onChange: n }) => {
|
|
184
|
+
const l = b(g), { text: a, mode: c } = V(r), d = Y(e, {
|
|
185
|
+
anyWord: l.pageAnyWord,
|
|
186
|
+
allWords: l.pageAllWords
|
|
187
|
+
}), s = c ?? d?.[0]?.value;
|
|
188
|
+
return /* @__PURE__ */ u("div", {
|
|
189
|
+
className: "filter-field__stack",
|
|
190
|
+
children: [/* @__PURE__ */ t(F, {
|
|
191
|
+
value: a,
|
|
192
|
+
placeholder: e.placeholder,
|
|
193
|
+
onChange: (o) => n({
|
|
194
|
+
text: o,
|
|
195
|
+
mode: s
|
|
196
|
+
})
|
|
197
|
+
}), d && /* @__PURE__ */ t(N, {
|
|
198
|
+
items: d.map((o) => ({
|
|
199
|
+
value: o.value,
|
|
200
|
+
label: o.label
|
|
201
|
+
})),
|
|
202
|
+
value: s ?? null,
|
|
203
|
+
onSelect: (o) => n({
|
|
204
|
+
text: a,
|
|
205
|
+
mode: o === null ? void 0 : String(o)
|
|
206
|
+
})
|
|
207
|
+
})]
|
|
208
|
+
});
|
|
209
|
+
}, U = (e) => {
|
|
210
|
+
if (e === null) return;
|
|
211
|
+
const [r, n, l] = String(e).split("-").map(Number);
|
|
212
|
+
return r && n && l ? new Date(r, n - 1, l) : void 0;
|
|
213
|
+
}, X = ({ value: e, onChange: r }) => {
|
|
214
|
+
const n = b(g);
|
|
215
|
+
return /* @__PURE__ */ t(z, {
|
|
216
|
+
value: U(M(e)),
|
|
217
|
+
placeholder: n.selectDate,
|
|
218
|
+
clearable: !0,
|
|
219
|
+
onChange: (l) => r(l instanceof Date ? L(l, "YYYY-MM-DD") : null)
|
|
220
|
+
});
|
|
221
|
+
}, fe = ({ spec: e, value: r, context: n, onChange: l }) => {
|
|
222
|
+
const a = `filter-field filter-field--${n}`;
|
|
223
|
+
switch (e.kind) {
|
|
224
|
+
case "single":
|
|
225
|
+
case "multi":
|
|
226
|
+
return /* @__PURE__ */ t("div", {
|
|
227
|
+
className: a,
|
|
228
|
+
children: /* @__PURE__ */ t(Q, {
|
|
229
|
+
spec: e,
|
|
230
|
+
value: r,
|
|
231
|
+
context: n,
|
|
232
|
+
onChange: l
|
|
233
|
+
})
|
|
234
|
+
});
|
|
235
|
+
case "range":
|
|
236
|
+
return /* @__PURE__ */ t("div", {
|
|
237
|
+
className: a,
|
|
238
|
+
children: /* @__PURE__ */ t(G, {
|
|
239
|
+
spec: e,
|
|
240
|
+
value: r,
|
|
241
|
+
onChange: l
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
case "rating":
|
|
245
|
+
return /* @__PURE__ */ t("div", {
|
|
246
|
+
className: a,
|
|
247
|
+
children: /* @__PURE__ */ t(J, {
|
|
248
|
+
spec: e,
|
|
249
|
+
value: r,
|
|
250
|
+
onChange: l
|
|
251
|
+
})
|
|
252
|
+
});
|
|
253
|
+
case "toggle": {
|
|
254
|
+
const c = r === !0;
|
|
255
|
+
return /* @__PURE__ */ u("div", {
|
|
256
|
+
className: `${a} filter-field__switch-row`,
|
|
257
|
+
children: [/* @__PURE__ */ t("button", {
|
|
258
|
+
type: "button",
|
|
259
|
+
className: "filter-field__switch-label",
|
|
260
|
+
onClick: () => l(!c),
|
|
261
|
+
children: e.label
|
|
262
|
+
}), /* @__PURE__ */ t(T, {
|
|
263
|
+
checked: c,
|
|
264
|
+
size: "small",
|
|
265
|
+
showLabels: !1,
|
|
266
|
+
onChange: l
|
|
267
|
+
})]
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
case "text":
|
|
271
|
+
return /* @__PURE__ */ t("div", {
|
|
272
|
+
className: a,
|
|
273
|
+
children: /* @__PURE__ */ t(K, {
|
|
274
|
+
spec: e,
|
|
275
|
+
value: r,
|
|
276
|
+
onChange: l
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
case "date":
|
|
280
|
+
return /* @__PURE__ */ t("div", {
|
|
281
|
+
className: a,
|
|
282
|
+
children: /* @__PURE__ */ t(X, {
|
|
283
|
+
spec: e,
|
|
284
|
+
value: r,
|
|
285
|
+
onChange: l
|
|
286
|
+
})
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
export {
|
|
291
|
+
fe as FilterField,
|
|
292
|
+
x as OptionRow,
|
|
293
|
+
N as Segmented
|
|
294
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Icon as _ } from "../Icon/Icon2.js";
|
|
2
|
+
import { libMessages as v } from "../../contexts/LanguageContext/libMessages.js";
|
|
3
|
+
import { useMessages as y } from "../../hooks/useLanguage.js";
|
|
4
|
+
import { Chip as b } from "../Chip/Chip2.js";
|
|
5
|
+
import { filterSummary as k, getAppliedFilters as A, isFilterActive as u } from "./filterRules.js";
|
|
6
|
+
import { FilterField as C } from "./FilterField2.js";
|
|
7
|
+
import { useSummaryMessages as h } from "./useSummaryMessages.js";
|
|
8
|
+
import { useState as F } from "react";
|
|
9
|
+
import { jsx as s, jsxs as g } from "react/jsx-runtime";
|
|
10
|
+
var S = 3, M = (r, n) => {
|
|
11
|
+
const a = r.filter((l) => l.kind !== "toggle"), i = a.filter((l) => l.priority === "pinned"), o = i.length > 0 ? i : a.slice(0, S), p = a.filter((l) => u(l, n[l.id]));
|
|
12
|
+
return new Set([...o, ...p].map((l) => l.id));
|
|
13
|
+
}, B = ({ filters: r, values: n, context: a, onFilterChange: i }) => {
|
|
14
|
+
const o = h(), [p, l] = F(() => M(r, n)), d = (e) => l((m) => {
|
|
15
|
+
const t = new Set(m);
|
|
16
|
+
return t.has(e) ? t.delete(e) : t.add(e), t;
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ s("div", {
|
|
19
|
+
className: `page-filters page-filters--${a}`,
|
|
20
|
+
children: r.map((e) => {
|
|
21
|
+
const m = n[e.id], t = /* @__PURE__ */ s(C, {
|
|
22
|
+
spec: e,
|
|
23
|
+
value: m,
|
|
24
|
+
context: a,
|
|
25
|
+
onChange: (N) => i(e.id, N)
|
|
26
|
+
});
|
|
27
|
+
if (e.kind === "toggle") return /* @__PURE__ */ s("div", {
|
|
28
|
+
className: "page-filters__flat",
|
|
29
|
+
children: t
|
|
30
|
+
}, e.id);
|
|
31
|
+
const c = p.has(e.id), f = u(e, m);
|
|
32
|
+
return /* @__PURE__ */ g("div", {
|
|
33
|
+
className: "page-filters__section",
|
|
34
|
+
children: [/* @__PURE__ */ g("button", {
|
|
35
|
+
type: "button",
|
|
36
|
+
className: "page-filters__header",
|
|
37
|
+
onClick: () => d(e.id),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ s("span", {
|
|
40
|
+
className: "page-filters__label",
|
|
41
|
+
children: e.label
|
|
42
|
+
}),
|
|
43
|
+
!c && f ? /* @__PURE__ */ s("span", {
|
|
44
|
+
className: "page-filters__summary",
|
|
45
|
+
children: k(e, m, o)
|
|
46
|
+
}) : /* @__PURE__ */ s("span", { className: "page-filters__spacer" }),
|
|
47
|
+
c && f && /* @__PURE__ */ s("span", { className: "page-filters__dot" }),
|
|
48
|
+
/* @__PURE__ */ s(_, {
|
|
49
|
+
name: c ? "caret-down" : "caret-right",
|
|
50
|
+
size: "sm"
|
|
51
|
+
})
|
|
52
|
+
]
|
|
53
|
+
}), c && /* @__PURE__ */ s("div", {
|
|
54
|
+
className: "page-filters__body",
|
|
55
|
+
children: t
|
|
56
|
+
})]
|
|
57
|
+
}, e.id);
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}, D = ({ filters: r, values: n, onFilterChange: a, onClearFilters: i, scroll: o = !1 }) => {
|
|
61
|
+
const p = y(v), l = h(), d = A(r, n, l);
|
|
62
|
+
return d.length === 0 ? null : /* @__PURE__ */ g("div", {
|
|
63
|
+
className: ["page-applied", o ? "page-applied--scroll" : ""].filter(Boolean).join(" "),
|
|
64
|
+
children: [d.map((e) => /* @__PURE__ */ g(b, {
|
|
65
|
+
selected: !0,
|
|
66
|
+
size: "small",
|
|
67
|
+
onClick: () => a(e.filterId, e.next),
|
|
68
|
+
children: [/* @__PURE__ */ s("span", {
|
|
69
|
+
className: "page-applied__label",
|
|
70
|
+
children: e.label
|
|
71
|
+
}), /* @__PURE__ */ s(_, {
|
|
72
|
+
name: "clear",
|
|
73
|
+
size: "sm"
|
|
74
|
+
})]
|
|
75
|
+
}, e.key)), i && /* @__PURE__ */ s("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
className: "page-shell__link",
|
|
78
|
+
onClick: i,
|
|
79
|
+
children: p.pageClearAll
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
D as AppliedFilters,
|
|
85
|
+
B as FilterSections
|
|
86
|
+
};
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { Icon as o } from "../Icon/Icon2.js";
|
|
2
|
+
import { libMessages as t } from "../../contexts/LanguageContext/libMessages.js";
|
|
3
|
+
import { useMessages as c } from "../../hooks/useLanguage.js";
|
|
4
|
+
import { Button as d } from "../Button/Button2.js";
|
|
5
|
+
import { Tooltip as g } from "../Tooltip/Tooltip2.js";
|
|
6
|
+
import { Dropdown as b } from "../Dropdown/Dropdown2.js";
|
|
7
|
+
import { ToggleSwitch as C } from "../ToggleSwitch/ToggleSwitch2.js";
|
|
8
|
+
import { MenuHamburger as N } from "../MenuHamburger/MenuHamburger2.js";
|
|
9
|
+
import { OptionRow as h, Segmented as p } from "./FilterField2.js";
|
|
10
|
+
import { resolveViewModes as k } from "./shellText.js";
|
|
11
|
+
import { useState as w } from "react";
|
|
12
|
+
import { Fragment as m, jsx as l, jsxs as r } from "react/jsx-runtime";
|
|
13
|
+
var H = ({ app: e, logoOnly: i = !1 }) => {
|
|
14
|
+
const a = typeof e.logo == "string" ? /* @__PURE__ */ l("img", {
|
|
15
|
+
src: e.logo,
|
|
16
|
+
alt: e.name
|
|
17
|
+
}) : e.logo ?? (e.icon ? /* @__PURE__ */ l(o, {
|
|
18
|
+
name: e.icon,
|
|
19
|
+
size: "lg"
|
|
20
|
+
}) : null), n = /* @__PURE__ */ r(m, { children: [a && /* @__PURE__ */ l("span", {
|
|
21
|
+
className: "page-shell__logo",
|
|
22
|
+
children: a
|
|
23
|
+
}), !i && /* @__PURE__ */ l("span", {
|
|
24
|
+
className: "page-shell__app-name",
|
|
25
|
+
children: e.name
|
|
26
|
+
})] });
|
|
27
|
+
return e.onHomeClick ? /* @__PURE__ */ l("button", {
|
|
28
|
+
type: "button",
|
|
29
|
+
className: "page-shell__app page-shell__app--clickable",
|
|
30
|
+
onClick: e.onHomeClick,
|
|
31
|
+
children: n
|
|
32
|
+
}) : /* @__PURE__ */ l("span", {
|
|
33
|
+
className: "page-shell__app",
|
|
34
|
+
children: n
|
|
35
|
+
});
|
|
36
|
+
}, L = ({ action: e, fullWidth: i = !1 }) => /* @__PURE__ */ l(d, {
|
|
37
|
+
icon: e.icon,
|
|
38
|
+
variant: e.variant ?? "default",
|
|
39
|
+
disabled: e.disabled,
|
|
40
|
+
fullWidth: i,
|
|
41
|
+
onClick: e.onClick,
|
|
42
|
+
children: e.label
|
|
43
|
+
}), R = ({ items: e }) => e.length > 0 ? /* @__PURE__ */ l(N, {
|
|
44
|
+
items: e,
|
|
45
|
+
disableResponsive: !0,
|
|
46
|
+
showLabel: !1
|
|
47
|
+
}) : null, f = ({ view: e, withLabels: i = !1 }) => {
|
|
48
|
+
const a = c(t);
|
|
49
|
+
return /* @__PURE__ */ l("div", {
|
|
50
|
+
className: ["page-shell__view-toggle", i ? "page-shell__view-toggle--labels" : ""].filter(Boolean).join(" "),
|
|
51
|
+
children: /* @__PURE__ */ l(p, {
|
|
52
|
+
items: k(e.modes, a).map((n) => ({
|
|
53
|
+
value: n.value,
|
|
54
|
+
label: i ? /* @__PURE__ */ r("span", {
|
|
55
|
+
className: "page-shell__view-option",
|
|
56
|
+
children: [/* @__PURE__ */ l(o, {
|
|
57
|
+
name: n.icon,
|
|
58
|
+
size: "sm"
|
|
59
|
+
}), n.label]
|
|
60
|
+
}) : /* @__PURE__ */ l(g, {
|
|
61
|
+
title: n.label,
|
|
62
|
+
children: /* @__PURE__ */ l(o, {
|
|
63
|
+
name: n.icon,
|
|
64
|
+
size: "sm"
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
})),
|
|
68
|
+
value: e.value,
|
|
69
|
+
onSelect: (n) => {
|
|
70
|
+
n !== null && e.onChange(String(n));
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}, F = ({ sort: e }) => {
|
|
75
|
+
const i = c(t), a = e.value.direction === "asc";
|
|
76
|
+
return /* @__PURE__ */ r("div", {
|
|
77
|
+
className: "page-shell__sort",
|
|
78
|
+
children: [/* @__PURE__ */ l("div", {
|
|
79
|
+
className: "page-shell__sort-field",
|
|
80
|
+
children: /* @__PURE__ */ l(b, {
|
|
81
|
+
name: "page-sort",
|
|
82
|
+
options: e.fields,
|
|
83
|
+
value: e.value.field,
|
|
84
|
+
highlighted: e.highlighted,
|
|
85
|
+
clearable: !1,
|
|
86
|
+
searchable: !1,
|
|
87
|
+
usePortal: !1,
|
|
88
|
+
onChange: (n) => {
|
|
89
|
+
n && !Array.isArray(n) && e.onChange({
|
|
90
|
+
field: String(n.value),
|
|
91
|
+
direction: e.value.direction
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
}), /* @__PURE__ */ l(g, {
|
|
96
|
+
title: a ? i.pageAscending : i.pageDescending,
|
|
97
|
+
children: /* @__PURE__ */ l(d, {
|
|
98
|
+
icon: a ? "arrow-up" : "arrow-down",
|
|
99
|
+
variant: "default",
|
|
100
|
+
onClick: () => e.onChange({
|
|
101
|
+
field: e.value.field,
|
|
102
|
+
direction: a ? "desc" : "asc"
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}, I = ({ sort: e, view: i }) => {
|
|
108
|
+
const a = c(t);
|
|
109
|
+
return /* @__PURE__ */ r("div", {
|
|
110
|
+
className: "filter-field filter-field--sheet page-shell__sheet-stack",
|
|
111
|
+
children: [e && /* @__PURE__ */ r(m, { children: [
|
|
112
|
+
/* @__PURE__ */ l("span", {
|
|
113
|
+
className: "page-shell__group-title",
|
|
114
|
+
children: a.sortBy
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ l("div", {
|
|
117
|
+
className: "filter-field__rows",
|
|
118
|
+
children: e.fields.map((n) => /* @__PURE__ */ l(h, {
|
|
119
|
+
label: n.label,
|
|
120
|
+
mark: "radio",
|
|
121
|
+
selected: e.value.field === n.value,
|
|
122
|
+
onClick: () => e.onChange({
|
|
123
|
+
field: n.value,
|
|
124
|
+
direction: e.value.direction
|
|
125
|
+
})
|
|
126
|
+
}, n.value))
|
|
127
|
+
}),
|
|
128
|
+
/* @__PURE__ */ l(p, {
|
|
129
|
+
items: [{
|
|
130
|
+
value: "asc",
|
|
131
|
+
label: a.pageAscending
|
|
132
|
+
}, {
|
|
133
|
+
value: "desc",
|
|
134
|
+
label: a.pageDescending
|
|
135
|
+
}],
|
|
136
|
+
value: e.value.direction,
|
|
137
|
+
onSelect: (n) => e.onChange({
|
|
138
|
+
field: e.value.field,
|
|
139
|
+
direction: n === "desc" ? "desc" : "asc"
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
] }), i && /* @__PURE__ */ r(m, { children: [
|
|
143
|
+
/* @__PURE__ */ l("span", {
|
|
144
|
+
className: "page-shell__group-title",
|
|
145
|
+
children: a.pageView
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ l(f, {
|
|
148
|
+
view: i,
|
|
149
|
+
withLabels: !0
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ l(_, {
|
|
152
|
+
view: i,
|
|
153
|
+
context: "sheet"
|
|
154
|
+
})
|
|
155
|
+
] })]
|
|
156
|
+
});
|
|
157
|
+
}, v = ({ label: e, summary: i, context: a, children: n }) => {
|
|
158
|
+
const [s, u] = w(!1);
|
|
159
|
+
return /* @__PURE__ */ r("div", {
|
|
160
|
+
className: "page-filters__section",
|
|
161
|
+
children: [/* @__PURE__ */ r("button", {
|
|
162
|
+
type: "button",
|
|
163
|
+
className: "page-filters__header",
|
|
164
|
+
onClick: () => u(!s),
|
|
165
|
+
children: [
|
|
166
|
+
/* @__PURE__ */ l("span", {
|
|
167
|
+
className: "page-filters__label",
|
|
168
|
+
children: e
|
|
169
|
+
}),
|
|
170
|
+
/* @__PURE__ */ l("span", {
|
|
171
|
+
className: "page-filters__summary",
|
|
172
|
+
children: i
|
|
173
|
+
}),
|
|
174
|
+
/* @__PURE__ */ l(o, {
|
|
175
|
+
name: s ? "caret-down" : "caret-right",
|
|
176
|
+
size: "sm"
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}), s && /* @__PURE__ */ l("div", {
|
|
180
|
+
className: `page-filters__body filter-field filter-field--${a}`,
|
|
181
|
+
children: n
|
|
182
|
+
})]
|
|
183
|
+
});
|
|
184
|
+
}, S = ({ columns: e, context: i }) => {
|
|
185
|
+
const a = c(t), n = (s) => e.onChange(e.value.includes(s) ? e.value.filter((u) => u !== s) : [...e.value, s]);
|
|
186
|
+
return /* @__PURE__ */ l(v, {
|
|
187
|
+
label: a.columns,
|
|
188
|
+
summary: a.pageColumnsShown(e.value.length, e.options.length),
|
|
189
|
+
context: i,
|
|
190
|
+
children: /* @__PURE__ */ l("div", {
|
|
191
|
+
className: "filter-field__rows",
|
|
192
|
+
children: e.options.map((s) => /* @__PURE__ */ l(h, {
|
|
193
|
+
label: s.label,
|
|
194
|
+
mark: "check",
|
|
195
|
+
selected: e.value.includes(s.value),
|
|
196
|
+
onClick: () => n(s.value)
|
|
197
|
+
}, s.value))
|
|
198
|
+
})
|
|
199
|
+
});
|
|
200
|
+
}, y = ({ groupBy: e, context: i }) => {
|
|
201
|
+
const a = c(t), n = e.options.find((s) => s.value === e.value);
|
|
202
|
+
return /* @__PURE__ */ l(v, {
|
|
203
|
+
label: a.groupBy,
|
|
204
|
+
summary: n?.label ?? a.pageGroupNone,
|
|
205
|
+
context: i,
|
|
206
|
+
children: /* @__PURE__ */ r("div", {
|
|
207
|
+
className: "filter-field__rows",
|
|
208
|
+
children: [/* @__PURE__ */ l(h, {
|
|
209
|
+
label: a.pageGroupNone,
|
|
210
|
+
mark: "radio",
|
|
211
|
+
selected: e.value === null,
|
|
212
|
+
onClick: () => e.onChange(null)
|
|
213
|
+
}), e.options.map((s) => /* @__PURE__ */ l(h, {
|
|
214
|
+
label: s.label,
|
|
215
|
+
mark: "radio",
|
|
216
|
+
selected: e.value === s.value,
|
|
217
|
+
onClick: () => e.onChange(s.value)
|
|
218
|
+
}, s.value))]
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
}, V = ({ toggle: e, context: i }) => /* @__PURE__ */ l("div", {
|
|
222
|
+
className: "page-filters__flat",
|
|
223
|
+
children: /* @__PURE__ */ r("div", {
|
|
224
|
+
className: `filter-field filter-field--${i} filter-field__switch-row`,
|
|
225
|
+
children: [/* @__PURE__ */ l("button", {
|
|
226
|
+
type: "button",
|
|
227
|
+
className: "filter-field__switch-label",
|
|
228
|
+
onClick: () => e.onChange(!e.value),
|
|
229
|
+
children: e.label
|
|
230
|
+
}), /* @__PURE__ */ l(C, {
|
|
231
|
+
checked: e.value,
|
|
232
|
+
size: "small",
|
|
233
|
+
showLabels: !1,
|
|
234
|
+
onChange: e.onChange
|
|
235
|
+
})]
|
|
236
|
+
})
|
|
237
|
+
}), _ = ({ view: e, context: i }) => !e.columns && !e.groupBy && !e.toggles?.length ? null : /* @__PURE__ */ r("div", {
|
|
238
|
+
className: `page-filters page-filters--${i}`,
|
|
239
|
+
children: [
|
|
240
|
+
e.columns && /* @__PURE__ */ l(S, {
|
|
241
|
+
columns: e.columns,
|
|
242
|
+
context: i
|
|
243
|
+
}),
|
|
244
|
+
e.groupBy && /* @__PURE__ */ l(y, {
|
|
245
|
+
groupBy: e.groupBy,
|
|
246
|
+
context: i
|
|
247
|
+
}),
|
|
248
|
+
e.toggles?.map((a) => /* @__PURE__ */ l(V, {
|
|
249
|
+
toggle: a,
|
|
250
|
+
context: i
|
|
251
|
+
}, a.id))
|
|
252
|
+
]
|
|
253
|
+
}), E = ({ pagination: e }) => {
|
|
254
|
+
const i = c(t);
|
|
255
|
+
if (!e || e.pageCount <= 1) return null;
|
|
256
|
+
const { page: a, pageCount: n, onChange: s } = e;
|
|
257
|
+
return /* @__PURE__ */ r("div", {
|
|
258
|
+
className: "page-shell__pager",
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ l(g, {
|
|
261
|
+
title: i.previous,
|
|
262
|
+
children: /* @__PURE__ */ l(d, {
|
|
263
|
+
icon: "caret-left",
|
|
264
|
+
variant: "plain",
|
|
265
|
+
size: "small",
|
|
266
|
+
disabled: a <= 1,
|
|
267
|
+
onClick: () => s(a - 1)
|
|
268
|
+
})
|
|
269
|
+
}),
|
|
270
|
+
/* @__PURE__ */ l("span", {
|
|
271
|
+
className: "page-shell__pager-label",
|
|
272
|
+
children: i.pageOf(a, n)
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ l(g, {
|
|
275
|
+
title: i.next,
|
|
276
|
+
children: /* @__PURE__ */ l(d, {
|
|
277
|
+
icon: "caret-right",
|
|
278
|
+
variant: "plain",
|
|
279
|
+
size: "small",
|
|
280
|
+
disabled: a >= n,
|
|
281
|
+
onClick: () => s(a + 1)
|
|
282
|
+
})
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
});
|
|
286
|
+
}, q = ({ view: e, showToggle: i = !0 }) => {
|
|
287
|
+
const a = c(t);
|
|
288
|
+
return /* @__PURE__ */ r("div", {
|
|
289
|
+
className: "page-shell__side-group",
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ l("span", {
|
|
292
|
+
className: "page-shell__group-title",
|
|
293
|
+
children: a.pageView
|
|
294
|
+
}),
|
|
295
|
+
i && /* @__PURE__ */ l(f, {
|
|
296
|
+
view: e,
|
|
297
|
+
withLabels: !0
|
|
298
|
+
}),
|
|
299
|
+
/* @__PURE__ */ l(_, {
|
|
300
|
+
view: e,
|
|
301
|
+
context: "panel"
|
|
302
|
+
})
|
|
303
|
+
]
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
export {
|
|
307
|
+
L as ActionButton,
|
|
308
|
+
H as AppMark,
|
|
309
|
+
R as PageMenu,
|
|
310
|
+
E as PagePager,
|
|
311
|
+
F as SortDropdown,
|
|
312
|
+
I as SortSheetBody,
|
|
313
|
+
_ as ViewExtras,
|
|
314
|
+
q as ViewOptions,
|
|
315
|
+
f as ViewToggle
|
|
316
|
+
};
|