@alveole/components 2.0.0-alpha → 2.0.0-alpha.2
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/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.d.ts.map +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/stories/index.d.ts +1 -1
- package/dist/stories/index.d.ts.map +1 -1
- package/dist/stories/index.js +1 -1
- package/dist/ui/Button/Button.d.ts.map +1 -1
- package/dist/ui/Button/Button.js +22 -2
- package/dist/ui/Button/Button.stories.d.ts +12 -0
- package/dist/ui/Button/Button.stories.d.ts.map +1 -1
- package/dist/ui/Button/Button.stories.js +20 -0
- package/dist/ui/Button/Button.stories.sources.d.ts +2 -0
- package/dist/ui/Button/Button.stories.sources.d.ts.map +1 -1
- package/dist/ui/Button/Button.stories.sources.js +3 -0
- package/dist/ui/Button/Button.types.d.ts +4 -0
- package/dist/ui/Button/Button.types.d.ts.map +1 -1
- package/dist/ui/Checkbox/Checkbox.js +2 -2
- package/dist/ui/FileDropZone/FileDropZone.d.ts +10 -0
- package/dist/ui/FileDropZone/FileDropZone.d.ts.map +1 -0
- package/dist/ui/FileDropZone/FileDropZone.js +3 -0
- package/dist/ui/FileDropZone/FileDropZone.stories.d.ts +50 -0
- package/dist/ui/FileDropZone/FileDropZone.stories.d.ts.map +1 -0
- package/dist/ui/FileDropZone/FileDropZone.stories.js +29 -0
- package/dist/ui/FileDropZone/FileDropZone.stories.sources.d.ts +10 -0
- package/dist/ui/FileDropZone/FileDropZone.stories.sources.d.ts.map +1 -0
- package/dist/ui/FileDropZone/FileDropZone.stories.sources.js +10 -0
- package/dist/ui/FileDropZone/FileDropZone.styles.d.ts +37 -0
- package/dist/ui/FileDropZone/FileDropZone.styles.d.ts.map +1 -0
- package/dist/ui/FileDropZone/FileDropZone.styles.js +35 -0
- package/dist/ui/FileDropZone/FileDropZone.web.d.ts +4 -0
- package/dist/ui/FileDropZone/FileDropZone.web.d.ts.map +1 -0
- package/dist/ui/FileDropZone/FileDropZone.web.js +11 -0
- package/dist/ui/FileDropZone/fichiersDuDataTransfer.d.ts.map +1 -0
- package/dist/ui/FileDropZone/index.d.ts +2 -0
- package/dist/ui/FileDropZone/index.d.ts.map +1 -0
- package/dist/ui/FileDropZone/index.js +1 -0
- package/dist/ui/FileDropZone/useDepotFichier.d.ts +17 -0
- package/dist/ui/FileDropZone/useDepotFichier.d.ts.map +1 -0
- package/dist/ui/FileDropZone/useDepotFichier.js +89 -0
- package/dist/ui/FormControl/FileInput.d.ts +10 -12
- package/dist/ui/FormControl/FileInput.d.ts.map +1 -1
- package/dist/ui/FormControl/FileInput.js +15 -53
- package/dist/ui/FormControl/FileInput.stories.d.ts +8 -40
- package/dist/ui/FormControl/FileInput.stories.d.ts.map +1 -1
- package/dist/ui/FormControl/FileInput.stories.js +46 -4
- package/dist/ui/FormControl/FileInput.stories.sources.d.ts +10 -0
- package/dist/ui/FormControl/FileInput.stories.sources.d.ts.map +1 -1
- package/dist/ui/FormControl/FileInput.stories.sources.js +11 -1
- package/dist/ui/FormControl/FileInput.styles.d.ts +2 -39
- package/dist/ui/FormControl/FileInput.styles.d.ts.map +1 -1
- package/dist/ui/FormControl/FileInput.styles.js +3 -32
- package/dist/ui/FormControl/FileInputListe.d.ts +11 -0
- package/dist/ui/FormControl/FileInputListe.d.ts.map +1 -0
- package/dist/ui/FormControl/FileInputListe.js +24 -0
- package/dist/ui/FormControl/fichierCorrespondAuType.d.ts +1 -0
- package/dist/ui/FormControl/fichierCorrespondAuType.d.ts.map +1 -1
- package/dist/ui/FormControl/fichierCorrespondAuType.js +5 -1
- package/dist/ui/FormControl/fichiersDuChamp.d.ts +43 -0
- package/dist/ui/FormControl/fichiersDuChamp.d.ts.map +1 -0
- package/dist/ui/FormControl/fichiersDuChamp.js +63 -0
- package/dist/ui/FormControl/useChoixDeFichier.d.ts +15 -0
- package/dist/ui/FormControl/useChoixDeFichier.d.ts.map +1 -0
- package/dist/ui/FormControl/useChoixDeFichier.js +87 -0
- package/dist/ui/FormControl/valideLeType.d.ts +1 -1
- package/dist/ui/FormControl/valideLeType.js +1 -1
- package/dist/ui/LucideIcon/catalogueLucide.d.ts +117 -0
- package/dist/ui/LucideIcon/catalogueLucide.d.ts.map +1 -1
- package/dist/ui/LucideIcon/vendor/lab.js +1 -1
- package/dist/ui/LucideIcon/vendor/lucide.d.ts +2233 -1722
- package/dist/ui/LucideIcon/vendor/lucide.js +3 -3
- package/dist/ui/RadioGroup/RadioGroup.d.ts +3 -1
- package/dist/ui/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/ui/RadioGroup/RadioGroup.js +5 -1
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -1
- package/package.json +10 -8
- package/dist/ui/DragAndDropFile/DragAndDropFile.d.ts +0 -10
- package/dist/ui/DragAndDropFile/DragAndDropFile.d.ts.map +0 -1
- package/dist/ui/DragAndDropFile/DragAndDropFile.js +0 -13
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.d.ts +0 -56
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.d.ts.map +0 -1
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.js +0 -17
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.sources.d.ts +0 -10
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.sources.d.ts.map +0 -1
- package/dist/ui/DragAndDropFile/DragAndDropFile.stories.sources.js +0 -10
- package/dist/ui/DragAndDropFile/DragAndDropFile.styles.d.ts +0 -43
- package/dist/ui/DragAndDropFile/DragAndDropFile.styles.d.ts.map +0 -1
- package/dist/ui/DragAndDropFile/DragAndDropFile.styles.js +0 -43
- package/dist/ui/DragAndDropFile/DragAndDropFile.web.d.ts +0 -3
- package/dist/ui/DragAndDropFile/DragAndDropFile.web.d.ts.map +0 -1
- package/dist/ui/DragAndDropFile/DragAndDropFile.web.js +0 -18
- package/dist/ui/DragAndDropFile/fichiersDuDataTransfer.d.ts.map +0 -1
- package/dist/ui/DragAndDropFile/index.d.ts +0 -2
- package/dist/ui/DragAndDropFile/index.d.ts.map +0 -1
- package/dist/ui/DragAndDropFile/index.js +0 -1
- package/dist/ui/DragAndDropFile/useDepotFichier.d.ts +0 -21
- package/dist/ui/DragAndDropFile/useDepotFichier.d.ts.map +0 -1
- package/dist/ui/DragAndDropFile/useDepotFichier.js +0 -77
- /package/dist/ui/{DragAndDropFile → FileDropZone}/fichiersDuDataTransfer.d.ts +0 -0
- /package/dist/ui/{DragAndDropFile → FileDropZone}/fichiersDuDataTransfer.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ALVEOLE_COMPONENTS_VERSION: "2.0.0-alpha";
|
|
1
|
+
export declare const ALVEOLE_COMPONENTS_VERSION: "2.0.0-alpha.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/generated/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,EAAG,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/generated/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,EAAG,eAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ALVEOLE_COMPONENTS_VERSION = "2.0.0-alpha";
|
|
1
|
+
export const ALVEOLE_COMPONENTS_VERSION = "2.0.0-alpha.2";
|
package/dist/stories/index.d.ts
CHANGED
|
@@ -31,9 +31,9 @@ export * as DataTableStory from '../ui/DataTable/DataTable.stories';
|
|
|
31
31
|
export * as DateInputStory from '../ui/DateInput/DateInput.stories';
|
|
32
32
|
export * as DividerStory from '../ui/Divider/Divider.stories';
|
|
33
33
|
export * as DocumentViewerStory from '../ui/DocumentViewer/DocumentViewer.stories';
|
|
34
|
-
export * as DragAndDropFileStory from '../ui/DragAndDropFile/DragAndDropFile.stories';
|
|
35
34
|
export * as DurationInputStory from '../ui/DurationInput/DurationInput.stories';
|
|
36
35
|
export * as EmptyStateStory from '../ui/EmptyState/EmptyState.stories';
|
|
36
|
+
export * as FileDropZoneStory from '../ui/FileDropZone/FileDropZone.stories';
|
|
37
37
|
export * as FilterDateStory from '../ui/FilterDate/FilterDate.stories';
|
|
38
38
|
export * as FileInputStory from '../ui/FormControl/FileInput.stories';
|
|
39
39
|
export * as FormControlStory from '../ui/FormControl/FormControl.stories';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stories/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,kBAAkB,MAAM,6CAA6C,CAAC;AAClF,OAAO,KAAK,wBAAwB,MAAM,qDAAqD,CAAC;AAChG,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,wBAAwB,MAAM,yDAAyD,CAAC;AACpG,OAAO,KAAK,aAAa,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,cAAc,MAAM,qCAAqC,CAAC;AACtE,OAAO,KAAK,YAAY,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,kBAAkB,MAAM,6CAA6C,CAAC;AAClF,OAAO,KAAK,eAAe,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,YAAY,MAAM,iCAAiC,CAA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AAC;AACnF,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAC;AACpE,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,qBAAqB,MAAM,iDAAiD,CAAC;AACzF,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC"}
|
package/dist/stories/index.js
CHANGED
|
@@ -33,9 +33,9 @@ export * as DataTableStory from '../ui/DataTable/DataTable.stories';
|
|
|
33
33
|
export * as DateInputStory from '../ui/DateInput/DateInput.stories';
|
|
34
34
|
export * as DividerStory from '../ui/Divider/Divider.stories';
|
|
35
35
|
export * as DocumentViewerStory from '../ui/DocumentViewer/DocumentViewer.stories';
|
|
36
|
-
export * as DragAndDropFileStory from '../ui/DragAndDropFile/DragAndDropFile.stories';
|
|
37
36
|
export * as DurationInputStory from '../ui/DurationInput/DurationInput.stories';
|
|
38
37
|
export * as EmptyStateStory from '../ui/EmptyState/EmptyState.stories';
|
|
38
|
+
export * as FileDropZoneStory from '../ui/FileDropZone/FileDropZone.stories';
|
|
39
39
|
export * as FilterDateStory from '../ui/FilterDate/FilterDate.stories';
|
|
40
40
|
export * as FileInputStory from '../ui/FormControl/FileInput.stories';
|
|
41
41
|
export * as FormControlStory from '../ui/FormControl/FormControl.stories';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,EAAa,IAAI,EAAE,MAAM,cAAc,CAAC;AAO/C,cAAc,gBAAgB,CAAC;AAE/B,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;8BA0EjB,CAAC"}
|
package/dist/ui/Button/Button.js
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { focusRingProps } from '@alveole/theme';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { useRef, useState } from 'react';
|
|
4
4
|
import { Pressable } from 'react-native';
|
|
5
5
|
import { useStyles } from './Button.styles';
|
|
6
6
|
import { etatDuBouton } from './Button.types';
|
|
7
7
|
import { ButtonContent } from './ButtonContent';
|
|
8
8
|
import { styleDuPressable } from './buttonStyling';
|
|
9
9
|
export * from './Button.types';
|
|
10
|
-
export const Button = React.forwardRef(function Button(
|
|
10
|
+
export const Button = React.forwardRef(function Button(propsDeLAppelant, ref) {
|
|
11
|
+
const verrou = useRef(false);
|
|
12
|
+
const [enCours, setEnCours] = useState(false);
|
|
13
|
+
// Un onPress qui rend une promesse (soumission de formulaire) verrouille le bouton jusqu'a sa
|
|
14
|
+
// fin. Le ref ferme la porte des le premier clic, avant que le state n'ait rafraichi le rendu :
|
|
15
|
+
// le second clic d'un double clic arrive sinon pendant que le bouton parait encore libre.
|
|
16
|
+
const onPress = event => {
|
|
17
|
+
if (verrou.current)
|
|
18
|
+
return;
|
|
19
|
+
const resultat = propsDeLAppelant.onPress?.(event);
|
|
20
|
+
if (!(resultat instanceof Promise))
|
|
21
|
+
return;
|
|
22
|
+
verrou.current = true;
|
|
23
|
+
setEnCours(true);
|
|
24
|
+
const liberer = () => {
|
|
25
|
+
verrou.current = false;
|
|
26
|
+
setEnCours(false);
|
|
27
|
+
};
|
|
28
|
+
resultat.then(liberer, liberer);
|
|
29
|
+
};
|
|
30
|
+
const props = { ...propsDeLAppelant, onPress, isLoading: propsDeLAppelant.isLoading || enCours };
|
|
11
31
|
const { type, disabled, isLoading, active = false, expanded = false, ...buttonProps } = props;
|
|
12
32
|
const styles = useStyles();
|
|
13
33
|
const etat = etatDuBouton(props);
|
|
@@ -305,6 +305,18 @@ export declare const States: () => React.JSX.Element;
|
|
|
305
305
|
* attendent le délai par défaut d'une seconde.
|
|
306
306
|
*/
|
|
307
307
|
export declare const Loading: () => React.JSX.Element;
|
|
308
|
+
/**
|
|
309
|
+
* Un `onPress` qui rend une promesse verrouille le bouton jusqu'à sa fin, résolue ou rejetée :
|
|
310
|
+
* c'est la protection contre la double soumission d'un formulaire. Le verrou est posé dès le
|
|
311
|
+
* premier clic, avant même le rafraîchissement : le second clic d'un double clic est ignoré.
|
|
312
|
+
* Pas besoin de gérer `isLoading` : le bouton charge seul, avec le même `loadingDelay`.
|
|
313
|
+
*
|
|
314
|
+
* Avec react-hook-form, `onPress={handleSubmit(...)}` suffit, `handleSubmit` rendant une promesse.
|
|
315
|
+
* Un `onPress` synchrone n'est pas verrouillé.
|
|
316
|
+
*
|
|
317
|
+
* Double-cliquez sur le bouton : l'envoi de 3 secondes n'est compté qu'une fois.
|
|
318
|
+
*/
|
|
319
|
+
export declare const OnPressAsynchrone: () => React.JSX.Element;
|
|
308
320
|
/** `leading` place l’icône avant le libellé, `trailing` après. Les deux peuvent coexister. */
|
|
309
321
|
export declare const Icons: () => React.JSX.Element;
|
|
310
322
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAS1B,wBAQkB;AAElB;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,QAAQ,yBAOpB,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,KAAK,yBAMjB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,MAAM,yBAOlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,OAAO,yBAenB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,yBAc7B,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,KAAK,yBAMjB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,yBAK/B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,yBASpB,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,SAAS,yBAAkE,CAAC;AAEzF,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box } from '../../core/Box';
|
|
4
|
+
import { Typography } from '../../core/Typography';
|
|
4
5
|
import { Avatar } from '../Avatar';
|
|
5
6
|
import { Button } from './Button';
|
|
6
7
|
import { useStyles } from './Button.styles';
|
|
@@ -72,6 +73,25 @@ export const Loading = () => {
|
|
|
72
73
|
};
|
|
73
74
|
return (_jsxs(Box, { display: "flex", flexDirection: "row", gap: 24, children: [_jsx(Button, { variant: "primary", title: "Enregistrer", isLoading: isLoading, onPress: handlePress }), _jsx(Button, { variant: "secondary", title: "Exporter", leading: "Download", isLoading: isLoading, onPress: handlePress }), _jsx(Button, { variant: "primary", title: "D\u00E9lai court", loadingDelay: "short", isLoading: isLoading, onPress: handlePress })] }));
|
|
74
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Un `onPress` qui rend une promesse verrouille le bouton jusqu'à sa fin, résolue ou rejetée :
|
|
78
|
+
* c'est la protection contre la double soumission d'un formulaire. Le verrou est posé dès le
|
|
79
|
+
* premier clic, avant même le rafraîchissement : le second clic d'un double clic est ignoré.
|
|
80
|
+
* Pas besoin de gérer `isLoading` : le bouton charge seul, avec le même `loadingDelay`.
|
|
81
|
+
*
|
|
82
|
+
* Avec react-hook-form, `onPress={handleSubmit(...)}` suffit, `handleSubmit` rendant une promesse.
|
|
83
|
+
* Un `onPress` synchrone n'est pas verrouillé.
|
|
84
|
+
*
|
|
85
|
+
* Double-cliquez sur le bouton : l'envoi de 3 secondes n'est compté qu'une fois.
|
|
86
|
+
*/
|
|
87
|
+
export const OnPressAsynchrone = () => {
|
|
88
|
+
const [envois, setEnvois] = React.useState(0);
|
|
89
|
+
const envoyer = async () => {
|
|
90
|
+
setEnvois(n => n + 1);
|
|
91
|
+
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
92
|
+
};
|
|
93
|
+
return (_jsxs(Box, { display: "flex", flexDirection: "row", gap: 24, style: { alignItems: 'center' }, children: [_jsx(Button, { variant: "primary", title: "Envoyer", loadingDelay: "short", onPress: envoyer }), _jsxs(Typography, { children: ["Envois : ", envois] })] }));
|
|
94
|
+
};
|
|
75
95
|
/** `leading` place l’icône avant le libellé, `trailing` après. Les deux peuvent coexister. */
|
|
76
96
|
export const Icons = () => (_jsxs(Box, { display: "flex", flexDirection: "row", gap: 24, children: [_jsx(Button, { variant: "secondary", title: "Ajouter", leading: "Plus" }), _jsx(Button, { variant: "secondary", title: "Exporter", trailing: "Download" }), _jsx(Button, { variant: "secondary", title: "Filtres", leading: "Plus", trailing: "ChevronDown" })] }));
|
|
77
97
|
/**
|
|
@@ -2,6 +2,7 @@ export declare const Variants: () => string;
|
|
|
2
2
|
export declare const Sizes: () => string;
|
|
3
3
|
export declare const States: () => string;
|
|
4
4
|
export declare const Loading: () => string;
|
|
5
|
+
export declare const OnPressAsynchrone: () => string;
|
|
5
6
|
export declare const Icons: () => string;
|
|
6
7
|
export declare const TertiaireAvecAvatar: () => string;
|
|
7
8
|
export declare const IconOnly: () => string;
|
|
@@ -11,6 +12,7 @@ export declare const storySources: {
|
|
|
11
12
|
readonly Sizes: () => string;
|
|
12
13
|
readonly States: () => string;
|
|
13
14
|
readonly Loading: () => string;
|
|
15
|
+
readonly OnPressAsynchrone: () => string;
|
|
14
16
|
readonly Icons: () => string;
|
|
15
17
|
readonly TertiaireAvecAvatar: () => string;
|
|
16
18
|
readonly IconOnly: () => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,cAA6U,CAAC;AAEnW,eAAO,MAAM,KAAK,cAAiW,CAAC;AAEpX,eAAO,MAAM,MAAM,cAA4W,CAAC;AAEhY,eAAO,MAAM,OAAO,cAAypB,CAAC;AAE9qB,eAAO,MAAM,KAAK,cAAwW,CAAC;AAE3X,eAAO,MAAM,mBAAmB,cAAkW,CAAC;AAEnY,eAAO,MAAM,QAAQ,cAAizB,CAAC;AAEv0B,eAAO,MAAM,SAAS,cAAwG,CAAC;AAE/H,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"Button.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ,cAA6U,CAAC;AAEnW,eAAO,MAAM,KAAK,cAAiW,CAAC;AAEpX,eAAO,MAAM,MAAM,cAA4W,CAAC;AAEhY,eAAO,MAAM,OAAO,cAAypB,CAAC;AAE9qB,eAAO,MAAM,iBAAiB,cAA2f,CAAC;AAE1hB,eAAO,MAAM,KAAK,cAAwW,CAAC;AAE3X,eAAO,MAAM,mBAAmB,cAAkW,CAAC;AAEnY,eAAO,MAAM,QAAQ,cAAizB,CAAC;AAEv0B,eAAO,MAAM,SAAS,cAAwG,CAAC;AAE/H,eAAO,MAAM,YAAY;;;;;;;;;;CAUf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC;AAExD,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAUtE,CAAC"}
|
|
@@ -4,6 +4,7 @@ export const Variants = () => "export const Variants = () => (\n <Box display=\
|
|
|
4
4
|
export const Sizes = () => "export const Sizes = () => (\n <Box display=\"flex\" flexDirection=\"row\" style={{ alignItems: 'center' }} gap={24}>\n <Button variant=\"secondary\" size=\"sm\" title=\"Bouton sm\" />\n <Button variant=\"secondary\" size=\"md\" title=\"Bouton md\" />\n <Button variant=\"secondary\" size=\"lg\" title=\"Bouton lg\" />\n </Box>\n);";
|
|
5
5
|
export const States = () => "export const States = () => (\n <Box display=\"flex\" flexDirection=\"row\" gap={24}>\n <Button variant=\"secondary\" title=\"Normal\" />\n <Button variant=\"secondary\" title=\"Disabled\" disabled />\n <Button variant=\"secondary\" title=\"Selected\" selected />\n <Button variant=\"secondary\" title=\"Expanded\" expanded />\n </Box>\n);";
|
|
6
6
|
export const Loading = () => "export const Loading = () => {\n const [isLoading, setIsLoading] = React.useState(false);\n\n const handlePress = () => {\n setIsLoading(true);\n setTimeout(() => setIsLoading(false), 3000);\n };\n\n return (\n <Box display=\"flex\" flexDirection=\"row\" gap={24}>\n <Button variant=\"primary\" title=\"Enregistrer\" isLoading={isLoading} onPress={handlePress} />\n <Button variant=\"secondary\" title=\"Exporter\" leading=\"Download\" isLoading={isLoading} onPress={handlePress} />\n <Button variant=\"primary\" title=\"Délai court\" loadingDelay=\"short\" isLoading={isLoading} onPress={handlePress} />\n </Box>\n );\n};";
|
|
7
|
+
export const OnPressAsynchrone = () => "export const OnPressAsynchrone = () => {\n const [envois, setEnvois] = React.useState(0);\n\n const envoyer = async () => {\n setEnvois(n => n + 1);\n await new Promise(resolve => setTimeout(resolve, 3000));\n };\n\n return (\n <Box display=\"flex\" flexDirection=\"row\" gap={24} style={{ alignItems: 'center' }}>\n <Button variant=\"primary\" title=\"Envoyer\" loadingDelay=\"short\" onPress={envoyer} />\n <Typography>Envois : {envois}</Typography>\n </Box>\n );\n};";
|
|
7
8
|
export const Icons = () => "export const Icons = () => (\n <Box display=\"flex\" flexDirection=\"row\" gap={24}>\n <Button variant=\"secondary\" title=\"Ajouter\" leading=\"Plus\" />\n <Button variant=\"secondary\" title=\"Exporter\" trailing=\"Download\" />\n <Button variant=\"secondary\" title=\"Filtres\" leading=\"Plus\" trailing=\"ChevronDown\" />\n </Box>\n);";
|
|
8
9
|
export const TertiaireAvecAvatar = () => "export const TertiaireAvecAvatar = () => (\n <Box display=\"flex\" flexDirection=\"row\" gap={24} style={{ alignItems: 'center' }}>\n <Button variant=\"tertiary\" title=\"Marie Curie\" leading={<Avatar size=\"xs\" fallbackText=\"Marie Curie\" />} />\n <Button variant=\"tertiary\" title=\"Marie Curie\" leading=\"User\" />\n </Box>\n);";
|
|
9
10
|
export const IconOnly = () => "export const IconOnly = () => (\n <Box display=\"flex\" flexDirection=\"row\" gap={24} style={{ alignItems: 'center' }}>\n <ButtonIcon variant=\"tertiary\" size=\"sm\" icon=\"MoreHorizontal\" accessibilityLabel=\"Plus d'actions\" />\n <ButtonIcon variant=\"tertiary\" size=\"md\" icon=\"MoreHorizontal\" accessibilityLabel=\"Plus d'actions\" />\n <ButtonIcon variant=\"tertiary\" size=\"lg\" icon=\"MoreHorizontal\" accessibilityLabel=\"Plus d'actions\" />\n <ButtonIcon variant=\"secondary\" size=\"md\" icon=\"Trash\" accessibilityLabel=\"Supprimer\" />\n <ButtonIcon variant=\"primary\" size=\"md\" icon=\"Plus\" accessibilityLabel=\"Ajouter\" />\n <ButtonIcon variant=\"tertiary\" size=\"md\" icon=\"CircleUser\" iconSize=\"xs\" accessibilityLabel=\"Voir le profil\" />\n </Box>\n);";
|
|
@@ -13,6 +14,7 @@ export const storySources = {
|
|
|
13
14
|
Sizes,
|
|
14
15
|
States,
|
|
15
16
|
Loading,
|
|
17
|
+
OnPressAsynchrone,
|
|
16
18
|
Icons,
|
|
17
19
|
TertiaireAvecAvatar,
|
|
18
20
|
IconOnly,
|
|
@@ -23,6 +25,7 @@ export const storyDescriptions = {
|
|
|
23
25
|
Sizes: "`md` par défaut. `sm` pour les zones denses, `lg` pour une action qu'on veut mettre en avant.",
|
|
24
26
|
States: "- `disabled` : l'action n'est pas disponible. Le bouton ne répond plus ni au clic ni au clavier.\n- `selected` : le bouton fait partie d'un groupe et c'est lui qui est choisi.\n- `expanded` : le bouton commande un menu ou un panneau actuellement déplié. Il pose aussi\n l'état accessible correspondant, ce que `selected` ne fait pas.",
|
|
25
27
|
Loading: "Le spinner n'apparaît qu'après un délai, réglé par `loadingDelay` : mêmes valeurs que la\nprop `delay` de `Spinner` (`false` / `true` / `'short'` (300 ms) / `'long'` / `number`).\nIl vaut `'long'` (1 000 ms) par défaut.\n\nCe délai évite un clignotement visuel quand l'opération se termine rapidement :\nsi le serveur répond en moins d'une seconde, l'utilisateur ne voit jamais le spinner.\nAu-delà, le spinner s'affiche pour signaler que l'attente va durer.\n\n**Le spinner prend la place de quelque chose, il ne s'ajoute jamais** : le bouton garde donc\nexactement sa largeur. S'il porte une icône, c'est elle que le spinner remplace, et le\nlibellé reste lisible. Sinon le spinner se centre et le libellé devient invisible sans\nquitter le flux, pour continuer d'imposer sa largeur.\n\nPendant toute l'attente - y compris avant que le spinner ne paraisse - le bouton cesse de\nrépondre : il sort du parcours au clavier et se déclare `aria-disabled`, pour qu'un second\nappui ne relance pas l'opération. Son apparence, elle, reste celle du repos.\n\nAppuyez sur un bouton pour simuler une opération de 3 secondes. Le troisième bouton, avec\n`loadingDelay=\"short\"`, montre son spinner dès 300 ms - avant les deux premiers, qui\nattendent le délai par défaut d'une seconde.",
|
|
28
|
+
OnPressAsynchrone: "Un `onPress` qui rend une promesse verrouille le bouton jusqu'à sa fin, résolue ou rejetée :\nc'est la protection contre la double soumission d'un formulaire. Le verrou est posé dès le\npremier clic, avant même le rafraîchissement : le second clic d'un double clic est ignoré.\nPas besoin de gérer `isLoading` : le bouton charge seul, avec le même `loadingDelay`.\n\nAvec react-hook-form, `onPress={handleSubmit(...)}` suffit, `handleSubmit` rendant une promesse.\nUn `onPress` synchrone n'est pas verrouillé.\n\nDouble-cliquez sur le bouton : l'envoi de 3 secondes n'est compté qu'une fois.",
|
|
26
29
|
Icons: "`leading` place l’icône avant le libellé, `trailing` après. Les deux peuvent coexister.",
|
|
27
30
|
TertiaireAvecAvatar: "`leading` et `trailing` acceptent aussi un élément : un avatar, un logo de réseau social.\nIl est posé dans un emplacement de la taille de l'icône, sans recevoir de couleur, si bien\nque le bouton garde sa hauteur et son alignement.",
|
|
28
31
|
IconOnly: "`ButtonIcon` est la **seule** façon d'obtenir un bouton carré. `Button` exige un `title` :\nil ne bascule plus en mode icône seule quand on le lui retire.\n\nC'est la règle des trois références. Atlassian rend les `children` de son bouton par défaut\nobligatoires, si bien qu'un bouton-icône ne peut y être écrit qu'avec `IconButton`. Primer a\ndeux composants, et la géométrie carrée n'existe que sur la classe que pose `IconButton`.\nBase n'a qu'un composant, mais la forme s'y demande (`shape=\"square\"`), jamais ne se déduit.\n\nLa raison est mesurable : tant que l'absence de `title` suffisait, rien ne signalait un\nbouton muet. Deux des quatre appels de ce genre écrits dans les applications n'avaient aucun\n`accessibilityLabel`. `ButtonIcon` le rend obligatoire, et le compilateur fait le reste.\n\nIl accepte `primary`, `secondary` et `tertiary`, et `iconSize` pour dissocier la taille de\nl'icône de celle du bouton.",
|
|
@@ -32,6 +32,10 @@ export type ButtonProps = Omit<PressableProps, 'children' | 'style'> & {
|
|
|
32
32
|
active?: boolean;
|
|
33
33
|
/** Le bouton commande un menu ou un panneau actuellement deplie. */
|
|
34
34
|
expanded?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Inutile pour un `onPress` qui rend une promesse : le bouton se verrouille et charge seul
|
|
37
|
+
* jusqu'a sa fin, ce qui empeche le double envoi d'un formulaire.
|
|
38
|
+
*/
|
|
35
39
|
isLoading?: boolean;
|
|
36
40
|
/**
|
|
37
41
|
* Retard avant que le spinner de `isLoading` ne paraisse. Memes valeurs que la prop `delay`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IACrE;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;IACvB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAA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D;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,4FAA4F;IAC5F,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,aAAa,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,WAAW,KAAG,YAMhD,CAAC"}
|
|
@@ -8,8 +8,8 @@ import { CheckboxContainer } from './CheckboxContainer';
|
|
|
8
8
|
import { CheckboxIndicator } from './CheckboxIndicator';
|
|
9
9
|
import { CheckboxLabel } from './CheckboxLabel';
|
|
10
10
|
export const Checkbox = React.forwardRef(function Checkbox(props, ref) {
|
|
11
|
-
const { size, variant, label, error, success, disabled
|
|
12
|
-
const baseProps = { size, variant, label, error, success, disabled
|
|
11
|
+
const { size, variant, label, error, success, disabled } = props;
|
|
12
|
+
const baseProps = { size, variant, label, error, success, disabled };
|
|
13
13
|
const { spacingValue } = useTheme();
|
|
14
14
|
const styles = useStyles();
|
|
15
15
|
const id = useId();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FileInputProps } from '../FormControl';
|
|
3
|
+
export type FileDropZoneProps = Pick<FileInputProps, 'value' | 'onChange' | 'type' | 'multiple' | 'disabled'> & {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Le texte de la surcouche pendant le survol. */
|
|
6
|
+
message?: string;
|
|
7
|
+
};
|
|
8
|
+
/** Le glisser-deposer de fichiers n'existe que sur le web : hors web, la zone rend ses enfants. */
|
|
9
|
+
export declare const FileDropZone: ({ children }: FileDropZoneProps) => React.JSX.Element;
|
|
10
|
+
//# sourceMappingURL=FileDropZone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDropZone.d.ts","sourceRoot":"","sources":["../../../src/ui/FileDropZone/FileDropZone.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC,GAAG;IAC9G,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,YAAY,GAAI,cAAc,iBAAiB,sBAAoB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
tags: "ui"[];
|
|
4
|
+
experimental: false;
|
|
5
|
+
webOnly: true;
|
|
6
|
+
description: string;
|
|
7
|
+
component: ({ children }: import("./FileDropZone").FileDropZoneProps) => import("react").JSX.Element;
|
|
8
|
+
styleFn: () => {
|
|
9
|
+
conteneur: {
|
|
10
|
+
position: "relative";
|
|
11
|
+
};
|
|
12
|
+
surcouche: {
|
|
13
|
+
position: "absolute";
|
|
14
|
+
top: number;
|
|
15
|
+
right: number;
|
|
16
|
+
bottom: number;
|
|
17
|
+
left: number;
|
|
18
|
+
borderWidth: number;
|
|
19
|
+
borderStyle: "dashed";
|
|
20
|
+
borderColor: string;
|
|
21
|
+
borderRadius: import("@alveole/theme").Radius;
|
|
22
|
+
backgroundColor: string;
|
|
23
|
+
alignItems: "center";
|
|
24
|
+
justifyContent: "center";
|
|
25
|
+
pointerEvents: "none";
|
|
26
|
+
};
|
|
27
|
+
pastille: {
|
|
28
|
+
backgroundColor: string;
|
|
29
|
+
borderRadius: import("@alveole/theme").Radius;
|
|
30
|
+
paddingLeft: string | number;
|
|
31
|
+
paddingRight: string | number;
|
|
32
|
+
paddingTop: string | number;
|
|
33
|
+
paddingBottom: string | number;
|
|
34
|
+
};
|
|
35
|
+
message: {
|
|
36
|
+
color: string;
|
|
37
|
+
fontSize: 16;
|
|
38
|
+
lineHeight: 24;
|
|
39
|
+
letterSpacing: 0;
|
|
40
|
+
fontFamily: string;
|
|
41
|
+
fontWeight?: import("react-native").TextStyle["fontWeight"];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export default _default;
|
|
46
|
+
export declare const Formulaire: () => import("react").JSX.Element;
|
|
47
|
+
export declare const Desactivee: () => import("react").JSX.Element;
|
|
48
|
+
export declare const MessagePersonnalise: () => import("react").JSX.Element;
|
|
49
|
+
export * as Sources from './FileDropZone.stories.sources';
|
|
50
|
+
//# sourceMappingURL=FileDropZone.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDropZone.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/FileDropZone/FileDropZone.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wBASkB;AAElB,eAAO,MAAM,UAAU,mCAetB,CAAC;AAEF,eAAO,MAAM,UAAU,mCAWtB,CAAC;AAEF,eAAO,MAAM,mBAAmB,mCAW/B,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box } from '../../core/Box';
|
|
4
|
+
import { FileInput, FormControl, TextInput } from '../FormControl';
|
|
5
|
+
import { FileDropZone } from './FileDropZone';
|
|
6
|
+
import { useStyles } from './FileDropZone.styles';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'FileDropZone',
|
|
9
|
+
tags: ['ui'],
|
|
10
|
+
experimental: false,
|
|
11
|
+
webOnly: true,
|
|
12
|
+
description: "Zone de dépôt : enveloppe une région (souvent tout un formulaire) sur laquelle on peut glisser-déposer des fichiers. Se branche sur le même état que le FileInput du formulaire. À réserver aux formulaires qui n'ont qu'un seul champ de fichier : avec plusieurs FileInput, l'utilisateur ne peut pas savoir lequel recevra le fichier déposé.",
|
|
13
|
+
component: FileDropZone,
|
|
14
|
+
styleFn: useStyles,
|
|
15
|
+
};
|
|
16
|
+
export const Formulaire = () => {
|
|
17
|
+
const [titre, setTitre] = useState('');
|
|
18
|
+
const [fichiers, setFichiers] = useState(null);
|
|
19
|
+
return (_jsx(FileDropZone, { value: fichiers, onChange: setFichiers, multiple: true, children: _jsxs(Box, { display: "flex", flexDirection: "column", gap: 16, p: 16, children: [_jsx(FormControl, { label: "Titre", children: _jsx(TextInput, { value: titre, onChangeText: setTitre }) }), _jsx(FormControl, { label: "Pi\u00E8ces jointes", hint: "Glissez des fichiers n'importe o\u00F9 sur le formulaire.", children: _jsx(FileInput, { value: fichiers, onChange: setFichiers, multiple: true }) })] }) }));
|
|
20
|
+
};
|
|
21
|
+
export const Desactivee = () => {
|
|
22
|
+
const [fichiers, setFichiers] = useState(null);
|
|
23
|
+
return (_jsx(FileDropZone, { value: fichiers, onChange: setFichiers, multiple: true, disabled: true, children: _jsx(Box, { p: 16, children: _jsx(FormControl, { label: "Pi\u00E8ces jointes", disabled: true, children: _jsx(FileInput, { value: fichiers, onChange: setFichiers, multiple: true, disabled: true }) }) }) }));
|
|
24
|
+
};
|
|
25
|
+
export const MessagePersonnalise = () => {
|
|
26
|
+
const [photo, setPhoto] = useState(null);
|
|
27
|
+
return (_jsx(FileDropZone, { value: photo, onChange: setPhoto, type: "image/*", message: "L\u00E2chez la photo pour l'ajouter", children: _jsx(Box, { p: 16, children: _jsx(FormControl, { label: "Photo", children: _jsx(FileInput, { value: photo, onChange: setPhoto, type: "image/*" }) }) }) }));
|
|
28
|
+
};
|
|
29
|
+
export * as Sources from './FileDropZone.stories.sources';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const Formulaire: () => string;
|
|
2
|
+
export declare const Desactivee: () => string;
|
|
3
|
+
export declare const MessagePersonnalise: () => string;
|
|
4
|
+
export declare const storySources: {
|
|
5
|
+
readonly Formulaire: () => string;
|
|
6
|
+
readonly Desactivee: () => string;
|
|
7
|
+
readonly MessagePersonnalise: () => string;
|
|
8
|
+
};
|
|
9
|
+
export type StorySourceName = keyof typeof storySources;
|
|
10
|
+
//# sourceMappingURL=FileDropZone.stories.sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDropZone.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/FileDropZone/FileDropZone.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,cAA6qB,CAAC;AAErsB,eAAO,MAAM,UAAU,cAA8a,CAAC;AAEtc,eAAO,MAAM,mBAAmB,cAA4b,CAAC;AAE7d,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// This file is generated. Do not edit manually.
|
|
2
|
+
// Source: src/ui/FileDropZone/FileDropZone.stories.tsx
|
|
3
|
+
export const Formulaire = () => "export const Formulaire = () => {\n const [titre, setTitre] = useState('');\n const [fichiers, setFichiers] = useState<FileInputValue>(null);\n return (\n <FileDropZone value={fichiers} onChange={setFichiers} multiple>\n <Box display=\"flex\" flexDirection=\"column\" gap={16} p={16}>\n <FormControl label=\"Titre\">\n <TextInput value={titre} onChangeText={setTitre} />\n </FormControl>\n <FormControl label=\"Pièces jointes\" hint=\"Glissez des fichiers n'importe où sur le formulaire.\">\n <FileInput value={fichiers} onChange={setFichiers} multiple />\n </FormControl>\n </Box>\n </FileDropZone>\n );\n};";
|
|
4
|
+
export const Desactivee = () => "export const Desactivee = () => {\n const [fichiers, setFichiers] = useState<FileInputValue>(null);\n return (\n <FileDropZone value={fichiers} onChange={setFichiers} multiple disabled>\n <Box p={16}>\n <FormControl label=\"Pièces jointes\" disabled>\n <FileInput value={fichiers} onChange={setFichiers} multiple disabled />\n </FormControl>\n </Box>\n </FileDropZone>\n );\n};";
|
|
5
|
+
export const MessagePersonnalise = () => "export const MessagePersonnalise = () => {\n const [photo, setPhoto] = useState<FileInputValue>(null);\n return (\n <FileDropZone value={photo} onChange={setPhoto} type=\"image/*\" message=\"Lâchez la photo pour l'ajouter\">\n <Box p={16}>\n <FormControl label=\"Photo\">\n <FileInput value={photo} onChange={setPhoto} type=\"image/*\" />\n </FormControl>\n </Box>\n </FileDropZone>\n );\n};";
|
|
6
|
+
export const storySources = {
|
|
7
|
+
Formulaire,
|
|
8
|
+
Desactivee,
|
|
9
|
+
MessagePersonnalise,
|
|
10
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const useStyles: () => {
|
|
2
|
+
conteneur: {
|
|
3
|
+
position: "relative";
|
|
4
|
+
};
|
|
5
|
+
surcouche: {
|
|
6
|
+
position: "absolute";
|
|
7
|
+
top: number;
|
|
8
|
+
right: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
left: number;
|
|
11
|
+
borderWidth: number;
|
|
12
|
+
borderStyle: "dashed";
|
|
13
|
+
borderColor: string;
|
|
14
|
+
borderRadius: import("@alveole/theme").Radius;
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
alignItems: "center";
|
|
17
|
+
justifyContent: "center";
|
|
18
|
+
pointerEvents: "none";
|
|
19
|
+
};
|
|
20
|
+
pastille: {
|
|
21
|
+
backgroundColor: string;
|
|
22
|
+
borderRadius: import("@alveole/theme").Radius;
|
|
23
|
+
paddingLeft: string | number;
|
|
24
|
+
paddingRight: string | number;
|
|
25
|
+
paddingTop: string | number;
|
|
26
|
+
paddingBottom: string | number;
|
|
27
|
+
};
|
|
28
|
+
message: {
|
|
29
|
+
color: string;
|
|
30
|
+
fontSize: 16;
|
|
31
|
+
lineHeight: 24;
|
|
32
|
+
letterSpacing: 0;
|
|
33
|
+
fontFamily: string;
|
|
34
|
+
fontWeight?: import("react-native").TextStyle["fontWeight"];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=FileDropZone.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDropZone.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/FileDropZone/FileDropZone.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCnB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { makeStyles } from '@alveole/theme';
|
|
2
|
+
export const useStyles = makeStyles(({ color, radius, spacing, text }) => ({
|
|
3
|
+
conteneur: {
|
|
4
|
+
position: 'relative',
|
|
5
|
+
},
|
|
6
|
+
// Posee sur le contenu sans le deplacer ni capter les clics : le formulaire reste lisible dessous.
|
|
7
|
+
surcouche: {
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
top: 0,
|
|
10
|
+
right: 0,
|
|
11
|
+
bottom: 0,
|
|
12
|
+
left: 0,
|
|
13
|
+
borderWidth: 2,
|
|
14
|
+
borderStyle: 'dashed',
|
|
15
|
+
borderColor: color.light.border['plain-info'],
|
|
16
|
+
borderRadius: radius('lg'),
|
|
17
|
+
backgroundColor: color.alpha(color.light.background['flat-info'], 0.1),
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
pointerEvents: 'none',
|
|
21
|
+
},
|
|
22
|
+
// Pastille opaque : le message reste lisible quel que soit le champ qu'il recouvre.
|
|
23
|
+
pastille: {
|
|
24
|
+
backgroundColor: color.light.background['default-grey'],
|
|
25
|
+
borderRadius: radius('lg'),
|
|
26
|
+
paddingLeft: spacing('2W'),
|
|
27
|
+
paddingRight: spacing('2W'),
|
|
28
|
+
paddingTop: spacing('1W'),
|
|
29
|
+
paddingBottom: spacing('1W'),
|
|
30
|
+
},
|
|
31
|
+
message: {
|
|
32
|
+
...text['Corps de texte'].MD.Bold,
|
|
33
|
+
color: color.light.text['default-info'],
|
|
34
|
+
},
|
|
35
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileDropZone.web.d.ts","sourceRoot":"","sources":["../../../src/ui/FileDropZone/FileDropZone.web.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAInD,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,gCAwBpD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '../../core/Box';
|
|
3
|
+
import { Typography } from '../../core/Typography';
|
|
4
|
+
import { useStyles } from './FileDropZone.styles';
|
|
5
|
+
import { useDepotFichier } from './useDepotFichier';
|
|
6
|
+
export const FileDropZone = (props) => {
|
|
7
|
+
const { children, message = 'Déposez vos fichiers ici' } = props;
|
|
8
|
+
const styles = useStyles();
|
|
9
|
+
const depot = useDepotFichier(props);
|
|
10
|
+
return (_jsxs("div", { "data-testid": "file-drop-zone", style: styles.conteneur, onDragEnter: depot.onDragEnter, onDragOver: depot.onDragOver, onDragLeave: depot.onDragLeave, onDrop: depot.onDrop, children: [children, depot.actif && (_jsx(Box, { tag: "file-drop-zone-overlay", style: styles.surcouche, children: _jsx(Box, { tag: "file-drop-zone-message", style: styles.pastille, children: _jsx(Typography, { style: styles.message, children: message }) }) }))] }));
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fichiersDuDataTransfer.d.ts","sourceRoot":"","sources":["../../../src/ui/FileDropZone/fichiersDuDataTransfer.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,IAAI,IAAI,GAAG,IAAI,CAAA;CAAE,CAAC;AAE7D;;;;;GAKG;AACH,KAAK,eAAe,GAAG;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AAQrG;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,GAAI,IAAI,eAAe,KAAG,IAAI,EAIhE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/FileDropZone/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FileDropZone';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FileInputProps } from '../FormControl';
|
|
3
|
+
type Options = Pick<FileInputProps, 'value' | 'type' | 'multiple' | 'onChange' | 'disabled'>;
|
|
4
|
+
/**
|
|
5
|
+
* Le comportement de la zone de depot : s'allumer quand un glissement de fichiers la survole,
|
|
6
|
+
* convertir les fichiers lâches en valeurs du champ, et liberer les URL d'objet. Chaque
|
|
7
|
+
* evenement traite s'arrete a la zone : entre zones imbriquees, seule la plus proche reagit.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useDepotFichier: ({ value, type, multiple, onChange, disabled }: Options) => {
|
|
10
|
+
actif: boolean;
|
|
11
|
+
onDragEnter: (e: React.DragEvent) => void;
|
|
12
|
+
onDragOver: (e: React.DragEvent) => void;
|
|
13
|
+
onDragLeave: (e: React.DragEvent) => void;
|
|
14
|
+
onDrop: (e: React.DragEvent) => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useDepotFichier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDepotFichier.d.ts","sourceRoot":"","sources":["../../../src/ui/FileDropZone/useDepotFichier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAqD,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAwBnH,KAAK,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;AAE7F;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAI,+CAA+C,OAAO;;qBA4B5D,KAAK,CAAC,SAAS;oBAOhB,KAAK,CAAC,SAAS;qBAId,KAAK,CAAC,SAAS;gBAOpB,KAAK,CAAC,SAAS;CAsBnC,CAAC"}
|