@olenbetong/synergi-react 2.7.0 → 2.8.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.
Files changed (72) hide show
  1. package/{src/components → es/chrome}/AppMenu/AppMenu.css +648 -648
  2. package/es/{components → chrome}/AppMenu/AppMenu.d.ts +17 -8
  3. package/es/chrome/AppMenu/AppMenu.js +145 -0
  4. package/es/chrome/AppMenu/AppMenuColorScheme.d.ts +2 -0
  5. package/es/chrome/AppMenu/AppMenuColorScheme.js +18 -0
  6. package/es/chrome/AppMenu/AppMenuFavoriteButton.d.ts +18 -0
  7. package/es/chrome/AppMenu/AppMenuFavoriteButton.js +11 -0
  8. package/es/chrome/AppMenu/AppMenuHeader.d.ts +24 -0
  9. package/es/chrome/AppMenu/AppMenuHeader.js +18 -0
  10. package/es/chrome/AppMenu/AppMenuList.d.ts +18 -0
  11. package/es/chrome/AppMenu/AppMenuList.js +39 -0
  12. package/es/chrome/AppMenu/AppMenuRail.d.ts +26 -0
  13. package/es/chrome/AppMenu/AppMenuRail.js +30 -0
  14. package/es/chrome/AppMenu/icons.d.ts +15 -0
  15. package/es/chrome/AppMenu/icons.js +13 -0
  16. package/es/chrome/AppMenu/index.d.ts +12 -0
  17. package/es/{components → chrome}/AppMenu/index.js +5 -0
  18. package/es/chrome/AppMenu/menuEntries.d.ts +51 -0
  19. package/es/chrome/AppMenu/menuEntries.js +93 -0
  20. package/es/{components → chrome}/AppMenu/types.d.ts +10 -0
  21. package/es/chrome/AppMenu/useFavorites.d.ts +13 -0
  22. package/es/chrome/AppMenu/useFavorites.js +28 -0
  23. package/es/{components → chrome}/AppMenu/useRovingTabIndex.d.ts +4 -0
  24. package/es/{components → chrome}/AppMenu/useRovingTabIndex.js +12 -1
  25. package/es/{components → chrome}/AppShell/index.js +23 -2
  26. package/es/colorScheme.d.ts +17 -0
  27. package/es/colorScheme.js +54 -0
  28. package/es/components/PageBanner/index.d.ts +1 -1
  29. package/es/index.d.ts +3 -2
  30. package/es/index.js +3 -2
  31. package/package.json +2 -2
  32. package/{es/components → src/chrome}/AppMenu/AppMenu.css +129 -2
  33. package/src/{components → chrome}/AppMenu/AppMenu.tsx +285 -285
  34. package/src/{components → chrome}/AppMenu/AppMenuColorScheme.tsx +42 -41
  35. package/src/{components → chrome}/AppMenu/AppMenuFavoriteButton.tsx +47 -47
  36. package/src/{components → chrome}/AppMenu/AppMenuHeader.tsx +79 -79
  37. package/src/{components → chrome}/AppMenu/AppMenuList.tsx +89 -89
  38. package/src/{components → chrome}/AppMenu/AppMenuRail.tsx +117 -117
  39. package/src/{components → chrome}/AppMenu/icons.tsx +76 -76
  40. package/src/{components → chrome}/AppMenu/index.ts +17 -17
  41. package/src/{components → chrome}/AppMenu/menuEntries.ts +128 -128
  42. package/src/{components → chrome}/AppMenu/types.ts +45 -45
  43. package/src/{components → chrome}/AppMenu/useFavorites.ts +40 -40
  44. package/src/{components → chrome}/AppMenu/useRovingTabIndex.ts +130 -130
  45. package/src/{components → chrome}/AppShell/index.tsx +287 -287
  46. package/src/colorScheme.ts +81 -81
  47. package/src/components/ImageEditor/ImageEditor.tsx +1 -1
  48. package/src/components/ImageEditor/index.ts +2 -0
  49. package/src/components/ImageEditor/plugins/zoomPlugin/ZoomControls.tsx +7 -8
  50. package/src/components/LinkedCardList/index.scss +93 -93
  51. package/src/components/PageBanner/index.tsx +5 -4
  52. package/src/components/ProgressBar/index.scss +94 -94
  53. package/src/elements/ElementDamage/DamageFormButtons.tsx +2 -2
  54. package/src/elements/ElementDamage/TransportElementSelect.tsx +1 -1
  55. package/src/elements/index.ts +5 -0
  56. package/src/index.ts +70 -61
  57. package/es/components/AppMenu/AppMenu.js +0 -223
  58. package/es/components/AppMenu/index.d.ts +0 -6
  59. /package/es/{components → chrome}/AppMenu/AppMenuToggle.d.ts +0 -0
  60. /package/es/{components → chrome}/AppMenu/AppMenuToggle.js +0 -0
  61. /package/es/{components → chrome}/AppMenu/AppMenuUserMenu.d.ts +0 -0
  62. /package/es/{components → chrome}/AppMenu/AppMenuUserMenu.js +0 -0
  63. /package/es/{components → chrome}/AppMenu/developerCategories.d.ts +0 -0
  64. /package/es/{components → chrome}/AppMenu/developerCategories.js +0 -0
  65. /package/es/{components → chrome}/AppMenu/types.js +0 -0
  66. /package/es/{components → chrome}/AppMenu/useServiceWorkerUpdate.d.ts +0 -0
  67. /package/es/{components → chrome}/AppMenu/useServiceWorkerUpdate.js +0 -0
  68. /package/es/{components → chrome}/AppShell/index.d.ts +0 -0
  69. /package/src/{components → chrome}/AppMenu/AppMenuToggle.tsx +0 -0
  70. /package/src/{components → chrome}/AppMenu/AppMenuUserMenu.tsx +0 -0
  71. /package/src/{components → chrome}/AppMenu/developerCategories.ts +0 -0
  72. /package/src/{components → chrome}/AppMenu/useServiceWorkerUpdate.ts +0 -0
