@abyss-project/commons-front-core 16.0.0 → 16.1.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 (63) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/{CookieConsentSettings-B7NfjgaI.js → CookieConsentSettings-DM0P2po1.js} +1 -1
  3. package/dist/{Surface-BEhoEhyC.js → Surface-DW78GtlG.js} +6 -0
  4. package/dist/{Tabs-DJ9_ZFjM.js → Tabs-DGh_2Lgc.js} +1 -1
  5. package/dist/components/data/DataTable/DataTableDesktop.d.ts +1 -1
  6. package/dist/components/data/DataTable/DataTableMobile.d.ts +1 -1
  7. package/dist/components/data/DataTable/data-table.types.d.ts +5 -0
  8. package/dist/components/editors/MarkdownEditor/MarkdownEditor.d.ts +22 -1
  9. package/dist/components/editors/MarkdownEditor/index.d.ts +1 -1
  10. package/dist/components/inputs/DropTargetOverlay/DropTargetOverlay.d.ts +12 -0
  11. package/dist/components/inputs/DropTargetOverlay/DropTargetOverlay.spec.d.ts +1 -0
  12. package/dist/components/inputs/index.d.ts +1 -0
  13. package/dist/cookie-consent.js +2 -2
  14. package/dist/{design-theme-N9jJSXdK.js → design-theme-BNfby4u0.js} +95 -90
  15. package/dist/{editors-QM76tqZI.js → editors-CoA-ElkI.js} +6654 -6626
  16. package/dist/editors.js +1 -1
  17. package/dist/hooks/index.d.ts +1 -0
  18. package/dist/hooks/use-file-drop-target.hook.d.ts +34 -0
  19. package/dist/hooks/use-rich-intl.hook.d.ts +38 -0
  20. package/dist/{index-DCk0q3d7.js → index--WDnqvkI.js} +3 -3
  21. package/dist/{index-COUUAr5G.js → index-9AhVX_o8.js} +1 -1
  22. package/dist/{index-3-SmpH5N.js → index-B4W3BpjI.js} +4 -4
  23. package/dist/{index-CQU0eEXk.js → index-BIX2oQnD.js} +4 -4
  24. package/dist/{index-mmrA4ErC.js → index-BNnh8uiO.js} +2 -2
  25. package/dist/{index-5OVR3WNo.js → index-BPIERrcr.js} +3 -3
  26. package/dist/{index-DmAoL9-1.js → index-BX4GOdlN.js} +4 -4
  27. package/dist/{index-D1M_muSg.js → index-BXY3SD83.js} +2 -2
  28. package/dist/{index-4b2f7sdW.js → index-C2MJfXbp.js} +2 -2
  29. package/dist/{index-BKAfoA1a.js → index-CMyVfh9D.js} +2 -2
  30. package/dist/{index-D8ncJrf1.js → index-CpJ_UF5V.js} +2 -2
  31. package/dist/{index-DYXAfA_s.js → index-DF-LePxe.js} +2 -2
  32. package/dist/{index-jZGexiyT.js → index-DJ4F-yGQ.js} +3 -3
  33. package/dist/{index-pX3CTxFd.js → index-DSRCuEE1.js} +2 -2
  34. package/dist/{index-C6jhogFt.js → index-DakS19sw.js} +2 -2
  35. package/dist/{index-Taee9VIc.js → index-Dgongfv-.js} +2 -2
  36. package/dist/{index-DA-HUFp6.js → index-Dl1yghiT.js} +2 -2
  37. package/dist/{index-Ce0rv5wr.js → index-MEKGvAmO.js} +3 -3
  38. package/dist/{index-nKbvjf2P.js → index-SJdLMrNS.js} +2 -2
  39. package/dist/{index-DW3SBSsW.js → index-ebpXyaXh.js} +2 -2
  40. package/dist/{index-CM5COMvb.js → index-jHXiCbzE.js} +2 -2
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.js +5657 -5426
  43. package/dist/legacy/theme/create-theme.d.ts +7 -1
  44. package/dist/legacy/theme/create-theme.spec.d.ts +1 -0
  45. package/dist/legacy.js +581 -571
  46. package/dist/motion/Appear.d.ts +25 -0
  47. package/dist/motion/AppearList.d.ts +31 -0
  48. package/dist/motion/index.d.ts +4 -0
  49. package/dist/motion/motion.d.ts +24 -0
  50. package/dist/motion/motion.spec.d.ts +1 -0
  51. package/dist/motion/use-added-keys.hook.d.ts +7 -0
  52. package/dist/motion/use-added-keys.hook.spec.d.ts +1 -0
  53. package/dist/theme/AbyssThemeProvider.d.ts +2 -1
  54. package/dist/theme/DesignCssVariables.d.ts +2 -1
  55. package/dist/theme/augmentation.d.ts +2 -1
  56. package/dist/theme/create-abyss-theme.d.ts +4 -1
  57. package/dist/theme/design-theme.d.ts +1 -1
  58. package/dist/theme/index.d.ts +2 -1
  59. package/dist/theme/reduced-motion.d.ts +7 -0
  60. package/dist/theme/reduced-motion.spec.d.ts +1 -0
  61. package/dist/translations/en.d.ts +3 -0
  62. package/dist/translations/fr.d.ts +3 -0
  63. package/package.json +3 -3
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { SxProps, Theme } from '@mui/material/styles';
3
+ export interface AppearProps {
4
+ children: ReactNode;
5
+ /**
6
+ * Whether the content is shown. Defaults to `true`. Going `false` fades it out and unmounts it;
7
+ * going `true` again mounts it and animates it in.
8
+ */
9
+ in?: boolean;
10
+ /**
11
+ * Animate the entry when this component mounts. Defaults to `true`; `false` for what is already
12
+ * there at the first render of a page, which never animates.
13
+ */
14
+ appear?: boolean;
15
+ /** Called once the exit fade is over and the content is unmounted. */
16
+ onExited?: () => void;
17
+ /** Styles of the wrapper element (its layout, say), merged after the motion styles. */
18
+ sx?: SxProps<Theme>;
19
+ }
20
+ /**
21
+ * Wraps an element that enters: it fades in while rising 4 px (`motion.enter`), and fades out
22
+ * when `in` turns `false` (`motion.exit`). The animation lives on a wrapper `div`, so the wrapped
23
+ * element keeps its own `transform` (a dnd-kit card, see the README).
24
+ */
25
+ export declare function Appear({ children, in: shown, appear, onExited, sx, }: AppearProps): JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { ReactNode } from 'react';
2
+ import { SxProps, Theme } from '@mui/material/styles';
3
+ export interface AppearListProps {
4
+ /**
5
+ * The items of the list, each with a stable `key`. An item whose key was not there before is
6
+ * animated in; one whose key disappears is faded out before it unmounts. The items present at
7
+ * the first render are never animated.
8
+ */
9
+ children: ReactNode;
10
+ /**
11
+ * Fade the removed items out before unmounting them. Defaults to `true`. `false` for a list
12
+ * whose items are replaced wholesale (a new page, a new filter), where the leaving items would
13
+ * sit next to the entering ones.
14
+ */
15
+ exit?: boolean;
16
+ /**
17
+ * Animate the items added by this update. Defaults to `true`; `false` for items that arrive by a
18
+ * drag and drop (a card dropped into a column), which must not fade in under the pointer. It is
19
+ * read when the children change: the items already in the list are never affected.
20
+ */
21
+ enter?: boolean;
22
+ /** Styles of the wrapper `div` of every item (it becomes the item in a flex or grid parent). */
23
+ itemSx?: SxProps<Theme>;
24
+ }
25
+ /**
26
+ * Animates the items added to a list after its first render (`Appear`: fade and 4 px rise) and the
27
+ * ones removed from it (fade out, unless `exit` is off), never the list as first shown. Each item sits in a wrapper
28
+ * `div`, which carries the animation: an item with its own inline `transform` (a dnd-kit card) is
29
+ * not disturbed.
30
+ */
31
+ export declare function AppearList({ children, exit, enter, itemSx, }: AppearListProps): JSX.Element;
@@ -0,0 +1,4 @@
1
+ export * from './motion';
2
+ export * from './Appear';
3
+ export * from './AppearList';
4
+ export * from './use-added-keys.hook';
@@ -0,0 +1,24 @@
1
+ import { CSSObject, Theme } from '@mui/material/styles';
2
+ /** How far an element rises while it fades in, in px. */
3
+ export declare const ENTER_OFFSET = 4;
4
+ /**
5
+ * The motion of the design system, read from the theme: the durations and the standard curve of
6
+ * `theme.design`, so a theme created with `reducedMotion` (or the user's « reduce animations »
7
+ * preference, through `AbyssThemeProvider`) turns all of it off.
8
+ */
9
+ export declare const motion: {
10
+ /**
11
+ * Styles of an element that has just mounted: it fades in while rising 4 px, over
12
+ * `durations.base` on `easings.standard`. Put them on a wrapper, not on an element that carries
13
+ * its own inline `transform` (a dnd-kit card): the animation would own `transform` while it runs.
14
+ */
15
+ enter: (theme: Theme) => CSSObject;
16
+ /**
17
+ * Timing of an element that leaves: a plain fade over `durations.fast`, as the `timeout` and
18
+ * `easing` of an MUI `Fade`.
19
+ */
20
+ exit: (theme: Theme) => {
21
+ timeout: number;
22
+ easing: string;
23
+ };
24
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The keys that showed up after the first render, among the `keys` of the current one: what a
3
+ * list adds while it is on screen, never what it opened with. A key that leaves and comes back
4
+ * counts as added again. For lists whose items cannot sit in a wrapper (table rows): the host
5
+ * gives these items `motion.enter`.
6
+ */
7
+ export declare function useAddedKeys(keys: string[]): ReadonlySet<string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -9,6 +9,7 @@ export interface AbyssThemeProviderProps {
9
9
  /**
10
10
  * Provides the design system theme: the MUI theme of `mode`, the `--abyss-*` variables of both
11
11
  * modes, `data-theme` on the document root (read by those variables), and the CSS baseline with
12
- * tabular figures.
12
+ * tabular figures. It follows the « reduce animations » preference: under it every duration of the
13
+ * theme and every `--abyss-duration-*` variable is 0.
13
14
  */
14
15
  export declare function AbyssThemeProvider({ mode, density, children, }: AbyssThemeProviderProps): JSX.Element;
@@ -6,6 +6,7 @@ export interface DesignCssVariablesProps {
6
6
  * Writes the `--abyss-*` variables of `mode` on the document root, the ones `AbyssThemeProvider`
7
7
  * writes. For a host still under the legacy theme provider: the design system components that
8
8
  * paint through those variables (`ToolIcon`, the `AppShell` product icon) then render as they do
9
- * under `AbyssThemeProvider`. Never mount both: `AbyssThemeProvider` already writes them.
9
+ * under `AbyssThemeProvider`, the « reduce animations » rule of the durations included. Never
10
+ * mount both: `AbyssThemeProvider` already writes them.
10
11
  */
11
12
  export declare function DesignCssVariables({ mode, }: DesignCssVariablesProps): JSX.Element;
@@ -21,7 +21,8 @@ export interface DesignTheme {
21
21
  overlay: string;
22
22
  modal: string;
23
23
  };
24
- durations: typeof durations;
24
+ /** Motion durations in ms; all 0 under `prefers-reduced-motion: reduce`. */
25
+ durations: Record<keyof typeof durations, number>;
25
26
  easings: typeof easings;
26
27
  }
27
28
  declare module '@mui/material/styles' {
@@ -3,8 +3,11 @@ import { Density } from './augmentation';
3
3
  import { ThemeMode } from './tokens/primitives';
4
4
  /**
5
5
  * The MUI theme of the design system, generated from the tokens (ADR-0174 §1, §3). Its values are
6
- * also exposed under `theme.design` for the components that style themselves.
6
+ * also exposed under `theme.design` for the components that style themselves. With
7
+ * `reducedMotion`, every duration (`theme.design.durations`, `theme.transitions.duration`) is 0:
8
+ * the one place the reduced-motion preference reaches the components.
7
9
  */
8
10
  export declare function createAbyssTheme(mode: ThemeMode, options?: {
9
11
  density?: Density;
12
+ reducedMotion?: boolean;
10
13
  }): Theme;
@@ -5,4 +5,4 @@ import { ThemeMode } from './tokens/primitives';
5
5
  * `createTheme`, so a new component rendered in an app still on the legacy theme reads the same
6
6
  * tokens.
7
7
  */
8
- export declare function buildDesignTheme(mode: ThemeMode, density?: Density): DesignTheme;
8
+ export declare function buildDesignTheme(mode: ThemeMode, density?: Density, reducedMotion?: boolean): DesignTheme;
@@ -2,8 +2,9 @@ export * from './tokens';
2
2
  export * from './augmentation';
3
3
  export * from './create-abyss-theme';
4
4
  export * from './css-variables';
5
+ export * from './reduced-motion';
5
6
  export * from './AbyssThemeProvider';
6
7
  export * from './DesignCssVariables';
7
8
  export * from './design-media';
8
9
  export * from './use-design-breakpoint';
9
- export { focusRing, px } from './components/shared';
10
+ export { focusRing, px, transitionOf } from './components/shared';
@@ -0,0 +1,7 @@
1
+ /** The media query of the « reduce animations » system preference. */
2
+ export declare const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
3
+ /**
4
+ * The `--abyss-duration-*` variables at 0 under the reduced-motion preference: the CSS side of
5
+ * `createAbyssTheme({ reducedMotion: true })`, for what paints from the variables.
6
+ */
7
+ export declare function buildReducedMotionCssVariables(): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -1626,6 +1626,9 @@ declare const _default: {
1626
1626
  'too-many': string;
1627
1627
  'rejected-type': string;
1628
1628
  };
1629
+ 'drop-target': {
1630
+ label: string;
1631
+ };
1629
1632
  'import-button': {
1630
1633
  file: string;
1631
1634
  url: string;
@@ -1626,6 +1626,9 @@ declare const _default: {
1626
1626
  'too-many': string;
1627
1627
  'rejected-type': string;
1628
1628
  };
1629
+ 'drop-target': {
1630
+ label: string;
1631
+ };
1629
1632
  'import-button': {
1630
1633
  file: string;
1631
1634
  url: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/commons-front-core",
3
- "version": "16.0.0",
3
+ "version": "16.1.0",
4
4
  "description": "Front Core package of AbyssProject",
5
5
  "main": "dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -88,7 +88,7 @@
88
88
  "react-router-dom": "^6.15.0",
89
89
  "react-toastify": "^8.0.2 || ^10.0.0",
90
90
  "zustand": "^5.0.0",
91
- "@abyss-project/main": "29.0.0"
91
+ "@abyss-project/main": "29.1.0"
92
92
  },
93
93
  "peerDependenciesMeta": {
94
94
  "@abyss-project/capacitor-auth": {
@@ -139,7 +139,7 @@
139
139
  "use-debounce": "^10.0.5",
140
140
  "uuid": "^9.0.0",
141
141
  "yup": "^0.32.11",
142
- "@abyss-project/main": "29.0.0"
142
+ "@abyss-project/main": "29.1.0"
143
143
  },
144
144
  "devDependencies": {
145
145
  "@abyss-project/cloud": "^2.4.0",