@peers-app/peers-ui 0.34.14 → 0.34.15

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.
Files changed (122) hide show
  1. package/dist/apps-home/app-menu.d.ts +1 -2
  2. package/dist/apps-home/app-menu.js +29 -25
  3. package/dist/command-palette/command-palette-ui.js +13 -12
  4. package/dist/components/autocomplete-chips.d.ts +18 -0
  5. package/dist/components/autocomplete-chips.js +49 -0
  6. package/dist/components/autocomplete.d.ts +88 -0
  7. package/dist/components/autocomplete.js +346 -0
  8. package/dist/components/confirm-button.d.ts +26 -0
  9. package/dist/components/confirm-button.js +55 -0
  10. package/dist/components/data-grid/autocomplete.d.ts +1 -31
  11. package/dist/components/data-grid/autocomplete.js +5 -197
  12. package/dist/components/empty-state.d.ts +16 -0
  13. package/dist/components/empty-state.js +16 -0
  14. package/dist/components/group-switcher.d.ts +3 -3
  15. package/dist/components/group-switcher.js +22 -17
  16. package/dist/components/inline-create-form.d.ts +22 -0
  17. package/dist/components/inline-create-form.js +56 -0
  18. package/dist/components/list-row.d.ts +33 -0
  19. package/dist/components/list-row.js +30 -0
  20. package/dist/components/list-screen.d.ts +31 -3
  21. package/dist/components/list-screen.js +61 -28
  22. package/dist/components/markdown-editor/format-bar.js +15 -40
  23. package/dist/components/markdown-editor/link-plugin.js +38 -9
  24. package/dist/components/markdown-editor/selection-bar-place.d.ts +37 -0
  25. package/dist/components/markdown-editor/selection-bar-place.js +107 -0
  26. package/dist/components/menu-button.d.ts +34 -0
  27. package/dist/components/menu-button.js +66 -0
  28. package/dist/components/screen-header.d.ts +35 -0
  29. package/dist/components/screen-header.js +30 -0
  30. package/dist/components/search-field.d.ts +22 -0
  31. package/dist/components/search-field.js +22 -0
  32. package/dist/components/segmented-control.d.ts +25 -0
  33. package/dist/components/segmented-control.js +18 -0
  34. package/dist/components/typeahead.d.ts +9 -0
  35. package/dist/components/typeahead.js +7 -0
  36. package/dist/groups/groups-client.d.ts +23 -1
  37. package/dist/groups/groups-client.js +31 -0
  38. package/dist/index.d.ts +10 -0
  39. package/dist/index.js +14 -1
  40. package/dist/isolated-screens/config.js +1 -9
  41. package/dist/isolated-screens/folder-picker-control.d.ts +57 -0
  42. package/dist/isolated-screens/folder-picker-control.js +217 -0
  43. package/dist/isolated-screens/folder-picker-host.d.ts +57 -0
  44. package/dist/isolated-screens/folder-picker-host.js +178 -0
  45. package/dist/isolated-screens/folder-picker-protocol.d.ts +75 -0
  46. package/dist/isolated-screens/folder-picker-protocol.js +104 -0
  47. package/dist/isolated-screens/frame-bridge.js +8 -0
  48. package/dist/isolated-screens/frame-document.js +2 -1
  49. package/dist/isolated-screens/frame-microphone.d.ts +55 -0
  50. package/dist/isolated-screens/frame-microphone.js +265 -0
  51. package/dist/isolated-screens/frame-permissions.d.ts +19 -0
  52. package/dist/isolated-screens/frame-permissions.js +32 -0
  53. package/dist/isolated-screens/frame-protocol.d.ts +26 -0
  54. package/dist/isolated-screens/frame-protocol.js +9 -0
  55. package/dist/isolated-screens/frame-pvars.d.ts +27 -0
  56. package/dist/isolated-screens/frame-pvars.js +101 -14
  57. package/dist/isolated-screens/global-widgets.d.ts +1 -2
  58. package/dist/isolated-screens/index.d.ts +2 -0
  59. package/dist/isolated-screens/index.js +3 -1
  60. package/dist/isolated-screens/isolated-screen.d.ts +21 -0
  61. package/dist/isolated-screens/isolated-screen.js +88 -5
  62. package/dist/isolated-screens/local-folder-picker.d.ts +55 -0
  63. package/dist/isolated-screens/local-folder-picker.js +143 -0
  64. package/dist/isolated-screens/microphone-host.d.ts +110 -0
  65. package/dist/isolated-screens/microphone-host.js +397 -0
  66. package/dist/isolated-screens/microphone-prompt.d.ts +20 -0
  67. package/dist/isolated-screens/microphone-prompt.js +60 -0
  68. package/dist/isolated-screens/piece-frames.js +5 -94
  69. package/dist/isolated-screens/piece-reach.d.ts +1 -0
  70. package/dist/isolated-screens/port-channel.d.ts +21 -11
  71. package/dist/isolated-screens/port-channel.js +15 -5
  72. package/dist/isolated-screens/slot-rect.d.ts +38 -0
  73. package/dist/isolated-screens/slot-rect.js +121 -0
  74. package/dist/isolated-screens/test-ports.d.ts +17 -0
  75. package/dist/isolated-screens/test-ports.js +25 -3
  76. package/dist/mentions/mention-chooser.js +1 -1
  77. package/dist/notifications/notifications-screen.js +1 -1
  78. package/dist/screens/data-explorer/data-explorer.d.ts +1 -0
  79. package/dist/screens/data-explorer/data-explorer.js +28 -10
  80. package/dist/screens/data-explorer/query-executor.d.ts +1 -0
  81. package/dist/screens/data-explorer/query-executor.js +3 -1
  82. package/dist/screens/groups/group-list.d.ts +13 -3
  83. package/dist/screens/groups/group-list.js +88 -11
  84. package/dist/screens/identity/identity-routes.d.ts +16 -0
  85. package/dist/screens/identity/identity-routes.js +27 -10
  86. package/dist/screens/identity/identity-screen.js +4 -1
  87. package/dist/screens/invites/activity-view.d.ts +3 -1
  88. package/dist/screens/invites/activity-view.js +7 -3
  89. package/dist/screens/invites/pending-invites-list.d.ts +8 -4
  90. package/dist/screens/invites/pending-invites-list.js +44 -45
  91. package/dist/screens/network-viewer/graph/network-graph-controls.js +3 -3
  92. package/dist/screens/packages/local-folder-grants-panel.d.ts +2 -0
  93. package/dist/screens/packages/local-folder-grants-panel.js +1 -1
  94. package/dist/screens/packages/package-info.js +2 -1
  95. package/dist/screens/packages/package-list.d.ts +2 -2
  96. package/dist/screens/packages/package-list.js +89 -105
  97. package/dist/screens/packages/package-microphone-panel.d.ts +14 -0
  98. package/dist/screens/packages/package-microphone-panel.js +62 -0
  99. package/dist/screens/packages/package-runtime-status.d.ts +10 -2
  100. package/dist/screens/packages/package-runtime-status.js +17 -4
  101. package/dist/screens/peer-types/peer-type-details.js +3 -2
  102. package/dist/screens/peer-types/peer-type-list.d.ts +1 -1
  103. package/dist/screens/peer-types/peer-type-list.js +4 -4
  104. package/dist/screens/settings/settings-page.js +1 -4
  105. package/dist/screens/tools/tool-details.js +2 -1
  106. package/dist/screens/tools/tool-list.d.ts +1 -1
  107. package/dist/screens/tools/tool-list.js +22 -60
  108. package/dist/screens/variables/variable-details.js +5 -4
  109. package/dist/screens/variables/variable-list.d.ts +17 -0
  110. package/dist/screens/variables/variable-list.js +72 -28
  111. package/dist/tabs-layout/network-status-details.d.ts +4 -4
  112. package/dist/tabs-layout/network-status-details.js +6 -5
  113. package/dist/tabs-layout/network-status-indicator.d.ts +1 -0
  114. package/dist/tabs-layout/network-status-indicator.js +1 -0
  115. package/dist/tabs-layout/tab-bar-shortcuts.d.ts +46 -0
  116. package/dist/tabs-layout/tab-bar-shortcuts.js +140 -0
  117. package/dist/tabs-layout/tabs-layout.js +11 -9
  118. package/dist/theme.css +326 -6
  119. package/dist/ui-contracts/popover-surface.d.ts +3 -0
  120. package/dist/ui-contracts/popover-surface.js +6 -3
  121. package/dist/ui-defaults/list-screen.js +10 -4
  122. package/package.json +3 -3