@@ -0,0 +1,13 @@
1
+ import type { AppEntry } from "./menuEntries.js";
2
+ /**
3
+ * Tracks the favorite state the user has changed while the menu is open.
4
+ *
5
+ * The changes are applied optimistically on top of the article rows and rolled
6
+ * back if the handler rejects. The overrides are kept for the lifetime of the
7
+ * menu, since the article list is only loaded the first time it is opened and
8
+ * would otherwise show a stale state the second time around.
9
+ */
10
+ export declare function useFavorites(onToggleFavorite?: (id: string, favorite: boolean) => void | Promise<unknown>): {
11
+ applyOverrides: (entries: AppEntry[]) => AppEntry[];
12
+ toggleFavorite: ((id: string, favorite: boolean) => Promise<void>) | undefined;
13
+ };
@@ -0,0 +1,28 @@
1
+ import { useCallback, useState } from "react";
2
+ /**
3
+ * Tracks the favorite state the user has changed while the menu is open.
4
+ *
5
+ * The changes are applied optimistically on top of the article rows and rolled
6
+ * back if the handler rejects. The overrides are kept for the lifetime of the
7
+ * menu, since the article list is only loaded the first time it is opened and
8
+ * would otherwise show a stale state the second time around.
9
+ */
10
+ export function useFavorites(onToggleFavorite) {
11
+ let [overrides, setOverrides] = useState({});
12
+ let applyOverrides = useCallback((entries) => {
13
+ if (Object.keys(overrides).length === 0)
14
+ return entries;
15
+ return entries.map((entry) => (entry.id in overrides ? { ...entry, isFavorite: overrides[entry.id] } : entry));
16
+ }, [overrides]);
17
+ let toggleFavorite = useCallback(async (id, favorite) => {
18
+ setOverrides((current) => ({ ...current, [id]: favorite }));
19
+ try {
20
+ await onToggleFavorite?.(id, favorite);
21
+ }
22
+ catch (error) {
23
+ console.error(error);
24
+ setOverrides((current) => ({ ...current, [id]: !favorite }));
25
+ }
26
+ }, [onToggleFavorite]);
27
+ return { applyOverrides, toggleFavorite: onToggleFavorite ? toggleFavorite : undefined };
28
+ }
@@ -21,4 +21,8 @@ export declare function useRovingTabIndex(itemCount: number, { columns }?: Rovin
21
21
  tabIndex: number;
22
22
  onFocus: () => void;
23
23
  };
