@memobit/libs 3.35.0 → 4.0.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/DataView/DataView2.js +46 -46
- 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/shellText.js +1 -1
- package/dist/components/PageShell/useConfirmedActions.js +35 -0
- package/dist/components/RouterAppFrame/RouterAppFrame.js +18 -16
- package/dist/components/ThemeSettings/ThemeContext.js +26 -26
- package/dist/components/ThemeSettings/ThemeContextValue.js +2 -1
- package/dist/components/ThemeSettings/getDefaultThemeForApp.js +5 -4
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +60 -9
- package/dist/router.d.ts +11 -2
- package/dist/version.js +1 -1
- package/dist/version.json +4 -4
- package/package.json +2 -2
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { ThemeContext as
|
|
2
|
-
import { Tooltip as
|
|
1
|
+
import { DEFAULT_FALLBACK_THEME as F, ThemeContext as R } from "./ThemeContextValue.js";
|
|
2
|
+
import { Tooltip as j } from "../Tooltip/Tooltip2.js";
|
|
3
3
|
import { THEME_CONFIGS as c, getThemeConfig as k } from "./themeConfig.js";
|
|
4
|
-
import { useCallback as m, useEffect as I, useState as
|
|
5
|
-
import { jsx as f, jsxs as
|
|
6
|
-
var
|
|
7
|
-
const [d, l] =
|
|
4
|
+
import { useCallback as m, useEffect as I, useState as E } from "react";
|
|
5
|
+
import { jsx as f, jsxs as v } from "react/jsx-runtime";
|
|
6
|
+
var L = "theme-stylesheet", b = "theme-font-link", w = "theme-font-link-display", C = "theme-font-link-mono", J = ({ children: M, theme: y, effects: N, onSave: g, allowedThemes: s, fallbackTheme: D = F }) => {
|
|
7
|
+
const [d, l] = E(null), [P, a] = E(null), [S, T] = E(!1), U = k(y) === void 0 ? D : y, o = d ?? U, p = P ?? N;
|
|
8
8
|
I(() => {
|
|
9
9
|
document.documentElement.setAttribute("data-theme", o);
|
|
10
10
|
const i = (typeof __MEMOBIT_THEME_URLS__ > "u" ? void 0 : __MEMOBIT_THEME_URLS__)?.[o];
|
|
11
11
|
if (i !== void 0) {
|
|
12
|
-
let e = document.getElementById(
|
|
13
|
-
e || (e = document.createElement("link"), e.id =
|
|
12
|
+
let e = document.getElementById(L);
|
|
13
|
+
e || (e = document.createElement("link"), e.id = L, e.rel = "stylesheet", document.head.appendChild(e));
|
|
14
14
|
const t = new URL(i, import.meta.url).href;
|
|
15
15
|
e.href !== t && (e.href = t);
|
|
16
16
|
}
|
|
17
17
|
const r = k(o);
|
|
18
18
|
if (r) {
|
|
19
|
-
let e = document.getElementById(
|
|
20
|
-
e || (e = document.createElement("link"), e.id =
|
|
21
|
-
let t = document.getElementById(
|
|
22
|
-
r.fontUrlDisplay ? (t || (t = document.createElement("link"), t.id =
|
|
19
|
+
let e = document.getElementById(b);
|
|
20
|
+
e || (e = document.createElement("link"), e.id = b, e.rel = "stylesheet", document.head.appendChild(e)), e.href = r.fontUrl;
|
|
21
|
+
let t = document.getElementById(w);
|
|
22
|
+
r.fontUrlDisplay ? (t || (t = document.createElement("link"), t.id = w, t.rel = "stylesheet", document.head.appendChild(t)), t.href = r.fontUrlDisplay) : t?.remove();
|
|
23
23
|
let n = document.getElementById(C);
|
|
24
24
|
r.fontUrlMono ? (n || (n = document.createElement("link"), n.id = C, n.rel = "stylesheet", document.head.appendChild(n)), n.href = r.fontUrlMono) : n?.remove();
|
|
25
25
|
}
|
|
26
26
|
}, [o]);
|
|
27
|
-
const
|
|
27
|
+
const O = m((i) => {
|
|
28
28
|
l(i);
|
|
29
29
|
}, []), K = m((i) => {
|
|
30
30
|
a(i);
|
|
31
|
-
}, []),
|
|
31
|
+
}, []), A = m(() => {
|
|
32
32
|
l(null), a(null);
|
|
33
33
|
}, []);
|
|
34
34
|
I(() => {
|
|
@@ -42,8 +42,8 @@ var b = "theme-stylesheet", w = "theme-font-link", L = "theme-font-link-display"
|
|
|
42
42
|
e.preventDefault();
|
|
43
43
|
const t = c.map((u) => u.value), n = s && s.length > 0 ? t.filter((u) => s.includes(u)) : t;
|
|
44
44
|
if (n.length === 0) return;
|
|
45
|
-
const _ = n.indexOf(o),
|
|
46
|
-
l(n[
|
|
45
|
+
const _ = n.indexOf(o), H = ((_ === -1 ? 0 : _) + (e.key === "]" ? 1 : -1) + n.length) % n.length;
|
|
46
|
+
l(n[H]);
|
|
47
47
|
} else e.key === "Escape" && d && (e.preventDefault(), l(null), a(null));
|
|
48
48
|
};
|
|
49
49
|
return window.addEventListener("keydown", r), () => window.removeEventListener("keydown", r);
|
|
@@ -52,7 +52,7 @@ var b = "theme-stylesheet", w = "theme-font-link", L = "theme-font-link-display"
|
|
|
52
52
|
d,
|
|
53
53
|
s
|
|
54
54
|
]);
|
|
55
|
-
const h = c.findIndex((i) => i.value === o), x = h >= 0 ? c[h].label : o,
|
|
55
|
+
const h = c.findIndex((i) => i.value === o), x = h >= 0 ? c[h].label : o, B = m(() => {
|
|
56
56
|
g?.({
|
|
57
57
|
theme: o,
|
|
58
58
|
effects: p
|
|
@@ -62,16 +62,16 @@ var b = "theme-stylesheet", w = "theme-font-link", L = "theme-font-link-display"
|
|
|
62
62
|
p,
|
|
63
63
|
g
|
|
64
64
|
]);
|
|
65
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ v(R.Provider, {
|
|
66
66
|
value: {
|
|
67
67
|
theme: o,
|
|
68
68
|
effects: p,
|
|
69
|
-
setPreviewTheme:
|
|
69
|
+
setPreviewTheme: O,
|
|
70
70
|
setPreviewEffects: K,
|
|
71
|
-
commitPreview:
|
|
72
|
-
clearPreview:
|
|
71
|
+
commitPreview: B,
|
|
72
|
+
clearPreview: A
|
|
73
73
|
},
|
|
74
|
-
children: [M, d && /* @__PURE__ */
|
|
74
|
+
children: [M, d && /* @__PURE__ */ v("div", {
|
|
75
75
|
style: {
|
|
76
76
|
position: "fixed",
|
|
77
77
|
bottom: 16,
|
|
@@ -85,7 +85,7 @@ var b = "theme-stylesheet", w = "theme-font-link", L = "theme-font-link-display"
|
|
|
85
85
|
boxShadow: "0 4px 16px rgba(0, 0, 0, 0.3)"
|
|
86
86
|
},
|
|
87
87
|
children: [
|
|
88
|
-
/* @__PURE__ */ f(
|
|
88
|
+
/* @__PURE__ */ f(j, {
|
|
89
89
|
title: "Copy theme name",
|
|
90
90
|
children: /* @__PURE__ */ f("span", {
|
|
91
91
|
onClick: () => {
|
|
@@ -95,7 +95,7 @@ var b = "theme-stylesheet", w = "theme-font-link", L = "theme-font-link-display"
|
|
|
95
95
|
children: x
|
|
96
96
|
})
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ v("span", {
|
|
99
99
|
style: {
|
|
100
100
|
opacity: 0.6,
|
|
101
101
|
marginLeft: 8,
|
|
@@ -116,7 +116,7 @@ var b = "theme-stylesheet", w = "theme-font-link", L = "theme-font-link-display"
|
|
|
116
116
|
},
|
|
117
117
|
children: "[ prev · ] next · Esc revert"
|
|
118
118
|
}),
|
|
119
|
-
|
|
119
|
+
S && /* @__PURE__ */ f("div", {
|
|
120
120
|
style: {
|
|
121
121
|
position: "absolute",
|
|
122
122
|
bottom: "calc(100% + 6px)",
|
|
@@ -136,5 +136,5 @@ var b = "theme-stylesheet", w = "theme-font-link", L = "theme-font-link-display"
|
|
|
136
136
|
});
|
|
137
137
|
};
|
|
138
138
|
export {
|
|
139
|
-
|
|
139
|
+
J as ThemeProvider
|
|
140
140
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { DEFAULT_FALLBACK_THEME as a } from "./ThemeContextValue.js";
|
|
2
|
+
import { THEME_CONFIGS as n } from "./themeConfig.js";
|
|
3
|
+
var A = (o, r = a) => {
|
|
4
|
+
const m = o.trim().toLowerCase(), e = n.find((t) => (t.recommendedApps ?? []).some((p) => p.toLowerCase() === m));
|
|
4
5
|
return e ? e.value : r;
|
|
5
6
|
};
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
A as getDefaultThemeForApp
|
|
8
9
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { RefObject } from 'react';
|
|
|
22
22
|
import { SyntheticEvent } from 'react';
|
|
23
23
|
import { THEME_CONFIGS } from '@memobit/themes';
|
|
24
24
|
import { ThemeConfig } from '@memobit/themes';
|
|
25
|
+
import { ThemeName } from '@memobit/themes';
|
|
25
26
|
import { TouchEvent as TouchEvent_2 } from 'react';
|
|
26
27
|
|
|
27
28
|
export declare const Accordion: default_2.FC<AccordionProps>;
|
|
@@ -215,7 +216,12 @@ export declare interface AppNavItem {
|
|
|
215
216
|
id: string;
|
|
216
217
|
label: string;
|
|
217
218
|
icon: IconName;
|
|
218
|
-
|
|
219
|
+
/** A number or short text beside the label ("3/12"). */
|
|
220
|
+
count?: number | string;
|
|
221
|
+
/** Sections with the same group are listed together under that heading in the side list. */
|
|
222
|
+
group?: string;
|
|
223
|
+
/** Tints the section's icon, e.g. a category colour. */
|
|
224
|
+
color?: string;
|
|
219
225
|
isActive: boolean;
|
|
220
226
|
onSelect: () => void;
|
|
221
227
|
}
|
|
@@ -808,6 +814,7 @@ export declare interface ContextToastAction {
|
|
|
808
814
|
onClick: () => void;
|
|
809
815
|
}
|
|
810
816
|
|
|
817
|
+
/** @deprecated Use PageShell inside an AppFrame / RouterAppFrame (see the page-shell-usage skill). Kept for the showcase demos. */
|
|
811
818
|
export declare const ControlPanel: default_2.FC<ControlPanelProps>;
|
|
812
819
|
|
|
813
820
|
export declare interface ControlPanelAction {
|
|
@@ -1079,6 +1086,7 @@ export declare interface ControlPanelProps {
|
|
|
1079
1086
|
visibleColumns?: ControlPanelVisibleColumnsConfig;
|
|
1080
1087
|
}
|
|
1081
1088
|
|
|
1089
|
+
/** @deprecated Use PageShell inside an AppFrame / RouterAppFrame (see the page-shell-usage skill). Kept for the showcase demos. */
|
|
1082
1090
|
export declare const ControlPanelProvider: default_2.FC<ControlPanelProviderProps>;
|
|
1083
1091
|
|
|
1084
1092
|
declare interface ControlPanelProviderProps {
|
|
@@ -1339,7 +1347,7 @@ export declare interface DataViewProps<T> {
|
|
|
1339
1347
|
totalItems?: number;
|
|
1340
1348
|
/** Group rows by a key. Rows render in group sections within the paginated slice. */
|
|
1341
1349
|
group?: DataViewGroupConfig<T>;
|
|
1342
|
-
/** Display the "Showing X-Y of Z" results-count label above the data.
|
|
1350
|
+
/** Display the "Showing X-Y of Z" results-count label above the data. When unset, it appears only if the list needs more than one page. `true` and `false` always show or always hide it. */
|
|
1343
1351
|
showResultsCount?: boolean;
|
|
1344
1352
|
/** Unfiltered total used to render the "filtered (... total)" form when smaller than this value. Defaults to `data.length`. */
|
|
1345
1353
|
totalCount?: number;
|
|
@@ -1849,6 +1857,10 @@ export declare interface FilterOption {
|
|
|
1849
1857
|
count?: number | string;
|
|
1850
1858
|
icon?: IconName;
|
|
1851
1859
|
color?: string;
|
|
1860
|
+
/** A small round picture before the label: a face, a product. */
|
|
1861
|
+
imageUrl?: string;
|
|
1862
|
+
/** A hover hint on the option, for what its label can't say ("5–50 km out"). */
|
|
1863
|
+
hint?: string;
|
|
1852
1864
|
}
|
|
1853
1865
|
|
|
1854
1866
|
/**
|
|
@@ -3044,9 +3056,21 @@ export declare interface PageAction {
|
|
|
3044
3056
|
menu?: boolean;
|
|
3045
3057
|
/** In the menu, draws a divider above this action to start a new group. */
|
|
3046
3058
|
separator?: boolean;
|
|
3059
|
+
/** Asks first, in a dialog, and runs `onClick` only on yes: for actions that can't be undone. */
|
|
3060
|
+
confirm?: PageActionConfirm;
|
|
3047
3061
|
onClick: () => void;
|
|
3048
3062
|
}
|
|
3049
3063
|
|
|
3064
|
+
export declare interface PageActionConfirm {
|
|
3065
|
+
/** Defaults to the action's label. */
|
|
3066
|
+
title?: string;
|
|
3067
|
+
message: string;
|
|
3068
|
+
/** Defaults to "Confirm". */
|
|
3069
|
+
confirmLabel?: string;
|
|
3070
|
+
/** Defaults to `danger`. */
|
|
3071
|
+
variant?: ButtonVariant;
|
|
3072
|
+
}
|
|
3073
|
+
|
|
3050
3074
|
export declare interface PageColumns {
|
|
3051
3075
|
options: Array<{
|
|
3052
3076
|
value: string;
|
|
@@ -3100,8 +3124,11 @@ export declare interface PageSearch {
|
|
|
3100
3124
|
/** Lays out a page's title, actions, search, sort, filters and view options around its content, per device. */
|
|
3101
3125
|
export declare const PageShell: FC<PageShellProps>;
|
|
3102
3126
|
|
|
3103
|
-
/**
|
|
3104
|
-
|
|
3127
|
+
/**
|
|
3128
|
+
* `workbench` (the default) is the full layout. `focus` is for a page that needs the whole screen and none of the
|
|
3129
|
+
* list chrome, such as a running quiz: a slim top bar with the title, actions and menu, and no side column.
|
|
3130
|
+
*/
|
|
3131
|
+
export declare type PageShellLayout = 'workbench' | 'focus';
|
|
3105
3132
|
|
|
3106
3133
|
export declare interface PageShellProps {
|
|
3107
3134
|
layout?: PageShellLayout;
|
|
@@ -3129,14 +3156,15 @@ export declare interface PageShellProps {
|
|
|
3129
3156
|
tabs?: PageTabs;
|
|
3130
3157
|
/** This page's own indicator (e.g. an overdue bell), shown where the frame's `status` goes, in its place. */
|
|
3131
3158
|
status?: ReactNode;
|
|
3159
|
+
/** A panel docked on the right on desktop (details of the picked item, a map legend); below the content elsewhere. */
|
|
3160
|
+
aside?: ReactNode;
|
|
3161
|
+
/** A bar that stays at the bottom of the screen while the page scrolls, such as a player; above the phone tab bar. */
|
|
3162
|
+
footer?: ReactNode;
|
|
3132
3163
|
children: ReactNode;
|
|
3133
3164
|
}
|
|
3134
3165
|
|
|
3135
3166
|
export declare interface PageSort {
|
|
3136
|
-
fields:
|
|
3137
|
-
value: string;
|
|
3138
|
-
label: string;
|
|
3139
|
-
}>;
|
|
3167
|
+
fields: PageSortField[];
|
|
3140
3168
|
value: PageSortValue;
|
|
3141
3169
|
/** Marks the sort as changed from the page's default. */
|
|
3142
3170
|
highlighted?: boolean;
|
|
@@ -3145,6 +3173,13 @@ export declare interface PageSort {
|
|
|
3145
3173
|
|
|
3146
3174
|
export declare type PageSortDirection = 'asc' | 'desc';
|
|
3147
3175
|
|
|
3176
|
+
export declare interface PageSortField {
|
|
3177
|
+
value: string;
|
|
3178
|
+
label: string;
|
|
3179
|
+
/** A field that only sorts one way ("Newest first"): picking it sets this direction and hides the direction switch. */
|
|
3180
|
+
direction?: PageSortDirection;
|
|
3181
|
+
}
|
|
3182
|
+
|
|
3148
3183
|
export declare interface PageSortValue {
|
|
3149
3184
|
field: string;
|
|
3150
3185
|
direction: PageSortDirection;
|
|
@@ -3176,6 +3211,7 @@ export declare interface PageView {
|
|
|
3176
3211
|
groupBy?: PageGroupBy;
|
|
3177
3212
|
toggles?: PageViewToggle[];
|
|
3178
3213
|
choices?: PageViewChoice[];
|
|
3214
|
+
sliders?: PageViewSlider[];
|
|
3179
3215
|
}
|
|
3180
3216
|
|
|
3181
3217
|
/** A display setting that always holds one of its options (currency, whose figures). Not a filter: it never counts as applied. */
|
|
@@ -3196,6 +3232,18 @@ export declare interface PageViewMode {
|
|
|
3196
3232
|
icon: IconName;
|
|
3197
3233
|
}
|
|
3198
3234
|
|
|
3235
|
+
/** A sized display preference shown with the view options, e.g. photo size. */
|
|
3236
|
+
export declare interface PageViewSlider {
|
|
3237
|
+
id: string;
|
|
3238
|
+
label: string;
|
|
3239
|
+
min: number;
|
|
3240
|
+
max: number;
|
|
3241
|
+
step?: number;
|
|
3242
|
+
unit?: string;
|
|
3243
|
+
value: number;
|
|
3244
|
+
onChange: (value: number) => void;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3199
3247
|
/** An on/off display preference shown with the view options, e.g. "Hide empty fields in cards". */
|
|
3200
3248
|
export declare interface PageViewToggle {
|
|
3201
3249
|
id: string;
|
|
@@ -3398,6 +3446,8 @@ export declare interface RangeFilterSpec extends FilterSpecBase {
|
|
|
3398
3446
|
max: number;
|
|
3399
3447
|
step?: number;
|
|
3400
3448
|
unit?: string;
|
|
3449
|
+
/** Adds from/to number boxes under the slider, for exact values the thumbs can't hit. */
|
|
3450
|
+
inputs?: boolean;
|
|
3401
3451
|
}
|
|
3402
3452
|
|
|
3403
3453
|
export declare const RangeSlider: FC<RangeSliderProps>;
|
|
@@ -3863,7 +3913,7 @@ export declare interface TextFilterValue {
|
|
|
3863
3913
|
mode?: string;
|
|
3864
3914
|
}
|
|
3865
3915
|
|
|
3866
|
-
export declare type Theme =
|
|
3916
|
+
export declare type Theme = ThemeName;
|
|
3867
3917
|
|
|
3868
3918
|
export { THEME_CONFIGS }
|
|
3869
3919
|
|
|
@@ -4101,6 +4151,7 @@ export declare interface ToggleSwitchProps {
|
|
|
4101
4151
|
|
|
4102
4152
|
export declare type ToggleSwitchVariant = 'plain' | 'default' | 'success' | 'info' | 'warning' | 'danger';
|
|
4103
4153
|
|
|
4154
|
+
/** @deprecated Use PageShell inside an AppFrame / RouterAppFrame (see the page-shell-usage skill). Kept for the showcase demos. */
|
|
4104
4155
|
export declare const Toolbar: default_2.FC<ToolbarProps>;
|
|
4105
4156
|
|
|
4106
4157
|
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
|
+
"version": "4.0.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",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@memobit/core": "1.0.0",
|
|
88
88
|
"@memobit/icons": "^1.7.0",
|
|
89
|
-
"@memobit/themes": "^
|
|
89
|
+
"@memobit/themes": "^3.0.0",
|
|
90
90
|
"react": "19.3.0",
|
|
91
91
|
"react-dom": "19.3.0",
|
|
92
92
|
"react-router": "8.4.0"
|