@memobit/libs 3.34.0 → 3.36.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/PageShell/AppNav.js +38 -27
- package/dist/components/PageShell/FilterField.css +1 -1
- package/dist/components/PageShell/FilterField2.js +243 -190
- package/dist/components/PageShell/FocusShell.js +60 -0
- package/dist/components/PageShell/PageParts.js +176 -155
- package/dist/components/PageShell/PageShell.css +1 -1
- package/dist/components/PageShell/PageShell2.js +11 -6
- package/dist/components/PageShell/WorkbenchPhone.js +75 -65
- package/dist/components/PageShell/WorkbenchShell.js +78 -64
- package/dist/components/PageShell/filterRules.js +64 -51
- package/dist/components/PageShell/shellText.js +1 -1
- package/dist/components/PageShell/useConfirmedActions.js +35 -0
- package/dist/components/PageShell/useSummaryMessages.js +4 -3
- package/dist/components/RouterAppFrame/RouterAppFrame.js +18 -16
- package/dist/contexts/LanguageContext/libMessages.js +2 -0
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +62 -7
- package/dist/router.d.ts +11 -2
- package/dist/version.js +1 -1
- package/dist/version.json +4 -4
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ var i = ({ counts: e, noun: a, heading: l }, r) => [e && a ? r.pageItemCount(e.s
|
|
|
31
31
|
icon: "map"
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
}, g = (e, a) => e.map((l) => typeof l == "string" ? t(l, a) : l), n = (e) => !!(e.columns || e.groupBy || e.toggles?.length || e.choices?.length);
|
|
34
|
+
}, g = (e, a) => e.map((l) => typeof l == "string" ? t(l, a) : l), n = (e) => !!(e.columns || e.groupBy || e.toggles?.length || e.choices?.length || e.sliders?.length);
|
|
35
35
|
export {
|
|
36
36
|
i as getHeadingText,
|
|
37
37
|
s as getResultLabel,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { libMessages as s } from "../../contexts/LanguageContext/libMessages.js";
|
|
2
|
+
import { useMessages as c } from "../../hooks/useLanguage.js";
|
|
3
|
+
import a from "../ConfirmDialog/ConfirmDialog2.js";
|
|
4
|
+
import { useState as f } from "react";
|
|
5
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
6
|
+
var x = (r, l) => {
|
|
7
|
+
const i = c(s), [n, e] = f(null), t = (o) => o.confirm ? {
|
|
8
|
+
...o,
|
|
9
|
+
onClick: () => e(o)
|
|
10
|
+
} : o, m = /* @__PURE__ */ u(a, {
|
|
11
|
+
isOpen: n !== null,
|
|
12
|
+
title: n?.confirm?.title ?? n?.label ?? "",
|
|
13
|
+
message: n?.confirm?.message ?? "",
|
|
14
|
+
confirm: {
|
|
15
|
+
text: n?.confirm?.confirmLabel ?? i.confirm,
|
|
16
|
+
variant: n?.confirm?.variant ?? "danger",
|
|
17
|
+
onClick: () => {
|
|
18
|
+
n?.onClick(), e(null);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
cancel: {
|
|
22
|
+
text: i.cancel,
|
|
23
|
+
onClick: () => e(null)
|
|
24
|
+
},
|
|
25
|
+
usePortal: !0
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
primaryAction: r && t(r),
|
|
29
|
+
actions: l.map(t),
|
|
30
|
+
dialog: m
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
x as useConfirmedActions
|
|
35
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { libMessages as
|
|
2
|
-
import { useMessages as
|
|
1
|
+
import { libMessages as t } from "../../contexts/LanguageContext/libMessages.js";
|
|
2
|
+
import { useMessages as a } from "../../hooks/useLanguage.js";
|
|
3
3
|
import { useMemo as s } from "react";
|
|
4
4
|
var g = () => {
|
|
5
|
-
const e = t
|
|
5
|
+
const e = a(t);
|
|
6
6
|
return s(() => ({
|
|
7
7
|
any: e.pageAny,
|
|
8
8
|
selectedCount: e.pageSelectedCount,
|
|
9
|
+
without: e.pageWithout,
|
|
9
10
|
ratingAtLeast: e.pageRatingAtLeast,
|
|
10
11
|
dateSince: e.pageDateSince,
|
|
11
12
|
dateUntil: e.pageDateUntil,
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { AppFrame as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { matchPath as
|
|
5
|
-
var k = ({ nav: n, app:
|
|
6
|
-
const { pathname: t } = d(), a = f(),
|
|
1
|
+
import { AppFrame as i } from "../PageShell/AppFrame.js";
|
|
2
|
+
import { useMemo as e } from "react";
|
|
3
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
4
|
+
import { matchPath as p, useLocation as d, useNavigate as f } from "react-router";
|
|
5
|
+
var k = ({ nav: n, app: r, ...l }) => {
|
|
6
|
+
const { pathname: t } = d(), a = f(), s = e(() => n.map((o) => ({
|
|
7
7
|
id: o.path,
|
|
8
8
|
label: o.label,
|
|
9
9
|
icon: o.icon,
|
|
10
10
|
count: o.count,
|
|
11
|
-
|
|
11
|
+
group: o.group,
|
|
12
|
+
color: o.color,
|
|
13
|
+
isActive: p({
|
|
12
14
|
path: o.path,
|
|
13
15
|
end: o.end ?? o.path === "/"
|
|
14
|
-
}, t) !== null || (o.activeOn ?? []).some((
|
|
15
|
-
path:
|
|
16
|
+
}, t) !== null || (o.activeOn ?? []).some((u) => p({
|
|
17
|
+
path: u,
|
|
16
18
|
end: !1
|
|
17
19
|
}, t) !== null),
|
|
18
20
|
onSelect: () => a(o.path)
|
|
@@ -20,19 +22,19 @@ var k = ({ nav: n, app: e, ...s }) => {
|
|
|
20
22
|
n,
|
|
21
23
|
t,
|
|
22
24
|
a
|
|
23
|
-
]), c = n[0]?.path ?? "/", h =
|
|
24
|
-
...
|
|
25
|
-
onHomeClick:
|
|
25
|
+
]), c = n[0]?.path ?? "/", h = e(() => ({
|
|
26
|
+
...r,
|
|
27
|
+
onHomeClick: r.onHomeClick ?? (t === c ? void 0 : () => a(c))
|
|
26
28
|
}), [
|
|
27
|
-
|
|
29
|
+
r,
|
|
28
30
|
t,
|
|
29
31
|
c,
|
|
30
32
|
a
|
|
31
33
|
]);
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
...
|
|
34
|
+
return /* @__PURE__ */ m(i, {
|
|
35
|
+
...l,
|
|
34
36
|
app: h,
|
|
35
|
-
nav:
|
|
37
|
+
nav: s
|
|
36
38
|
});
|
|
37
39
|
};
|
|
38
40
|
export {
|
|
@@ -58,6 +58,7 @@ var l = {
|
|
|
58
58
|
pageNoMatches: "No matches",
|
|
59
59
|
pageSearchOptions: (e) => `Search ${e.toLowerCase()}`,
|
|
60
60
|
pageSelectedCount: (e) => `${e} selected`,
|
|
61
|
+
pageWithout: (e) => `Without ${e}`,
|
|
61
62
|
pageRatingAtLeast: (e) => `${e}★ and up`,
|
|
62
63
|
pageDateSince: (e) => `since ${e}`,
|
|
63
64
|
pageDateUntil: (e) => `until ${e}`,
|
|
@@ -199,6 +200,7 @@ var l = {
|
|
|
199
200
|
pageNoMatches: "Nicio potrivire",
|
|
200
201
|
pageSearchOptions: (e) => `Caută în ${e.toLowerCase()}`,
|
|
201
202
|
pageSelectedCount: (e) => `${e} selectate`,
|
|
203
|
+
pageWithout: (e) => `Fără ${e}`,
|
|
202
204
|
pageRatingAtLeast: (e) => `${e}★ sau mai mult`,
|
|
203
205
|
pageDateSince: (e) => `din ${e}`,
|
|
204
206
|
pageDateUntil: (e) => `până la ${e}`,
|
package/dist/index.d.ts
CHANGED
|
@@ -215,7 +215,12 @@ export declare interface AppNavItem {
|
|
|
215
215
|
id: string;
|
|
216
216
|
label: string;
|
|
217
217
|
icon: IconName;
|
|
218
|
-
|
|
218
|
+
/** A number or short text beside the label ("3/12"). */
|
|
219
|
+
count?: number | string;
|
|
220
|
+
/** Sections with the same group are listed together under that heading in the side list. */
|
|
221
|
+
group?: string;
|
|
222
|
+
/** Tints the section's icon, e.g. a category colour. */
|
|
223
|
+
color?: string;
|
|
219
224
|
isActive: boolean;
|
|
220
225
|
onSelect: () => void;
|
|
221
226
|
}
|
|
@@ -808,6 +813,7 @@ export declare interface ContextToastAction {
|
|
|
808
813
|
onClick: () => void;
|
|
809
814
|
}
|
|
810
815
|
|
|
816
|
+
/** @deprecated Use PageShell inside an AppFrame / RouterAppFrame (see the page-shell-usage skill). Kept for the showcase demos. */
|
|
811
817
|
export declare const ControlPanel: default_2.FC<ControlPanelProps>;
|
|
812
818
|
|
|
813
819
|
export declare interface ControlPanelAction {
|
|
@@ -1079,6 +1085,7 @@ export declare interface ControlPanelProps {
|
|
|
1079
1085
|
visibleColumns?: ControlPanelVisibleColumnsConfig;
|
|
1080
1086
|
}
|
|
1081
1087
|
|
|
1088
|
+
/** @deprecated Use PageShell inside an AppFrame / RouterAppFrame (see the page-shell-usage skill). Kept for the showcase demos. */
|
|
1082
1089
|
export declare const ControlPanelProvider: default_2.FC<ControlPanelProviderProps>;
|
|
1083
1090
|
|
|
1084
1091
|
declare interface ControlPanelProviderProps {
|
|
@@ -1849,6 +1856,10 @@ export declare interface FilterOption {
|
|
|
1849
1856
|
count?: number | string;
|
|
1850
1857
|
icon?: IconName;
|
|
1851
1858
|
color?: string;
|
|
1859
|
+
/** A small round picture before the label: a face, a product. */
|
|
1860
|
+
imageUrl?: string;
|
|
1861
|
+
/** A hover hint on the option, for what its label can't say ("5–50 km out"). */
|
|
1862
|
+
hint?: string;
|
|
1852
1863
|
}
|
|
1853
1864
|
|
|
1854
1865
|
/**
|
|
@@ -2980,6 +2991,11 @@ export declare interface MultiFilterSpec extends FilterSpecBase {
|
|
|
2980
2991
|
kind: 'multi';
|
|
2981
2992
|
options: FilterOption[];
|
|
2982
2993
|
control?: FilterControl;
|
|
2994
|
+
/**
|
|
2995
|
+
* What the applied chips list: the picked options (default), or the ones left out ("Without X"). Use `excluded`
|
|
2996
|
+
* with a `defaultValue` of every option, for filters where everything is on until the user turns some off.
|
|
2997
|
+
*/
|
|
2998
|
+
chips?: 'selected' | 'excluded';
|
|
2983
2999
|
}
|
|
2984
3000
|
|
|
2985
3001
|
export declare const NavBar: default_2.FC<NavBarProps>;
|
|
@@ -3039,9 +3055,21 @@ export declare interface PageAction {
|
|
|
3039
3055
|
menu?: boolean;
|
|
3040
3056
|
/** In the menu, draws a divider above this action to start a new group. */
|
|
3041
3057
|
separator?: boolean;
|
|
3058
|
+
/** Asks first, in a dialog, and runs `onClick` only on yes: for actions that can't be undone. */
|
|
3059
|
+
confirm?: PageActionConfirm;
|
|
3042
3060
|
onClick: () => void;
|
|
3043
3061
|
}
|
|
3044
3062
|
|
|
3063
|
+
export declare interface PageActionConfirm {
|
|
3064
|
+
/** Defaults to the action's label. */
|
|
3065
|
+
title?: string;
|
|
3066
|
+
message: string;
|
|
3067
|
+
/** Defaults to "Confirm". */
|
|
3068
|
+
confirmLabel?: string;
|
|
3069
|
+
/** Defaults to `danger`. */
|
|
3070
|
+
variant?: ButtonVariant;
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3045
3073
|
export declare interface PageColumns {
|
|
3046
3074
|
options: Array<{
|
|
3047
3075
|
value: string;
|
|
@@ -3095,8 +3123,11 @@ export declare interface PageSearch {
|
|
|
3095
3123
|
/** Lays out a page's title, actions, search, sort, filters and view options around its content, per device. */
|
|
3096
3124
|
export declare const PageShell: FC<PageShellProps>;
|
|
3097
3125
|
|
|
3098
|
-
/**
|
|
3099
|
-
|
|
3126
|
+
/**
|
|
3127
|
+
* `workbench` (the default) is the full layout. `focus` is for a page that needs the whole screen and none of the
|
|
3128
|
+
* list chrome, such as a running quiz: a slim top bar with the title, actions and menu, and no side column.
|
|
3129
|
+
*/
|
|
3130
|
+
export declare type PageShellLayout = 'workbench' | 'focus';
|
|
3100
3131
|
|
|
3101
3132
|
export declare interface PageShellProps {
|
|
3102
3133
|
layout?: PageShellLayout;
|
|
@@ -3124,14 +3155,15 @@ export declare interface PageShellProps {
|
|
|
3124
3155
|
tabs?: PageTabs;
|
|
3125
3156
|
/** This page's own indicator (e.g. an overdue bell), shown where the frame's `status` goes, in its place. */
|
|
3126
3157
|
status?: ReactNode;
|
|
3158
|
+
/** A panel docked on the right on desktop (details of the picked item, a map legend); below the content elsewhere. */
|
|
3159
|
+
aside?: ReactNode;
|
|
3160
|
+
/** A bar that stays at the bottom of the screen while the page scrolls, such as a player; above the phone tab bar. */
|
|
3161
|
+
footer?: ReactNode;
|
|
3127
3162
|
children: ReactNode;
|
|
3128
3163
|
}
|
|
3129
3164
|
|
|
3130
3165
|
export declare interface PageSort {
|
|
3131
|
-
fields:
|
|
3132
|
-
value: string;
|
|
3133
|
-
label: string;
|
|
3134
|
-
}>;
|
|
3166
|
+
fields: PageSortField[];
|
|
3135
3167
|
value: PageSortValue;
|
|
3136
3168
|
/** Marks the sort as changed from the page's default. */
|
|
3137
3169
|
highlighted?: boolean;
|
|
@@ -3140,6 +3172,13 @@ export declare interface PageSort {
|
|
|
3140
3172
|
|
|
3141
3173
|
export declare type PageSortDirection = 'asc' | 'desc';
|
|
3142
3174
|
|
|
3175
|
+
export declare interface PageSortField {
|
|
3176
|
+
value: string;
|
|
3177
|
+
label: string;
|
|
3178
|
+
/** A field that only sorts one way ("Newest first"): picking it sets this direction and hides the direction switch. */
|
|
3179
|
+
direction?: PageSortDirection;
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3143
3182
|
export declare interface PageSortValue {
|
|
3144
3183
|
field: string;
|
|
3145
3184
|
direction: PageSortDirection;
|
|
@@ -3171,6 +3210,7 @@ export declare interface PageView {
|
|
|
3171
3210
|
groupBy?: PageGroupBy;
|
|
3172
3211
|
toggles?: PageViewToggle[];
|
|
3173
3212
|
choices?: PageViewChoice[];
|
|
3213
|
+
sliders?: PageViewSlider[];
|
|
3174
3214
|
}
|
|
3175
3215
|
|
|
3176
3216
|
/** A display setting that always holds one of its options (currency, whose figures). Not a filter: it never counts as applied. */
|
|
@@ -3191,6 +3231,18 @@ export declare interface PageViewMode {
|
|
|
3191
3231
|
icon: IconName;
|
|
3192
3232
|
}
|
|
3193
3233
|
|
|
3234
|
+
/** A sized display preference shown with the view options, e.g. photo size. */
|
|
3235
|
+
export declare interface PageViewSlider {
|
|
3236
|
+
id: string;
|
|
3237
|
+
label: string;
|
|
3238
|
+
min: number;
|
|
3239
|
+
max: number;
|
|
3240
|
+
step?: number;
|
|
3241
|
+
unit?: string;
|
|
3242
|
+
value: number;
|
|
3243
|
+
onChange: (value: number) => void;
|
|
3244
|
+
}
|
|
3245
|
+
|
|
3194
3246
|
/** An on/off display preference shown with the view options, e.g. "Hide empty fields in cards". */
|
|
3195
3247
|
export declare interface PageViewToggle {
|
|
3196
3248
|
id: string;
|
|
@@ -3393,6 +3445,8 @@ export declare interface RangeFilterSpec extends FilterSpecBase {
|
|
|
3393
3445
|
max: number;
|
|
3394
3446
|
step?: number;
|
|
3395
3447
|
unit?: string;
|
|
3448
|
+
/** Adds from/to number boxes under the slider, for exact values the thumbs can't hit. */
|
|
3449
|
+
inputs?: boolean;
|
|
3396
3450
|
}
|
|
3397
3451
|
|
|
3398
3452
|
export declare const RangeSlider: FC<RangeSliderProps>;
|
|
@@ -4096,6 +4150,7 @@ export declare interface ToggleSwitchProps {
|
|
|
4096
4150
|
|
|
4097
4151
|
export declare type ToggleSwitchVariant = 'plain' | 'default' | 'success' | 'info' | 'warning' | 'danger';
|
|
4098
4152
|
|
|
4153
|
+
/** @deprecated Use PageShell inside an AppFrame / RouterAppFrame (see the page-shell-usage skill). Kept for the showcase demos. */
|
|
4099
4154
|
export declare const Toolbar: default_2.FC<ToolbarProps>;
|
|
4100
4155
|
|
|
4101
4156
|
export declare interface ToolbarControlPanelToggleConfig {
|
package/dist/router.d.ts
CHANGED
|
@@ -43,7 +43,12 @@ declare interface AppNavItem {
|
|
|
43
43
|
id: string;
|
|
44
44
|
label: string;
|
|
45
45
|
icon: IconName;
|
|
46
|
-
|
|
46
|
+
/** A number or short text beside the label ("3/12"). */
|
|
47
|
+
count?: number | string;
|
|
48
|
+
/** Sections with the same group are listed together under that heading in the side list. */
|
|
49
|
+
group?: string;
|
|
50
|
+
/** Tints the section's icon, e.g. a category colour. */
|
|
51
|
+
color?: string;
|
|
47
52
|
isActive: boolean;
|
|
48
53
|
onSelect: () => void;
|
|
49
54
|
}
|
|
@@ -52,7 +57,11 @@ export declare interface AppRouteNavItem {
|
|
|
52
57
|
path: string;
|
|
53
58
|
label: string;
|
|
54
59
|
icon: IconName;
|
|
55
|
-
count?: number;
|
|
60
|
+
count?: number | string;
|
|
61
|
+
/** Sections with the same group are listed together under that heading. */
|
|
62
|
+
group?: string;
|
|
63
|
+
/** Tints the section's icon. */
|
|
64
|
+
color?: string;
|
|
56
65
|
/** Whether only the exact path counts as this section. Defaults to true for '/' and false otherwise, so '/archive/12' still lights up Archive. */
|
|
57
66
|
end?: boolean;
|
|
58
67
|
/** Other paths that belong to this section, e.g. ['/person/:id/*'] for a People section's detail pages. */
|
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": "3.
|
|
3
|
+
"version": "3.36.0",
|
|
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",
|