24
+ getSecondaryProps: (index: number) => {
25
+ tabIndex: number;
26
+ onFocus: () => void;
27
+ };
24
28
  };
@@ -99,5 +99,16 @@ export function useRovingTabIndex(itemCount, { columns = false } = {}) {
99
99
  onFocus: () => setActiveIndex(index),
100
100
  };
101
101
  }
102
- return { onKeyDown, getItemProps };
102
+ /**
103
+ * Props for a secondary control belonging to item `index`, e.g. the favorite
104
+ * toggle next to an app link. It shares the item's tab stop — so Tab reaches
105
+ * it from the link — but the arrow keys skip it.
106
+ */
107
+ function getSecondaryProps(index) {
108
+ return {
109
+ tabIndex: index === activeIndex ? 0 : -1,
110
+ onFocus: () => setActiveIndex(index),
111
+ };
112
+ }
113
+ return { onKeyDown, getItemProps, getSecondaryProps };
103
114
  }
@@ -1,8 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { StyledEngineProvider, ThemeProvider } from "@mui/material";
3
3
  import { createTheme as muiCreateTheme } from "@mui/material/styles";
4
+ import { getLocalizedString } from "@olenbetong/appframe-core";
4
5
  import { AppErrorBoundary } from "@olenbetong/appframe-mui";
5
- import { useEffect, useMemo, useState } from "react";
6
+ import { useCallback, useEffect, useMemo, useState } from "react";
6
7
  import { createPortal } from "react-dom";
7
8
  import { AppMenu } from "../AppMenu/AppMenu.js";
8
9
  import { AppMenuToggle } from "../AppMenu/AppMenuToggle.js";
