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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,88 +1,92 @@
1
- # Changelog — @abyss-project/commons-front-core
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
-
19
- ## 17.2.1
20
-
21
- Fixes after the P5 #792 L0 re-review. No export removed, no signature changed.
22
-
23
- - `DeliveryHistory`: the duration in the delivery detail has its own label (`deliveries.history.detail.duration`, « Durée » / « Duration ») instead of reusing « Livrée ».
24
- - `deliveries.duration-ms` formats the number (`{value, number} ms`): 30000 renders « 30 000 ms » in French, « 30,000 ms » in English.
25
- - `DeliverySubscriptions`: the URL column minimum width goes from 220 to 160 px; the table was 1120 px wide in a 1100 px frame and the row menu of each row was cut off (found by the new responsive assertion).
26
- - Tests: the Deliveries specs assert the label and the formatted duration; the catalogue responsive spec asserts that the actions button and the state badge of every row of `DeliverySubscriptions`, `DeliveryHistory` and `ScheduledTasks` sit inside their container at 1440 and 390 px, and that the badge text fits its background.
27
-
28
- ## 17.2.0
29
-
30
- Additions only (P5 #792, ADR-0257 decision 11). No export removed, no signature changed.
31
-
32
- - `DeliverySubscriptions`, `DeliveryHistory` and `ScheduledTasks` (`business`, `components/business/Deliveries/README.md`): the delivery subscriptions, the delivery history (detail and replay) and the scheduled tasks of AbyssFlow, fed by props that return promises. Translations `deliveries.*` (FR and EN).
33
- - `@abyss-project/flow` becomes an optional peer dependency (`^1.2.0`, the version that ships the delivery models), imported as types only: a host that does not use these components does not install it.
34
- - `@abyss-project/main` is resolved to 32.0.0 (P5 #792: Flow permissions, webhook delivery metric, signature helper).
35
-
36
- ## 17.1.0
37
-
38
- No export removed, no signature changed (card #286, toasts of the satellites).
39
-
40
- **Migration required.** A consumer that keeps the react-toastify `ToastContainer` and does not mount the core's `ToastProvider` no longer sees the errors of `toastErrorUnlessQuotaRefusal`, `toastErrorUnlessAnyQuotaRefusal`, `CloudImport`, `DropZone` and `ProjectLinkSelector`: they now go to the core's `toast`, which only a mounted `ToastProvider` displays. Mount `ToastProvider` and move your own calls to the core's `toast`.
41
-
42
- - `toastErrorUnlessQuotaRefusal`, `toastErrorUnlessAnyQuotaRefusal` and the legacy `CloudImport`, `DropZone` and `ProjectLinkSelector` show their errors through the core's `toast`: they appear in the mounted `ToastProvider`, no longer in a react-toastify `ToastContainer`.
43
- - `react-toastify` is no longer a peer dependency (nor external in the build): nothing in the package imports it any more. A consumer that mounts `ToastProvider` and no longer imports it can drop it from its `package.json`. A guard (`src/design-system-toasts.spec.ts`) keeps it out of `src/` and `catalog/`.
44
-
45
- ## 17.0.0
46
-
47
- Breaking (card #286 M6): `AbyssToast` is removed from `./legacy`. Mount `ToastProvider` and call the core's `toast`. `react-toastify` stays a peer dependency while the satellites use it. In 17.0.x, a satellite that moves without migrating keeps its react-toastify `ToastContainer` and only loses the `AbyssToast` styling; from 17.1.0 it must mount `ToastProvider` (see below).
48
-
49
- - `@abyss-project/main` is resolved to 31.1.0 (P4b #783, workflows in AbyssFlow).
50
-
51
- ## 16.1.1
52
-
53
- No export or signature changed (card #782).
54
-
55
- - MUI icons are imported one by one (`@mui/icons-material/<Icon>`) in `legacy/` and the design theme: the published `dist/legacy.js` and `dist/design-theme-*.js` no longer import the `@mui/icons-material` barrel (~10 000 modules), which every vitest test file of a consumer loaded again. Measured: importing `dist/legacy.js` 33-41 s -> 9 s, the design theme 22-25 s -> 4 s.
56
- - ESLint `@typescript-eslint/no-restricted-imports` forbids the barrel in this package (type imports allowed).
57
- - `load-safety.spec.ts` no longer mocks the barrel.
58
-
59
- ## 16.1.0
60
-
61
- Additions only (card #227, lot D2, ADR-0248). No export removed, no signature changed.
62
-
63
- ### Motion
64
-
65
- - `motion.enter` / `motion.exit`, `Appear`, `AppearList` (props `enter`, `exit`, `itemSx`) and `useAddedKeys` (`src/motion/README.md`): items added after the first render fade in with a 4 px rise, removed ones fade out; nothing is animated at the first render. The animation sits on a wrapper, so an inline `transform` (dnd-kit) is kept.
66
- - `transitionOf` is exported.
67
- - `DataTable` gains `animateAdded`.
68
-
69
- ### Reduced motion, global
70
-
71
- - `createAbyssTheme(mode, { reducedMotion })` (and the legacy `createAbyssTheme(mode, { reducedMotion })`) sets every duration of the theme to 0. `AbyssThemeProvider` follows `prefers-reduced-motion: reduce`; `DesignCssVariables` writes the rule that sets `--abyss-duration-*` to `0ms`. Visible effect on every front that takes this version: no motion when the system asks for reduced motion. A legacy host has to read `REDUCED_MOTION_QUERY` and pass the option.
72
-
73
- ### File drop
74
-
75
- - `useFileDropTarget` (reacts only to a drag that carries files, the innermost target wins) and `DropTargetOverlay` (README), label `ds.inputs.drop-target.label`.
76
- - `MarkdownEditor` takes a `ref`: `MarkdownEditorHandle.appendFiles(files)` adds files at the end of the document.
77
-
78
- ## 16.0.0
79
-
80
- ### Feedback intake moves from Console to Workspace (P4a, D25)
81
-
82
- - `fileInternalTicketIntake` (Internal Tickets, `@abyss-project/console`) is replaced by `fileDeskIntake`
83
- (Desk, `@abyss-project/workspace`). The RUM feedback of `AbyssRumProvider` is filed on
84
- `/public/desk/intake/:slug` of AbyssWorkspace.
85
- - `AbyssRumFeedbackTicket.internalTicketSectionId` is renamed `deskSectionId`.
86
- - `@abyss-project/console` is no longer a peer dependency nor a dev dependency of the package.
87
- - `@abyss-project/workspace` `^4.6.0` is now a peer dependency. A front that enables the RUM feedback
88
- must call `AbyssWorkspaceCore.setConfig` with its `VITE_ABYSS_WORKSPACE_URL_API`.
1
+ # Changelog — @abyss-project/commons-front-core
2
+
3
+ ## 18.1.1
4
+
5
+ - **Fix #747: the cookie banner no longer covers the main button of a modal whose surface creates a containing block** (the `backdrop-filter` of the legacy theme's dialog paper, but also `filter`, `transform`, `contain: paint`, `will-change: transform`, `container-type`...). The banner, `position: fixed`, stuck to the bottom of that surface instead of the window, over « Suivant ». While the surface hosts the banner, the properties a stylesheet gives to the surface and to its ancestors up to the modal root that create such a block are switched off by an inline style (properties an element carries inline, such as the translate of a sheet being dragged or the exit transform of a drawer, are never touched), and that style is removed when the banner leaves or the modal closes. Visible cost: the surface loses the blur or the filter, and an `@container` query defined on it or on an ancestor stops applying, for as long as the banner is shown in it. No API change; a front gets it by upgrading.
6
+
7
+ ## 18.0.0
8
+
9
+ 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.
10
+
11
+ - **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.
12
+ - **`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`).
13
+ - **`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.
14
+ - **« Gérer les cookies »** (`cookies.action.manage`) in `AccountMenu` and in `AbyssLayoutMenu` (`./legacy`) under an `AbyssCookieConsentProvider`.
15
+ - **#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.
16
+ - A choice stored in the account that is of another version or older than six months no longer silences the banner.
17
+ - Banner texts (FR, EN): no third-party tracker is named; audience measurement is the Abyss usage tracking.
18
+ - Card #286 (admin):
19
+ - `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.
20
+ - `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.
21
+ - `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.
22
+
23
+ ## 17.2.1
24
+
25
+ Fixes after the P5 #792 L0 re-review. No export removed, no signature changed.
26
+
27
+ - `DeliveryHistory`: the duration in the delivery detail has its own label (`deliveries.history.detail.duration`, « Durée » / « Duration ») instead of reusing « Livrée ».
28
+ - `deliveries.duration-ms` formats the number (`{value, number} ms`): 30000 renders « 30 000 ms » in French, « 30,000 ms » in English.
29
+ - `DeliverySubscriptions`: the URL column minimum width goes from 220 to 160 px; the table was 1120 px wide in a 1100 px frame and the row menu of each row was cut off (found by the new responsive assertion).
30
+ - Tests: the Deliveries specs assert the label and the formatted duration; the catalogue responsive spec asserts that the actions button and the state badge of every row of `DeliverySubscriptions`, `DeliveryHistory` and `ScheduledTasks` sit inside their container at 1440 and 390 px, and that the badge text fits its background.
31
+
32
+ ## 17.2.0
33
+
34
+ Additions only (P5 #792, ADR-0257 decision 11). No export removed, no signature changed.
35
+
36
+ - `DeliverySubscriptions`, `DeliveryHistory` and `ScheduledTasks` (`business`, `components/business/Deliveries/README.md`): the delivery subscriptions, the delivery history (detail and replay) and the scheduled tasks of AbyssFlow, fed by props that return promises. Translations `deliveries.*` (FR and EN).
37
+ - `@abyss-project/flow` becomes an optional peer dependency (`^1.2.0`, the version that ships the delivery models), imported as types only: a host that does not use these components does not install it.
38
+ - `@abyss-project/main` is resolved to 32.0.0 (P5 #792: Flow permissions, webhook delivery metric, signature helper).
39
+
40
+ ## 17.1.0
41
+
42
+ No export removed, no signature changed (card #286, toasts of the satellites).
43
+
44
+ **Migration required.** A consumer that keeps the react-toastify `ToastContainer` and does not mount the core's `ToastProvider` no longer sees the errors of `toastErrorUnlessQuotaRefusal`, `toastErrorUnlessAnyQuotaRefusal`, `CloudImport`, `DropZone` and `ProjectLinkSelector`: they now go to the core's `toast`, which only a mounted `ToastProvider` displays. Mount `ToastProvider` and move your own calls to the core's `toast`.
45
+
46
+ - `toastErrorUnlessQuotaRefusal`, `toastErrorUnlessAnyQuotaRefusal` and the legacy `CloudImport`, `DropZone` and `ProjectLinkSelector` show their errors through the core's `toast`: they appear in the mounted `ToastProvider`, no longer in a react-toastify `ToastContainer`.
47
+ - `react-toastify` is no longer a peer dependency (nor external in the build): nothing in the package imports it any more. A consumer that mounts `ToastProvider` and no longer imports it can drop it from its `package.json`. A guard (`src/design-system-toasts.spec.ts`) keeps it out of `src/` and `catalog/`.
48
+
49
+ ## 17.0.0
50
+
51
+ Breaking (card #286 M6): `AbyssToast` is removed from `./legacy`. Mount `ToastProvider` and call the core's `toast`. `react-toastify` stays a peer dependency while the satellites use it. In 17.0.x, a satellite that moves without migrating keeps its react-toastify `ToastContainer` and only loses the `AbyssToast` styling; from 17.1.0 it must mount `ToastProvider` (see below).
52
+
53
+ - `@abyss-project/main` is resolved to 31.1.0 (P4b #783, workflows in AbyssFlow).
54
+
55
+ ## 16.1.1
56
+
57
+ No export or signature changed (card #782).
58
+
59
+ - MUI icons are imported one by one (`@mui/icons-material/<Icon>`) in `legacy/` and the design theme: the published `dist/legacy.js` and `dist/design-theme-*.js` no longer import the `@mui/icons-material` barrel (~10 000 modules), which every vitest test file of a consumer loaded again. Measured: importing `dist/legacy.js` 33-41 s -> 9 s, the design theme 22-25 s -> 4 s.
60
+ - ESLint `@typescript-eslint/no-restricted-imports` forbids the barrel in this package (type imports allowed).
61
+ - `load-safety.spec.ts` no longer mocks the barrel.
62
+
63
+ ## 16.1.0
64
+
65
+ Additions only (card #227, lot D2, ADR-0248). No export removed, no signature changed.
66
+
67
+ ### Motion
68
+
69
+ - `motion.enter` / `motion.exit`, `Appear`, `AppearList` (props `enter`, `exit`, `itemSx`) and `useAddedKeys` (`src/motion/README.md`): items added after the first render fade in with a 4 px rise, removed ones fade out; nothing is animated at the first render. The animation sits on a wrapper, so an inline `transform` (dnd-kit) is kept.
70
+ - `transitionOf` is exported.
71
+ - `DataTable` gains `animateAdded`.
72
+
73
+ ### Reduced motion, global
74
+
75
+ - `createAbyssTheme(mode, { reducedMotion })` (and the legacy `createAbyssTheme(mode, { reducedMotion })`) sets every duration of the theme to 0. `AbyssThemeProvider` follows `prefers-reduced-motion: reduce`; `DesignCssVariables` writes the rule that sets `--abyss-duration-*` to `0ms`. Visible effect on every front that takes this version: no motion when the system asks for reduced motion. A legacy host has to read `REDUCED_MOTION_QUERY` and pass the option.
76
+
77
+ ### File drop
78
+
79
+ - `useFileDropTarget` (reacts only to a drag that carries files, the innermost target wins) and `DropTargetOverlay` (README), label `ds.inputs.drop-target.label`.
80
+ - `MarkdownEditor` takes a `ref`: `MarkdownEditorHandle.appendFiles(files)` adds files at the end of the document.
81
+
82
+ ## 16.0.0
83
+
84
+ ### Feedback intake moves from Console to Workspace (P4a, D25)
85
+
86
+ - `fileInternalTicketIntake` (Internal Tickets, `@abyss-project/console`) is replaced by `fileDeskIntake`
87
+ (Desk, `@abyss-project/workspace`). The RUM feedback of `AbyssRumProvider` is filed on
88
+ `/public/desk/intake/:slug` of AbyssWorkspace.
89
+ - `AbyssRumFeedbackTicket.internalTicketSectionId` is renamed `deskSectionId`.
90
+ - `@abyss-project/console` is no longer a peer dependency nor a dev dependency of the package.
91
+ - `@abyss-project/workspace` `^4.6.0` is now a peer dependency. A front that enables the RUM feedback
92
+ must call `AbyssWorkspaceCore.setConfig` with its `VITE_ABYSS_WORKSPACE_URL_API`.
@@ -1,61 +1,112 @@
1
- import { useState } from 'react';
2
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
- import Button from '@mui/material/Button';
4
- import { AbyssCookieConsentProvider } from '../../src/components/business/CookieConsent/AbyssCookieConsentProvider';
5
- import { Drawer } from '../../src/components/layers/Drawer/Drawer';
6
- import { Modal } from '../../src/components/layers/Modal/Modal';
7
- import { clearCookie } from '../../src/utils/cookie-storage.utils';
8
- import { CONSENT_VERSION } from '../../src/utils/cookie-consent-contract';
9
- import { Example, Showcase } from '../frame';
10
-
11
- const queryClient = new QueryClient();
12
-
13
- /** The real provider and banner, on the page: a visitor who has not chosen yet sees the banner. */
14
- export const CookieConsentPage = () => {
15
- // A choice made in an earlier visit of the catalog would hide the banner this page shows.
16
- useState(() => clearCookie({}));
17
- const [wizardOpen, setWizardOpen] = useState(false);
18
- const [drawerOpen, setDrawerOpen] = useState(false);
19
- return (
20
- <QueryClientProvider client={queryClient}>
21
- <AbyssCookieConsentProvider
22
- consentVersion={CONSENT_VERSION}
23
- isAuthenticated={false}
24
- >
25
- <Showcase
26
- family="Métier"
27
- name="CookieConsent"
28
- description="Bandeau de consentement en bas à droite (pleine largeur sous 768 px) : accepter et refuser pèsent autant ; « Personnaliser » ouvre la fenêtre de réglages, et le bandeau s'efface tant qu'elle est ouverte. Quand une modale est ouverte, le bandeau la suit : il reste atteignable au clavier et par un lecteur d'écran, et la modale s'arrête au-dessus de lui."
29
- >
30
- <Example title="Bandeau, réglages et modale ouverte">
31
- <Button variant="outlined" onClick={() => setWizardOpen(true)}>
32
- Ouvrir l&apos;assistant
33
- </Button>
34
- <Button variant="outlined" onClick={() => setDrawerOpen(true)}>
35
- Ouvrir l&apos;aperçu
36
- </Button>
37
- </Example>
38
- </Showcase>
39
- <Modal
40
- open={wizardOpen}
41
- onClose={() => setWizardOpen(false)}
42
- title="Assistant de démarrage"
43
- actions={
44
- <Button variant="contained" onClick={() => setWizardOpen(false)}>
45
- Suivant
46
- </Button>
47
- }
48
- >
49
- <p>Étape 1 sur 3</p>
50
- </Modal>
51
- <Drawer
52
- open={drawerOpen}
53
- onClose={() => setDrawerOpen(false)}
54
- title="Aperçu"
55
- >
56
- <p>Contenu de l&apos;aperçu</p>
57
- </Drawer>
58
- </AbyssCookieConsentProvider>
59
- </QueryClientProvider>
60
- );
61
- };
1
+ import { useState } from 'react';
2
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
+ import Button from '@mui/material/Button';
4
+ import Dialog from '@mui/material/Dialog';
5
+ import DialogActions from '@mui/material/DialogActions';
6
+ import DialogContent from '@mui/material/DialogContent';
7
+ import DialogTitle from '@mui/material/DialogTitle';
8
+ import { AbyssCookieConsentProvider } from '../../src/components/business/CookieConsent/AbyssCookieConsentProvider';
9
+ import { Drawer } from '../../src/components/layers/Drawer/Drawer';
10
+ import { Modal } from '../../src/components/layers/Modal/Modal';
11
+ import { clearCookie } from '../../src/utils/cookie-storage.utils';
12
+ import { CONSENT_VERSION } from '../../src/utils/cookie-consent-contract';
13
+ import { Example, Showcase } from '../frame';
14
+
15
+ const queryClient = new QueryClient();
16
+
17
+ /** A property that makes the surface the containing block of what is `position: fixed` inside it. */
18
+ enum SurfaceEffect {
19
+ BackdropFilter = 'backdrop-filter',
20
+ Filter = 'filter',
21
+ }
22
+
23
+ const SURFACE_STYLES: Record<SurfaceEffect, Record<string, string>> = {
24
+ // The legacy theme's dialog paper (frosted glass).
25
+ [SurfaceEffect.BackdropFilter]: { backdropFilter: 'blur(12px)' },
26
+ [SurfaceEffect.Filter]: { filter: 'drop-shadow(0 2px 4px rgba(0,0,0,0.3))' },
27
+ };
28
+
29
+ /** The real provider and banner, on the page: a visitor who has not chosen yet sees the banner. */
30
+ export const CookieConsentPage = () => {
31
+ // A choice made in an earlier visit of the catalog would hide the banner this page shows.
32
+ useState(() => clearCookie({}));
33
+ const [wizardOpen, setWizardOpen] = useState(false);
34
+ const [drawerOpen, setDrawerOpen] = useState(false);
35
+ const [effect, setEffect] = useState<SurfaceEffect | null>(null);
36
+ return (
37
+ <QueryClientProvider client={queryClient}>
38
+ <AbyssCookieConsentProvider
39
+ consentVersion={CONSENT_VERSION}
40
+ isAuthenticated={false}
41
+ >
42
+ <Showcase
43
+ family="Métier"
44
+ name="CookieConsent"
45
+ description="Bandeau de consentement en bas à droite (pleine largeur sous 768 px) : accepter et refuser pèsent autant ; « Personnaliser » ouvre la fenêtre de réglages, et le bandeau s'efface tant qu'elle est ouverte. Quand une modale est ouverte, le bandeau la suit : il reste atteignable au clavier et par un lecteur d'écran, et la modale s'arrête au-dessus de lui."
46
+ >
47
+ <Example title="Bandeau, réglages et modale ouverte">
48
+ <Button variant="outlined" onClick={() => setWizardOpen(true)}>
49
+ Ouvrir l&apos;assistant
50
+ </Button>
51
+ <Button variant="outlined" onClick={() => setDrawerOpen(true)}>
52
+ Ouvrir l&apos;aperçu
53
+ </Button>
54
+ <Button
55
+ variant="outlined"
56
+ onClick={() => setEffect(SurfaceEffect.BackdropFilter)}
57
+ >
58
+ Ouvrir la fenêtre à fond flouté
59
+ </Button>
60
+ <Button
61
+ variant="outlined"
62
+ onClick={() => setEffect(SurfaceEffect.Filter)}
63
+ >
64
+ Ouvrir la fenêtre à filtre
65
+ </Button>
66
+ </Example>
67
+ </Showcase>
68
+ <Modal
69
+ open={wizardOpen}
70
+ onClose={() => setWizardOpen(false)}
71
+ title="Assistant de démarrage"
72
+ actions={
73
+ <Button variant="contained" onClick={() => setWizardOpen(false)}>
74
+ Suivant
75
+ </Button>
76
+ }
77
+ >
78
+ <p>Étape 1 sur 3</p>
79
+ </Modal>
80
+ <Dialog
81
+ open={effect !== null}
82
+ onClose={() => setEffect(null)}
83
+ aria-labelledby="surface-dialog-title"
84
+ slotProps={{
85
+ paper: {
86
+ sx: effect === null ? undefined : SURFACE_STYLES[effect],
87
+ },
88
+ }}
89
+ >
90
+ <DialogTitle id="surface-dialog-title">
91
+ Assistant à surface spéciale
92
+ </DialogTitle>
93
+ <DialogContent>
94
+ <p>Étape 1 sur 3</p>
95
+ </DialogContent>
96
+ <DialogActions>
97
+ <Button variant="contained" onClick={() => setEffect(null)}>
98
+ Suivant
99
+ </Button>
100
+ </DialogActions>
101
+ </Dialog>
102
+ <Drawer
103
+ open={drawerOpen}
104
+ onClose={() => setDrawerOpen(false)}
105
+ title="Aperçu"
106
+ >
107
+ <p>Contenu de l&apos;aperçu</p>
108
+ </Drawer>
109
+ </AbyssCookieConsentProvider>
110
+ </QueryClientProvider>
111
+ );
112
+ };
@@ -39,6 +39,21 @@ const boxOf = async (page: Page, name: string) => {
39
39
  return box;
40
40
  };
41
41
 
42
+ /** Whether the topmost element at the middle of `box` is, or sits in, the button of that name. */
43
+ const isButtonAt = (
44
+ page: Page,
45
+ name: string,
46
+ box: { x: number; y: number; width: number; height: number },
47
+ ): Promise<boolean> =>
48
+ page
49
+ .getByRole('button', { name, exact: true })
50
+ .evaluate(
51
+ (button, point) =>
52
+ document.elementFromPoint(point.x, point.y)?.closest('button') ===
53
+ button,
54
+ { x: box.x + box.width / 2, y: box.y + box.height / 2 },
55
+ );
56
+
42
57
  const overlaps = (
43
58
  a: { x: number; y: number; width: number; height: number },
44
59
  b: { x: number; y: number; width: number; height: number },
@@ -78,14 +93,139 @@ for (const viewport of VIEWPORTS) {
78
93
  expect(banner).not.toBeNull();
79
94
  expect(overlaps(next, banner!)).toBe(false);
80
95
  // The browser agrees: what is at the middle of « Suivant » is « Suivant ».
81
- const hit = await page.evaluate(
82
- ({ x, y }) => document.elementFromPoint(x, y)?.textContent ?? '',
83
- { x: next.x + next.width / 2, y: next.y + next.height / 2 },
84
- );
85
- expect(hit).toContain('Suivant');
96
+ expect(await isButtonAt(page, 'Suivant', next)).toBe(true);
86
97
  });
87
98
  }
88
99
 
100
+ // The banner is `position: fixed`. A surface that carries `backdrop-filter` (the legacy theme's
101
+ // dialog paper), `filter`, `transform`... becomes the box that fixed element is laid out in: the
102
+ // banner then sticks to the bottom of the surface and covers « Suivant ». The catalog's own theme
103
+ // has none, so these dialogs carry the property by hand.
104
+ const SURFACE_EFFECTS = [
105
+ { label: 'backdrop-filter', opener: 'Ouvrir la fenêtre à fond flouté' },
106
+ { label: 'filter', opener: 'Ouvrir la fenêtre à filtre' },
107
+ ] as const;
108
+
109
+ for (const effect of SURFACE_EFFECTS) {
110
+ for (const viewport of [
111
+ { width: 1440, height: 900 },
112
+ { width: 390, height: 844 },
113
+ ]) {
114
+ test(`the banner sticks to the bottom of the window and leaves « Suivant » free over a dialog with ${effect.label} at ${viewport.width}px`, async ({
115
+ page,
116
+ }) => {
117
+ await openCatalogPage(page, 'CookieConsent', ThemeMode.Dark, viewport);
118
+ await page.getByRole('button', { name: effect.opener }).click();
119
+ await expect(
120
+ page.getByRole('dialog', { name: 'Assistant à surface spéciale' }),
121
+ ).toBeVisible();
122
+ await settle(page);
123
+
124
+ // The property that anchored the banner to the paper is switched off while it is hosted.
125
+ const computed = await page
126
+ .locator('.MuiDialog-paper')
127
+ .evaluate(
128
+ (paper, property) =>
129
+ getComputedStyle(paper).getPropertyValue(property),
130
+ effect.label,
131
+ );
132
+ expect(computed).toBe('none');
133
+
134
+ const banner = await page
135
+ .getByRole('dialog', { name: 'Vos préférences de cookies' })
136
+ .boundingBox();
137
+ expect(banner).not.toBeNull();
138
+ // Stuck to the bottom of the window (an 8 to 24 px offset), not to the bottom of the paper.
139
+ const gap = viewport.height - (banner!.y + banner!.height);
140
+ expect(gap).toBeGreaterThanOrEqual(0);
141
+ expect(gap).toBeLessThanOrEqual(32);
142
+
143
+ const next = await boxOf(page, 'Suivant');
144
+ expect(overlaps(next, banner!)).toBe(false);
145
+ expect(await isButtonAt(page, 'Suivant', next)).toBe(true);
146
+ });
147
+ }
148
+ }
149
+
150
+ // The panel of a bottom sheet follows the finger with an inline `translateY` and no transition.
151
+ // The banner must not freeze it: only what a stylesheet gives is switched off, never an inline style.
152
+ test('the sheet keeps following the finger while the banner is shown', async ({
153
+ page,
154
+ }) => {
155
+ await openCatalogPage(page, 'CookieConsent', ThemeMode.Dark, {
156
+ width: 390,
157
+ height: 844,
158
+ });
159
+ await page.getByRole('button', { name: "Ouvrir l'assistant" }).click();
160
+ const panel = page.getByRole('dialog', { name: 'Assistant de démarrage' });
161
+ await expect(panel).toBeVisible();
162
+ await settle(page);
163
+
164
+ const before = await panel.boundingBox();
165
+ const grip = await page.getByTestId('bottom-sheet-drag-zone').boundingBox();
166
+ expect(before).not.toBeNull();
167
+ expect(grip).not.toBeNull();
168
+ const x = grip!.x + grip!.width / 2;
169
+ const y = grip!.y + grip!.height / 2;
170
+ await page.mouse.move(x, y);
171
+ await page.mouse.down();
172
+ // Less than the commit ratio, so that the sheet stays open under the finger.
173
+ for (let step = 1; step <= 4; step += 1) {
174
+ await page.mouse.move(x, y + step * 10);
175
+ await page.waitForTimeout(30);
176
+ }
177
+ const dragged = await panel.boundingBox();
178
+ expect(dragged).not.toBeNull();
179
+ expect(dragged!.y - before!.y).toBeGreaterThan(30);
180
+ await page.mouse.up();
181
+ });
182
+
183
+ // A drawer closes by sliding out. The banner must not hold it on screen: nothing writes over the
184
+ // transform the exit transition drives.
185
+ test('a drawer closes by sliding out while the banner is shown, and does not come back', async ({
186
+ page,
187
+ }) => {
188
+ await openCatalogPage(page, 'CookieConsent', ThemeMode.Dark, {
189
+ width: 1440,
190
+ height: 900,
191
+ });
192
+ await page.getByRole('button', { name: "Ouvrir l'aperçu" }).click();
193
+ const drawer = page.getByRole('dialog', { name: 'Aperçu' });
194
+ await expect(drawer).toBeVisible();
195
+ await settle(page);
196
+ expect(await inAccessibilityTree(page, BANNER_BUTTON)).toBe(true);
197
+
198
+ // Every inline transform the drawer paper goes through. A frame sampler would depend on the
199
+ // runner's load: a starved main thread paints no frame between the exit and the unmount.
200
+ await page.evaluate(() => {
201
+ const transforms: string[] = [];
202
+ (window as unknown as { drawerTransforms: string[] }).drawerTransforms =
203
+ transforms;
204
+ const paper = document.querySelector<HTMLElement>('.MuiDrawer-paper');
205
+ if (paper === null) {
206
+ return;
207
+ }
208
+ new MutationObserver(() => {
209
+ transforms.push(paper.style.transform);
210
+ }).observe(paper, { attributes: true, attributeFilter: ['style'] });
211
+ });
212
+ await page.keyboard.press('Escape');
213
+ await expect(drawer).toHaveCount(0);
214
+
215
+ const transforms = await page.evaluate(
216
+ () =>
217
+ (window as unknown as { drawerTransforms: string[] }).drawerTransforms,
218
+ );
219
+ // MUI wrote the exit transform, and nothing wrote over it afterwards.
220
+ const firstExit = transforms.findIndex((value) =>
221
+ value.startsWith('translate'),
222
+ );
223
+ expect(firstExit).toBeGreaterThanOrEqual(0);
224
+ transforms.slice(firstExit).forEach((value) => {
225
+ expect(value).toMatch(/^translate/);
226
+ });
227
+ });
228
+
89
229
  test('the banner is not aria-hidden over a drawer and the drawer stops above it', async ({
90
230
  page,
91
231
  }) => {