@abyss-project/commons-front-core 17.2.1 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +2 -1
  3. package/catalog/captures-plan.ts +120 -116
  4. package/catalog/catalog-entries.ts +149 -148
  5. package/catalog/pages/AppShell.tsx +18 -9
  6. package/catalog/pages/CookieConsent.tsx +54 -31
  7. package/catalog/pages/DeliveryHistory.tsx +66 -66
  8. package/catalog/pages/DeliverySubscriptions.tsx +110 -110
  9. package/catalog/pages/ScheduledTasks.tsx +117 -117
  10. package/catalog/pages/index.ts +166 -165
  11. package/catalog/playwright.ci.config.ts +4 -3
  12. package/catalog/specs/captures.spec.ts +145 -145
  13. package/catalog/specs/cookie-consent-modal.spec.ts +187 -0
  14. package/catalog/specs/write-capture-index.ts +81 -81
  15. package/dist/CookieConsentSettings-B7HIIzyI.js +595 -0
  16. package/dist/{Surface-BDfRxVLj.js → Surface-dziv23sf.js} +56 -51
  17. package/dist/{Tabs-DEY2HEqj.js → Tabs-_onUZBA-.js} +613 -591
  18. package/dist/components/business/CookieConsent/AbyssCookieConsentProvider.d.ts +11 -3
  19. package/dist/components/business/CookieConsent/CookieConsentBanner.d.ts +4 -3
  20. package/dist/components/business/CookieConsent/CookieConsentPreferences.d.ts +12 -0
  21. package/dist/components/business/CookieConsent/index.d.ts +2 -0
  22. package/dist/components/business/CookieConsent/use-banner-portal.d.ts +36 -0
  23. package/dist/components/inputs/NumberField/NumberField.d.ts +18 -2
  24. package/dist/components/layers/Toast/toast-clearance.d.ts +5 -0
  25. package/dist/components/structure/AccountMenu/AccountMenu.d.ts +2 -1
  26. package/dist/components/structure/AppShell/SpaceSwitcher.d.ts +4 -2
  27. package/dist/components/structure/AppShell/app-shell.types.d.ts +5 -1
  28. package/dist/components/structure/FilterBar/FilterBar.d.ts +7 -2
  29. package/dist/cookie-consent.js +26 -17
  30. package/dist/{design-theme-Bd0pEPei.js → design-theme-B3C3z1gE.js} +1 -1
  31. package/dist/{editors-CtkDomwX.js → editors-BhQlONOy.js} +27 -27
  32. package/dist/editors.js +1 -1
  33. package/dist/hooks/use-cookie-consent.hook.spec.d.ts +1 -0
  34. package/dist/hooks/use-rich-intl.hook.d.ts +2 -0
  35. package/dist/{index-DKsvuaEj.js → index-B6LMTOKG.js} +3 -3
  36. package/dist/{index-B9avfa3r.js → index-B6w5_TeJ.js} +3 -3
  37. package/dist/{index-Ch8JqU5w.js → index-BBF-FvT6.js} +2 -2
  38. package/dist/{index-CqgMX8kF.js → index-BGAZK8Vk.js} +2 -2
  39. package/dist/{index-DnQguWf1.js → index-BGJobvxw.js} +1 -1
  40. package/dist/{index-SN7FZBya.js → index-BTDlbjWW.js} +2 -2
  41. package/dist/{index-Cl3hwdsZ.js → index-BcjlG5TB.js} +2 -2
  42. package/dist/{index-CSdO6zlX.js → index-BeMiREqf.js} +2 -2
  43. package/dist/{index-psJ1Q-lU.js → index-ByN6DcaL.js} +2 -2
  44. package/dist/{index-DtpGwH5a.js → index-CJI1dJrw.js} +3 -3
  45. package/dist/{index-CEjiERmo.js → index-D1mQgWN3.js} +2 -2
  46. package/dist/{index-BcXqvMY8.js → index-DLlWMDxB.js} +4 -4
  47. package/dist/{index-DFZlN4E3.js → index-DNd8NZnu.js} +4 -4
  48. package/dist/{index-mUtvzoSi.js → index-Dakpr4C1.js} +3 -3
  49. package/dist/{index-D0EF36wh.js → index-DkZAsKob.js} +2 -2
  50. package/dist/{index-FUuoLSZ0.js → index-DprTO7yi.js} +4 -4
  51. package/dist/{index-DZbCUZUp.js → index-N4BwXTyk.js} +2 -2
  52. package/dist/{index-IVjoNq-p.js → index-V4F4Sk7y.js} +2 -2
  53. package/dist/{index-DcV2fWbx.js → index-y-TnfE6Z.js} +2 -2
  54. package/dist/{index-DtncSsmw.js → index-yFJTDKIX.js} +2 -2
  55. package/dist/{index-DVBqUPxf.js → index-ytgNPz5f.js} +2 -2
  56. package/dist/index.js +3480 -3417
  57. package/dist/legacy.js +1728 -1707
  58. package/dist/translations/en.d.ts +1 -0
  59. package/dist/translations/fr.d.ts +1 -0
  60. package/dist/utils/cookie-consent-contract.d.ts +55 -0
  61. package/dist/utils/cookie-consent-contract.spec.d.ts +1 -0
  62. package/dist/utils/cookie-storage.utils.d.ts +1 -8
  63. package/dist/utils/index.d.ts +1 -0
  64. package/package.json +1 -1
  65. package/dist/CookieConsentSettings-CtLrSfve.js +0 -505
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog — @abyss-project/commons-front-core
2
2
 