@@ -39,6 +40,7 @@ const dsMenuArticles = af.data.generateApiDataObject({
39
40
  { name: "Title", type: "string", nullable: true },
40
41
  { name: "MenuGroup", type: "string", nullable: true },
41
42
  { name: "Path", type: "string", nullable: true },
43
+ { name: "IsFavorite", type: "boolean", nullable: true },
42
44
  ],
43
45
  parameters: {
44
46
  maxRecords: -1,
@@ -46,6 +48,16 @@ const dsMenuArticles = af.data.generateApiDataObject({
46
48
  sortOrder: [{ MenuGroup: af.data.SortOrder.Asc }, { Title: af.data.SortOrder.Asc }],
47
49
  },
48
50
  });
51
+ // Toggles the current user's favorite state for an article.
52
+ const procSetArticleFavorite = new af.ProcedureAPI({
53
+ procedureId: "astp_WebShared_SetArticleFavorite",
54
+ parameters: [
55
+ { name: "HostName", type: "string", required: true, hasDefault: false },
56
+ { name: "ArticleID", type: "string", required: true, hasDefault: false },
57
+ { name: "Favorite", type: "boolean", required: false, hasDefault: true },
58
+ ],
59
+ timeout: 30000,
60
+ });
49
61
  // The current user's employee record, used for the photo and full name.
50
62
  const dsAppMenuUser = af.data.generateApiDataObject({
51
63
  resource: "aviw_Personnel_Employees_Lookup",
@@ -192,6 +204,15 @@ export function AppShell({ children }) {
192
204
  // The developer tools are only reachable for developers, so hide them for
193
205
  // everyone else instead of showing links that all return 403.
194
206
  const categories = useMemo(() => (globalThis.af?.userSession?.isDeveloper ? createDeveloperCategories() : []), []);
207
+ // The portal isn't listed with the apps, so link to it from the menu itself
208
+ // unless that's the article we're already on.
209
+ const homeLink = useMemo(() => {
210
+ const articleId = (globalThis.af?.article?.id ?? "").replace(/\.\d+$/, "");
211
+ return articleId === "portal" ? undefined : { label: getLocalizedString("Front page"), href: "/portal" };
212
+ }, []);
213
+ const toggleFavorite = useCallback(async (articleId, favorite) => {
214
+ await procSetArticleFavorite.execute({ HostName: hostName, ArticleID: articleId, Favorite: favorite });
215
+ }, []);
195
216
  // Rebuilt whenever the color scheme changes so MUI components (notably the
196
217
  // data grid) follow Designsystemet instead of staying stuck in light mode.
197
218
  // Also re-read after mount, since the stylesheets are imported from JS and
@@ -202,5 +223,5 @@ export function AppShell({ children }) {
202
223
  }, [colorScheme]);
203
224
  const appMenuSlot = document.getElementById("ob-toolbar-app-menu");
204
225
  return (_jsx(StyledEngineProvider, { injectFirst: true, children: _jsx(ThemeProvider, { theme: theme, children: _jsxs(AppErrorBoundary, { children: [appMenuSlot &&
205
- createPortal(_jsx(AppMenuToggle, { open: isAppMenuOpen, hasUpdate: isUpdateAvailable, "aria-controls": "ob-app-menu", onClick: () => setIsAppMenuOpen((open) => !open) }), appMenuSlot), _jsx(AppMenu, { id: "ob-app-menu", dataObject: dsMenuArticles, userDataObject: dsAppMenuUser, categories: categories, hasUpdate: isUpdateAvailable, onInstallUpdate: installUpdate, open: isAppMenuOpen, onClose: () => setIsAppMenuOpen(false) }), children] }) }) }));
226
+ createPortal(_jsx(AppMenuToggle, { open: isAppMenuOpen, hasUpdate: isUpdateAvailable, "aria-controls": "ob-app-menu", onClick: () => setIsAppMenuOpen((open) => !open) }), appMenuSlot), _jsx(AppMenu, { id: "ob-app-menu", dataObject: dsMenuArticles, userDataObject: dsAppMenuUser, categories: categories, homeLink: homeLink, onToggleFavorite: toggleFavorite, hasUpdate: isUpdateAvailable, onInstallUpdate: installUpdate, open: isAppMenuOpen, onClose: () => setIsAppMenuOpen(false) }), children] }) }) }));
206
227
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Color scheme preference (system / light / dark).
3
+ *
4
+ * The preference lives in the `ob-color-scheme` cookie so the article template
5
+ * can read it server side and render `data-color-scheme` on `<html>` and
6
+ * `<body>` before the first paint. The site script for the 2026 template
7
+ * (`ob.2026.application.min.js`) owns the same cookie for the toolbar user menu
8
+ * toggle, so both write the cookie, apply the attributes, and dispatch
9
+ * `COLOR_SCHEME_CHANGE_EVENT` to keep every toggle on the page in sync.
10
+ */
11
+ export type ColorSchemePreference = "auto" | "light" | "dark";
12
+ /** Dispatched on `window` whenever the preference changes. */
13
+ export declare const COLOR_SCHEME_CHANGE_EVENT = "ob:colorschemechange";
14
+ export declare function getColorSchemePreference(): ColorSchemePreference;
15
+ export declare function setColorSchemePreference(preference: ColorSchemePreference): void;
16
+ /** Reads the stored preference and keeps it in sync with other toggles on the page. */
17
+ export declare function useColorSchemePreference(): [ColorSchemePreference, (value: ColorSchemePreference) => void];
@@ -0,0 +1,54 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ const COOKIE_NAME = "ob-color-scheme";
3
+ const COOKIE_MAX_AGE = 60 * 60 * 24 * 365;
4
+ const DEFAULT_PREFERENCE = "auto";
5
+ const PREFERENCES = ["auto", "light", "dark"];
6
+ /** Dispatched on `window` whenever the preference changes. */
7
+ export const COLOR_SCHEME_CHANGE_EVENT = "ob:colorschemechange";
8
+ function isColorSchemePreference(value) {
9
+ return typeof value === "string" && PREFERENCES.includes(value);
10
+ }
11
+ export function getColorSchemePreference() {
12
+ if (typeof document === "undefined")
13
+ return DEFAULT_PREFERENCE;
14
+ let match = document.cookie.match(new RegExp(`(?:^|;\\s*)${COOKIE_NAME}=([^;]*)`));
15
+ let value = match ? decodeURIComponent(match[1]) : null;
16
+ return isColorSchemePreference(value) ? value : DEFAULT_PREFERENCE;
17
+ }
18
+ export function setColorSchemePreference(preference) {
19
+ if (typeof document === "undefined" || !isColorSchemePreference(preference))
20
+ return;
21
+ let secure = window.location.protocol === "https:" ? ";secure" : "";
22
+ document.cookie = `${COOKIE_NAME}=${preference};path=/;max-age=${COOKIE_MAX_AGE};samesite=lax${secure}`;
23
+ /*
24
+ * Both elements are updated: `<html>` so the browser applies `color-scheme`
25
+ * to scrollbars and native controls, `<body>` because Designsystemet declares
26
+ * the light tokens on `:root` as well (`:root, [data-color-scheme="light"]`).
27
+ */
28
+ document.documentElement.dataset.colorScheme = preference;
29
+ if (document.body)
30
+ document.body.dataset.colorScheme = preference;
31
+ window.dispatchEvent(new CustomEvent(COLOR_SCHEME_CHANGE_EVENT, { detail: preference }));
32
+ }
33
+ /** Reads the stored preference and keeps it in sync with other toggles on the page. */
34
+ export function useColorSchemePreference() {
35
+ let [preference, setPreference] = useState(() => getColorSchemePreference());
36
+ useEffect(() => {
37
+ function update() {
38
+ setPreference(getColorSchemePreference());
39
+ }
40
+ update();
41
+ window.addEventListener(COLOR_SCHEME_CHANGE_EVENT, update);
42
+ // Cookies fire no change event, so also pick up changes made in another tab.
43
+ document.addEventListener("visibilitychange", update);
44
+ return () => {
45
+ window.removeEventListener(COLOR_SCHEME_CHANGE_EVENT, update);
46
+ document.removeEventListener("visibilitychange", update);
47
+ };
48
+ }, []);
49
+ let setValue = useCallback((value) => {
50
+ setColorSchemePreference(value);
51
+ setPreference(value);
52
+ }, []);
53
+ return [preference, setValue];
54
+ }
@@ -11,7 +11,7 @@ export type TabListProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "classNa
11
11
  sticky?: boolean;
