@gravitee/graphene-core 3.49.0 → 3.50.0-feat-app-context-switcher.ae2d062

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 (37) hide show
  1. package/USAGE_GUIDE.md +56 -2
  2. package/dist/__stories__/fixtures/index.d.ts +1 -0
  3. package/dist/__stories__/fixtures/index.d.ts.map +1 -1
  4. package/dist/__stories__/fixtures/shell/app-context-switcher.fixture.d.ts +20 -0
  5. package/dist/__stories__/fixtures/shell/app-context-switcher.fixture.d.ts.map +1 -0
  6. package/dist/base/Command/Command.d.ts +3 -2
  7. package/dist/base/Command/Command.d.ts.map +1 -1
  8. package/dist/composed/AppContextSwitcher/AppColumn.d.ts +21 -0
  9. package/dist/composed/AppContextSwitcher/AppColumn.d.ts.map +1 -0
  10. package/dist/composed/AppContextSwitcher/AppContextSwitcher.d.ts +18 -0
  11. package/dist/composed/AppContextSwitcher/AppContextSwitcher.d.ts.map +1 -0
  12. package/dist/composed/AppContextSwitcher/AppContextSwitcherTrigger.d.ts +15 -0
  13. package/dist/composed/AppContextSwitcher/AppContextSwitcherTrigger.d.ts.map +1 -0
  14. package/dist/composed/AppContextSwitcher/AppRow.d.ts +14 -0
  15. package/dist/composed/AppContextSwitcher/AppRow.d.ts.map +1 -0
  16. package/dist/composed/AppContextSwitcher/EntranceRow.d.ts +17 -0
  17. package/dist/composed/AppContextSwitcher/EntranceRow.d.ts.map +1 -0
  18. package/dist/composed/AppContextSwitcher/EnvironmentColumn.d.ts +12 -0
  19. package/dist/composed/AppContextSwitcher/EnvironmentColumn.d.ts.map +1 -0
  20. package/dist/composed/AppContextSwitcher/EnvironmentRow.d.ts +16 -0
  21. package/dist/composed/AppContextSwitcher/EnvironmentRow.d.ts.map +1 -0
  22. package/dist/composed/AppContextSwitcher/appContextSwitcher.types.d.ts +59 -0
  23. package/dist/composed/AppContextSwitcher/appContextSwitcher.types.d.ts.map +1 -0
  24. package/dist/composed/AppContextSwitcher/environmentList.d.ts +8 -0
  25. package/dist/composed/AppContextSwitcher/environmentList.d.ts.map +1 -0
  26. package/dist/composed/AppContextSwitcher/index.d.ts +3 -0
  27. package/dist/composed/AppContextSwitcher/index.d.ts.map +1 -0
  28. package/dist/composed/AppContextSwitcher/panelNavigation.d.ts +26 -0
  29. package/dist/composed/AppContextSwitcher/panelNavigation.d.ts.map +1 -0
  30. package/dist/composed/AppContextSwitcher/use-app-context-switcher.d.ts +39 -0
  31. package/dist/composed/AppContextSwitcher/use-app-context-switcher.d.ts.map +1 -0
  32. package/dist/composed/ContentHeader/ContentHeader.d.ts +1 -1
  33. package/dist/index.d.ts +1 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +6950 -6505
  36. package/dist/styles/globals.css +1 -1
  37. package/package.json +2 -1
package/USAGE_GUIDE.md CHANGED
@@ -358,9 +358,57 @@ App and environment switching has moved from the sidebar header into the top con
358
358
 
359
359
  **Local dev shells:** Module-local dev shells (`LocalDevShell`) that previously passed `apps`/`activeAppKey` to `AppSidebar` need the same migration. For minimal single-app dev setups, `AppContextBar` can be omitted entirely — just remove the old props from `AppSidebar`.
360
360
 
