@abyss-project/commons-front-core 8.2.0 → 8.3.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 (99) hide show
  1. package/README.md +171 -125
  2. package/catalog/catalog-entries.ts +17 -1
  3. package/catalog/cloud-picker-fixture.tsx +97 -0
  4. package/catalog/pages/Avatar.tsx +94 -0
  5. package/catalog/pages/Callout.tsx +67 -0
  6. package/catalog/pages/CloudImport.tsx +35 -0
  7. package/catalog/pages/ContextSelector.tsx +103 -0
  8. package/catalog/pages/CopyField.tsx +29 -0
  9. package/catalog/pages/DropZone.tsx +37 -0
  10. package/catalog/pages/FormField.tsx +54 -0
  11. package/catalog/pages/ImportButton.tsx +45 -0
  12. package/catalog/pages/ImportFromCloudModal.tsx +33 -0
  13. package/catalog/pages/Menu.tsx +99 -98
  14. package/catalog/pages/NumberField.tsx +46 -0
  15. package/catalog/pages/QRCodeModal.tsx +26 -0
  16. package/catalog/pages/SettingsRow.tsx +67 -0
  17. package/catalog/pages/Tabs.tsx +72 -0
  18. package/catalog/pages/UsageMeter.tsx +58 -0
  19. package/catalog/pages/index.ts +30 -2
  20. package/dist/{AbyssCookieConsentProvider-TE46ywnd.js → AbyssCookieConsentProvider-B-PlGbFf.js} +1096 -946
  21. package/dist/{CookieConsentSettings.component-BKsYgpMa.js → CookieConsentSettings.component-DEGCDEJW.js} +1 -1
  22. package/dist/components/business/CloudImport/CloudImport.d.ts +24 -0
  23. package/dist/components/business/CloudImport/cloud-import-tree.d.ts +22 -0
  24. package/dist/components/business/ImportFromCloudModal/ImportFromCloudModal.d.ts +21 -0
  25. package/dist/components/business/QRCodeModal/QRCodeModal.d.ts +18 -0
  26. package/dist/components/business/QRCodeModal/QRCodeModal.spec.d.ts +1 -0
  27. package/dist/components/business/index.d.ts +3 -0
  28. package/dist/components/data/DataTable/data-table.types.d.ts +10 -0
  29. package/dist/components/data/UsageMeter/UsageMeter.d.ts +31 -0
  30. package/dist/components/data/UsageMeter/UsageMeter.spec.d.ts +1 -0
  31. package/dist/components/data/index.d.ts +1 -0
  32. package/dist/components/inputs/ContextSelector/ContextSelector.d.ts +60 -0
  33. package/dist/components/inputs/ContextSelector/ContextSelector.spec.d.ts +1 -0
  34. package/dist/components/inputs/CopyField/CopyField.d.ts +19 -0
  35. package/dist/components/inputs/CopyField/CopyField.spec.d.ts +1 -0
  36. package/dist/components/inputs/DropZone/DropZone.d.ts +30 -0
  37. package/dist/components/inputs/DropZone/DropZone.spec.d.ts +1 -0
  38. package/dist/components/inputs/FormField/FormField.d.ts +29 -0
  39. package/dist/components/inputs/FormField/FormField.spec.d.ts +1 -0
  40. package/dist/components/inputs/ImportButton/ImportButton.d.ts +33 -0
  41. package/dist/components/inputs/ImportButton/ImportButton.spec.d.ts +1 -0
  42. package/dist/components/inputs/NumberField/NumberField.d.ts +21 -0
  43. package/dist/components/inputs/NumberField/NumberField.spec.d.ts +1 -0
  44. package/dist/components/inputs/NumberField/number-input.d.ts +13 -0
  45. package/dist/components/inputs/SettingsRow/SettingsRow.d.ts +16 -0
  46. package/dist/components/inputs/SettingsRow/SettingsRow.spec.d.ts +1 -0
  47. package/dist/components/inputs/index.d.ts +7 -0
  48. package/dist/components/layers/Menu/Menu.d.ts +2 -0
  49. package/dist/components/meaning/Avatar/Avatar.d.ts +41 -0
  50. package/dist/components/meaning/Avatar/Avatar.spec.d.ts +1 -0
  51. package/dist/components/meaning/index.d.ts +1 -0
  52. package/dist/components/states/Callout/Callout.d.ts +25 -0
  53. package/dist/components/states/Callout/Callout.spec.d.ts +1 -0
  54. package/dist/components/states/index.d.ts +1 -0
  55. package/dist/components/structure/Tabs/Tabs.d.ts +34 -0
  56. package/dist/components/structure/Tabs/Tabs.spec.d.ts +1 -0
  57. package/dist/components/structure/index.d.ts +1 -0
  58. package/dist/cookie-consent.js +2 -2
  59. package/dist/design-theme-CKTz_cOa.js +15490 -0
  60. package/dist/hooks/use-rich-intl.hook.d.ts +150 -0
  61. package/dist/{index-Dhz388yW.js → index-7N3J68EI.js} +2 -2
  62. package/dist/{index-BI8z_ZwK.js → index-B3rK_-T4.js} +4 -4
  63. package/dist/{index-BZfgg1Dp.js → index-B6qHo25Z.js} +2 -2
  64. package/dist/{index-D490I-Im.js → index-BMaAO_4e.js} +2 -2
  65. package/dist/{index-FS21eF3a.js → index-B_jSh70G.js} +3 -3
  66. package/dist/{index-B-Gq5Zeh.js → index-B_yywet5.js} +3 -3
  67. package/dist/{index-BR66kEMM.js → index-Bdtvzv-J.js} +2 -2
  68. package/dist/{index-C-bs2P06.js → index-Bh2_8FCK.js} +2 -2
  69. package/dist/{index-BXs_bBcm.js → index-Bpg9TBMX.js} +1 -1
  70. package/dist/{index-4BMCQ_6u.js → index-Bpnf8xKI.js} +2 -2
  71. package/dist/{index-DPxFwYmx.js → index-Bw2swxVq.js} +2 -2
  72. package/dist/{index-DjLWvtUt.js → index-BxxZgBFn.js} +2 -2
  73. package/dist/{index-C6ZLgLu-.js → index-Ca9tzEsn.js} +2 -2
  74. package/dist/{index-Bi3OW3pz.js → index-Csvh-AG6.js} +2 -2
  75. package/dist/{index-ltq6POQa.js → index-CwuklsUK.js} +3 -3
  76. package/dist/{index-csvcp4rP.js → index-DFC9xBY9.js} +2 -2
  77. package/dist/{index-C4VmhCn7.js → index-DfUcsAJv.js} +4 -4
  78. package/dist/{index-Bu5LDz63.js → index-DqedXp41.js} +3 -3
  79. package/dist/{index-CK9kVK6Y.js → index-DwXNHQIp.js} +4 -4
  80. package/dist/{index-Dm6584pR.js → index-_UY_fqvv.js} +28373 -34464
  81. package/dist/{index-DC-vg2P2.js → index-dVVflNge.js} +2 -2
  82. package/dist/{index-DistZiPf.js → index-sEWp0xIC.js} +2 -2
  83. package/dist/index.js +7214 -5051
  84. package/dist/legacy/components/QuotaOffer/AbyssQuotaOffer.component.d.ts +1 -1
  85. package/dist/legacy/components/QuotaOffer/index.d.ts +2 -2
  86. package/dist/legacy.js +142 -142
  87. package/dist/theme/tokens/semantic.d.ts +1 -1
  88. package/dist/translations/en.d.ts +75 -0
  89. package/dist/translations/fr.d.ts +75 -0
  90. package/dist/utils/cloud-accept.utils.spec.d.ts +1 -0
  91. package/dist/utils/index.d.ts +1 -0
  92. package/dist/utils/quota-offer-state.utils.spec.d.ts +1 -0
  93. package/package.json +1 -1
  94. package/test-results/catalog/.last-run.json +4 -0
  95. package/dist/design-theme-CN_6fRX3.js +0 -9344
  96. /package/dist/{legacy/components/Inputs/CloudImport/cloud-accept.spec.d.ts → components/business/CloudImport/CloudImport.spec.d.ts} +0 -0
  97. /package/dist/{legacy/components/QuotaOffer/quota-offer-state.spec.d.ts → components/business/ImportFromCloudModal/ImportFromCloudModal.spec.d.ts} +0 -0
  98. /package/dist/{legacy/components/Inputs/CloudImport/cloud-accept.d.ts → utils/cloud-accept.utils.d.ts} +0 -0
  99. /package/dist/{legacy/components/QuotaOffer/quota-offer-state.d.ts → utils/quota-offer-state.utils.d.ts} +0 -0