12
12
  };
13
13
  export declare function TabList({ as, className, children, sticky, ...other }: TabListProps): React.JSX.Element;
14
- export type TabProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "className" | "children"> & {
14
+ export type TabProps = Pick<React.HTMLProps<HTMLDivElement>, "id" | "className" | "children"> & Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "target" | "rel"> & {
15
15
  active?: boolean;
16
16
  as?: "a" | "li" | "div" | "span";
17
17
  };
package/es/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export { AppMenu, type AppMenuArticle, type AppMenuCategory, type AppMenuLink, type AppMenuLinkGroup, type AppMenuProps, AppMenuToggle, type AppMenuToggleProps, type AppMenuUser, AppMenuUserMenu, type AppMenuUserMenuProps, createDeveloperCategories, defaultUserMenuItems, type DeveloperCategoryOptions, useServiceWorkerUpdate, } from "./components/AppMenu/index.js";
2
- export { AppShell, type AppShellProps } from "./components/AppShell/index.js";
1
+ export { AppMenu, type AppMenuArticle, type AppMenuCategory, AppMenuColorScheme, AppMenuFavoriteButton, type AppMenuFavoriteButtonProps, AppMenuHeader, type AppMenuHeaderProps, type AppMenuLink, type AppMenuLinkGroup, AppMenuList, type AppMenuListProps, type AppMenuProps, AppMenuRail, type AppMenuRailProps, type AppMenuSelection, AppMenuToggle, type AppMenuToggleProps, type AppMenuUser, AppMenuUserMenu, type AppMenuUserMenuProps, createDeveloperCategories, defaultUserMenuItems, type DeveloperCategoryOptions, useServiceWorkerUpdate, } from "./chrome/AppMenu/index.js";
2
+ export { AppShell, type AppShellProps } from "./chrome/AppShell/index.js";
3
3
  export { Checkbox, type CheckboxProps } from "./components/Checkbox/index.js";
4
+ export { COLOR_SCHEME_CHANGE_EVENT, type ColorSchemePreference, getColorSchemePreference, setColorSchemePreference, useColorSchemePreference, } from "./colorScheme.js";
4
5
  export { CardColumn, CardDetail, CardLabel, CardStep, CardStepList, ColorCard } from "./components/ColorCard/index.js";
5
6
  export { DateNavigator } from "./components/DateNavigator/index.js";
6
7
  export * from "./components/FilePond.js";
package/es/index.js CHANGED
@@ -1,6 +1,7 @@
1
- export { AppMenu, AppMenuToggle, AppMenuUserMenu, createDeveloperCategories, defaultUserMenuItems, useServiceWorkerUpdate, } from "./components/AppMenu/index.js";
2
- export { AppShell } from "./components/AppShell/index.js";
1
+ export { AppMenu, AppMenuColorScheme, AppMenuFavoriteButton, AppMenuHeader, AppMenuList, AppMenuRail, AppMenuToggle, AppMenuUserMenu, createDeveloperCategories, defaultUserMenuItems, useServiceWorkerUpdate, } from "./chrome/AppMenu/index.js";
2
+ export { AppShell } from "./chrome/AppShell/index.js";
3
3
  export { Checkbox } from "./components/Checkbox/index.js";
4
+ export { COLOR_SCHEME_CHANGE_EVENT, getColorSchemePreference, setColorSchemePreference, useColorSchemePreference, } from "./colorScheme.js";
4
5
  export { CardColumn, CardDetail, CardLabel, CardStep, CardStepList, ColorCard } from "./components/ColorCard/index.js";
5
6
  export { DateNavigator } from "./components/DateNavigator/index.js";
6
7
  export * from "./components/FilePond.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/synergi-react",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Standalone React component for SynergiWeb and Partner Portal",
5
5
  "type": "module",
6
6
  "exports": {
@@ -45,8 +45,8 @@
45
45
  "pdfjs-dist": "5.7.284",
46
46
  "react-pdf": "^10.4.1",
47
47
  "@olenbetong/appframe-core": "2.11.10",
48
- "@olenbetong/appframe-react": "2.0.0",
49
48
  "@olenbetong/appframe-data": "1.5.0",
49
+ "@olenbetong/appframe-react": "2.0.0",
50
50
  "@olenbetong/appframe-mui": "6.6.0"
51
51
  },
52
52
  "repository": {
@@ -179,6 +179,31 @@
179
179
  letter-spacing: 0.04em;
180
180
  }
181
181
 
182
+ /*
183
+ * Color scheme toggle. `margin-block-start: auto` pins it to the bottom of the
184
+ * rail; the group list above shrinks and scrolls instead of pushing it down.
185
+ */
186
+ .ob-app-menu__color-scheme {
187
+ display: flex;
188
+ flex: 0 0 auto;
189
+ justify-content: center;
190
+ margin-block-start: auto;
191
+ padding-block-start: var(--ds-size-3);
192
+ }
193
+
194
+ /* Icon-only buttons: the label text stays in the DOM as the accessible name. */
195
+ .ob-app-menu__color-scheme-label {
196
+ position: absolute;
197
+ width: 1px;
198
+ height: 1px;
199
+ margin: -1px;
200
+ padding: 0;
201
+ overflow: hidden;
202
+ clip-path: inset(50%);
203
+ white-space: nowrap;
204
+ border: 0;
205
+ }
206
+
182
207
  /* -------------------------------------------------------------------------- */
183
208
  /* Right pane: app list */
184
209
  /* -------------------------------------------------------------------------- */
@@ -200,9 +225,40 @@
200
225
  margin-block-end: var(--ds-size-2);
201
226
  }