361
+ ### App context switcher
362
+
363
+ `AppContextSwitcher` is the other way to fill `appContext`: one menu for the app and the environment, where `AppContextBar` has a menu for each. The entrance (Account Management on Cloud, Home elsewhere) sits on top, every environment on the left with the pinned ones first, and the apps of the selected environment on the right. Picking an environment only shows its apps: nothing happens until the user picks an app or the entrance, so one pick changes both. With a single environment, the column and the search go away and the apps show as tiles.
364
+
365
+ Both go in the same slot, and a host uses one of them. The switcher fits a host with several environments: an app in another environment is one pick away, and a long list scrolls and can be searched. With `toHref`, the apps and the entrance are real links. An environment never is, since picking one only shows its apps: keep `AppContextBar` if users need to open an environment in a new tab. Like `AppContextBar`, it is host-owned: federated modules don't set it.
366
+
367
+ **`AppContextSwitcher` props:**
368
+
369
+ | Prop | Type | Required | Notes |
370
+ | --- | --- | --- | --- |
371
+ | `apps` | `AppDefinition[]` | Yes | The apps of an environment. `pinned` and `href` are ignored |
372
+ | `environments` | `EnvironmentDefinition[]` | Yes | `{ key, label, pinned? }`. Pinned environments come first |
373
+ | `entrance` | `EntranceDefinition` | No | `{ key, label, icon, contextLabel? }`. `contextLabel` (the account name) ends the entrance row in muted text, and takes the place of the environment in the trigger while the entrance is the active page |
374
+ | `activeAppKey` | `string` | Yes | The entrance key while the entrance is the active page |
375
+ | `activeEnvironmentKey` | `string` | Yes | |
376
+ | `onSelect` | `(selection: AppContextSwitcherSelection) => void` | Yes | See below |
377
+ | `toHref` | `(selection: AppContextSwitcherSelection) => string \| undefined` | No | The URL of a selection. With it, the apps and the entrance are real links: cmd/ctrl-click, middle-click or cmd/ctrl/shift+Enter open one in a new tab, a plain click or Enter still goes through `onSelect` |
378
+ | `defaultOpen` | `boolean` | No | Opens the panel on the first render |
379
+ | `onOpenChange` | `(open: boolean) => void` | No | |
380
+
381
+ **`onSelect`** gets one of:
382
+
383
+ - `{ kind: 'app', appKey, environmentKey }`: open the app in that environment, at its root.
384
+ - `{ kind: 'entrance', environmentKey }`: open the entrance. `environmentKey` is the environment selected in the panel, for an entrance that depends on it, such as Home.
385
+
386
+ The panel closes on every pick. Picking the page already shown calls nothing.
387
+
388
+ **Pins** are read-only: the panel shows them, with no control to change them, because a button inside an option is out of keyboard reach. Store them on the host and let users pin on a page you own, such as the environments page.
389
+
390
+ ```tsx
391
+ <ContentHeader
392
+ leading={slots.leading}
393
+ appContext={
394
+ <AppContextSwitcher
395
+ apps={apps}
396
+ environments={environments}
397
+ entrance={{ key: 'account', label: 'Account Management', icon: <GioProductizeIcon />, contextLabel: accountName }}
398
+ activeAppKey={activeAppKey}
399
+ activeEnvironmentKey={envHrid}
400
+ onSelect={handleSelect}
401
+ toHref={(selection) => (selection.kind === 'app' ? appPath(selection) : '/account')}
402
+ />
403
+ }
404
+ breadcrumbs={slots.breadcrumbs}
405
+ trailing={...}
406
+ />
407
+ ```
408
+
361
409
  ### Breadcrumbs
362
410
 
363
- When using `AppContextBar` in the `appContext` slot, the active application name is already visible in the header bar. Remove the app/module name (e.g. "API Management", "Access Management") from your first breadcrumb segment to avoid duplication. Breadcrumbs should start at the **page level**:
411
+ When using `AppContextBar` or `AppContextSwitcher` in the `appContext` slot, the active application name is already visible in the header bar. Remove the app/module name (e.g. "API Management", "Access Management") from your first breadcrumb segment to avoid duplication. Breadcrumbs should start at the **page level**:
364
412
 