@@ -1,199 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Autocomplete = Autocomplete;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const react_dom_1 = require("react-dom");
7
- const reactive_1 = require("./reactive");
8
- const emptyOptions = [];
9
- // Bootstrap button states remain available without drawing separate button boxes.
10
- const indicatorStyle = {
11
- width: "2rem",
12
- height: "100%",
13
- padding: 0,
14
- border: 0,
15
- "--bs-btn-color": "var(--bs-tertiary-color)",
16
- "--bs-btn-hover-color": "var(--bs-secondary-color)",
17
- "--bs-btn-active-color": "var(--bs-body-color)",
18
- "--bs-btn-disabled-color": "var(--bs-tertiary-color)",
19
- "--bs-btn-bg": "transparent",
20
- "--bs-btn-hover-bg": "transparent",
21
- "--bs-btn-active-bg": "transparent",
22
- "--bs-btn-disabled-bg": "transparent",
23
- };
24
- /**
25
- * Searchable, clearable Bootstrap combobox inspired by JobTrak's Typeahead/FK controls.
26
- * Arrow keys and Enter belong to the popup while open; Tab selects a highlighted result
27
- * and continues naturally. The popup is portaled so a scrolling grid cannot clip it.
28
- */
29
- function Autocomplete(props) {
30
- const value = (0, reactive_1.useGridValue)(props.value);
31
- const options = (0, reactive_1.useGridValue)(props.options ?? emptyOptions);
32
- const id = (0, react_1.useId)();
33
- const input = (0, react_1.useRef)(null);
34
- const [open, setOpen] = (0, react_1.useState)(false);
35
- const [query, setQuery] = (0, react_1.useState)(null);
36
- const [active, setActive] = (0, react_1.useState)(-1);
37
- const [remote, setRemote] = (0, react_1.useState)([]);
38
- const [loading, setLoading] = (0, react_1.useState)(false);
39
- const [error, setError] = (0, react_1.useState)("");
40
- const [position, setPosition] = (0, react_1.useState)({ left: 0, top: 0, width: 0, maxHeight: 240 });
41
- const search = query ?? "";
42
- const eligible = search.length >= (props.minLength ?? 0);
43
- const results = (props.loadOptions
44
- ? remote
45
- : options.filter((option) => props.getOptionLabel(option).toLocaleLowerCase().includes(search.toLocaleLowerCase()))).slice(0, props.maxResults ?? 100);
46
- (0, react_1.useEffect)(() => {
47
- if (!open || props.disabled || !eligible || !props.loadOptions) {
48
- setLoading(false);
49
- setRemote([]);
50
- return;
51
- }
52
- const controller = new AbortController();
53
- let current = true;
54
- setLoading(true);
55
- setRemote([]);
56
- setError("");
57
- const timer = setTimeout(async () => {
58
- try {
59
- const rows = await props.loadOptions?.(search, controller.signal);
60
- if (current)
61
- setRemote(rows ?? []);
62
- }
63
- catch (cause) {
64
- if (current)
65
- setError(cause instanceof Error ? cause.message : "Could not load choices");
66
- }
67
- finally {
68
- if (current)
69
- setLoading(false);
70
- }
71
- }, props.debounceMs ?? 150);
72
- return () => {
73
- current = false;
74
- controller.abort();
75
- clearTimeout(timer);
76
- };
77
- }, [open, props.disabled, search, eligible, props.loadOptions, props.debounceMs]);
78
- (0, react_1.useLayoutEffect)(() => {
79
- if (!open)
80
- return;
81
- const place = () => {
82
- const rect = input.current?.parentElement?.getBoundingClientRect();
83
- if (!rect)
84
- return;
85
- const below = window.innerHeight - rect.bottom - 8;
86
- const height = Math.min(240, Math.max(100, below >= 140 ? below : rect.top - 8));
87
- setPosition({
88
- left: rect.left,
89
- width: rect.width,
90
- top: below >= 140 ? rect.bottom : Math.max(8, rect.top - height),
91
- maxHeight: height,
92
- });
93
- };
94
- place();
95
- window.addEventListener("resize", place);
96
- window.addEventListener("scroll", place, true);
97
- return () => {
98
- window.removeEventListener("resize", place);
99
- window.removeEventListener("scroll", place, true);
100
- };
101
- }, [open]);
102
- (0, react_1.useEffect)(() => {
103
- if (open && active >= 0)
104
- document.getElementById(`${id}-${active}`)?.scrollIntoView?.({ block: "nearest" });
105
- }, [open, active, id]);
106
- const close = () => {
107
- setOpen(false);
108
- setQuery(null);
109
- setActive(-1);
110
- };
111
- const choose = (option) => {
112
- props.onChange(option);
113
- close();
114
- };
115
- const setRef = (node) => {
116
- input.current = node;
117
- if (typeof props.inputRef === "function")
118
- props.inputRef(node);
119
- else if (props.inputRef)
120
- props.inputRef.current = node;
121
- };
122
- const show = open && !props.disabled;
123
- const showClear = (props.clearable ?? !props.required) && value !== null;
124
- const selectedLabel = value === null ? "" : props.getOptionLabel(value);
125
- return ((0, jsx_runtime_1.jsxs)("div", { className: "peers-autocomplete position-relative", style: { minWidth: 0, width: "100%" }, children: [(0, jsx_runtime_1.jsx)("input", { ref: setRef, className: `form-control ${props.invalid ? "is-invalid" : ""}`, style: {
126
- minWidth: 0,
127
- paddingRight: props.invalid
128
- ? showClear
129
- ? "6.25rem"
130
- : "4.25rem"
131
- : showClear
132
- ? "4.75rem"
133
- : "2.75rem",
134
- backgroundPosition: props.invalid
135
- ? `right ${showClear ? "4.75rem" : "2.75rem"} center`
136
- : undefined,
137
- }, role: "combobox", "aria-label": props.label, "aria-autocomplete": "list", "aria-expanded": show, "aria-controls": show ? id : undefined, "aria-activedescendant": show && active >= 0 && results[active] ? `${id}-${active}` : undefined, "aria-invalid": props.invalid || undefined, autoComplete: "off", value: query ?? selectedLabel, placeholder: props.placeholder, disabled: props.disabled, required: props.required, onFocus: (event) => {
138
- event.target.select();
139
- }, onBlur: close, onChange: (event) => {
140
- setQuery(event.target.value);
141
- setError("");
142
- if (props.loadOptions) {
143
- setRemote([]);
144
- setLoading(true);
145
- }
146
- setOpen(true);
147
- setActive(-1);
148
- }, onKeyDown: (event) => {
149
- if (event.nativeEvent.isComposing || event.ctrlKey || event.metaKey || event.altKey)
150
- return;
151
- if (event.key === "ArrowDown" || (event.key === "ArrowUp" && show)) {
152
- event.preventDefault();
153
- event.stopPropagation();
154
- setOpen(true);
155
- setActive((prior) => event.key === "ArrowDown"
156
- ? Math.min(prior + 1, results.length - 1)
157
- : prior <= 0
158
- ? results.length - 1
159
- : prior - 1);
160
- }
161
- else if (event.key === "Enter" && show) {
162
- event.preventDefault();
163
- event.stopPropagation();
164
- const option = results[active >= 0 ? active : 0];
165
- if (eligible && option && !loading && !error)
166
- choose(option);
167
- }
168
- else if (event.key === "Escape" && (show || query !== null)) {
169
- event.preventDefault();
170
- event.stopPropagation();
171
- close();
172
- }
173
- else if (event.key === "Tab" &&
174
- eligible &&
175
- show &&
176
- active >= 0 &&
177
- results[active] &&
178
- !loading &&
179
- !error) {
180
- choose(results[active]);
181
- }
182
- } }), (0, jsx_runtime_1.jsxs)("span", { className: "position-absolute top-0 end-0 h-100 d-flex align-items-center", style: { paddingRight: "0.25rem" }, children: [showClear && ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn d-inline-flex align-items-center justify-content-center", style: indicatorStyle, tabIndex: -1, "aria-label": `Clear ${props.label}`, disabled: props.disabled, onMouseDown: (event) => event.preventDefault(), onClick: () => {
183
- choose(null);
184
- input.current?.focus();
185
- }, children: (0, jsx_runtime_1.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: (0, jsx_runtime_1.jsx)("path", { d: "m4 4 8 8M12 4l-8 8", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) })), (0, jsx_runtime_1.jsx)("span", { "aria-hidden": "true", style: {
186
- height: "55%",
187
- borderLeft: "1px solid var(--bs-border-color)",
188
- marginInline: "0.125rem",
189
- } }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn d-inline-flex align-items-center justify-content-center", style: indicatorStyle, tabIndex: -1, "aria-label": `Show ${props.label} choices`, disabled: props.disabled, onMouseDown: (event) => event.preventDefault(), onClick: () => {
190
- input.current?.focus();
191
- setQuery(null);
192
- setActive(-1);
193
- setOpen(!open);
194
- }, children: (0, jsx_runtime_1.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", focusable: "false", children: (0, jsx_runtime_1.jsx)("path", { d: "m4 6 4 4 4-4", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) })] }), show &&
195
- (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { id: id, role: "listbox", "aria-label": `${props.label} choices`, className: "border rounded bg-body text-body shadow", style: { position: "fixed", ...position, overflowY: "auto", zIndex: 1080 }, children: loading || error || !eligible || !results.length ? ((0, jsx_runtime_1.jsx)("div", { className: `p-2 ${error ? "text-danger" : "text-body-secondary"}`, role: "status", children: loading
196
- ? "Loading…"
197
- : error ||
198
- (!eligible ? `Type at least ${props.minLength} characters` : "No matches") })) : (results.map((option, index) => ((0, jsx_runtime_1.jsx)("div", { id: `${id}-${index}`, role: "option", "aria-selected": value !== null && props.getOptionKey(value) === props.getOptionKey(option), className: `px-3 py-2 ${active === index ? "text-bg-primary" : ""}`, style: { cursor: "pointer" }, onMouseEnter: () => setActive(index), onMouseDown: (event) => event.preventDefault(), onClick: () => choose(option), children: props.getOptionLabel(option) }, props.getOptionKey(option))))) }), document.body)] }));
199
- }
3
+ exports.Autocomplete = void 0;
4
+ // The autocomplete moved to components/autocomplete.tsx when it became peers-ui's standard
5
+ // picker. This path stays for packages that import it from here (JobTrak).
6
+ var autocomplete_1 = require("../autocomplete");
7
+ Object.defineProperty(exports, "Autocomplete", { enumerable: true, get: function () { return autocomplete_1.Autocomplete; } });
@@ -0,0 +1,16 @@
1
+ import type React from "react";
2
+ /**
3
+ * What a list shows when it has nothing: an icon, a short title, a line on why or what to do,
4
+ * and an optional button to do it.
5
+ *
6
+ * @param props.icon - A Bootstrap icon class, such as `"bi-people"`.
7
+ * @param props.title - Such as "No groups yet" or "No matching groups".
8
+ * @param props.children - The line under it.
9
+ * @param props.action - A button, such as "Create your first group".
10
+ */
11
+ export declare function EmptyState(props: {
12
+ icon?: string;
13
+ title: React.ReactNode;
14
+ children?: React.ReactNode;
15
+ action?: React.ReactNode;
16
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmptyState = EmptyState;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ * What a list shows when it has nothing: an icon, a short title, a line on why or what to do,
7
+ * and an optional button to do it.
8
+ *
9
+ * @param props.icon - A Bootstrap icon class, such as `"bi-people"`.
10
+ * @param props.title - Such as "No groups yet" or "No matching groups".
11
+ * @param props.children - The line under it.
12
+ * @param props.action - A button, such as "Create your first group".
13
+ */
14
+ function EmptyState(props) {
15
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "border rounded p-4 text-center", children: [props.icon && (0, jsx_runtime_1.jsx)("i", { className: `${props.icon} fs-2 text-body-secondary`, "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("h6", { className: "mt-2", children: props.title }), props.children && (0, jsx_runtime_1.jsx)("p", { className: "small text-body-secondary mb-2", children: props.children }), props.action] }));
16
+ }
@@ -5,9 +5,9 @@ interface GroupSwitcherProps {
5
5
  isMobile?: boolean;
6
6
  }
7
7
  /**
8
- * Header dropdown for switching the active group (or the personal context), opening the current
9
- * group's color-and-icon dialog, and creating a new group, which also installs the default
10
- * packages into it.
8
+ * Header dropdown for switching the active group (or the personal context), opening a group's
9
+ * details in Identity from the gear on its row, opening the current group's color-and-icon dialog,
10
+ * and creating a new group, which also installs the default packages into it.
11
11
  */
12
12
  export declare function GroupSwitcher({ colorMode, isMobile }: GroupSwitcherProps): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -9,6 +9,8 @@ const group_look_1 = require("../groups/group-look");
9
9
  const groups_client_1 = require("../groups/groups-client");
10
10
  const hooks_1 = require("../hooks");
11
11
  const groups_ipc_1 = require("../screens/groups/groups-ipc");
12
+ const identity_routes_1 = require("../screens/identity/identity-routes");
13
+ const tabs_state_1 = require("../tabs-layout/tabs-state");
12
14
  const color_picker_1 = require("./color-picker");
13
15
  const icon_1 = require("./icon");
14
16
  const icon_picker_1 = require("./icon-picker");
@@ -38,9 +40,17 @@ function useMenuMaxHeight(menu, open) {
38
40
  return maxHeight;
39
41
  }
40
42
  /**
41
- * Header dropdown for switching the active group (or the personal context), opening the current
42
- * group's color-and-icon dialog, and creating a new group, which also installs the default
43
- * packages into it.
43
+ * One group in the switcher's menu: its icon and name switch to it, and a gear at the end opens its
44
+ * details in Identity without switching (on every row, so new people find it, and a phone has no
45
+ * hover).
46
+ */
47
+ function SwitcherRow({ active, icon, name, detailsLabel, onSelect, onDetails }) {
48
+ return ((0, jsx_runtime_1.jsxs)("div", { className: `dropdown-item d-flex align-items-stretch peers-switcher-row ${active ? "active" : ""}`, children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: "peers-switcher-pick", onClick: onSelect, children: [icon, (0, jsx_runtime_1.jsx)("span", { className: "text-truncate", children: name })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "peers-switcher-gear", title: detailsLabel, "aria-label": detailsLabel, onClick: onDetails, children: (0, jsx_runtime_1.jsx)("i", { className: "bi-gear", "aria-hidden": "true" }) })] }));
49
+ }
50
+ /**
51
+ * Header dropdown for switching the active group (or the personal context), opening a group's
52
+ * details in Identity from the gear on its row, opening the current group's color-and-icon dialog,
53
+ * and creating a new group, which also installs the default packages into it.
44
54
  */
45
55
  function GroupSwitcher({ colorMode, isMobile = false }) {
46
56
  const [showDropdown, setShowDropdown] = (0, react_1.useState)(false);
@@ -81,6 +91,11 @@ function GroupSwitcher({ colorMode, isMobile = false }) {
81
91
  userContext.currentlyActiveGroupId(group?.groupId || "");
82
92
  setShowDropdown(false);
83
93
  };
94
+ // Personal has no details page: its gear opens Identity's Groups, where it's the first row.
95
+ const handleDetailsClick = (group) => {
96
+ setShowDropdown(false);
97
+ (0, tabs_state_1.goToTabPath)(group ? `${identity_routes_1.IDENTITY_GROUPS_PATH}/${group.groupId}` : identity_routes_1.IDENTITY_GROUPS_PATH);
98
+ };
84
99
  const handleCreateClick = () => {
85
100
  setShowDropdown(false);
86
101
  setShowCreateModal(true);
@@ -92,6 +107,8 @@ function GroupSwitcher({ colorMode, isMobile = false }) {
92
107
  (0, group_appearance_dialog_1.openGroupAppearanceDialog)(currentGroup?.groupId ?? userContext.userId);
93
108
  };
94
109
  const looks = (0, groups_client_1.useGroups)();
110
+ // In the person's order (System Groups'), by name until it answers.
111
+ const orderedGroups = (0, react_1.useMemo)(() => (0, groups_client_1.inGroupOrder)(allGroups, (0, groups_client_1.listedGroupOrder)(looks), (group) => group), [allGroups, looks]);
95
112
  /**
96
113
  * A group's icon in its color; Personal when `group` is null. An emoji keeps its own colors,
97
114
  * so its group's color goes in a small dot beside it.
@@ -136,21 +153,9 @@ function GroupSwitcher({ colorMode, isMobile = false }) {
136
153
  // Down to the window's bottom edge, so a long list of groups shows whole.
137
154
  maxHeight: menuMaxHeight ?? MENU_MIN_HEIGHT,
138
155
  overflowY: "auto",
139
- }, children: [(0, jsx_runtime_1.jsxs)("button", { className: `dropdown-item d-flex align-items-center ${!currentGroup ? "active" : ""}`, style: {
140
- cursor: "pointer",
141
- border: "none",
142
- background: "none",
143
- width: "100%",
144
- textAlign: "left",
145
- }, onClick: () => handleGroupSelect(null), children: [groupIcon(null, "me-2"), (0, jsx_runtime_1.jsx)("span", { children: "Personal" })] }), allGroups.length > 0 && (0, jsx_runtime_1.jsx)("div", { className: "dropdown-divider" }), allGroups
156
+ }, children: [(0, jsx_runtime_1.jsx)(SwitcherRow, { active: !currentGroup, icon: groupIcon(null, "me-2"), name: "Personal", detailsLabel: "Personal, in Identity's groups", onSelect: () => handleGroupSelect(null), onDetails: () => handleDetailsClick(null) }), allGroups.length > 0 && (0, jsx_runtime_1.jsx)("div", { className: "dropdown-divider" }), orderedGroups
146
157
  .filter((g) => !g.disabled)
147
- .map((group) => ((0, jsx_runtime_1.jsxs)("button", { className: `dropdown-item d-flex align-items-center ${currentGroup?.groupId === group.groupId ? "active" : ""}`, style: {
148
- cursor: "pointer",
149
- border: "none",
150
- background: "none",
151
- width: "100%",
152
- textAlign: "left",
153
- }, onClick: () => handleGroupSelect(group), children: [groupIcon(group, "me-2"), (0, jsx_runtime_1.jsx)("span", { className: "text-truncate", children: group.name })] }, group.groupId))), (0, jsx_runtime_1.jsx)("div", { className: "dropdown-divider" }), (0, jsx_runtime_1.jsxs)("button", { className: "dropdown-item d-flex align-items-center", style: {
158
+ .map((group) => ((0, jsx_runtime_1.jsx)(SwitcherRow, { active: currentGroup?.groupId === group.groupId, icon: groupIcon(group, "me-2"), name: group.name, detailsLabel: `${group.name} details`, onSelect: () => handleGroupSelect(group), onDetails: () => handleDetailsClick(group) }, group.groupId))), (0, jsx_runtime_1.jsx)("div", { className: "dropdown-divider" }), (0, jsx_runtime_1.jsxs)("button", { className: "dropdown-item d-flex align-items-center", style: {
154
159
  cursor: "pointer",
155
160
  border: "none",
156
161
  background: "none",
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A small card for naming something new, under a screen's header: a field, a submit button and
3
+ * Cancel, as Identity's "Create a group" has. It shows the error a failed submit throws.
4
+ *
5
+ * @param props.title - The card's title, such as "New variable".
6
+ * @param props.placeholder - The field's hint, also its name, such as "Name".
7
+ * @param props.submitLabel - The submit button's text; "Create" by default.
8
+ * @param props.initialValue - What the field starts with, such as the search text.
9
+ * @param props.onSubmit - Called with the trimmed text. While a promise it returns is unsettled,
10
+ * the submit button shows "…", Cancel is disabled, and Escape in the field is ignored.
11
+ * @param props.onCancel - Closes the card; Escape in the field calls it too.
12
+ * @param props.children - More content above the field, such as a line on what to enter.
13
+ */
14
+ export declare function InlineCreateForm(props: {
15
+ title: string;
16
+ placeholder?: string;
17
+ submitLabel?: string;
18
+ initialValue?: string;
19
+ onSubmit: (text: string) => unknown;
20
+ onCancel: () => void;
21
+ children?: React.ReactNode;
22
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InlineCreateForm = InlineCreateForm;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ /**
7
+ * A small card for naming something new, under a screen's header: a field, a submit button and
8
+ * Cancel, as Identity's "Create a group" has. It shows the error a failed submit throws.
9
+ *
10
+ * @param props.title - The card's title, such as "New variable".
11
+ * @param props.placeholder - The field's hint, also its name, such as "Name".
12
+ * @param props.submitLabel - The submit button's text; "Create" by default.
13
+ * @param props.initialValue - What the field starts with, such as the search text.
14
+ * @param props.onSubmit - Called with the trimmed text. While a promise it returns is unsettled,
15
+ * the submit button shows "…", Cancel is disabled, and Escape in the field is ignored.
16
+ * @param props.onCancel - Closes the card; Escape in the field calls it too.
17
+ * @param props.children - More content above the field, such as a line on what to enter.
18
+ */
19
+ function InlineCreateForm(props) {
20
+ const [text, setText] = (0, react_1.useState)(props.initialValue ?? "");
21
+ const [busy, setBusy] = (0, react_1.useState)(false);
22
+ const [error, setError] = (0, react_1.useState)("");
23
+ const placeholder = props.placeholder ?? "Name";
24
+ const submitLabel = props.submitLabel ?? "Create";
25
+ async function submit() {
26
+ const value = text.trim();
27
+ if (!value)
28
+ return;
29
+ setBusy(true);
30
+ setError("");
31
+ try {
32
+ await props.onSubmit(value);
33
+ }
34
+ catch (err) {
35
+ setError(err instanceof Error ? err.message : String(err));
36
+ }
37
+ finally {
38
+ setBusy(false);
39
+ }
40
+ }
41
+ return ((0, jsx_runtime_1.jsx)("div", { className: "card mb-3", children: (0, jsx_runtime_1.jsxs)("div", { className: "card-body", children: [(0, jsx_runtime_1.jsx)("h6", { className: "card-title", children: props.title }), props.children, (0, jsx_runtime_1.jsxs)("form", { className: "input-group", onSubmit: (event) => {
42
+ event.preventDefault();
43
+ void submit();
44
+ }, children: [(0, jsx_runtime_1.jsx)("input", { className: "form-control", value: text, onChange: (event) => setText(event.target.value), onKeyDown: (event) => {
45
+ if (event.key !== "Escape")
46
+ return;
47
+ if (busy) {
48
+ event.preventDefault();
49
+ event.stopPropagation();
50
+ }
51
+ else
52
+ props.onCancel();
53
+ }, placeholder: placeholder, "aria-label": placeholder,
54
+ // biome-ignore lint/a11y/noAutofocus: the card opens because the user asked to type a name
55
+ autoFocus: true }), (0, jsx_runtime_1.jsx)("button", { type: "submit", className: "btn btn-primary", disabled: !text.trim() || busy, children: busy ? `${submitLabel}…` : submitLabel }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "btn btn-outline-secondary", onClick: props.onCancel, disabled: busy, children: "Cancel" })] }), error && (0, jsx_runtime_1.jsx)("div", { className: "small text-danger mt-2", children: error })] }) }));
56
+ }
@@ -0,0 +1,33 @@
1
+ import type React from "react";
2
+ /**
3
+ * A row in a list screen, clickable anywhere: a tile with the item's icon, its name and one line
4
+ * of description, small badges for its facts on the right, and a chevron. Put rows in a
5
+ * `<div className="list-group">`.
6
+ *
7
+ * The whole row is one link (or button): its name is the link, stretched over the row. Buttons
8
+ * in `actions` sit above it and stay their own.
9
+ *
10
+ * @param props.href - Where the row goes, such as `"#packages/<id>"`.
11
+ * @param props.onClick - What the row does, for a row that isn't a link.
12
+ * @param props.icon - The tile's content, usually an `<i>` or `<Icon>`.
13
+ * @param props.title - The item's name.
14
+ * @param props.description - One line under the name; longer text is cut with an ellipsis.
15
+ * @param props.badges - Small badges for the item's facts, such as its version.
16
+ * @param props.actions - Buttons of the row's own, such as Update.
17
+ * @param props.monospace - Show the name in a fixed-width font (variable names, ids).
18
+ * @param props.className - More classes for the row.
19
+ * @param props.tileClassName - More classes for the tile, such as `"is-app peers-app-color-blue"`
20
+ * for an app's colored tile.
21
+ */
22
+ export declare function ListRow(props: {
23
+ href?: string;
24
+ onClick?: () => void;
25
+ icon?: React.ReactNode;
26
+ title: React.ReactNode;
27
+ description?: React.ReactNode;
28
+ badges?: React.ReactNode;
29
+ actions?: React.ReactNode;
30
+ monospace?: boolean;
31
+ tileClassName?: string;
32
+ className?: string;
33
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListRow = ListRow;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ * A row in a list screen, clickable anywhere: a tile with the item's icon, its name and one line
7
+ * of description, small badges for its facts on the right, and a chevron. Put rows in a
8
+ * `<div className="list-group">`.
9
+ *
10
+ * The whole row is one link (or button): its name is the link, stretched over the row. Buttons
11
+ * in `actions` sit above it and stay their own.
12
+ *
13
+ * @param props.href - Where the row goes, such as `"#packages/<id>"`.
14
+ * @param props.onClick - What the row does, for a row that isn't a link.
15
+ * @param props.icon - The tile's content, usually an `<i>` or `<Icon>`.
16
+ * @param props.title - The item's name.
17
+ * @param props.description - One line under the name; longer text is cut with an ellipsis.
18
+ * @param props.badges - Small badges for the item's facts, such as its version.
19
+ * @param props.actions - Buttons of the row's own, such as Update.
20
+ * @param props.monospace - Show the name in a fixed-width font (variable names, ids).
21
+ * @param props.className - More classes for the row.
22
+ * @param props.tileClassName - More classes for the tile, such as `"is-app peers-app-color-blue"`
23
+ * for an app's colored tile.
24
+ */
25
+ function ListRow(props) {
26
+ const nameClass = `peers-list-row-name stretched-link${props.monospace ? " font-monospace" : ""}`;
27
+ const name = props.href ? ((0, jsx_runtime_1.jsx)("a", { href: props.href, className: nameClass, children: props.title })) : props.onClick ? ((0, jsx_runtime_1.jsx)("button", { type: "button", className: nameClass, onClick: props.onClick, children: props.title })) : ((0, jsx_runtime_1.jsx)("span", { className: nameClass.replace(" stretched-link", ""), children: props.title }));
28
+ const goes = !!(props.href || props.onClick);
29
+ return ((0, jsx_runtime_1.jsxs)("div", { className: `list-group-item ${goes ? "list-group-item-action" : ""} peers-list-row ${props.className ?? ""}`, children: [props.icon && ((0, jsx_runtime_1.jsx)("span", { className: `peers-list-row-tile ${props.tileClassName ?? ""}`, "aria-hidden": "true", children: props.icon })), (0, jsx_runtime_1.jsxs)("span", { className: "flex-grow-1 overflow-hidden", style: { minWidth: 0 }, children: [name, props.description && ((0, jsx_runtime_1.jsx)("span", { className: "small text-body-secondary d-block text-truncate", children: props.description }))] }), props.badges && (0, jsx_runtime_1.jsx)("span", { className: "peers-list-row-badges", children: props.badges }), props.actions && (0, jsx_runtime_1.jsx)("span", { className: "peers-list-row-actions", children: props.actions }), goes && (0, jsx_runtime_1.jsx)("i", { className: "bi-chevron-right text-body-secondary", "aria-hidden": "true" })] }));
30
+ }
@@ -1,15 +1,43 @@
1
- import { type DataFilter, type SortBy, type Table } from "@peers-app/peers-sdk";
1
+ import type { DataFilter, SortBy, Table } from "@peers-app/peers-sdk";
2
+ import type React from "react";
2
3
  interface IProps<T extends Record<string, unknown>> {
3
4
  table: Table<T>;
4
5
  /**
5
- * Creates a new record from the search text when the user presses Enter. When omitted,
6
- * the list is browse/search only (no create) and the placeholder drops "or create".
6
+ * Creates a record with the name the user typed. When given, the header has a "New …" button
7
+ * that opens a name field; the search box never creates.
7
8
  */
8
9
  newRecord?: (text: string) => Promise<T>;
9
10
  getFilter?: (text: string) => DataFilter<T>;
10
11
  sortBy?: SortBy<T>;
12
+ /** Draws one record, usually as a {@link ListRow}; rows go in a list group. */
11
13
  renderItem: (record: T) => JSX.Element;
14
+ /** What a record is called, such as "variable": the search hint and the New button use it. */
12
15
  placeholderName?: string;
16
+ /** The header's icon (a Bootstrap icon class) and name; no header without a title. */
17
+ icon?: string;
18
+ title?: string;
19
+ /** The header's line on what the list holds. */
20
+ subtitle?: string;
21
+ /** More header buttons, after New. */
22
+ actions?: React.ReactNode;
23
+ /** Shown between the search box and the list, such as a filter. */
24
+ toolbar?: React.ReactNode;
25
+ /** Change it to reload the list from the start, such as when a filter changes. */
26
+ resetKey?: string;
27
+ /** The empty list's icon (a Bootstrap icon class). */
28
+ emptyIcon?: string;
13
29
  }
30
+ /**
31
+ * A searchable list of a table's records, loaded a page at a time as the user scrolls: a header
32
+ * (with New when the screen can create), a search box, then the rows. Types, Variables and the
33
+ * fallback list for any table use it.
34
+ */
14
35
  export declare function ListScreen<T extends Record<string, unknown>>(props: IProps<T>): import("react/jsx-runtime").JSX.Element;
36
+ /**
37
+ * The first line of a markdown description as plain text, for a row's one-line description:
38
+ * headings, emphasis, code marks and links' addresses are dropped; code keeps its punctuation.
39
+ *
40
+ * @param markdown - The description.
41
+ */
42
+ export declare function firstLineOf(markdown: string | undefined): string;
15
43
  export {};