3
+ ## 18.0.0
4
+
5
+ Breaking: `VALIDITY_DAYS` is removed from the root, `./cookie-consent` and `./legacy`; read `CONSENT_VALIDITY_DAYS` instead (no consumer outside the core used it). Cards #753 and #747 (ADR-0261), plus the #286 admin additions. No signature narrowed.
6
+
7
+ - **Validity of the choice: six months instead of 365 days.** `CONSENT_VALIDITY_DAYS` (183), `CONSENT_VALIDITY_MS` and `COOKIE_MAX_AGE_SECONDS` replace `VALIDITY_DAYS`: one constant for the cookie's `Max-Age` and for the validity check. Every stored choice older than six months asks again.
8
+ - **`cookie-consent-contract`** (leaf file, no import) exports what a reader or writer of the apex cookie must agree on: `COOKIE_NAME`, `COOKIE_PATH`, `COOKIE_SAME_SITE`, the validity constants, `StoredConsent`, `encodeStoredConsent`, `decodeStoredConsent`, `isStoredConsentValid`. `COOKIE_NAME` and `StoredConsent` moved there from `cookie-storage.utils` (still exported by the root and by `./cookie-consent`).
9
+ - **`openPreferences()`** on `useAbyssCookieConsent()` / `useOptionalAbyssCookieConsent()` (type `AbyssCookieConsentApi`, which extends `UseCookieConsent`): reopens the preferences modal, before or after a choice. `renderBanner` receives the `AbyssCookieConsentApi`. The modal is a new export, `CookieConsentPreferences`, mounted by the provider.
10
+ - **« Gérer les cookies »** (`cookies.action.manage`) in `AccountMenu` and in `AbyssLayoutMenu` (`./legacy`) under an `AbyssCookieConsentProvider`.
11
+ - **#747: the banner follows the open modal**: it is placed inside the modal's `aria-modal` surface (dialog paper, bottom sheet panel, drawer paper), out of the `aria-hidden` MUI puts on the page, and the surface stops above it. A front gets it by upgrading, with no change.
12
+ - A choice stored in the account that is of another version or older than six months no longer silences the banner.
13
+ - Banner texts (FR, EN): no third-party tracker is named; audience measurement is the Abyss usage tracking.
14
+ - Card #286 (admin):
15
+ - `NumberField`: new optional props `max` (clamped when the field is left, like `min`), `help`, `error`, `hideLabel`, `ariaLabel` and `testId`, named like those of `ComboboxField`; without them nothing changes.
16
+ - `FilterBar`: with no filters (`filters` is `null`, `undefined` or `false`) the bar renders only its search field, at every width: below `md` it no longer draws the "Filtres" button nor opens an empty sheet, and from `md` up it no longer draws the inline filter container nor the "Réinitialiser" button. Without `search` either, it renders nothing. With filters nothing changes.
17
+ - `AppShell`: the `space` prop is optional. Without it no space selector is rendered (sidebar, rail or mobile drawer) and the top card is a plain product mark (icon and name, nothing opens); with `space` nothing changes.
18
+
3
19
  ## 17.2.1
4
20
 
5
21
  Fixes after the P5 #792 L0 re-review. No export removed, no signature changed.
package/README.md CHANGED
@@ -32,7 +32,7 @@ Le RUM navigateur d'un front (SDK `@abyss-project/monitor-browser`, peer `^1.3.2
32
32
  ```tsx
33
33
  <AbyssErrorBoundary appName="abyss-cloud">
34
34
  <AuthProvider client={authClient}>
35
- <AbyssCookieConsentProvider consentVersion={COOKIE_CONSENT_VERSION} isAuthenticated={isAuthenticated}>
35
+ <AbyssCookieConsentProvider consentVersion={CONSENT_VERSION} isAuthenticated={isAuthenticated}>
36
36
  <AbyssRumProvider config={buildRumOptions()}>
37
37
  <App />
38
38
  </AbyssRumProvider>
@@ -44,6 +44,7 @@ Le RUM navigateur d'un front (SDK `@abyss-project/monitor-browser`, peer `^1.3.2
44
44
  - **`config` est requise** (raison de la majeure 8.0.0 : aucun front ne peut oublier son RUM). `config={null}` désactive le RUM explicitement : rien n'est installé. Elle reçoit les options de `AbyssRum.init` (`apiUrl`, `proxyUrl`, `applicationId`, `token`, `release`, `instrumentedOrigins`, `routeResolver`…), sauf `consent`, que le provider fournit.
45
45
  - **Une seule initialisation.** `AbyssRum.init` est appelé au premier commit avec une `config` non nulle, une fois, StrictMode compris. Une `config` qui change ensuite est **ignorée** : le SDK vit autant que la page.
46
46
  - **Consentement.** Le replay exige la catégorie analytics de `AbyssCookieConsentProvider`, relue à chaque décision du SDK : un consentement donné ou retiré après le démarrage est suivi. Sans provider de consentement, analytics vaut refusé.