365
413
  ```tsx
366
414
  /* Good — starts at the page, app name is in AppContextBar */
@@ -383,7 +431,7 @@ If you have not migrated to `AppContextBar` yet, keeping the app name as the fir
383
431
 
384
432
  **Linear breadcrumbs:** When each step maps to a **path string** and React Router’s `navigate`, use **`buildLinearBreadcrumbs(navigate, segments)`** so `ContentHeader` / `useLayoutConfig` get consistent `BreadcrumbEntry[]` without copying the same `onClick` wiring. If the first crumb is a **custom action** (e.g. “back” that is not `navigate('/path')`), build that entry by hand or mix with `buildLinearBreadcrumbs`—see Storybook **Composed/ContentHeader → Linear breadcrumbs from builder** for the canonical route-based pattern. API edge cases are covered in `packages/core/src/lib/breadcrumbs/buildLinearBreadcrumbs.test.ts`.
385
433
 
386
- **Opening navigation in a new tab:** an app (`AppDefinition`), an environment or other `SelectorDropdown` option (`SelectorOption`), a side menu item (`NavItem`) or a breadcrumb (`BreadcrumbEntry`) with an `href` renders as a real link, so users can right-click, middle-click or cmd/ctrl-click it to open it in a new tab. A plain click still calls your callback (`onAppChange`, `onEnvironmentChange`, `onItemSelect`, the crumb's `onClick`) and navigates without a reload. A modified click leaves the app switcher or environment menu open, so several items can be opened in turn. Without a callback, a plain click loads the `href`, except on the current app, environment or side menu item, which stays put. The browser opens an `href` as-is, without React Router's relative resolution or `basename`, so pass the full URL. `buildLinearBreadcrumbs` adds `href` only when you pass `toHref`, which turns each segment's `to` into that URL: `to` still goes to `navigate` unchanged, so `toHref` must resolve it the same way `navigate` does. `(to) => to` is enough when every `to` is an absolute path and the router has no `basename`; for a relative `to` such as `'..'`, resolve it, e.g. with React Router's `resolvePath(to, location.pathname).pathname` for `relative: 'path'`, and add the `basename` if there is one.
434
+ **Opening navigation in a new tab:** an app (`AppDefinition`), an environment or other `SelectorDropdown` option (`SelectorOption`), a side menu item (`NavItem`) or a breadcrumb (`BreadcrumbEntry`) with an `href`, or a row of `AppContextSwitcher` whose `toHref` gives a URL, renders as a real link, so users can right-click, middle-click or cmd/ctrl-click it to open it in a new tab. A plain click still calls your callback (`onAppChange`, `onEnvironmentChange`, `onItemSelect`, the crumb's `onClick`) and navigates without a reload. A modified click leaves the app switcher or environment menu open, so several items can be opened in turn. Without a callback, a plain click loads the `href`, except on the current app, environment or side menu item, which stays put. The browser opens an `href` as-is, without React Router's relative resolution or `basename`, so pass the full URL. `buildLinearBreadcrumbs` adds `href` only when you pass `toHref`, which turns each segment's `to` into that URL: `to` still goes to `navigate` unchanged, so `toHref` must resolve it the same way `navigate` does. `(to) => to` is enough when every `to` is an absolute path and the router has no `basename`; for a relative `to` such as `'..'`, resolve it, e.g. with React Router's `resolvePath(to, location.pathname).pathname` for `relative: 'path'`, and add the `basename` if there is one.
387
435
 
388
436
  ### `contentVariant` — content width
389
437
 
@@ -1160,6 +1208,12 @@ The components that derive ids from yours. A part exists only when you pass an i
1160
1208
  | `JsonSchemaForm` | `${id}-<path>.<i>-toggle` | Array item row toggle, object items only; `<i>` is the item's position |
1161
1209
  | `JsonSchemaForm` | `${id}-<path>-variant` | `oneOf` / `anyOf` variant selector; its items are `-variant-option-<index>`, by position |
1162
1210
  | `JsonSchemaForm` | `${id}-schema-error` | The invalid schema alert |
1211
+ | `AppContextSwitcher` | `${id}-content` | Panel content node, inside the portal |
1212
+ | `AppContextSwitcher` | `${id}-search` | Search field, with several environments |
1213
+ | `AppContextSwitcher` | `${id}-clear` | Clear button of the search field, while it has text |
1214
+ | `AppContextSwitcher` | `${id}-entrance` | Entrance row |
1215
+ | `AppContextSwitcher` | `${id}-environment-option-<key>` | Environment row, `EnvironmentDefinition.key` |
1216
+ | `AppContextSwitcher` | `${id}-app-option-<key>` | App row, `AppDefinition.key` |
1163
1217
 
1164
1218
  `JsonSchemaForm` renders no element of its own, so its id is only a prefix. A field at the root path is `${id}`, and its error `${id}-error`.
1165
1219
 
@@ -2,6 +2,7 @@
2
2
  * Storybook fixtures by feature area. Prefer importing from this barrel or from a
3
3
  * specific module (e.g. `./apim/navigation.fixture`) in large stories.
4
4
  */
5
+ export { accountManagementEntrance, cloudEnvironments, gammaConsoleApps, homeEntrance, manyEnvironments, selfHostedEnvironments, teamEnvironments, } from './shell/app-context-switcher.fixture';
5
6
  export { sampleApps, sampleAppsExtended } from './shell/app-switcher.fixture';
6
7
  export { sampleEnvironments, sampleEnvironmentsForSidebar } from './shell/environment-picker.fixture';
7
8
  export { agentManagementApps, agentManagementNavGroups, contextNavGroups, contextPageTabKeys, findContextLabel, findNavLabel, licenseAwareNavGroups, pageLayoutNavGroups, sampleNavGroups, } from './navigation.fixture';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/__stories__/fixtures/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAEtG,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gCAAgC,EAChC,0BAA0B,EAC1B,8BAA8B,EAC9B,sCAAsC,EACtC,gCAAgC,EAChC,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,sBAAsB,EACtB,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kCAAkC,EAAE,MAAM,4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AE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { EntranceDefinition, EnvironmentDefinition } from '../../../composed/AppContextSwitcher';
2
+ import { AppDefinition } from '../../../composed/AppSwitcher';
3
+ /** The Gamma console's apps, in the order of its catalog. */
4
+ export declare const gammaConsoleApps: AppDefinition[];
5
+ /** A Cloud account's environments, two of them pinned. */
6
+ export declare const cloudEnvironments: EnvironmentDefinition[];
7
+ /** Enough environments to search through. */
8
+ export declare const manyEnvironments: EnvironmentDefinition[];
9
+ /**
10
+ * A production and a staging environment per team, two of them pinned: a search can match more of them than the
11
+ * panel holds.
12
+ */
13
+ export declare const teamEnvironments: EnvironmentDefinition[];
14
+ /** A self-hosted installation's environments. */
15
+ export declare const selfHostedEnvironments: EnvironmentDefinition[];
16
+ /** On Cloud, Account Management sits above the environments. */
17
+ export declare const accountManagementEntrance: EntranceDefinition;
18
+ /** Without Account Management, Home takes its place. */
19
+ export declare const homeEntrance: EntranceDefinition;
20
+ //# sourceMappingURL=app-context-switcher.fixture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-context-switcher.fixture.d.ts","sourceRoot":"","sources":["../../../../src/__stories__/fixtures/shell/app-context-switcher.fixture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACrH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAalF,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,EAAE,aAAa,EA2C3C,CAAC;AAEF,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,EAAE,qBAAqB,EAMpD,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,EAAE,qBAAqB,EASnD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,qBAAqB,EA4BlD,CAAC;AAEH,iDAAiD;AACjD,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EAIzD,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,yBAAyB,EAAE,kBAKvC,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,YAAY,EAAE,kBAA0E,CAAC"}
@@ -10,12 +10,13 @@ declare function CommandDialog({ title, description, children, className, showCl
10
10
  /** Lands on the dialog content; the built-in close button, with `showCloseButton`, gets `${id}-close`. */
11
11
  'data-testid'?: string;
12
12
  }): React.JSX.Element;
13
- declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
13
+ /** `children` land in the group after the input: a trailing addon, such as a clear button. */
14
+ declare function CommandInput({ className, children, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
14
15
  declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.List>): React.JSX.Element;
15
16
  declare function CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element;
16
17
  declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Group>): React.JSX.Element;
17
18
  declare function CommandSeparator({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
18
- declare function CommandItem({ className, children, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): React.JSX.Element;
19
+ declare function CommandItem({ className, children, asChild, ...props }: React.ComponentProps<typeof CommandPrimitive.Item>): React.JSX.Element;
19
20
  declare function CommandShortcut({ className, ...props }: React.ComponentProps<'span'>): React.JSX.Element;
20
21
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, };
21
22
  //# sourceMappingURL=Command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Command.d.ts","sourceRoot":"","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AAE,MAAM,CAAC;CACxB,qBAiBA;AAED,8FAA8F;AAC9F,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,qBAmB3G;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,qBAQ/F;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,qBAQjG;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,KAAK,CAAC,qBAWjG;AAED,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAE7E;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,QAAQ,EACR,OAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC,qBAgCpD;AAED,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,qBAW7E;AAED,OAAO,EACL,OAAO,EACP,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,eAAe,GAChB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Ref } from 'react';
2
+ import { AppDefinition } from '../AppSwitcher';
3
+ interface AppColumnProps {
4
+ readonly ref?: Ref<HTMLDivElement>;
5
+ readonly apps: readonly AppDefinition[];
6
+ readonly activeAppKey: string;
7
+ /** The apps shown are the active environment's. */
8
+ readonly inActiveEnvironment: boolean;
9
+ /** Names the environment next to the environment column. Without it, the apps are tiles, as in `AppSwitcher`. */
10
+ readonly environmentLabel?: string;
11
+ readonly hrefOf?: (appKey: string) => string | undefined;
12
+ readonly onSelect: (key: string) => void;
13
+ readonly partTestId: (part: string) => string | undefined;
14
+ }
15
+ /**
16
+ * The apps of the selected environment: a column next to the environments, or under them in a narrow panel, or tiles
17
+ * on their own.
18
+ */
19
+ declare function AppColumn({ ref, apps, activeAppKey, inActiveEnvironment, environmentLabel, hrefOf, onSelect, partTestId, }: AppColumnProps): import("react").JSX.Element;
20
+ export { AppColumn };
21
+ //# sourceMappingURL=AppColumn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppColumn.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/AppColumn.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAIlF,UAAU,cAAc;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,mDAAmD;IACnD,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,iHAAiH;IACjH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACzD,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC3D;AAED;;;GAGG;AACH,iBAAS,SAAS,CAAC,EACjB,GAAG,EACH,IAAI,EACJ,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,UAAU,GACX,EAAE,cAAc,+BA2BhB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { AppContextSwitcherProps } from './appContextSwitcher.types';
2
+ /**
3
+ * One control for the app and the environment: the entrance on top, the environments on the left, the apps of the
4
+ * selected environment on the right. A narrow panel, in a small or zoomed window, stacks the apps under the
5
+ * environments.
6
+ *
7
+ * A Radix menu would eat the search field's keystrokes with its typeahead, so this composes `Popover` and `Command`
8
+ * as `DataTableViewOptionsSearch` does. Up and Down move within a column, Right and Left move between the columns,
9
+ * Enter picks, Escape closes and returns the focus to the trigger. Enter or Right on an environment shows its apps
10
+ * and highlights what Enter opens next, where a click only shows them. The highlight wears a ring while the
11
+ * keyboard drives it, as `focus-visible` would, and screen readers follow it through `aria-activedescendant`.
12
+ */
13
+ declare function AppContextSwitcher({ apps, environments, entrance, activeAppKey, activeEnvironmentKey, onSelect, toHref, defaultOpen, onOpenChange, className, 'data-testid': testId, }: AppContextSwitcherProps): import("react").JSX.Element;
14
+ declare namespace AppContextSwitcher {
15
+ var displayName: string;
16
+ }
17
+ export { AppContextSwitcher };
18
+ //# sourceMappingURL=AppContextSwitcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppContextSwitcher.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/AppContextSwitcher.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AA2B1E;;;;;;;;;;GAUG;AACH,iBAAS,kBAAkB,CAAC,EAC1B,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,QAAQ,EACR,MAAM,EACN,WAAmB,EACnB,YAAY,EACZ,SAAS,EACT,aAAa,EAAE,MAAM,GACtB,EAAE,uBAAuB,+BAqPzB;kBAjQQ,kBAAkB;;;AAqQ3B,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { ComponentProps, ReactNode } from 'react';
2
+ import { Button } from '../../base/Button';
3
+ interface AppContextSwitcherTriggerProps extends ComponentProps<typeof Button> {
4
+ readonly icon?: ReactNode;
5
+ readonly label: string;
6
+ /** Where the label applies: the environment, or the entrance's context. */
7
+ readonly context?: string;
8
+ }
9
+ /**
10
+ * The header button: the active app and its environment, such as "API Management · Production". It never outgrows its
11
+ * container: a name too long for its room is cut, the full name in its tooltip.
12
+ */
13
+ declare function AppContextSwitcherTrigger({ icon, label, context, className, ...props }: AppContextSwitcherTriggerProps): import("react").JSX.Element;
14
+ export { AppContextSwitcherTrigger };
15
+ //# sourceMappingURL=AppContextSwitcherTrigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppContextSwitcherTrigger.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/AppContextSwitcherTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D,UAAU,8BAA+B,SAAQ,cAAc,CAAC,OAAO,MAAM,CAAC;IAC5E,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,iBAAS,yBAAyB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,8BAA8B,+BA4B/G;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { AppDefinition } from '../AppSwitcher';
2
+ interface AppRowProps {
3
+ readonly app: AppDefinition;
4
+ /** The page shown: the active app in the active environment. */
5
+ readonly current: boolean;
6
+ /** A tile with the app's description, as in `AppSwitcher`, instead of a single line. */
7
+ readonly tile: boolean;
8
+ readonly href?: string;
9
+ readonly onSelect: (key: string) => void;
10
+ readonly 'data-testid'?: string;
11
+ }
12
+ declare function AppRow({ app, current, tile, href, onSelect, 'data-testid': testId }: AppRowProps): import("react").JSX.Element;
13
+ export { AppRow };
14
+ //# sourceMappingURL=AppRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppRow.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/AppRow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAKlF,UAAU,WAAW;IACnB,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,iBAAS,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,WAAW,+BAmCzF;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { EntranceDefinition } from './appContextSwitcher.types';
2
+ interface EntranceRowProps {
3
+ readonly entrance: EntranceDefinition;
4
+ readonly current: boolean;
5
+ /** The apps below are tiles: the icon keeps a tile's width so that the labels line up. */
6
+ readonly overTiles: boolean;
7
+ readonly href?: string;
8
+ readonly onSelect: () => void;
9
+ readonly 'data-testid'?: string;
10
+ }
11
+ /**
12
+ * The row above the columns: the page that sits above the environments. Its context, the account, ends the row in
13
+ * muted text: everything the panel lists belongs to it, and it cannot be changed from here.
14
+ */
15
+ declare function EntranceRow({ entrance, current, overTiles, href, onSelect, 'data-testid': testId }: EntranceRowProps): import("react").JSX.Element;
16
+ export { EntranceRow };
17
+ //# sourceMappingURL=EntranceRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntranceRow.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/EntranceRow.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,UAAU,gBAAgB;IACxB,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,0FAA0F;IAC1F,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;;GAGG;AACH,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,gBAAgB,+BAkC7G;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { EnvironmentDefinition } from './appContextSwitcher.types';
2
+ interface EnvironmentColumnProps {
3
+ readonly environments: readonly EnvironmentDefinition[];
4
+ readonly selectedKey: string;
5
+ readonly activeKey: string;
6
+ readonly onSelect: (key: string) => void;
7
+ readonly partTestId: (part: string) => string | undefined;
8
+ }
9
+ /** The left column: every environment, or the ones a search matches. */
10
+ declare function EnvironmentColumn({ environments, selectedKey, activeKey, onSelect, partTestId }: EnvironmentColumnProps): import("react").JSX.Element;
11
+ export { EnvironmentColumn };
12
+ //# sourceMappingURL=EnvironmentColumn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentColumn.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/EnvironmentColumn.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,YAAY,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAC3D;AAED,wEAAwE;AACxE,iBAAS,iBAAiB,CAAC,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,sBAAsB,+BAuBhH;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { EnvironmentDefinition } from './appContextSwitcher.types';
2
+ interface EnvironmentRowProps {
3
+ readonly environment: EnvironmentDefinition;
4
+ /** Its apps are the ones shown. */
5
+ readonly selected: boolean;
6
+ readonly active: boolean;
7
+ readonly onSelect: (key: string) => void;
8
+ readonly 'data-testid'?: string;
9
+ }
10
+ /**
11
+ * One environment. Picking it shows its apps, nothing more: a chevron points at them, darker on the environment whose
12
+ * apps are shown, which also keeps a fill. The check marks the active environment, a pin the pinned ones.
13
+ */
14
+ declare function EnvironmentRow({ environment, selected, active, onSelect, 'data-testid': testId }: EnvironmentRowProps): import("react").JSX.Element;
15
+ export { EnvironmentRow };
16
+ //# sourceMappingURL=EnvironmentRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentRow.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/EnvironmentRow.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGxE,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAC5C,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AASD;;;GAGG;AACH,iBAAS,cAAc,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,mBAAmB,+BAoC9G;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { ReactNode } from 'react';
2
+ import { AppDefinition } from '../AppSwitcher';
3
+ interface EnvironmentDefinition {
4
+ readonly key: string;
5
+ readonly label: string;
6
+ /**
7
+ * Pinned environments come first, with a pin. The panel only shows pins: a button inside an option would be out of
8
+ * keyboard reach, so the host lets users pin elsewhere, such as on its environments page.
9
+ */
10
+ readonly pinned?: boolean;
11
+ }
12
+ /**
13
+ * The page above the environments, on its own row at the top of the panel: Account Management on Cloud, Home
14
+ * elsewhere.
15
+ */
16
+ interface EntranceDefinition {
17
+ readonly key: string;
18
+ readonly label: string;
19
+ readonly icon: ReactNode;
20
+ /**
21
+ * The account name: ends the entrance row in the panel, and takes the place of the environment in the trigger while
22
+ * the entrance is the active page. Without it, the trigger shows the active environment, as it does for an app.
23
+ */
24
+ readonly contextLabel?: string;
25
+ }
26
+ type AppContextSwitcherSelection = {
27
+ readonly kind: 'app';
28
+ readonly appKey: string;
29
+ readonly environmentKey: string;
30
+ } | {
31
+ readonly kind: 'entrance';
32
+ /** The environment selected in the panel, for an entrance that depends on it, such as Home. */
33
+ readonly environmentKey: string;
34
+ };
35
+ interface AppContextSwitcherProps {
36
+ /** The apps of an environment. `pinned` and `href` are ignored. */
37
+ readonly apps: readonly AppDefinition[];
38
+ readonly environments: readonly EnvironmentDefinition[];
39
+ readonly entrance?: EntranceDefinition;
40
+ /** The active app, or the entrance key while the entrance is the active page. */
41
+ readonly activeAppKey: string;
42
+ readonly activeEnvironmentKey: string;
43
+ /** Called when an app or the entrance is picked, except for the page already shown. The panel closes either way. */
44
+ readonly onSelect: (selection: AppContextSwitcherSelection) => void;
45
+ /**
46
+ * The URL of a selection: makes the apps and the entrance real links, so that they open in a new tab on
47
+ * cmd/ctrl-click, middle-click or cmd/ctrl/shift+Enter. A plain click or Enter still goes through `onSelect`.
48
+ */
49
+ readonly toHref?: (selection: AppContextSwitcherSelection) => string | undefined;
50
+ /** Opens the panel on the first render. */
51
+ readonly defaultOpen?: boolean;
52
+ readonly onOpenChange?: (open: boolean) => void;
53
+ /** Applied to the trigger. */
54
+ readonly className?: string;
55
+ /** Lands on the trigger. The parts the panel renders derive their ids from it. */
56
+ readonly 'data-testid'?: string;
57
+ }
58
+ export type { AppContextSwitcherProps, AppContextSwitcherSelection, EntranceDefinition, EnvironmentDefinition };
59
+ //# sourceMappingURL=appContextSwitcher.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appContextSwitcher.types.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/appContextSwitcher.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAElF,UA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C,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,8BAA8B;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,YAAY,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { EnvironmentDefinition } from './appContextSwitcher.types';
2
+ /**
3
+ * The environments the panel lists: pinned ones first, then the others, each in the order given. A query keeps those
4
+ * whose label contains it.
5
+ */
6
+ declare function listEnvironments(environments: readonly EnvironmentDefinition[], query: string): EnvironmentDefinition[];
7
+ export { listEnvironments };
8
+ //# sourceMappingURL=environmentList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environmentList.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/environmentList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,YAAY,EAAE,SAAS,qBAAqB,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,qBAAqB,EAAE,CAKhH;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { AppContextSwitcher } from './AppContextSwitcher';
2
+ export type { AppContextSwitcherProps, AppContextSwitcherSelection, EntranceDefinition, EnvironmentDefinition, } from './appContextSwitcher.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EACV,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,26 @@
1
+ declare const ENTRANCE_ITEM = "entrance";
2
+ declare function environmentItem(key: string): string;
3
+ declare function appItem(key: string): string;
4
+ /** The panel's items by area, each in the order shown: the entrance row, the environment column, the apps column. */
5
+ interface PanelAreas {
6
+ readonly top: readonly string[];
7
+ readonly left: readonly string[];
8
+ readonly right: readonly string[];
9
+ }
10
+ /** Where a move to the other column lands. */
11
+ interface ColumnLanding {
12
+ readonly left?: string;
13
+ readonly right?: string;
14
+ }
15
+ declare const NAVIGATION_KEYS: readonly ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
16
+ type NavigationKey = (typeof NAVIGATION_KEYS)[number];
17
+ declare function isNavigationKey(key: string): key is NavigationKey;
18
+ /**
19
+ * The item a navigation key moves the highlight to. Up and Down stay in the column and stop at its ends, Up from the
20
+ * top of a column reaches the entrance row. Right goes from the environments to the apps, Left comes back. Returns
21
+ * `undefined` when the key is not the panel's to handle, so the search field keeps it to move its caret.
22
+ */
23
+ declare function nextItem(areas: PanelAreas, current: string, key: NavigationKey, landing: ColumnLanding): string | undefined;
24
+ export { appItem, ENTRANCE_ITEM, environmentItem, isNavigationKey, nextItem };
25
+ export type { ColumnLanding, NavigationKey, PanelAreas };
26
+ //# sourceMappingURL=panelNavigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panelNavigation.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/panelNavigation.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,aAAa,aAAa,CAAC;AAEjC,iBAAS,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,iBAAS,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpC;AAED,qHAAqH;AACrH,UAAU,UAAU;IAClB,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,8CAA8C;AAC9C,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,QAAA,MAAM,eAAe,8DAA+D,CAAC;AACrF,KAAK,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,iBAAS,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,aAAa,CAE1D;AAUD;;;;GAIG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAoBpH;AAED,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC;AAC9E,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { AppDefinition } from '../AppSwitcher';
2
+ import { EntranceDefinition, EnvironmentDefinition } from './appContextSwitcher.types';
3
+ import { NavigationKey } from './panelNavigation';
4
+ interface UseAppContextSwitcherOptions {
5
+ readonly apps: readonly AppDefinition[];
6
+ readonly environments: readonly EnvironmentDefinition[];
7
+ readonly entrance?: EntranceDefinition;
8
+ readonly activeAppKey: string;
9
+ readonly activeEnvironmentKey: string;
10
+ readonly defaultOpen: boolean;
11
+ readonly onOpenChange?: (open: boolean) => void;
12
+ }
13
+ /**
14
+ * The switcher's state. The selected environment is the one whose apps are shown: the picked one, which starts as the
15
+ * active one at each opening, or the first match of a search that leaves it out. The highlight is cmdk's, held here so
16
+ * that the arrow keys can move it by column. cmdk still moves it on its own, to the first item after each search and
17
+ * to the item under the pointer, and those moves are always accepted: cmdk updates its internal value before it
18
+ * reports one.
19
+ */
20
+ declare function useAppContextSwitcher({ apps, environments, entrance, activeAppKey, activeEnvironmentKey, defaultOpen, onOpenChange, }: UseAppContextSwitcherOptions): {
21
+ open: boolean;
22
+ changeOpen: (next: boolean) => void;
23
+ query: string;
24
+ changeQuery: import('react').Dispatch<import('react').SetStateAction<string>>;
25
+ highlighted: string;
26
+ changeHighlighted: import('react').Dispatch<import('react').SetStateAction<string>>;
27
+ moveHighlight: (key: NavigationKey) => boolean;
28
+ selectedEnvironmentKey: string;
29
+ showEnvironment: (key: string) => void;
30
+ pickHighlightedEnvironment: () => boolean;
31
+ inActiveEnvironment: boolean;
32
+ singleEnvironment: boolean;
33
+ listedEnvironments: EnvironmentDefinition[];
34
+ showEntrance: boolean;
35
+ showApps: boolean;
36
+ };
37
+ export { useAppContextSwitcher };
38
+ export type { UseAppContextSwitcherOptions };
39
+ //# sourceMappingURL=use-app-context-switcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app-context-switcher.d.ts","sourceRoot":"","sources":["../../../src/composed/AppContextSwitcher/use-app-context-switcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,OAAO,EAKL,KAAK,aAAa,EAGnB,MAAM,mBAAmB,CAAC;AAE3B,UAAU,4BAA4B;IACpC,QAAQ,CAAC,IAAI,EAAE,SAAS,aAAa,EAAE,CAAC;IACxC,QAAQ,CAAC,YAAY,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACjD;AAED;;;;;;GAMG;AACH,iBAAS,qBAAqB,CAAC,EAC7B,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,YAAY,GACb,EAAE,4BAA4B;;uBA2CH,OAAO;;;;;yBA0BL,aAAa,KAAG,OAAO;;2BAfrB,MAAM;sCAMG,OAAO;;;;;;EAoC/C;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,4BAA4B,EAAE,CAAC"}
@@ -6,7 +6,7 @@ interface ContentHeaderProps {
6
6
  /** Leading icon (e.g. context sidebar toggle). Only rendered when provided. */
7
7
  readonly leading?: ReactNode;
8
8
  /**
9
- * App context selector (typically an `<AppContextBar />`).
9
+ * App context selector (an `<AppContextBar />` or an `<AppContextSwitcher />`).
10
10
  * Rendered between leading and breadcrumbs, separated by a vertical divider.
11
11
  */
12
12
  readonly appContext?: ReactNode;
package/dist/index.d.ts CHANGED
@@ -50,6 +50,7 @@ export * from './base/ToggleGroup';
50
50
  export * from './base/Textarea';
51
51
  export * from './base/Tooltip';
52
52
  export * from './composed/AppContextBar';
53
+ export * from './composed/AppContextSwitcher';
53
54
  export * from './composed/AppLayout';
54
55
  export * from './composed/AppSidebar';
55
56
  export * from './composed/AppSwitcher';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC3F,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGhE,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAA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