@memobit/libs 4.1.0 → 4.1.1
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.
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import { Icon as h } from "../Icon/Icon2.js";
|
|
2
2
|
import { libMessages as c } from "../../contexts/LanguageContext/libMessages.js";
|
|
3
3
|
import { useMessages as o } from "../../hooks/useLanguage.js";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as m } from "../Button/Button2.js";
|
|
5
5
|
import { Tooltip as d } from "../Tooltip/Tooltip2.js";
|
|
6
6
|
import { Chip as N } from "../Chip/Chip2.js";
|
|
7
7
|
import { Dropdown as w } from "../Dropdown/Dropdown2.js";
|
|
8
8
|
import { Slider as k } from "../Slider/Slider2.js";
|
|
9
9
|
import { ToggleSwitch as S } from "../ToggleSwitch/ToggleSwitch2.js";
|
|
10
10
|
import { MenuHamburger as V } from "../MenuHamburger/MenuHamburger2.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
import { fitsSegmented as y } from "./filterRules.js";
|
|
12
|
+
import { OptionRow as u, Segmented as p } from "./FilterField2.js";
|
|
13
|
+
import { hasViewExtras as z, resolveViewModes as A } from "./shellText.js";
|
|
14
|
+
import { useState as R } from "react";
|
|
15
|
+
import { Fragment as g, jsx as l, jsxs as r } from "react/jsx-runtime";
|
|
16
|
+
var W = ({ app: e, logoOnly: i = !1 }) => {
|
|
17
|
+
const a = typeof e.logo == "string" ? /* @__PURE__ */ l("img", {
|
|
17
18
|
src: e.logo,
|
|
18
19
|
alt: e.name
|
|
19
20
|
}) : e.logo ?? (e.icon ? /* @__PURE__ */ l(h, {
|
|
20
21
|
name: e.icon,
|
|
21
22
|
size: "lg"
|
|
22
|
-
}) : null), s = /* @__PURE__ */ r(
|
|
23
|
+
}) : null), s = /* @__PURE__ */ r(g, { children: [a && /* @__PURE__ */ l("span", {
|
|
23
24
|
className: "page-shell__logo",
|
|
24
|
-
children:
|
|
25
|
-
}), !
|
|
25
|
+
children: a
|
|
26
|
+
}), !i && /* @__PURE__ */ l("span", {
|
|
26
27
|
className: "page-shell__app-name",
|
|
27
28
|
children: e.name
|
|
28
29
|
})] });
|
|
@@ -35,31 +36,31 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
35
36
|
className: "page-shell__app",
|
|
36
37
|
children: s
|
|
37
38
|
});
|
|
38
|
-
},
|
|
39
|
-
const
|
|
39
|
+
}, X = ({ action: e, fullWidth: i = !1 }) => {
|
|
40
|
+
const a = /* @__PURE__ */ l(m, {
|
|
40
41
|
icon: e.icon,
|
|
41
42
|
variant: e.variant ?? "default",
|
|
42
43
|
disabled: e.disabled,
|
|
43
|
-
fullWidth:
|
|
44
|
+
fullWidth: i,
|
|
44
45
|
onClick: e.onClick,
|
|
45
46
|
children: e.label
|
|
46
47
|
});
|
|
47
48
|
return e.tooltip ? /* @__PURE__ */ l(d, {
|
|
48
49
|
title: e.tooltip,
|
|
49
|
-
children:
|
|
50
|
-
}) :
|
|
51
|
-
},
|
|
50
|
+
children: a
|
|
51
|
+
}) : a;
|
|
52
|
+
}, Y = ({ items: e }) => e.length > 0 ? /* @__PURE__ */ l(V, {
|
|
52
53
|
items: e,
|
|
53
54
|
disableResponsive: !0,
|
|
54
55
|
showLabel: !1
|
|
55
|
-
}) : null, f = ({ view: e, withLabels:
|
|
56
|
-
const
|
|
56
|
+
}) : null, f = ({ view: e, withLabels: i = !1 }) => {
|
|
57
|
+
const a = o(c), { modes: s = [], onChange: n } = e;
|
|
57
58
|
return s.length < 2 || !n ? null : /* @__PURE__ */ l("div", {
|
|
58
|
-
className: ["page-shell__view-toggle",
|
|
59
|
+
className: ["page-shell__view-toggle", i ? "page-shell__view-toggle--labels" : ""].filter(Boolean).join(" "),
|
|
59
60
|
children: /* @__PURE__ */ l(p, {
|
|
60
|
-
items:
|
|
61
|
+
items: A(s, a).map((t) => ({
|
|
61
62
|
value: t.value,
|
|
62
|
-
label:
|
|
63
|
+
label: i ? /* @__PURE__ */ r("span", {
|
|
63
64
|
className: "page-shell__view-option",
|
|
64
65
|
children: [/* @__PURE__ */ l(h, {
|
|
65
66
|
name: t.icon,
|
|
@@ -79,11 +80,11 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
79
80
|
}
|
|
80
81
|
})
|
|
81
82
|
});
|
|
82
|
-
}, v = (e,
|
|
83
|
-
field:
|
|
84
|
-
direction:
|
|
85
|
-
}), _ = (e) => e.fields.some((
|
|
86
|
-
const
|
|
83
|
+
}, v = (e, i) => e.onChange({
|
|
84
|
+
field: i.value,
|
|
85
|
+
direction: i.direction ?? e.value.direction
|
|
86
|
+
}), _ = (e) => e.fields.some((i) => i.value === e.value.field && i.direction !== void 0), Z = ({ sort: e }) => {
|
|
87
|
+
const i = o(c), a = e.value.direction === "asc";
|
|
87
88
|
return /* @__PURE__ */ r("div", {
|
|
88
89
|
className: "page-shell__sort",
|
|
89
90
|
children: [/* @__PURE__ */ l("div", {
|
|
@@ -102,29 +103,29 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
102
103
|
}
|
|
103
104
|
})
|
|
104
105
|
}), !_(e) && /* @__PURE__ */ l(d, {
|
|
105
|
-
title:
|
|
106
|
-
children: /* @__PURE__ */ l(
|
|
107
|
-
icon:
|
|
106
|
+
title: a ? i.pageAscending : i.pageDescending,
|
|
107
|
+
children: /* @__PURE__ */ l(m, {
|
|
108
|
+
icon: a ? "arrow-up" : "arrow-down",
|
|
108
109
|
variant: "default",
|
|
109
110
|
onClick: () => e.onChange({
|
|
110
111
|
field: e.value.field,
|
|
111
|
-
direction:
|
|
112
|
+
direction: a ? "desc" : "asc"
|
|
112
113
|
})
|
|
113
114
|
})
|
|
114
115
|
})]
|
|
115
116
|
});
|
|
116
|
-
},
|
|
117
|
-
const
|
|
117
|
+
}, ee = ({ sort: e, view: i }) => {
|
|
118
|
+
const a = o(c);
|
|
118
119
|
return /* @__PURE__ */ r("div", {
|
|
119
120
|
className: "filter-field filter-field--sheet page-shell__sheet-stack",
|
|
120
|
-
children: [e && /* @__PURE__ */ r(
|
|
121
|
+
children: [e && /* @__PURE__ */ r(g, { children: [
|
|
121
122
|
/* @__PURE__ */ l("span", {
|
|
122
123
|
className: "page-shell__group-title",
|
|
123
|
-
children:
|
|
124
|
+
children: a.sortBy
|
|
124
125
|
}),
|
|
125
126
|
/* @__PURE__ */ l("div", {
|
|
126
127
|
className: "filter-field__rows",
|
|
127
|
-
children: e.fields.map((s) => /* @__PURE__ */ l(
|
|
128
|
+
children: e.fields.map((s) => /* @__PURE__ */ l(u, {
|
|
128
129
|
label: s.label,
|
|
129
130
|
mark: "radio",
|
|
130
131
|
selected: e.value.field === s.value,
|
|
@@ -134,10 +135,10 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
134
135
|
!_(e) && /* @__PURE__ */ l(p, {
|
|
135
136
|
items: [{
|
|
136
137
|
value: "asc",
|
|
137
|
-
label:
|
|
138
|
+
label: a.pageAscending
|
|
138
139
|
}, {
|
|
139
140
|
value: "desc",
|
|
140
|
-
label:
|
|
141
|
+
label: a.pageDescending
|
|
141
142
|
}],
|
|
142
143
|
value: e.value.direction,
|
|
143
144
|
onSelect: (s) => e.onChange({
|
|
@@ -145,23 +146,23 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
145
146
|
direction: s === "desc" ? "desc" : "asc"
|
|
146
147
|
})
|
|
147
148
|
})
|
|
148
|
-
] }),
|
|
149
|
+
] }), i && /* @__PURE__ */ r(g, { children: [
|
|
149
150
|
/* @__PURE__ */ l("span", {
|
|
150
151
|
className: "page-shell__group-title",
|
|
151
|
-
children:
|
|
152
|
+
children: a.pageView
|
|
152
153
|
}),
|
|
153
154
|
/* @__PURE__ */ l(f, {
|
|
154
|
-
view:
|
|
155
|
+
view: i,
|
|
155
156
|
withLabels: !0
|
|
156
157
|
}),
|
|
157
158
|
/* @__PURE__ */ l(C, {
|
|
158
|
-
view:
|
|
159
|
+
view: i,
|
|
159
160
|
context: "sheet"
|
|
160
161
|
})
|
|
161
162
|
] })]
|
|
162
163
|
});
|
|
163
|
-
}, b = ({ label: e, summary:
|
|
164
|
-
const [n, t] =
|
|
164
|
+
}, b = ({ label: e, summary: i, context: a, children: s }) => {
|
|
165
|
+
const [n, t] = R(!1);
|
|
165
166
|
return /* @__PURE__ */ r("div", {
|
|
166
167
|
className: "page-filters__section",
|
|
167
168
|
children: [/* @__PURE__ */ r("button", {
|
|
@@ -175,7 +176,7 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
175
176
|
}),
|
|
176
177
|
/* @__PURE__ */ l("span", {
|
|
177
178
|
className: "page-filters__summary",
|
|
178
|
-
children:
|
|
179
|
+
children: i
|
|
179
180
|
}),
|
|
180
181
|
/* @__PURE__ */ l(h, {
|
|
181
182
|
name: n ? "caret-down" : "caret-right",
|
|
@@ -183,19 +184,19 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
183
184
|
})
|
|
184
185
|
]
|
|
185
186
|
}), n && /* @__PURE__ */ l("div", {
|
|
186
|
-
className: `page-filters__body filter-field filter-field--${
|
|
187
|
+
className: `page-filters__body filter-field filter-field--${a}`,
|
|
187
188
|
children: s
|
|
188
189
|
})]
|
|
189
190
|
});
|
|
190
|
-
},
|
|
191
|
-
const
|
|
191
|
+
}, M = ({ columns: e, context: i }) => {
|
|
192
|
+
const a = o(c), s = (n) => e.onChange(e.value.includes(n) ? e.value.filter((t) => t !== n) : [...e.value, n]);
|
|
192
193
|
return /* @__PURE__ */ l(b, {
|
|
193
|
-
label:
|
|
194
|
-
summary:
|
|
195
|
-
context:
|
|
194
|
+
label: a.columns,
|
|
195
|
+
summary: a.pageColumnsShown(e.value.length, e.options.length),
|
|
196
|
+
context: i,
|
|
196
197
|
children: /* @__PURE__ */ l("div", {
|
|
197
198
|
className: "filter-field__rows",
|
|
198
|
-
children: e.options.map((n) => /* @__PURE__ */ l(
|
|
199
|
+
children: e.options.map((n) => /* @__PURE__ */ l(u, {
|
|
199
200
|
label: n.label,
|
|
200
201
|
mark: "check",
|
|
201
202
|
selected: e.value.includes(n.value),
|
|
@@ -203,20 +204,20 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
203
204
|
}, n.value))
|
|
204
205
|
})
|
|
205
206
|
});
|
|
206
|
-
},
|
|
207
|
-
const
|
|
207
|
+
}, T = ({ groupBy: e, context: i }) => {
|
|
208
|
+
const a = o(c), s = e.options.find((n) => n.value === e.value);
|
|
208
209
|
return /* @__PURE__ */ l(b, {
|
|
209
|
-
label:
|
|
210
|
-
summary: s?.label ??
|
|
211
|
-
context:
|
|
210
|
+
label: a.groupBy,
|
|
211
|
+
summary: s?.label ?? a.pageGroupNone,
|
|
212
|
+
context: i,
|
|
212
213
|
children: /* @__PURE__ */ r("div", {
|
|
213
214
|
className: "filter-field__rows",
|
|
214
|
-
children: [/* @__PURE__ */ l(
|
|
215
|
-
label:
|
|
215
|
+
children: [/* @__PURE__ */ l(u, {
|
|
216
|
+
label: a.pageGroupNone,
|
|
216
217
|
mark: "radio",
|
|
217
218
|
selected: e.value === null,
|
|
218
219
|
onClick: () => e.onChange(null)
|
|
219
|
-
}), e.options.map((n) => /* @__PURE__ */ l(
|
|
220
|
+
}), e.options.map((n) => /* @__PURE__ */ l(u, {
|
|
220
221
|
label: n.label,
|
|
221
222
|
mark: "radio",
|
|
222
223
|
selected: e.value === n.value,
|
|
@@ -224,10 +225,10 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
224
225
|
}, n.value))]
|
|
225
226
|
})
|
|
226
227
|
});
|
|
227
|
-
},
|
|
228
|
+
}, $ = ({ toggle: e, context: i }) => /* @__PURE__ */ l("div", {
|
|
228
229
|
className: "page-filters__flat",
|
|
229
230
|
children: /* @__PURE__ */ r("div", {
|
|
230
|
-
className: `filter-field filter-field--${
|
|
231
|
+
className: `filter-field filter-field--${i} filter-field__switch-row`,
|
|
231
232
|
children: [/* @__PURE__ */ l("button", {
|
|
232
233
|
type: "button",
|
|
233
234
|
className: "filter-field__switch-label",
|
|
@@ -240,25 +241,33 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
240
241
|
onChange: e.onChange
|
|
241
242
|
})]
|
|
242
243
|
})
|
|
243
|
-
}),
|
|
244
|
+
}), D = ({ choice: e, context: i }) => /* @__PURE__ */ l("div", {
|
|
244
245
|
className: "page-filters__flat",
|
|
245
246
|
children: /* @__PURE__ */ r("div", {
|
|
246
|
-
className: `filter-field filter-field--${
|
|
247
|
+
className: `filter-field filter-field--${i} page-shell__view-choice`,
|
|
247
248
|
children: [/* @__PURE__ */ l("span", {
|
|
248
249
|
className: "page-shell__view-choice-label",
|
|
249
250
|
children: e.label
|
|
250
|
-
}), /* @__PURE__ */ l(p, {
|
|
251
|
+
}), y(e.options.map((a) => a.label)) ? /* @__PURE__ */ l(p, {
|
|
251
252
|
items: e.options,
|
|
252
253
|
value: e.value,
|
|
253
|
-
onSelect: (
|
|
254
|
-
|
|
254
|
+
onSelect: (a) => {
|
|
255
|
+
a !== null && e.onChange(String(a));
|
|
255
256
|
}
|
|
257
|
+
}) : /* @__PURE__ */ l("div", {
|
|
258
|
+
className: "filter-field__rows",
|
|
259
|
+
children: e.options.map((a) => /* @__PURE__ */ l(u, {
|
|
260
|
+
label: a.label,
|
|
261
|
+
mark: "radio",
|
|
262
|
+
selected: e.value === a.value,
|
|
263
|
+
onClick: () => e.onChange(a.value)
|
|
264
|
+
}, a.value))
|
|
256
265
|
})]
|
|
257
266
|
})
|
|
258
|
-
}),
|
|
267
|
+
}), O = ({ slider: e, context: i }) => /* @__PURE__ */ l("div", {
|
|
259
268
|
className: "page-filters__flat",
|
|
260
269
|
children: /* @__PURE__ */ r("div", {
|
|
261
|
-
className: `filter-field filter-field--${
|
|
270
|
+
className: `filter-field filter-field--${i} page-shell__view-choice`,
|
|
262
271
|
children: [/* @__PURE__ */ l("span", {
|
|
263
272
|
className: "page-shell__view-choice-label",
|
|
264
273
|
children: e.label
|
|
@@ -273,86 +282,86 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
273
282
|
onChange: e.onChange
|
|
274
283
|
})]
|
|
275
284
|
})
|
|
276
|
-
}), C = ({ view: e, context:
|
|
277
|
-
className: `page-filters page-filters--${
|
|
285
|
+
}), C = ({ view: e, context: i }) => z(e) ? /* @__PURE__ */ r("div", {
|
|
286
|
+
className: `page-filters page-filters--${i}`,
|
|
278
287
|
children: [
|
|
279
|
-
e.choices?.map((
|
|
280
|
-
choice:
|
|
281
|
-
context:
|
|
282
|
-
},
|
|
283
|
-
e.sliders?.map((
|
|
284
|
-
slider:
|
|
285
|
-
context:
|
|
286
|
-
},
|
|
287
|
-
e.columns && /* @__PURE__ */ l(
|
|
288
|
+
e.choices?.map((a) => /* @__PURE__ */ l(D, {
|
|
289
|
+
choice: a,
|
|
290
|
+
context: i
|
|
291
|
+
}, a.id)),
|
|
292
|
+
e.sliders?.map((a) => /* @__PURE__ */ l(O, {
|
|
293
|
+
slider: a,
|
|
294
|
+
context: i
|
|
295
|
+
}, a.id)),
|
|
296
|
+
e.columns && /* @__PURE__ */ l(M, {
|
|
288
297
|
columns: e.columns,
|
|
289
|
-
context:
|
|
298
|
+
context: i
|
|
290
299
|
}),
|
|
291
|
-
e.groupBy && /* @__PURE__ */ l(
|
|
300
|
+
e.groupBy && /* @__PURE__ */ l(T, {
|
|
292
301
|
groupBy: e.groupBy,
|
|
293
|
-
context:
|
|
302
|
+
context: i
|
|
294
303
|
}),
|
|
295
|
-
e.toggles?.map((
|
|
296
|
-
toggle:
|
|
297
|
-
context:
|
|
298
|
-
},
|
|
304
|
+
e.toggles?.map((a) => /* @__PURE__ */ l($, {
|
|
305
|
+
toggle: a,
|
|
306
|
+
context: i
|
|
307
|
+
}, a.id))
|
|
299
308
|
]
|
|
300
|
-
}) : null,
|
|
301
|
-
const
|
|
309
|
+
}) : null, le = ({ pagination: e }) => {
|
|
310
|
+
const i = o(c);
|
|
302
311
|
if (!e || e.pageCount <= 1) return null;
|
|
303
|
-
const { page:
|
|
312
|
+
const { page: a, pageCount: s, onChange: n } = e;
|
|
304
313
|
return /* @__PURE__ */ r("div", {
|
|
305
314
|
className: "page-shell__pager",
|
|
306
315
|
children: [
|
|
307
316
|
/* @__PURE__ */ l(d, {
|
|
308
|
-
title:
|
|
309
|
-
children: /* @__PURE__ */ l(
|
|
317
|
+
title: i.previous,
|
|
318
|
+
children: /* @__PURE__ */ l(m, {
|
|
310
319
|
icon: "caret-left",
|
|
311
320
|
variant: "plain",
|
|
312
321
|
size: "small",
|
|
313
|
-
disabled:
|
|
314
|
-
onClick: () => n(
|
|
322
|
+
disabled: a <= 1,
|
|
323
|
+
onClick: () => n(a - 1)
|
|
315
324
|
})
|
|
316
325
|
}),
|
|
317
326
|
/* @__PURE__ */ l("span", {
|
|
318
327
|
className: "page-shell__pager-label",
|
|
319
|
-
children:
|
|
328
|
+
children: i.pageOf(a, s)
|
|
320
329
|
}),
|
|
321
330
|
/* @__PURE__ */ l(d, {
|
|
322
|
-
title:
|
|
323
|
-
children: /* @__PURE__ */ l(
|
|
331
|
+
title: i.next,
|
|
332
|
+
children: /* @__PURE__ */ l(m, {
|
|
324
333
|
icon: "caret-right",
|
|
325
334
|
variant: "plain",
|
|
326
335
|
size: "small",
|
|
327
|
-
disabled:
|
|
328
|
-
onClick: () => n(
|
|
336
|
+
disabled: a >= s,
|
|
337
|
+
onClick: () => n(a + 1)
|
|
329
338
|
})
|
|
330
339
|
})
|
|
331
340
|
]
|
|
332
341
|
});
|
|
333
|
-
},
|
|
342
|
+
}, ae = ({ tabs: e }) => !e || e.items.length < 2 ? null : /* @__PURE__ */ l("div", {
|
|
334
343
|
className: "page-shell__tabs",
|
|
335
|
-
children: e.items.map((
|
|
336
|
-
const
|
|
344
|
+
children: e.items.map((i) => {
|
|
345
|
+
const a = i.value === e.value;
|
|
337
346
|
return /* @__PURE__ */ l(N, {
|
|
338
|
-
icon:
|
|
339
|
-
count:
|
|
340
|
-
selected:
|
|
341
|
-
variant:
|
|
342
|
-
onClick: () => e.onChange(
|
|
343
|
-
children:
|
|
344
|
-
},
|
|
347
|
+
icon: i.icon,
|
|
348
|
+
count: i.count,
|
|
349
|
+
selected: a,
|
|
350
|
+
variant: a ? "default" : i.tone ?? "default",
|
|
351
|
+
onClick: () => e.onChange(i.value),
|
|
352
|
+
children: i.label
|
|
353
|
+
}, i.value);
|
|
345
354
|
})
|
|
346
|
-
}),
|
|
347
|
-
const
|
|
355
|
+
}), ie = ({ view: e, showToggle: i = !0 }) => {
|
|
356
|
+
const a = o(c);
|
|
348
357
|
return /* @__PURE__ */ r("div", {
|
|
349
358
|
className: "page-shell__side-group",
|
|
350
359
|
children: [
|
|
351
360
|
/* @__PURE__ */ l("span", {
|
|
352
361
|
className: "page-shell__group-title",
|
|
353
|
-
children:
|
|
362
|
+
children: a.pageView
|
|
354
363
|
}),
|
|
355
|
-
|
|
364
|
+
i && /* @__PURE__ */ l(f, {
|
|
356
365
|
view: e,
|
|
357
366
|
withLabels: !0
|
|
358
367
|
}),
|
|
@@ -364,14 +373,14 @@ var Q = ({ app: e, logoOnly: a = !1 }) => {
|
|
|
364
373
|
});
|
|
365
374
|
};
|
|
366
375
|
export {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
376
|
+
X as ActionButton,
|
|
377
|
+
W as AppMark,
|
|
378
|
+
Y as PageMenu,
|
|
379
|
+
le as PagePager,
|
|
380
|
+
ae as PageTabsRow,
|
|
381
|
+
Z as SortDropdown,
|
|
382
|
+
ee as SortSheetBody,
|
|
374
383
|
C as ViewExtras,
|
|
375
|
-
|
|
384
|
+
ie as ViewOptions,
|
|
376
385
|
f as ViewToggle
|
|
377
386
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { formatAppDate as d } from "../../helpers/Datetime.js";
|
|
2
|
-
var
|
|
2
|
+
var s = 4, v = 24, S = 10, k = 8, M = 14, c = (t) => typeof t == "string" || typeof t == "number", u = (t) => Array.isArray(t) ? t.filter(c) : [], f = (t) => c(t) && t !== "" ? t : null, x = (t) => typeof t == "number" ? t : 0, y = (t, n, e) => {
|
|
3
3
|
const [r, i] = u(t);
|
|
4
4
|
return [typeof r == "number" ? r : n, typeof i == "number" ? i : e];
|
|
5
|
-
},
|
|
5
|
+
}, $ = (t) => {
|
|
6
6
|
const [n, e] = u(t);
|
|
7
7
|
return [typeof n == "string" ? n : "", typeof e == "string" ? e : ""];
|
|
8
|
-
},
|
|
8
|
+
}, w = (t) => typeof t == "object" && t !== null && !Array.isArray(t), g = (t) => w(t) ? t : { text: "" }, C = (t, n) => t.wordMatch ? [{
|
|
9
9
|
value: "or",
|
|
10
10
|
label: n.anyWord
|
|
11
11
|
}, {
|
|
@@ -28,8 +28,8 @@ var A = 4, k = 24, v = 10, S = 8, M = 14, h = (t) => typeof t == "string" || typ
|
|
|
28
28
|
default:
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
if (t.defaultValue !== void 0) return
|
|
31
|
+
}, h = (t) => JSON.stringify(Array.isArray(t) ? [...t].map(String).sort() : t ?? null), b = (t, n) => {
|
|
32
|
+
if (t.defaultValue !== void 0) return h(n) !== h(t.defaultValue);
|
|
33
33
|
switch (t.kind) {
|
|
34
34
|
case "single":
|
|
35
35
|
case "date":
|
|
@@ -45,21 +45,16 @@ var A = 4, k = 24, v = 10, S = 8, M = 14, h = (t) => typeof t == "string" || typ
|
|
|
45
45
|
case "toggle":
|
|
46
46
|
return n === !0;
|
|
47
47
|
case "text":
|
|
48
|
-
return
|
|
48
|
+
return g(n).text.trim() !== "";
|
|
49
49
|
case "date-range":
|
|
50
|
-
return
|
|
50
|
+
return $(n).some((e) => e !== "");
|
|
51
51
|
}
|
|
52
|
-
},
|
|
52
|
+
}, _ = (t, n) => t.filter((e) => b(e, n[e.id])).length, m = (t, n) => t.find((e) => e.value === n)?.label ?? String(n), V = (t, n = 0) => t.length <= s && t.reduce((e, r) => e + r.length, n) <= v, D = (t, n) => {
|
|
53
53
|
if (t.kind !== "single" && t.kind !== "multi") return null;
|
|
54
54
|
if (t.control) return t.control;
|
|
55
55
|
const e = t.options.length;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const r = t.options.reduce((i, l) => i + l.label.length, 3);
|
|
59
|
-
return e <= A && r <= k ? "segmented" : n === "sheet" ? "chips" : "radio";
|
|
60
|
-
}
|
|
61
|
-
return e > M ? "search-list" : e <= S || n === "sheet" ? "chips" : "checklist";
|
|
62
|
-
}, V = (t, n, e) => {
|
|
56
|
+
return t.kind === "single" ? e > S ? "search-list" : V(t.options.map((r) => r.label), 3) ? "segmented" : n === "sheet" ? "chips" : "radio" : e > M ? "search-list" : e <= k || n === "sheet" ? "chips" : "checklist";
|
|
57
|
+
}, I = (t, n, e) => {
|
|
63
58
|
switch (t.kind) {
|
|
64
59
|
case "single": {
|
|
65
60
|
const r = f(n);
|
|
@@ -82,7 +77,7 @@ var A = 4, k = 24, v = 10, S = 8, M = 14, h = (t) => typeof t == "string" || typ
|
|
|
82
77
|
case "toggle":
|
|
83
78
|
return t.label;
|
|
84
79
|
case "text": {
|
|
85
|
-
const { text: r, mode: i } =
|
|
80
|
+
const { text: r, mode: i } = g(n), l = C(t, e), o = l && i !== l[0]?.value ? l.find((a) => a.value === i)?.label : void 0;
|
|
86
81
|
return o ? `“${r.trim()}” · ${o}` : `“${r.trim()}”`;
|
|
87
82
|
}
|
|
88
83
|
case "date": {
|
|
@@ -92,13 +87,13 @@ var A = 4, k = 24, v = 10, S = 8, M = 14, h = (t) => typeof t == "string" || typ
|
|
|
92
87
|
return t.relation === "until" ? e.dateUntil(i) : e.dateSince(i);
|
|
93
88
|
}
|
|
94
89
|
case "date-range": {
|
|
95
|
-
const [r, i] =
|
|
90
|
+
const [r, i] = $(n);
|
|
96
91
|
return r && i ? `${d(r)} – ${d(i)}` : r ? e.dateSince(d(r)) : i ? e.dateUntil(d(i)) : "";
|
|
97
92
|
}
|
|
98
93
|
}
|
|
99
|
-
},
|
|
94
|
+
}, F = (t, n, e) => t.flatMap((r) => {
|
|
100
95
|
const i = n[r.id];
|
|
101
|
-
if (
|
|
96
|
+
if (!b(r, i)) return [];
|
|
102
97
|
if (r.kind === "multi" && r.chips === "excluded") {
|
|
103
98
|
const o = u(i);
|
|
104
99
|
return r.options.filter((a) => !o.includes(a.value)).map((a) => ({
|
|
@@ -114,35 +109,36 @@ var A = 4, k = 24, v = 10, S = 8, M = 14, h = (t) => typeof t == "string" || typ
|
|
|
114
109
|
key: `${r.id}:${a}`,
|
|
115
110
|
filterId: r.id,
|
|
116
111
|
label: m(r.options, a),
|
|
117
|
-
next: o.filter((
|
|
112
|
+
next: o.filter((A) => A !== a)
|
|
118
113
|
}));
|
|
119
114
|
}
|
|
120
115
|
const l = r.kind === "text" ? {
|
|
121
|
-
...
|
|
116
|
+
...g(i),
|
|
122
117
|
text: ""
|
|
123
118
|
} : E(r);
|
|
124
119
|
return [{
|
|
125
120
|
key: r.id,
|
|
126
121
|
filterId: r.id,
|
|
127
|
-
label:
|
|
122
|
+
label: I(r, i, e),
|
|
128
123
|
next: l
|
|
129
124
|
}];
|
|
130
125
|
});
|
|
131
126
|
export {
|
|
132
|
-
|
|
127
|
+
_ as countActiveFilters,
|
|
133
128
|
E as defaultFilterValue,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
129
|
+
I as filterSummary,
|
|
130
|
+
V as fitsSegmented,
|
|
131
|
+
F as getAppliedFilters,
|
|
132
|
+
C as getTextModes,
|
|
133
|
+
b as isFilterActive,
|
|
134
|
+
c as isScalar,
|
|
135
|
+
w as isTextFilterValue,
|
|
140
136
|
m as optionLabel,
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
D as pickControl,
|
|
138
|
+
$ as toDateRange,
|
|
143
139
|
u as toList,
|
|
144
140
|
x as toNumber,
|
|
145
141
|
y as toRange,
|
|
146
142
|
f as toScalar,
|
|
147
|
-
|
|
143
|
+
g as toText
|
|
148
144
|
};
|
package/dist/version.js
CHANGED
package/dist/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memobit/libs",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "React component library powering the Memobit apps — 100+ components, helpers and hooks. Icons ship as @memobit/icons and themes as @memobit/themes. TypeScript-first, ESM-only, React 19.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|