202
227
 
228
+ .ob-app-menu__header-start {
229
+ display: flex;
230
+ align-items: center;
231
+ gap: var(--ds-size-2);
232
+ /* Pushes the update/user/close controls to the end of the header. */
233
+ flex: 1 1 auto;
234
+ min-width: 0;
235
+ }
236
+
237
+ .ob-app-menu__home {
238
+ display: inline-flex;
239
+ align-items: center;
240
+ gap: var(--ds-size-2);
241
+ padding: var(--ds-size-1) var(--ds-size-3);
242
+ border-radius: var(--ds-border-radius-md);
243
+ background: transparent;
244
+ color: var(--ds-color-brand-text-default, var(--ds-color-neutral-text-default));
245
+ font: inherit;
246
+ text-decoration: none;
247
+ white-space: nowrap;
248
+ }
249
+
250
+ .ob-app-menu__home:hover {
251
+ background: var(--ds-color-neutral-surface-hover);
252
+ text-decoration: underline;
253
+ }
254
+
255
+ .ob-app-menu__home:focus-visible {
256
+ outline: var(--ds-border-width-focus, 3px) solid var(--ds-color-focus-outer);
257
+ outline-offset: var(--ds-size-1);
258
+ }
259
+
203
260
  .ob-app-menu__pane-toggle {
204
261
  display: none;
205
- margin-inline-end: auto;
206
262
  padding: var(--ds-size-1) var(--ds-size-3);
207
263
  border: var(--ds-border-width-default, 1px) solid var(--ds-color-neutral-border-default);
208
264
  border-radius: var(--ds-border-radius-md);
@@ -289,9 +345,18 @@
289
345
  padding: 0;
290
346
  }