@@ -0,0 +1,35 @@
1
+ import { CloudImport } from '../../src/components/business/CloudImport/CloudImport';
2
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
3
+ import {
4
+ CATALOG_CLOUD_PICKER,
5
+ CATALOG_FAILED_CLOUD_PICKER,
6
+ } from '../cloud-picker-fixture';
7
+
8
+ export const CloudImportPage = () => {
9
+ const { log } = useEventLog();
10
+ return (
11
+ <Showcase
12
+ family="Métier"
13
+ name="CloudImport"
14
+ description="Le sélecteur AbyssCloud : espace (le mien, ceux des organisations, ceux partagés avec moi), arborescence, fichiers choisis, import. Les fichiers trop lourds ou d'un type refusé ne sont pas listés."
15
+ >
16
+ <Example title="Plusieurs fichiers, PDF et images" maxWidth={768}>
17
+ <CloudImport
18
+ cloudPicker={CATALOG_CLOUD_PICKER}
19
+ multiple
20
+ accept={['application/pdf', 'image/*']}
21
+ onImport={(_space, files) =>
22
+ log(`importé ${files.map((file) => file.name).join(', ')}`)
23
+ }
24
+ />
25
+ </Example>
26
+ <Example title="Le cloud n'a pas pu être préparé" maxWidth={768}>
27
+ <CloudImport
28
+ cloudPicker={CATALOG_FAILED_CLOUD_PICKER}
29
+ onImport={() => undefined}
30
+ />
31
+ </Example>
32
+ <LastEvent />
33
+ </Showcase>
34
+ );
35
+ };
@@ -0,0 +1,103 @@
1
+ import { useState } from 'react';
2
+ import {
3
+ ContextKind,
4
+ ContextSelector,
5
+ } from '../../src/components/inputs/ContextSelector/ContextSelector';
6
+ import type {
7
+ ContextSelectorData,
8
+ ContextValue,
9
+ } from '../../src/components/inputs/ContextSelector/ContextSelector';
10
+ import {
11
+ OrganizationAvatar,
12
+ ProjectAvatar,
13
+ UserAvatar,
14
+ } from '../../src/components/meaning/Avatar/Avatar';
15
+ import { LogoAbyssSmall } from '../../src/assets';
16
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
17
+
18
+ const AVATAR = 22;
19
+ const picture = () => LogoAbyssSmall;
20
+
21
+ const DATA: ContextSelectorData = {
22
+ personal: {
23
+ label: 'Mehdi',
24
+ avatar: (
25
+ <UserAvatar
26
+ userId="u1"
27
+ alias="Mehdi"
28
+ hasThumbnail
29
+ size={AVATAR}
30
+ getProfilePictureUrl={picture}
31
+ />
32
+ ),
33
+ },
34
+ organizations: [
35
+ {
36
+ id: 'o1',
37
+ name: 'Abyss',
38
+ avatar: (
39
+ <OrganizationAvatar
40
+ orgId="o1"
41
+ name="Abyss"
42
+ hasThumbnail={false}
43
+ size={AVATAR}
44
+ getLogoUrl={picture}
45
+ />
46
+ ),
47
+ projects: [
48
+ {
49
+ id: 'p1',
50
+ name: 'Atlas',
51
+ avatar: (
52
+ <ProjectAvatar
53
+ projectId="p1"
54
+ title="Atlas"
55
+ hasThumbnail={false}
56
+ size={AVATAR}
57
+ getProjectPictureUrl={picture}
58
+ />
59
+ ),
60
+ },
61
+ { id: 'p2', name: 'Refonte du site vitrine' },
62
+ ],
63
+ },
64
+ { id: 'o2', name: 'Karbon Studio' },
65
+ ],
66
+ };
67
+
68
+ export const ContextSelectorPage = () => {
69
+ const { log } = useEventLog();
70
+ const [value, setValue] = useState<ContextValue>({
71
+ kind: ContextKind.Organization,
72
+ organizationId: 'o1',
73
+ });
74
+ return (
75
+ <Showcase
76
+ family="Saisie"
77
+ name="ContextSelector"
78
+ description="Choix de la portée d'une page : mon espace, puis un groupe par organisation (toute l'organisation, puis ses projets). La saisie filtre les entrées."
79
+ >
80
+ <Example title="Portée des ressources" maxWidth={480}>
81
+ <ContextSelector
82
+ data={DATA}
83
+ value={value}
84
+ onChange={(next) => {
85
+ setValue(next);
86
+ log(`portée ${next.kind}`);
87
+ }}
88
+ label="Espace"
89
+ />
90
+ </Example>
91
+ <Example title="Inactif" maxWidth={480}>
92
+ <ContextSelector
93
+ data={DATA}
94
+ value={{ kind: ContextKind.Personal }}
95
+ onChange={() => undefined}
96
+ label="Espace"
97
+ disabled
98
+ />
99
+ </Example>
100
+ <LastEvent />
101
+ </Showcase>
102
+ );
103
+ };
@@ -0,0 +1,29 @@
1
+ import { CopyField } from '../../src/components/inputs/CopyField/CopyField';
2
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
3
+
4
+ export const CopyFieldPage = () => {
5
+ const { log } = useEventLog();
6
+ return (
7
+ <Showcase
8
+ family="Saisie"
9
+ name="CopyField"
10
+ description="Valeur à copier, masquable : bouton de copie, annonce du résultat dans une région vivante, bouton pour afficher une valeur masquée."
11
+ >
12
+ <Example title="Clé d'API, masquée" maxWidth={640}>
13
+ <CopyField
14
+ value="abyss_sk_live_5f2c9a7e1b3d4f60a8c2e9b7d1f3a5c7"
15
+ masked
16
+ onReveal={() => log('afficher la clé')}
17
+ copyLabel="Copier la clé"
18
+ />
19
+ </Example>
20
+ <Example title="Identifiant de connexion IA" maxWidth={640}>
21
+ <CopyField
22
+ value="https://mcp.abyss-project.fr/u/7f3a9c2e"
23
+ copyLabel="Copier l'adresse"
24
+ />
25
+ </Example>
26
+ <LastEvent />
27
+ </Showcase>
28
+ );
29
+ };
@@ -0,0 +1,37 @@
1
+ import { DropZone } from '../../src/components/inputs/DropZone/DropZone';
2
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
3
+ import { CATALOG_CLOUD_PICKER } from '../cloud-picker-fixture';
4
+
5
+ const TEN_MIB = 10 * 1024 * 1024;
6
+
7
+ export const DropZonePage = () => {
8
+ const { log } = useEventLog();
9
+ const dropped = (files: File[]) =>
10
+ log(`déposé ${files.map((file) => file.name).join(', ')}`);
11
+ return (
12
+ <Showcase
13
+ family="Saisie"
14
+ name="DropZone"
15
+ description="Zone de dépôt de fichiers : bouton pour parcourir l'appareil, limite de taille, refus expliqués sous la zone, entrée AbyssCloud quand elle est branchée. Sous 768 px, seul le bouton reste."
16
+ >
17
+ <Example title="Une image, avec AbyssCloud" maxWidth={640}>
18
+ <DropZone
19
+ title="Signature"
20
+ onDrop={dropped}
21
+ multiple={false}
22
+ accept={{ 'image/png': ['.png'], 'image/jpeg': ['.jpg', '.jpeg'] }}
23
+ maxSize={TEN_MIB}
24
+ cloudImport={{
25
+ ...CATALOG_CLOUD_PICKER,
26
+ onImport: (_space, files) =>
27
+ log(`importé ${files.map((file) => file.name).join(', ')}`),
28
+ }}
29
+ />
30
+ </Example>
31
+ <Example title="Plusieurs fichiers, sans AbyssCloud" maxWidth={640}>
32
+ <DropZone onDrop={dropped} maxSize={TEN_MIB} />
33
+ </Example>
34
+ <LastEvent />
35
+ </Showcase>
36
+ );
37
+ };
@@ -0,0 +1,54 @@
1
+ import { useState } from 'react';
2
+ import MenuItem from '@mui/material/MenuItem';
3
+ import OutlinedInput from '@mui/material/OutlinedInput';
4
+ import Select from '@mui/material/Select';
5
+ import { FormField } from '../../src/components/inputs/FormField/FormField';
6
+ import { Columns, Example, Showcase } from '../frame';
7
+
8
+ export const FormFieldPage = () => {
9
+ const [company, setCompany] = useState('Abyss SAS');
10
+ const [vat, setVat] = useState('FR123');
11
+ const [country, setCountry] = useState('fr');
12
+ return (
13
+ <Showcase
14
+ family="Saisie"
15
+ name="FormField"
16
+ description="Libellé, aide et erreur autour d'un champ MUI : l'id et les aria-describedby sont reliés, l'erreur et l'obligation passent au champ."
17
+ >
18
+ <Example title="Aide et obligation, erreur, liste">
19
+ <Columns>
20
+ <FormField
21
+ label="Raison sociale"
22
+ help="Telle qu'elle figure sur vos factures."
23
+ required
24
+ >
25
+ <OutlinedInput
26
+ value={company}
27
+ onChange={(event) => setCompany(event.target.value)}
28
+ />
29
+ </FormField>
30
+ <FormField
31
+ label="Numéro de TVA"
32
+ help="FR suivi de 11 chiffres."
33
+ error="Ce numéro n'est pas valide."
34
+ >
35
+ <OutlinedInput
36
+ value={vat}
37
+ onChange={(event) => setVat(event.target.value)}
38
+ />
39
+ </FormField>
40
+ <FormField label="Pays de facturation">
41
+ <Select
42
+ value={country}
43
+ onChange={(event) => setCountry(event.target.value)}
44
+ >
45
+ <MenuItem value="fr">France</MenuItem>
46
+ <MenuItem value="be">Belgique</MenuItem>
47
+ <MenuItem value="ch">Suisse</MenuItem>
48
+ </Select>
49
+ </FormField>
50
+ </Columns>
51
+ </Example>
52
+ </Showcase>
53
+ );
54
+ };
@@ -0,0 +1,45 @@
1
+ import Button from '@mui/material/Button';
2
+ import FileUploadOutlinedIcon from '@mui/icons-material/FileUploadOutlined';
3
+ import { ImportButton } from '../../src/components/inputs/ImportButton/ImportButton';
4
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
5
+ import { CATALOG_CLOUD_PICKER } from '../cloud-picker-fixture';
6
+
7
+ export const ImportButtonPage = () => {
8
+ const { log } = useEventLog();
9
+ return (
10
+ <Showcase
11
+ family="Saisie"
12
+ name="ImportButton"
13
+ description="Un déclencheur qui ouvre le menu des sources : l'appareil, un lien (adresse vérifiée avant l'import), AbyssCloud."
14
+ >
15
+ <Example title="Trois sources">
16
+ <ImportButton
17
+ isLoading={false}
18
+ handleFileUpload={async (event) =>
19
+ log(`fichier ${event.target.files?.[0]?.name ?? ''}`)
20
+ }
21
+ handleUploadFromUrl={async (url) => log(`lien ${url}`)}
22
+ accept={['image/*']}
23
+ cloudImport={{
24
+ ...CATALOG_CLOUD_PICKER,
25
+ onImport: (_space, files) =>
26
+ log(`importé ${files.map((file) => file.name).join(', ')}`),
27
+ }}
28
+ >
29
+ <Button
30
+ variant="outlined"
31
+ startIcon={<FileUploadOutlinedIcon aria-hidden />}
32
+ >
33
+ Importer une image
34
+ </Button>
35
+ </ImportButton>
36
+ </Example>
37
+ <Example title="L'appareil seulement, import en cours">
38
+ <ImportButton isLoading handleFileUpload={async () => undefined}>
39
+ <Button variant="outlined">Importer</Button>
40
+ </ImportButton>
41
+ </Example>
42
+ <LastEvent />
43
+ </Showcase>
44
+ );
45
+ };
@@ -0,0 +1,33 @@
1
+ import { useState } from 'react';
2
+ import Button from '@mui/material/Button';
3
+ import { ImportFromCloudModal } from '../../src/components/business/ImportFromCloudModal/ImportFromCloudModal';
4
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
5
+ import { CATALOG_CLOUD_PICKER } from '../cloud-picker-fixture';
6
+
7
+ export const ImportFromCloudModalPage = () => {
8
+ const { log } = useEventLog();
9
+ const [open, setOpen] = useState(true);
10
+ return (
11
+ <Showcase
12
+ family="Métier"
13
+ name="ImportFromCloudModal"
14
+ description="Le sélecteur AbyssCloud dans une modale ; une feuille du bas sous 768 px. Importer remet les fichiers à l'hôte et ferme."
15
+ >
16
+ <Example title="Une image">
17
+ <Button variant="outlined" onClick={() => setOpen(true)}>
18
+ Importer depuis AbyssCloud
19
+ </Button>
20
+ </Example>
21
+ <LastEvent />
22
+ <ImportFromCloudModal
23
+ open={open}
24
+ onClose={() => setOpen(false)}
25
+ cloudPicker={CATALOG_CLOUD_PICKER}
26
+ accept={['image/*']}
27
+ onImport={(_space, files) =>
28
+ log(`importé ${files.map((file) => file.name).join(', ')}`)
29
+ }
30
+ />
31
+ </Showcase>
32
+ );
33
+ };
@@ -1,98 +1,99 @@
1
- import { useEffect, useRef, useState } from 'react';
2
- import Button from '@mui/material/Button';
3
- import ContentCopyOutlined from '@mui/icons-material/ContentCopyOutlined';
4
- import DeleteOutlineOutlined from '@mui/icons-material/DeleteOutlineOutlined';
5
- import DriveFileMoveOutlined from '@mui/icons-material/DriveFileMoveOutlined';
6
- import EditOutlined from '@mui/icons-material/EditOutlined';
7
- import IosShareOutlined from '@mui/icons-material/IosShareOutlined';
8
- import LockOutlined from '@mui/icons-material/LockOutlined';
9
- import MoreHorizRounded from '@mui/icons-material/MoreHorizRounded';
10
- import {
11
- Menu,
12
- MenuItemTone,
13
- MenuSeparator,
14
- } from '../../src/components/layers/Menu/Menu';
15
- import { Example, LastEvent, Showcase, useEventLog } from '../frame';
16
-
17
- export const MenuPage = () => {
18
- const { log } = useEventLog();
19
- const trigger = useRef<HTMLButtonElement>(null);
20
- const [anchor, setAnchor] = useState<HTMLElement | null>(null);
21
-
22
- // Opened on arrival, so the page shows the menu without a click.
23
- useEffect(() => {
24
- setAnchor(trigger.current);
25
- }, []);
26
-
27
- const select = (action: string) => () => log(action);
28
-
29
- return (
30
- <Showcase
31
- family="Couches"
32
- name="Menu"
33
- description="Menu d'actions : icône, raccourci, ton danger, entrées désactivées sautées par les flèches."
34
- >
35
- <Example title="Actions d'un fichier">
36
- <Button
37
- ref={trigger}
38
- variant="outlined"
39
- startIcon={<MoreHorizRounded />}
40
- onClick={(event) => setAnchor(event.currentTarget)}
41
- >
42
- avis-imposition-2026.pdf
43
- </Button>
44
- </Example>
45
- <LastEvent />
46
- <Menu
47
- anchorEl={anchor}
48
- open={anchor !== null}
49
- onClose={() => setAnchor(null)}
50
- items={[
51
- {
52
- id: 'share',
53
- label: 'Partager',
54
- icon: <IosShareOutlined />,
55
- shortcut: 'Ctrl+Maj+S',
56
- onSelect: select('partager'),
57
- },
58
- {
59
- id: 'rename',
60
- label: 'Renommer',
61
- icon: <EditOutlined />,
62
- shortcut: 'F2',
63
- onSelect: select('renommer'),
64
- },
65
- {
66
- id: 'copy',
67
- label: 'Copier le lien',
68
- icon: <ContentCopyOutlined />,
69
- shortcut: 'Ctrl+L',
70
- onSelect: select('copier'),
71
- },
72
- {
73
- id: 'move',
74
- label: 'Déplacer',
75
- icon: <DriveFileMoveOutlined />,
76
- onSelect: select('déplacer'),
77
- },
78
- {
79
- id: 'encrypt',
80
- label: 'Déjà chiffré',
81
- icon: <LockOutlined />,
82
- disabled: true,
83
- onSelect: select('chiffrer'),
84
- },
85
- MenuSeparator.Divider,
86
- {
87
- id: 'trash',
88
- label: 'Mettre à la corbeille',
89
- icon: <DeleteOutlineOutlined />,
90
- tone: MenuItemTone.Danger,
91
- shortcut: 'Suppr',
92
- onSelect: select('corbeille'),
93
- },
94
- ]}
95
- />
96
- </Showcase>
97
- );
98
- };
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import Button from '@mui/material/Button';
3
+ import ContentCopyOutlined from '@mui/icons-material/ContentCopyOutlined';
4
+ import DeleteOutlineOutlined from '@mui/icons-material/DeleteOutlineOutlined';
5
+ import DriveFileMoveOutlined from '@mui/icons-material/DriveFileMoveOutlined';
6
+ import EditOutlined from '@mui/icons-material/EditOutlined';
7
+ import IosShareOutlined from '@mui/icons-material/IosShareOutlined';
8
+ import LockOutlined from '@mui/icons-material/LockOutlined';
9
+ import MoreHorizRounded from '@mui/icons-material/MoreHorizRounded';
10
+ import {
11
+ Menu,
12
+ MenuItemTone,
13
+ MenuSeparator,
14
+ } from '../../src/components/layers/Menu/Menu';
15
+ import { Example, LastEvent, Showcase, useEventLog } from '../frame';
16
+
17
+ export const MenuPage = () => {
18
+ const { log } = useEventLog();
19
+ const trigger = useRef<HTMLButtonElement>(null);
20
+ const [anchor, setAnchor] = useState<HTMLElement | null>(null);
21
+
22
+ // Opened on arrival, so the page shows the menu without a click.
23
+ useEffect(() => {
24
+ setAnchor(trigger.current);
25
+ }, []);
26
+
27
+ const select = (action: string) => () => log(action);
28
+
29
+ return (
30
+ <Showcase
31
+ family="Couches"
32
+ name="Menu"
33
+ description="Menu d'actions : icône, description, raccourci, ton danger, entrées désactivées sautées par les flèches."
34
+ >
35
+ <Example title="Actions d'un fichier">
36
+ <Button
37
+ ref={trigger}
38
+ variant="outlined"
39
+ startIcon={<MoreHorizRounded />}
40
+ onClick={(event) => setAnchor(event.currentTarget)}
41
+ >
42
+ avis-imposition-2026.pdf
43
+ </Button>
44
+ </Example>
45
+ <LastEvent />
46
+ <Menu
47
+ anchorEl={anchor}
48
+ open={anchor !== null}
49
+ onClose={() => setAnchor(null)}
50
+ items={[
51
+ {
52
+ id: 'share',
53
+ label: 'Partager',
54
+ description: 'Lien ou invitation par courriel',
55
+ icon: <IosShareOutlined />,
56
+ shortcut: 'Ctrl+Maj+S',
57
+ onSelect: select('partager'),
58
+ },
59
+ {
60
+ id: 'rename',
61
+ label: 'Renommer',
62
+ icon: <EditOutlined />,
63
+ shortcut: 'F2',
64
+ onSelect: select('renommer'),
65
+ },
66
+ {
67
+ id: 'copy',
68
+ label: 'Copier le lien',
69
+ icon: <ContentCopyOutlined />,
70
+ shortcut: 'Ctrl+L',
71
+ onSelect: select('copier'),
72
+ },
73
+ {
74
+ id: 'move',
75
+ label: 'Déplacer',
76
+ icon: <DriveFileMoveOutlined />,
77
+ onSelect: select('déplacer'),
78
+ },
79
+ {
80
+ id: 'encrypt',
81
+ label: 'Déjà chiffré',
82
+ icon: <LockOutlined />,
83
+ disabled: true,
84
+ onSelect: select('chiffrer'),
85
+ },
86
+ MenuSeparator.Divider,
87
+ {
88
+ id: 'trash',
89
+ label: 'Mettre à la corbeille',
90
+ icon: <DeleteOutlineOutlined />,
91
+ tone: MenuItemTone.Danger,
92
+ shortcut: 'Suppr',
93
+ onSelect: select('corbeille'),
94
+ },
95
+ ]}
96
+ />
97
+ </Showcase>
98
+ );
99
+ };
@@ -0,0 +1,46 @@
1
+ import { useState } from 'react';
2
+ import { NumberField } from '../../src/components/inputs/NumberField/NumberField';
3
+ import { Columns, Example, Showcase } from '../frame';
4
+
5
+ export const NumberFieldPage = () => {
6
+ const [ceiling, setCeiling] = useState<number | null>(1250.5);
7
+ const [seats, setSeats] = useState<number | null>(12);
8
+ const [empty, setEmpty] = useState<number | null>(null);
9
+ return (
10
+ <Showcase
11
+ family="Saisie"
12
+ name="NumberField"
13
+ description="Nombre saisi et affiché avec les séparateurs de la langue ; « , » ou « . » lus comme marque décimale, borné et arrondi en sortie du champ."
14
+ >
15
+ <Example title="Montant, quantité, champ vide et désactivé">
16
+ <Columns>
17
+ <NumberField
18
+ label="Plafond mensuel"
19
+ value={ceiling}
20
+ onChange={setCeiling}
21
+ decimals={2}
22
+ adornment="€"
23
+ />
24
+ <NumberField
25
+ label="Sièges"
26
+ value={seats}
27
+ onChange={setSeats}
28
+ min={1}
29
+ />
30
+ <NumberField
31
+ label="Stockage supplémentaire"
32
+ value={empty}
33
+ onChange={setEmpty}
34
+ adornment="Go"
35
+ />
36
+ <NumberField
37
+ label="Crédits offerts"
38
+ value={500}
39
+ onChange={() => undefined}
40
+ disabled
41
+ />
42
+ </Columns>
43
+ </Example>
44
+ </Showcase>
45
+ );
46
+ };
@@ -0,0 +1,26 @@
1
+ import { useState } from 'react';
2
+ import Button from '@mui/material/Button';
3
+ import { QRCodeModal } from '../../src/components/business/QRCodeModal/QRCodeModal';
4
+ import { Example, Showcase } from '../frame';
5
+
6
+ export const QRCodeModalPage = () => {
7
+ const [open, setOpen] = useState(true);
8
+ return (
9
+ <Showcase
10
+ family="Métier"
11
+ name="QRCodeModal"
12
+ description="Un lien en QR code, toujours sur une page claire (jeton paper) pour rester lisible par un appareil photo ; le lien à copier et « Partager »."
13
+ >
14
+ <Example title="Lien de parrainage">
15
+ <Button variant="outlined" onClick={() => setOpen(true)}>
16
+ Afficher le QR code
17
+ </Button>
18
+ </Example>
19
+ <QRCodeModal
20
+ open={open}
21
+ onClose={() => setOpen(false)}
22
+ url="https://abyss-project.fr/auth/register?sponsorship=7f3a9c2e"
23
+ />
24
+ </Showcase>
25
+ );
26
+ };