47
+ - **Un seul choix, six mois (#753, ADR-0261).** Le RUM est le seul traceur d'un front : plus de Google Analytics, de Tag Manager ni de Clarity. Le choix vit dans le cookie apex `abyssCookieConsent`, partagé avec la landing, valable `CONSENT_VALIDITY_DAYS` (183) jours ; `useAbyssCookieConsent().openPreferences()` rouvre les réglages (les menus de compte du core offrent « Gérer les cookies » sous le provider). Format, version et vecteurs d'or : `src/components/business/CookieConsent/README.md`.
47
48
  - **Acteur.** Sous `AuthProvider`, l'acteur de la session est l'id de l'utilisateur connecté, `null` à la déconnexion, inchangé pendant le chargement de la session. Sans `AuthProvider`, aucun acteur.
48
49
  - **`feedbackTicket`** (`intakeSlug`, `internalTicketSectionId`, `appName`, `sessionUrl(sessionId, offsetMs)`, `locale?()`) : chaque retour utilisateur enregistré par Monitor devient un ticket Internal Tickets, par l'intake public d'abyss-console (`fileInternalTicketIntake`, peer `@abyss-project/console` `^12.4.0`, configuré par `AbyssConsoleCore.setConfig` du front). Titre `[<appName>] Retour utilisateur` ; description : le message, l'e-mail, la route et le lien vers la session. Le déclarant est l'e-mail saisi, sinon celui de l'utilisateur connecté ; un retour anonyme sans e-mail ne crée aucun ticket et reste dans Monitor. Un échec de création est journalisé (`console.warn`) et avalé. `locale()` est relue à chaque retour : sa sous-étiquette primaire (`en-GB` → `en`) part comme `locale` de l'intake, la langue des courriels de suivi ; une langue que l'intake ne parle pas (hors `UserLanguage`) n'est pas envoyée.
49
50
  - **`onFeedbackSent`** : rappel du front, appelé pour chaque retour enregistré, après le ticket (créé, sauté ou en échec).
@@ -1,116 +1,120 @@
1
- import { dirname, resolve } from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { CATALOG_ENTRIES, CATALOG_THEMES } from './catalog-entries';
4
- import type { CatalogEntry, CatalogTheme } from './catalog-entries';
5
-
6
- // The package is an ES module: no `__dirname`.
7
- const catalogDir = dirname(fileURLToPath(import.meta.url));
8
-
9
- // Which screenshots the catalog produces, shared by `specs/captures.spec.ts` (takes them) and
10
- // `specs/write-capture-index.ts` (lists them in `index.md`).
11
-
12
- export const CAPTURES_DIR = resolve(
13
- catalogDir,
14
- '../../../e2e/screenshots/286/core',
15
- );
16
-
17
- export const DESKTOP_WIDTH = 1440;
18
- export const TABLET_WIDTH = 768;
19
- export const PHONE_WIDTH = 390;
20
-
21
- /** Viewport height per width: a laptop screen, a tablet held in portrait, a phone. */
22
- export const VIEWPORT_HEIGHT: Record<number, number> = {
23
- [DESKTOP_WIDTH]: 900,
24
- [TABLET_WIDTH]: 1024,
25
- [PHONE_WIDTH]: 844,
26
- };
27
-
28
- /** The pages also shown at tablet width: the shell turns into an icon rail there. */
29
- const TABLET_CAPTURES = new Set(['SceneDesktop', 'AppShell']);
30
-
31
- /** A state reached after arrival, captured under its own name. */
32
- export type CaptureState =
33
- | 'arrival'
34
- | 'sheet-open'
35
- | 'list-open'
36
- | 'calendar-open'
37
- | 'panel-open'
38
- | 'menu-open'
39
- | 'settings-open'
40
- | 'form-open'
41
- | 'secret-shown'
42
- | 'delete-confirm'
43
- | 'detail-open'
44
- | 'runs-open';
45
-
46
- /** File name suffix of each state. */
47
- const STATE_SUFFIX: Record<CaptureState, string> = {
48
- arrival: '',
49
- 'sheet-open': '-feuille',
50
- 'list-open': '-liste',
51
- 'calendar-open': '-calendrier',
52
- 'panel-open': '-ouvert',
53
- 'menu-open': '-ouvert',
54
- 'settings-open': '-reglages',
55
- 'form-open': '-formulaire',
56
- 'secret-shown': '-secret',
57
- 'delete-confirm': '-suppression',
58
- 'detail-open': '-detail',
59
- 'runs-open': '-executions',
60
- };
61
-
62
- /** The states shown beyond arrival: what a closed control hides (options, calendar, sheet). */
63
- const EXTRA_STATES: Record<string, CaptureState[]> = {
64
- SceneMobile: ['sheet-open'],
65
- RichSelect: ['list-open'],
66
- ComboboxField: ['list-open'],
67
- ExpressionSearch: ['list-open'],
68
- DateField: ['calendar-open'],
69
- NotificationsMenu: ['panel-open'],
70
- AccountMenu: ['panel-open'],
71
- ValueMenu: ['menu-open'],
72
- CookieConsent: ['settings-open'],
73
- // The panels of the delivery components: forms, secret shown once, confirms, detail, run history.
74
- DeliverySubscriptions: ['form-open', 'secret-shown', 'delete-confirm'],
75
- DeliveryHistory: ['detail-open'],
76
- ScheduledTasks: ['form-open', 'secret-shown', 'delete-confirm', 'runs-open'],
77
- };
78
-
79
- export interface Capture {
80
- entry: CatalogEntry;
81
- theme: CatalogTheme;
82
- width: number;
83
- state: CaptureState;
84
- file: string;
85
- }
86
-
87
- const widthsOf = (entry: CatalogEntry): number[] => [
88
- DESKTOP_WIDTH,
89
- ...(TABLET_CAPTURES.has(entry.name) ? [TABLET_WIDTH] : []),
90
- ...(entry.mobileCapture ? [PHONE_WIDTH] : []),
91
- ];
92
-
93
- const statesOf = (entry: CatalogEntry): CaptureState[] => {
94
- return ['arrival', ...(EXTRA_STATES[entry.name] ?? [])];
95
- };
96
-
97
- const fileName = (
98
- entry: CatalogEntry,
99
- theme: CatalogTheme,
100
- width: number,
101
- state: CaptureState,
102
- ) => `${entry.slug}${STATE_SUFFIX[state]}-${theme}-${width}.png`;
103
-
104
- export const CAPTURES: Capture[] = CATALOG_ENTRIES.flatMap((entry) =>
105
- statesOf(entry).flatMap((state) =>
106
- CATALOG_THEMES.flatMap((theme) =>
107
- widthsOf(entry).map((width) => ({
108
- entry,
109
- theme,
110
- width,
111
- state,
112
- file: fileName(entry, theme, width, state),
113
- })),
114
- ),
115
- ),
116
- );
1
+ import { dirname, resolve } from 'path';
2
+ import { fileURLToPath } from 'url';
3
+ import { CATALOG_ENTRIES, CATALOG_THEMES } from './catalog-entries';
4
+ import type { CatalogEntry, CatalogTheme } from './catalog-entries';
5
+
6
+ // The package is an ES module: no `__dirname`.
7
+ const catalogDir = dirname(fileURLToPath(import.meta.url));
8
+
9
+ // Which screenshots the catalog produces, shared by `specs/captures.spec.ts` (takes them) and
10
+ // `specs/write-capture-index.ts` (lists them in `index.md`).
11
+
12
+ export const CAPTURES_DIR = resolve(
13
+ catalogDir,
14
+ '../../../e2e/screenshots/286/core',
15
+ );
16
+
17
+ export const DESKTOP_WIDTH = 1440;
18
+ export const TABLET_WIDTH = 768;
19
+ export const PHONE_WIDTH = 390;
20
+
21
+ /** Viewport height per width: a laptop screen, a tablet held in portrait, a phone. */
22
+ export const VIEWPORT_HEIGHT: Record<number, number> = {
23
+ [DESKTOP_WIDTH]: 900,
24
+ [TABLET_WIDTH]: 1024,
25
+ [PHONE_WIDTH]: 844,
26
+ };
27
+
28
+ /** The pages also shown at tablet width: the shell turns into an icon rail there. */
29
+ const TABLET_CAPTURES = new Set([
30
+ 'SceneDesktop',
31
+ 'AppShell',
32
+ 'AppShellNoSpace',
33
+ ]);
34
+
35
+ /** A state reached after arrival, captured under its own name. */
36
+ export type CaptureState =
37
+ | 'arrival'
38
+ | 'sheet-open'
39
+ | 'list-open'
40
+ | 'calendar-open'
41
+ | 'panel-open'
42
+ | 'menu-open'
43
+ | 'settings-open'
44
+ | 'form-open'
45
+ | 'secret-shown'
46
+ | 'delete-confirm'
47
+ | 'detail-open'
48
+ | 'runs-open';
49
+
50
+ /** File name suffix of each state. */
51
+ const STATE_SUFFIX: Record<CaptureState, string> = {
52
+ arrival: '',
53
+ 'sheet-open': '-feuille',
54
+ 'list-open': '-liste',
55
+ 'calendar-open': '-calendrier',
56
+ 'panel-open': '-ouvert',
57
+ 'menu-open': '-ouvert',
58
+ 'settings-open': '-reglages',
59
+ 'form-open': '-formulaire',
60
+ 'secret-shown': '-secret',
61
+ 'delete-confirm': '-suppression',
62
+ 'detail-open': '-detail',
63
+ 'runs-open': '-executions',
64
+ };
65
+
66
+ /** The states shown beyond arrival: what a closed control hides (options, calendar, sheet). */
67
+ const EXTRA_STATES: Record<string, CaptureState[]> = {
68
+ SceneMobile: ['sheet-open'],
69
+ RichSelect: ['list-open'],
70
+ ComboboxField: ['list-open'],
71
+ ExpressionSearch: ['list-open'],
72
+ DateField: ['calendar-open'],
73
+ NotificationsMenu: ['panel-open'],
74
+ AccountMenu: ['panel-open'],
75
+ ValueMenu: ['menu-open'],
76
+ CookieConsent: ['settings-open'],
77
+ // The panels of the delivery components: forms, secret shown once, confirms, detail, run history.
78
+ DeliverySubscriptions: ['form-open', 'secret-shown', 'delete-confirm'],
79
+ DeliveryHistory: ['detail-open'],
80
+ ScheduledTasks: ['form-open', 'secret-shown', 'delete-confirm', 'runs-open'],
81
+ };
82
+
83
+ export interface Capture {
84
+ entry: CatalogEntry;
85
+ theme: CatalogTheme;
86
+ width: number;
87
+ state: CaptureState;
88
+ file: string;
89
+ }
90
+
91
+ const widthsOf = (entry: CatalogEntry): number[] => [
92
+ DESKTOP_WIDTH,
93
+ ...(TABLET_CAPTURES.has(entry.name) ? [TABLET_WIDTH] : []),
94
+ ...(entry.mobileCapture ? [PHONE_WIDTH] : []),
95
+ ];
96
+
97
+ const statesOf = (entry: CatalogEntry): CaptureState[] => {
98
+ return ['arrival', ...(EXTRA_STATES[entry.name] ?? [])];
99
+ };
100
+
101
+ const fileName = (
102
+ entry: CatalogEntry,
103
+ theme: CatalogTheme,
104
+ width: number,
105
+ state: CaptureState,
106
+ ) => `${entry.slug}${STATE_SUFFIX[state]}-${theme}-${width}.png`;
107
+
108
+ export const CAPTURES: Capture[] = CATALOG_ENTRIES.flatMap((entry) =>
109
+ statesOf(entry).flatMap((state) =>
110
+ CATALOG_THEMES.flatMap((theme) =>
111
+ widthsOf(entry).map((width) => ({
112
+ entry,
113
+ theme,
114
+ width,
115
+ state,
116
+ file: fileName(entry, theme, width, state),
117
+ })),
118
+ ),
119
+ ),
120
+ );
@@ -1,148 +1,149 @@
1
- import { ThemeMode } from '../src/theme/tokens/primitives';
2
-
3
- // The catalog pages, as plain data: read by the browser entry (`main.tsx`) and by the Playwright
4
- // specs, which run in Node and must not load React or MUI.
5
-
6
- export type CatalogFamily =
7
- | 'scenes'
8
- | 'structure'
9
- | 'mobile'
10
- | 'states'
11
- | 'data'
12
- | 'meaning'
13
- | 'business'
14
- | 'layers'
15
- | 'navigation'
16
- | 'inputs';
17
-
18
- export interface CatalogEntry {
19
- /** Value of the `component` URL parameter. */
20
- name: string;
21
- family: CatalogFamily;
22
- /** Base name of the screenshots: `<slug>-<theme>-<width>.png`. */
23
- slug: string;
24
- /** Checked by `responsive.spec.ts` at 360, 768 and 1440 px: the pages that change form below 768 px. */
25
- responsive: boolean;
26
- /** Also captured at 390 px: the page changes form below 768 px. */
27
- mobileCapture: boolean;
28
- }
29
-
30
- const entry = (
31
- name: string,
32
- family: CatalogFamily,
33
- slug: string,
34
- options: { responsive?: boolean; mobileCapture?: boolean } = {},
35
- ): CatalogEntry => ({
36
- name,
37
- family,
38
- slug,
39
- responsive: options.responsive ?? false,
40
- mobileCapture: options.mobileCapture ?? false,
41
- });
42
-
43
- const RESPONSIVE = { responsive: true, mobileCapture: true };
44
-
45
- export const CATALOG_ENTRIES: CatalogEntry[] = [
46
- entry('SceneDesktop', 'scenes', 'scene-bureau', RESPONSIVE),
47
- entry('SceneMobile', 'scenes', 'scene-mobile', RESPONSIVE),
48
- entry('AppShell', 'structure', 'app-shell', RESPONSIVE),
49
- entry('PageHeader', 'structure', 'page-header', RESPONSIVE),
50
- entry('Section', 'structure', 'section', RESPONSIVE),
51
- entry('Surface', 'structure', 'surface', RESPONSIVE),
52
- entry('Toolbar', 'structure', 'toolbar', RESPONSIVE),
53
- entry('FilterBar', 'structure', 'filter-bar', RESPONSIVE),
54
- entry('SplitView', 'structure', 'split-view', RESPONSIVE),
55
- entry('Tabs', 'structure', 'tabs', RESPONSIVE),
56
- entry('Accordion', 'structure', 'accordion', RESPONSIVE),
57
- entry('AmbientBackground', 'structure', 'ambient-background', {
58
- mobileCapture: true,
59
- }),
60
- entry('NotificationsMenu', 'structure', 'notifications-menu', {
61
- mobileCapture: true,
62
- }),
63
- entry('AccountMenu', 'structure', 'account-menu'),
64
- entry('Breadcrumbs', 'navigation', 'breadcrumbs', RESPONSIVE),
65
- entry('MobileShell', 'mobile', 'mobile-shell', RESPONSIVE),
66
- entry('BottomSheet', 'mobile', 'bottom-sheet', RESPONSIVE),
67
- entry('ActionBar', 'mobile', 'action-bar', RESPONSIVE),
68
- entry('SwipeDeck', 'mobile', 'swipe-deck', RESPONSIVE),
69
- entry('PageState', 'states', 'page-state', { mobileCapture: true }),
70
- entry('Callout', 'states', 'callout', RESPONSIVE),
71
- entry('ErrorBoundary', 'states', 'error-boundary', { mobileCapture: true }),
72
- entry('DataTable', 'data', 'data-table', RESPONSIVE),
73
- entry('KeyValueList', 'data', 'key-value-list'),
74
- entry('StatTile', 'data', 'stat-tile'),
75
- entry('Sparkline', 'data', 'sparkline'),
76
- entry('Pagination', 'data', 'pagination', RESPONSIVE),
77
- entry('LineChart', 'data', 'line-chart'),
78
- entry('BarChart', 'data', 'bar-chart'),
79
- entry('ChartTheme', 'data', 'chart-theme'),
80
- entry('UsageMeter', 'data', 'usage-meter'),
81
- entry('FacetPanel', 'data', 'facet-panel', { mobileCapture: true }),
82
- entry('StatusBadge', 'meaning', 'status-badge'),
83
- entry('MethodBadge', 'meaning', 'method-badge'),
84
- entry('SeverityBadge', 'meaning', 'severity-badge'),
85
- entry('ScanBadge', 'meaning', 'scan-badge'),
86
- entry('RoleBadge', 'meaning', 'role-badge'),
87
- entry('ToolIcon', 'meaning', 'tool-icon'),
88
- entry('ValueMenu', 'meaning', 'value-menu', { mobileCapture: true }),
89
- entry('Avatar', 'meaning', 'avatar'),
90
- entry('AvatarGroup', 'meaning', 'avatar-group'),
91
- entry('TeamAvatar', 'meaning', 'team-avatar'),
92
- entry('InfectedDownloadModal', 'business', 'infected-download-modal'),
93
- entry('CloudImport', 'business', 'cloud-import', RESPONSIVE),
94
- entry(
95
- 'DeliverySubscriptions',
96
- 'business',
97
- 'delivery-subscriptions',
98
- RESPONSIVE,
99
- ),
100
- entry('DeliveryHistory', 'business', 'delivery-history', RESPONSIVE),
101
- entry('ScheduledTasks', 'business', 'scheduled-tasks', RESPONSIVE),
102
- entry('ImportFromCloudModal', 'business', 'import-from-cloud-modal', {
103
- mobileCapture: true,
104
- }),
105
- entry('QRCodeModal', 'business', 'qr-code-modal', { mobileCapture: true }),
106
- entry('CookieConsent', 'business', 'cookie-consent', {
107
- mobileCapture: true,
108
- }),
109
- entry('Modal', 'layers', 'modal', { mobileCapture: true }),
110
- entry('ConfirmDialog', 'layers', 'confirm-dialog'),
111
- entry('ConfirmDialogWarning', 'layers', 'confirm-dialog-warning'),
112
- entry('Drawer', 'layers', 'drawer'),
113
- entry('PreviewDrawer', 'layers', 'preview-drawer', { mobileCapture: true }),
114
- entry('Menu', 'layers', 'menu'),
115
- entry('AnchoredPanel', 'layers', 'anchored-panel', { mobileCapture: true }),
116
- entry('Toast', 'layers', 'toast', { mobileCapture: true }),
117
- entry('CommandPalette', 'layers', 'command-palette'),
118
- entry('ProductTour', 'layers', 'product-tour', { mobileCapture: true }),
119
- entry('RichSelect', 'inputs', 'rich-select'),
120
- entry('DateField', 'inputs', 'date-field'),
121
- entry('DateRangeField', 'inputs', 'date-range-field'),
122
- entry('ColorField', 'inputs', 'color-field'),
123
- entry('SegmentedControl', 'inputs', 'segmented-control'),
124
- entry('FormField', 'inputs', 'form-field'),
125
- entry('PasswordField', 'inputs', 'password-field', RESPONSIVE),
126
- entry('NumberField', 'inputs', 'number-field'),
127
- entry('SettingsRow', 'inputs', 'settings-row', RESPONSIVE),
128
- entry('CopyField', 'inputs', 'copy-field', RESPONSIVE),
129
- entry('ComboboxField', 'inputs', 'combobox-field', RESPONSIVE),
130
- entry('UserPicker', 'inputs', 'user-picker', RESPONSIVE),
131
- entry('CompanySearchField', 'inputs', 'company-search-field', RESPONSIVE),
132
- entry('EntityImageField', 'inputs', 'entity-image-field', RESPONSIVE),
133
- entry('ContextSelector', 'inputs', 'context-selector', RESPONSIVE),
134
- entry('DropZone', 'inputs', 'drop-zone', RESPONSIVE),
135
- entry('ImportButton', 'inputs', 'import-button'),
136
- entry('MarkdownEditor', 'inputs', 'markdown-editor', RESPONSIVE),
137
- entry('PdfEditor', 'inputs', 'pdf-editor', RESPONSIVE),
138
- entry('ExpressionSearch', 'inputs', 'expression-search', {
139
- mobileCapture: true,
140
- }),
141
- ];
142
-
143
- export const CATALOG_THEMES = [ThemeMode.Dark, ThemeMode.Light] as const;
144
- export type CatalogTheme = (typeof CATALOG_THEMES)[number];
145
-
146
- /** Path of a catalog page, relative to the catalog server. */
147
- export const catalogPath = (name: string, theme: CatalogTheme): string =>
148
- `/?component=${encodeURIComponent(name)}&theme=${theme}`;
1
+ import { ThemeMode } from '../src/theme/tokens/primitives';
2
+
3
+ // The catalog pages, as plain data: read by the browser entry (`main.tsx`) and by the Playwright
4
+ // specs, which run in Node and must not load React or MUI.
5
+
6
+ export type CatalogFamily =
7
+ | 'scenes'
8
+ | 'structure'
9
+ | 'mobile'
10
+ | 'states'
11
+ | 'data'
12
+ | 'meaning'
13
+ | 'business'
14
+ | 'layers'
15
+ | 'navigation'
16
+ | 'inputs';
17
+
18
+ export interface CatalogEntry {
19
+ /** Value of the `component` URL parameter. */
20
+ name: string;
21
+ family: CatalogFamily;
22
+ /** Base name of the screenshots: `<slug>-<theme>-<width>.png`. */
23
+ slug: string;
24
+ /** Checked by `responsive.spec.ts` at 360, 768 and 1440 px: the pages that change form below 768 px. */
25
+ responsive: boolean;
26
+ /** Also captured at 390 px: the page changes form below 768 px. */
27
+ mobileCapture: boolean;
28
+ }
29
+
30
+ const entry = (
31
+ name: string,
32
+ family: CatalogFamily,
33
+ slug: string,
34
+ options: { responsive?: boolean; mobileCapture?: boolean } = {},
35
+ ): CatalogEntry => ({
36
+ name,
37
+ family,
38
+ slug,
39
+ responsive: options.responsive ?? false,
40
+ mobileCapture: options.mobileCapture ?? false,
41
+ });
42
+
43
+ const RESPONSIVE = { responsive: true, mobileCapture: true };
44
+
45
+ export const CATALOG_ENTRIES: CatalogEntry[] = [
46
+ entry('SceneDesktop', 'scenes', 'scene-bureau', RESPONSIVE),
47
+ entry('SceneMobile', 'scenes', 'scene-mobile', RESPONSIVE),
48
+ entry('AppShell', 'structure', 'app-shell', RESPONSIVE),
49
+ entry('AppShellNoSpace', 'structure', 'app-shell-sans-espace', RESPONSIVE),
50
+ entry('PageHeader', 'structure', 'page-header', RESPONSIVE),
51
+ entry('Section', 'structure', 'section', RESPONSIVE),
52
+ entry('Surface', 'structure', 'surface', RESPONSIVE),
53
+ entry('Toolbar', 'structure', 'toolbar', RESPONSIVE),
54
+ entry('FilterBar', 'structure', 'filter-bar', RESPONSIVE),
55
+ entry('SplitView', 'structure', 'split-view', RESPONSIVE),
56
+ entry('Tabs', 'structure', 'tabs', RESPONSIVE),
57
+ entry('Accordion', 'structure', 'accordion', RESPONSIVE),
58
+ entry('AmbientBackground', 'structure', 'ambient-background', {
59
+ mobileCapture: true,
60
+ }),
61
+ entry('NotificationsMenu', 'structure', 'notifications-menu', {
62
+ mobileCapture: true,
63
+ }),
64
+ entry('AccountMenu', 'structure', 'account-menu'),
65
+ entry('Breadcrumbs', 'navigation', 'breadcrumbs', RESPONSIVE),
66
+ entry('MobileShell', 'mobile', 'mobile-shell', RESPONSIVE),
67
+ entry('BottomSheet', 'mobile', 'bottom-sheet', RESPONSIVE),
68
+ entry('ActionBar', 'mobile', 'action-bar', RESPONSIVE),
69
+ entry('SwipeDeck', 'mobile', 'swipe-deck', RESPONSIVE),
70
+ entry('PageState', 'states', 'page-state', { mobileCapture: true }),
71
+ entry('Callout', 'states', 'callout', RESPONSIVE),
72
+ entry('ErrorBoundary', 'states', 'error-boundary', { mobileCapture: true }),
73
+ entry('DataTable', 'data', 'data-table', RESPONSIVE),
74
+ entry('KeyValueList', 'data', 'key-value-list'),
75
+ entry('StatTile', 'data', 'stat-tile'),
76
+ entry('Sparkline', 'data', 'sparkline'),
77
+ entry('Pagination', 'data', 'pagination', RESPONSIVE),
78
+ entry('LineChart', 'data', 'line-chart'),
79
+ entry('BarChart', 'data', 'bar-chart'),
80
+ entry('ChartTheme', 'data', 'chart-theme'),
81
+ entry('UsageMeter', 'data', 'usage-meter'),
82
+ entry('FacetPanel', 'data', 'facet-panel', { mobileCapture: true }),
83
+ entry('StatusBadge', 'meaning', 'status-badge'),
84
+ entry('MethodBadge', 'meaning', 'method-badge'),
85
+ entry('SeverityBadge', 'meaning', 'severity-badge'),
86
+ entry('ScanBadge', 'meaning', 'scan-badge'),
87
+ entry('RoleBadge', 'meaning', 'role-badge'),
88
+ entry('ToolIcon', 'meaning', 'tool-icon'),
89
+ entry('ValueMenu', 'meaning', 'value-menu', { mobileCapture: true }),
90
+ entry('Avatar', 'meaning', 'avatar'),
91
+ entry('AvatarGroup', 'meaning', 'avatar-group'),
92
+ entry('TeamAvatar', 'meaning', 'team-avatar'),
93
+ entry('InfectedDownloadModal', 'business', 'infected-download-modal'),
94
+ entry('CloudImport', 'business', 'cloud-import', RESPONSIVE),
95
+ entry(
96
+ 'DeliverySubscriptions',
97
+ 'business',
98
+ 'delivery-subscriptions',
99
+ RESPONSIVE,
100
+ ),
101
+ entry('DeliveryHistory', 'business', 'delivery-history', RESPONSIVE),
102
+ entry('ScheduledTasks', 'business', 'scheduled-tasks', RESPONSIVE),
103
+ entry('ImportFromCloudModal', 'business', 'import-from-cloud-modal', {
104
+ mobileCapture: true,
105
+ }),
106
+ entry('QRCodeModal', 'business', 'qr-code-modal', { mobileCapture: true }),
107
+ entry('CookieConsent', 'business', 'cookie-consent', {
108
+ mobileCapture: true,
109
+ }),
110
+ entry('Modal', 'layers', 'modal', { mobileCapture: true }),
111
+ entry('ConfirmDialog', 'layers', 'confirm-dialog'),
112
+ entry('ConfirmDialogWarning', 'layers', 'confirm-dialog-warning'),
113
+ entry('Drawer', 'layers', 'drawer'),
114
+ entry('PreviewDrawer', 'layers', 'preview-drawer', { mobileCapture: true }),
115
+ entry('Menu', 'layers', 'menu'),
116
+ entry('AnchoredPanel', 'layers', 'anchored-panel', { mobileCapture: true }),
117
+ entry('Toast', 'layers', 'toast', { mobileCapture: true }),
118
+ entry('CommandPalette', 'layers', 'command-palette'),
119
+ entry('ProductTour', 'layers', 'product-tour', { mobileCapture: true }),
120
+ entry('RichSelect', 'inputs', 'rich-select'),
121
+ entry('DateField', 'inputs', 'date-field'),
122
+ entry('DateRangeField', 'inputs', 'date-range-field'),
123
+ entry('ColorField', 'inputs', 'color-field'),
124
+ entry('SegmentedControl', 'inputs', 'segmented-control'),
125
+ entry('FormField', 'inputs', 'form-field'),
126
+ entry('PasswordField', 'inputs', 'password-field', RESPONSIVE),
127
+ entry('NumberField', 'inputs', 'number-field'),
128
+ entry('SettingsRow', 'inputs', 'settings-row', RESPONSIVE),
129
+ entry('CopyField', 'inputs', 'copy-field', RESPONSIVE),
130
+ entry('ComboboxField', 'inputs', 'combobox-field', RESPONSIVE),
131
+ entry('UserPicker', 'inputs', 'user-picker', RESPONSIVE),
132
+ entry('CompanySearchField', 'inputs', 'company-search-field', RESPONSIVE),
133
+ entry('EntityImageField', 'inputs', 'entity-image-field', RESPONSIVE),
134
+ entry('ContextSelector', 'inputs', 'context-selector', RESPONSIVE),
135
+ entry('DropZone', 'inputs', 'drop-zone', RESPONSIVE),
136
+ entry('ImportButton', 'inputs', 'import-button'),
137
+ entry('MarkdownEditor', 'inputs', 'markdown-editor', RESPONSIVE),
138
+ entry('PdfEditor', 'inputs', 'pdf-editor', RESPONSIVE),
139
+ entry('ExpressionSearch', 'inputs', 'expression-search', {
140
+ mobileCapture: true,
141
+ }),
142
+ ];
143
+
144
+ export const CATALOG_THEMES = [ThemeMode.Dark, ThemeMode.Light] as const;
145
+ export type CatalogTheme = (typeof CATALOG_THEMES)[number];
146
+
147
+ /** Path of a catalog page, relative to the catalog server. */
148
+ export const catalogPath = (name: string, theme: CatalogTheme): string =>
149
+ `/?component=${encodeURIComponent(name)}&theme=${theme}`;
@@ -20,7 +20,7 @@ import {
20
20
  import { AccountCard, SHELL_FOOTER, TopbarActions } from '../parts';
21
21
 
22
22
  /** The shell alone, with the Banking navigation and a saved filter named by one unbroken word. */
23
- export const AppShellPage = () => {
23
+ const AppShellDemo = ({ withSpace }: { withSpace: boolean }) => {
24
24
  const { log } = useEventLog();
25
25
  const [spaceId, setSpaceId] = useState(SPACES[0].id);
26
26
  const current = SPACES.find((space) => space.id === spaceId) ?? SPACES[0];
@@ -33,14 +33,18 @@ export const AppShellPage = () => {
33
33
  name: 'Banking',
34
34
  icon: <ToolIcon tool={ToolKind.Banking} size={24} />,
35
35
  }}
36
- space={{
37
- current,
38
- spaces: SPACES,
39
- onChange: (id) => {
40
- setSpaceId(id);
41
- log(`espace ${id}`);
42
- },
43
- }}
36
+ space={
37
+ withSpace
38
+ ? {
39
+ current,
40
+ spaces: SPACES,
41
+ onChange: (id) => {
42
+ setSpaceId(id);
43
+ log(`espace ${id}`);
44
+ },
45
+ }
46
+ : undefined
47
+ }
44
48
  nav={BANKING_NAV_WITH_LONG_LABEL}
45
49
  activeItemId="home"
46
50
  mainSpaceLink={{ href: '#abyss', label: 'Mon espace Abyss' }}
@@ -93,3 +97,8 @@ export const AppShellPage = () => {
93
97
  </AppShell>
94
98
  );
95
99
  };
100
+
101
+ export const AppShellPage = () => <AppShellDemo withSpace />;
102
+
103
+ /** The same shell without `space` (the back-office): the product mark, no selector. */
104
+ export const AppShellNoSpacePage = () => <AppShellDemo withSpace={false} />;