291
347
 
348
+ .ob-app-menu__item {
349
+ display: flex;
350
+ align-items: center;
351
+ gap: var(--ds-size-1);
352
+ min-width: 0;
353
+ }
354
+
292
355
  .ob-app-menu__link {
293
356
  display: block;
357
+ flex: 1 1 auto;
294
358
  width: 100%;
359
+ min-width: 0;
295
360
  padding: var(--ds-size-1) var(--ds-size-2);
296
361
  border: none;
297
362
  border-radius: var(--ds-border-radius-sm);
@@ -314,6 +379,63 @@
314
379
  outline-offset: calc(var(--ds-size-1) * -1);
315
380
  }
316
381
 
382
+ /*
383
+ * Favorite toggle. Hidden until the entry is hovered or focused to keep the
384
+ * list calm, but always visible for entries that already are favorites so the
385
+ * state is readable at a glance.
386
+ */
387
+ .ob-app-menu__favorite {
388
+ display: inline-flex;
389
+ align-items: center;
390
+ justify-content: center;
391
+ flex: 0 0 auto;
392
+ padding: var(--ds-size-1);
393
+ border: none;
394
+ border-radius: var(--ds-border-radius-sm);
395
+ background: transparent;
396
+ color: var(--ds-color-neutral-text-subtle);
397
+ cursor: pointer;
398
+ opacity: 0;
399
+ pointer-events: none;
400
+ }
401
+
402
+ .ob-app-menu__item:hover .ob-app-menu__favorite,
403
+ .ob-app-menu__item:focus-within .ob-app-menu__favorite,
404
+ .ob-app-menu__favorite[data-favorite="true"] {
405
+ opacity: 1;
406
+ pointer-events: auto;
407
+ }
408
+
409
+ .ob-app-menu__favorite[data-favorite="true"] {
410
+ color: var(--ds-color-warning-base-default, #c77300);
411
+ }
412
+
413
+ .ob-app-menu__favorite:hover {
414
+ background: var(--ds-color-neutral-surface-hover);
415
+ color: var(--ds-color-warning-base-hover, var(--ds-color-neutral-text-default));
416
+ }
417
+
418
+ .ob-app-menu__favorite:focus-visible {
419
+ opacity: 1;
420
+ pointer-events: auto;
421
+ outline: var(--ds-border-width-focus, 3px) solid var(--ds-color-focus-outer);
422
+ outline-offset: calc(var(--ds-size-1) * -1);
423
+ }
424
+
425
+ @media (prefers-reduced-motion: no-preference) {
426
+ .ob-app-menu__favorite {
427
+ transition: opacity 120ms ease-out;
428
+ }
429
+ }
430
+
431
+ /* Without a pointer there is no hover, so always show the toggles. */
432
+ @media (hover: none) {
433
+ .ob-app-menu__favorite {
434
+ opacity: 1;
435
+ pointer-events: auto;
436
+ }
437
+ }
438
+
317
439
  .ob-app-menu__message {
318
440
  margin: var(--ds-size-6) 0;
319
441
  text-align: center;
@@ -511,11 +633,16 @@
511
633
  }
512
634
 
513
635
  /* Not enough room for the label next to the pane toggle and user menu. */
514
- .ob-app-menu__update-label {
636
+ .ob-app-menu__update-label,
637
+ .ob-app-menu__home-label {
515
638
  display: none;
516
639
  }
517
640
 
518
641
  .ob-app-menu__update {
519
642
  padding-inline: var(--ds-size-2);
520
643
  }
644
+
645
+ .ob-app-menu__home {
646
+ padding-inline: var(--ds-size-2);
647
+ }
521
648
  }