@alveole/components 1.5.3 → 1.6.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.
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/ui/BottomSheet/BottomSheet.d.ts +10 -2
- package/dist/ui/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/ui/BottomSheet/BottomSheet.js +3 -2
- package/dist/ui/BottomSheet/BottomSheet.stories.d.ts +4 -1
- package/dist/ui/BottomSheet/BottomSheet.stories.d.ts.map +1 -1
- package/dist/ui/BottomSheet/BottomSheet.stories.js +4 -0
- package/dist/ui/BottomSheet/BottomSheet.stories.sources.d.ts +2 -0
- package/dist/ui/BottomSheet/BottomSheet.stories.sources.d.ts.map +1 -1
- package/dist/ui/BottomSheet/BottomSheet.stories.sources.js +2 -0
- package/dist/ui/BottomSheet/BottomSheet.styles.d.ts +3 -1
- package/dist/ui/BottomSheet/BottomSheet.styles.d.ts.map +1 -1
- package/dist/ui/BottomSheet/BottomSheet.styles.js +4 -2
- package/dist/ui/Card/CardHeader.styles.d.ts +1 -3
- package/dist/ui/Card/CardHeader.styles.d.ts.map +1 -1
- package/dist/ui/Card/CardHeader.styles.js +2 -4
- package/dist/ui/Card/CardMedia.styles.d.ts +1 -3
- package/dist/ui/Card/CardMedia.styles.d.ts.map +1 -1
- package/dist/ui/Card/CardMedia.styles.js +2 -4
- package/dist/ui/ListItem/ListItem.d.ts +2 -0
- package/dist/ui/ListItem/ListItem.d.ts.map +1 -1
- package/dist/ui/ListItem/ListItem.js +10 -3
- package/dist/ui/ListItem/ListItem.stories.d.ts +2 -0
- package/dist/ui/ListItem/ListItem.stories.d.ts.map +1 -1
- package/dist/ui/ListItem/ListItem.stories.js +17 -0
- package/dist/ui/ListItem/ListItem.stories.sources.d.ts +4 -0
- package/dist/ui/ListItem/ListItem.stories.sources.d.ts.map +1 -1
- package/dist/ui/ListItem/ListItem.stories.sources.js +4 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.d.ts +2 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.d.ts.map +1 -1
- package/dist/ui/RadioGroup/RadioGroup.stories.js +4 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.sources.d.ts +2 -0
- package/dist/ui/RadioGroup/RadioGroup.stories.sources.d.ts.map +1 -1
- package/dist/ui/RadioGroup/RadioGroup.stories.sources.js +2 -0
- package/dist/ui/RadioGroup/RadioInput.d.ts +2 -0
- package/dist/ui/RadioGroup/RadioInput.d.ts.map +1 -1
- package/dist/ui/RadioGroup/RadioInput.js +12 -4
- package/dist/ui/RadioGroup/index.d.ts +2 -0
- package/dist/ui/RadioGroup/index.d.ts.map +1 -1
- package/dist/ui/RadioGroup/index.js +2 -0
- package/dist/ui/Toast/Toast.js +2 -2
- package/dist/ui/Toast/Toast.stories.d.ts +8 -6
- package/dist/ui/Toast/Toast.stories.d.ts.map +1 -1
- package/dist/ui/Toast/Toast.styles.d.ts +8 -6
- package/dist/ui/Toast/Toast.styles.d.ts.map +1 -1
- package/dist/ui/Toast/Toast.styles.js +9 -2
- package/dist/ui/Toast/Toasts.js +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ALVEOLE_COMPONENTS_VERSION: "1.
|
|
1
|
+
export declare const ALVEOLE_COMPONENTS_VERSION: "1.6.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ALVEOLE_COMPONENTS_VERSION = "1.
|
|
1
|
+
export const ALVEOLE_COMPONENTS_VERSION = "1.6.0";
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SheetProps as TamaguiSheetProps } from 'tamagui';
|
|
3
|
+
type BottomSheetWithPoints = {
|
|
4
|
+
points: TamaguiSheetProps['snapPoints'];
|
|
5
|
+
fitContent?: false;
|
|
6
|
+
};
|
|
7
|
+
type BottomSheetWithoutPoints = {
|
|
8
|
+
points?: undefined;
|
|
9
|
+
fitContent: true;
|
|
10
|
+
};
|
|
3
11
|
export type BottomSheetProps = React.PropsWithChildren<{
|
|
4
12
|
open: TamaguiSheetProps['open'];
|
|
5
13
|
title: string;
|
|
6
|
-
points: TamaguiSheetProps['snapPoints'];
|
|
7
14
|
action?: React.ReactNode | undefined;
|
|
8
15
|
setOpen: (value: boolean) => void;
|
|
9
|
-
}>;
|
|
16
|
+
} & (BottomSheetWithoutPoints | BottomSheetWithPoints)>;
|
|
10
17
|
export declare const BottomSheet: (props: BottomSheetProps) => React.JSX.Element;
|
|
18
|
+
export {};
|
|
11
19
|
//# sourceMappingURL=BottomSheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/ui/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAyB,UAAU,IAAI,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAOjF,
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/ui/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAyB,UAAU,IAAI,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAOjF,KAAK,qBAAqB,GAAG;IAC3B,MAAM,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IACxC,UAAU,CAAC,EAAE,KAAK,CAAC;CACpB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC9B,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,UAAU,EAAE,IAAI,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,iBAAiB,CACpD;IACE,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IACrC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,GAAG,CAAC,wBAAwB,GAAG,qBAAqB,CAAC,CACvD,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,sBAsDlD,CAAC"}
|
|
@@ -8,9 +8,10 @@ import { ButtonIcon } from '../Button';
|
|
|
8
8
|
import { Divider } from '../Divider';
|
|
9
9
|
import { useStyles } from './BottomSheet.styles';
|
|
10
10
|
export const BottomSheet = (props) => {
|
|
11
|
-
const { children, open, title, points, action, setOpen } = props;
|
|
11
|
+
const { children, open, title, points, fitContent, action, setOpen } = props;
|
|
12
12
|
const [position, setPosition] = React.useState(0);
|
|
13
13
|
const styles = useStyles();
|
|
14
14
|
const { bottom } = useSafeAreaInsets();
|
|
15
|
-
|
|
15
|
+
const snapPointsMode = fitContent ? 'fit' : 'percent';
|
|
16
|
+
return (_jsx(Box, { tag: "sheet", style: styles.container, children: _jsxs(TamaguiSheet, { modal: true, forceRemoveScrollEnabled: open, open: open, onOpenChange: setOpen, snapPoints: fitContent ? undefined : points, snapPointsMode: snapPointsMode, dismissOnSnapToBottom: true, position: position, onPositionChange: setPosition, zIndex: 100000, animation: "medium", children: [_jsx(TamaguiSheet.Overlay, { style: styles.overlay }), _jsxs(TamaguiSheet.Frame, { style: styles.frame, children: [_jsx(TamaguiSheet.Handle, { style: styles.handle }), _jsxs(Box, { tag: "sheet-header", style: styles.header, children: [_jsx(Box, { children: _jsx(ButtonIcon, { icon: "X", variant: "tertiary", size: "md", onPress: () => setOpen(false) }) }), _jsx(Box, { flex: 1, children: _jsx(Typography, { style: styles.title, children: title }) }), action && (_jsx(Box, { mt: 'auto', mb: 'auto', children: action }))] }), _jsx(Divider, { ml: '2W', mr: '2W' }), _jsx(Box, { tag: "sheet-content", style: [styles.content, !fitContent && styles.contentFull], pb: bottom, children: children })] })] }) }));
|
|
16
17
|
};
|
|
@@ -7,10 +7,12 @@ declare const _default: {
|
|
|
7
7
|
styleFn: () => {
|
|
8
8
|
container: {};
|
|
9
9
|
content: {
|
|
10
|
-
height: "100%";
|
|
11
10
|
backgroundColor: string;
|
|
12
11
|
marginTop: string | number;
|
|
13
12
|
};
|
|
13
|
+
contentFull: {
|
|
14
|
+
height: "100%";
|
|
15
|
+
};
|
|
14
16
|
header: {
|
|
15
17
|
paddingLeft: string | number;
|
|
16
18
|
paddingRight: string | number;
|
|
@@ -45,5 +47,6 @@ declare const _default: {
|
|
|
45
47
|
export default _default;
|
|
46
48
|
export declare const Default: () => import("react").JSX.Element;
|
|
47
49
|
export declare const WithAction: () => import("react").JSX.Element;
|
|
50
|
+
export declare const FitContent: () => import("react").JSX.Element;
|
|
48
51
|
export * as Sources from './BottomSheet.stories.sources';
|
|
49
52
|
//# sourceMappingURL=BottomSheet.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/BottomSheet/BottomSheet.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BottomSheet.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/BottomSheet/BottomSheet.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAOkB;AAElB,eAAO,MAAM,OAAO,mCAcnB,CAAC;AAEF,eAAO,MAAM,UAAU,mCAoBtB,CAAC;AAEF,eAAO,MAAM,UAAU,mCActB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC"}
|
|
@@ -19,4 +19,8 @@ export const WithAction = () => {
|
|
|
19
19
|
const [open, setOpen] = useState(false);
|
|
20
20
|
return (_jsxs(_Fragment, { children: [_jsx(Box, { display: "flex", flexDirection: "row", children: _jsx(Button, { title: "Ouvrir la modal", variant: "primary", onPress: () => setOpen(true) }) }), _jsx(BottomSheet, { open: open, setOpen: setOpen, points: [50], title: "Titre", action: _jsx(Button, { title: "Action", variant: "tertiary", size: "sm" }), children: _jsx(Typography, { children: "Children" }) })] }));
|
|
21
21
|
};
|
|
22
|
+
export const FitContent = () => {
|
|
23
|
+
const [open, setOpen] = useState(false);
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { display: "flex", flexDirection: "row", children: _jsx(Button, { title: "Ouvrir la modal", variant: "primary", onPress: () => setOpen(true) }) }), _jsx(BottomSheet, { fitContent: true, open: open, setOpen: setOpen, title: "Titre", children: _jsx(Typography, { height: 100, children: "Children" }) })] }));
|
|
25
|
+
};
|
|
22
26
|
export * as Sources from './BottomSheet.stories.sources';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export declare const Default: () => string;
|
|
2
2
|
export declare const WithAction: () => string;
|
|
3
|
+
export declare const FitContent: () => string;
|
|
3
4
|
export declare const storySources: {
|
|
4
5
|
readonly Default: () => string;
|
|
5
6
|
readonly WithAction: () => string;
|
|
7
|
+
readonly FitContent: () => string;
|
|
6
8
|
};
|
|
7
9
|
export type StorySourceName = keyof typeof storySources;
|
|
8
10
|
//# sourceMappingURL=BottomSheet.stories.sources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/BottomSheet/BottomSheet.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAwb,CAAC;AAE7c,eAAO,MAAM,UAAU,cAAkjB,CAAC;AAE1kB,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"BottomSheet.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/BottomSheet/BottomSheet.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAwb,CAAC;AAE7c,eAAO,MAAM,UAAU,cAAkjB,CAAC;AAE1kB,eAAO,MAAM,UAAU,cAAic,CAAC;AAEzd,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// Source: src/ui/BottomSheet/BottomSheet.stories.tsx
|
|
3
3
|
export const Default = () => "export const Default = () => {\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Box display=\"flex\" flexDirection=\"row\">\n <Button title=\"Ouvrir la modal\" variant=\"primary\" onPress={() => setOpen(true)} />\n </Box>\n\n <BottomSheet open={open} setOpen={setOpen} points={[80, 25]} title=\"Titre\">\n <Typography>Children</Typography>\n </BottomSheet>\n </>\n );\n};";
|
|
4
4
|
export const WithAction = () => "export const WithAction = () => {\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Box display=\"flex\" flexDirection=\"row\">\n <Button title=\"Ouvrir la modal\" variant=\"primary\" onPress={() => setOpen(true)} />\n </Box>\n\n <BottomSheet\n open={open}\n setOpen={setOpen}\n points={[50]}\n title=\"Titre\"\n action={<Button title=\"Action\" variant=\"tertiary\" size=\"sm\" />}\n >\n <Typography>Children</Typography>\n </BottomSheet>\n </>\n );\n};";
|
|
5
|
+
export const FitContent = () => "export const FitContent = () => {\n const [open, setOpen] = useState(false);\n\n return (\n <>\n <Box display=\"flex\" flexDirection=\"row\">\n <Button title=\"Ouvrir la modal\" variant=\"primary\" onPress={() => setOpen(true)} />\n </Box>\n\n <BottomSheet fitContent open={open} setOpen={setOpen} title=\"Titre\">\n <Typography height={100}>Children</Typography>\n </BottomSheet>\n </>\n );\n};";
|
|
5
6
|
export const storySources = {
|
|
6
7
|
Default,
|
|
7
8
|
WithAction,
|
|
9
|
+
FitContent,
|
|
8
10
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export declare const useStyles: () => {
|
|
2
2
|
container: {};
|
|
3
3
|
content: {
|
|
4
|
-
height: "100%";
|
|
5
4
|
backgroundColor: string;
|
|
6
5
|
marginTop: string | number;
|
|
7
6
|
};
|
|
7
|
+
contentFull: {
|
|
8
|
+
height: "100%";
|
|
9
|
+
};
|
|
8
10
|
header: {
|
|
9
11
|
paddingLeft: string | number;
|
|
10
12
|
paddingRight: string | number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/BottomSheet/BottomSheet.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"BottomSheet.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/BottomSheet/BottomSheet.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;gBAkBO,MAAM;;;;;;;;;;;;;;;;;;;;CAgBhC,CAAC"}
|
|
@@ -2,10 +2,12 @@ import { makeStyles } from '@alveole/theme';
|
|
|
2
2
|
export const useStyles = makeStyles(({ spacing, text, color }) => ({
|
|
3
3
|
container: {},
|
|
4
4
|
content: {
|
|
5
|
-
height: '100%',
|
|
6
5
|
backgroundColor: color.light.background['alt-grey'],
|
|
7
6
|
marginTop: spacing('2W'),
|
|
8
7
|
},
|
|
8
|
+
contentFull: {
|
|
9
|
+
height: '100%',
|
|
10
|
+
},
|
|
9
11
|
header: {
|
|
10
12
|
paddingLeft: spacing('2W'),
|
|
11
13
|
paddingRight: spacing('2W'),
|
|
@@ -26,7 +28,7 @@ export const useStyles = makeStyles(({ spacing, text, color }) => ({
|
|
|
26
28
|
backgroundColor: color.alpha(color.background.inverse, 0.5),
|
|
27
29
|
},
|
|
28
30
|
title: {
|
|
29
|
-
...text['Corps de texte'].LG.
|
|
31
|
+
...text['Corps de texte'].LG.Medium,
|
|
30
32
|
color: color.light.text['title-grey'],
|
|
31
33
|
marginTop: 'auto',
|
|
32
34
|
marginBottom: 'auto',
|
|
@@ -33,8 +33,6 @@ export declare const useStyles: () => {
|
|
|
33
33
|
display: "flex";
|
|
34
34
|
alignItems: "flex-start";
|
|
35
35
|
};
|
|
36
|
-
imageDisabled:
|
|
37
|
-
filter: "grayscale(1)";
|
|
38
|
-
};
|
|
36
|
+
imageDisabled: import("@alveole/theme").StyleValue;
|
|
39
37
|
};
|
|
40
38
|
//# sourceMappingURL=CardHeader.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/Card/CardHeader.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"CardHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/Card/CardHeader.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BnB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeStyles } from '@alveole/theme';
|
|
1
|
+
import { grayscaleStyle, makeStyles } from '@alveole/theme';
|
|
2
2
|
export const useStyles = makeStyles(({ spacing, color, text }) => ({
|
|
3
3
|
cardHeader: {
|
|
4
4
|
display: 'flex',
|
|
@@ -26,7 +26,5 @@ export const useStyles = makeStyles(({ spacing, color, text }) => ({
|
|
|
26
26
|
display: 'flex',
|
|
27
27
|
alignItems: 'flex-start',
|
|
28
28
|
},
|
|
29
|
-
imageDisabled:
|
|
30
|
-
filter: 'grayscale(1)',
|
|
31
|
-
},
|
|
29
|
+
imageDisabled: grayscaleStyle,
|
|
32
30
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardMedia.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/Card/CardMedia.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"CardMedia.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/Card/CardMedia.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;CAKnB,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { makeStyles } from '@alveole/theme';
|
|
1
|
+
import { grayscaleStyle, makeStyles } from '@alveole/theme';
|
|
2
2
|
export const useStyles = makeStyles(() => ({
|
|
3
3
|
cardMedia: {
|
|
4
4
|
overflow: 'hidden',
|
|
5
5
|
},
|
|
6
|
-
disabled:
|
|
7
|
-
filter: 'grayscale(1)',
|
|
8
|
-
},
|
|
6
|
+
disabled: grayscaleStyle,
|
|
9
7
|
}));
|
|
@@ -2,11 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { BoxProps } from '../../core';
|
|
3
3
|
import { AvatarProps } from '../Avatar';
|
|
4
4
|
import { IconProps } from '../LucideIcon';
|
|
5
|
+
import { RadioInputProps } from '../RadioGroup';
|
|
5
6
|
export type ListItemProps = BoxProps & {
|
|
6
7
|
title: string;
|
|
7
8
|
description?: string;
|
|
8
9
|
IconProps?: Pick<IconProps, 'color' | 'name'>;
|
|
9
10
|
AvatarProps?: Pick<AvatarProps, 'fallbackText' | 'src'>;
|
|
11
|
+
RadioProps?: Pick<RadioInputProps, 'checked' | 'onChange' | 'value'>;
|
|
10
12
|
preview_url?: string;
|
|
11
13
|
trailing?: () => React.ReactNode;
|
|
12
14
|
loading?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/ui/ListItem/ListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../../src/ui/ListItem/ListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAO,QAAQ,EAAqB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAU,WAAW,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,SAAS,EAAc,MAAM,eAAe,CAAC;AACtD,OAAO,EAAc,eAAe,EAAE,MAAM,eAAe,CAAC;AAI5D,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,cAAc,GAAG,KAAK,CAAC,CAAC;IACxD,UAAU,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC,CAAC;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,aAAa,sBAqF5C,CAAC"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { Box, Image, Typography } from '../../core';
|
|
3
4
|
import { Avatar } from '../Avatar';
|
|
4
5
|
import { LucideIcon } from '../LucideIcon';
|
|
6
|
+
import { RadioGroup } from '../RadioGroup';
|
|
5
7
|
import { Spinner } from '../Spinner';
|
|
6
8
|
import { useStyles } from './ListItem.styles';
|
|
7
9
|
export const ListItem = (props) => {
|
|
8
|
-
const { children, title, description, style, AvatarProps, IconProps, preview_url, trailing, loading = false, showSeparateur = true, ...itemProps } = props;
|
|
10
|
+
const { children, title, description, style, AvatarProps, IconProps, RadioProps, preview_url, trailing, loading = false, showSeparateur = true, onPress, ...itemProps } = props;
|
|
11
|
+
const handlePress = React.useCallback((event) => {
|
|
12
|
+
if (RadioProps)
|
|
13
|
+
RadioProps.onChange?.(RadioProps.value);
|
|
14
|
+
onPress?.(event);
|
|
15
|
+
}, [RadioProps, onPress]);
|
|
9
16
|
const styles = useStyles();
|
|
10
|
-
return (_jsxs(Box, { children: [_jsxs(Box, { tag: "resource-item", style: [styles.item, style], hoverStyle:
|
|
17
|
+
return (_jsxs(Box, { children: [_jsxs(Box, { tag: "resource-item", style: [styles.item, style], hoverStyle: onPress || RadioProps ? styles.itemHover : {}, onPress: handlePress, ...itemProps, children: [preview_url ? (_jsx(Box, { style: styles.previewContainer, children: _jsx(Image, { source: { uri: preview_url }, width: styles.preview.width, height: styles.preview.height, contentFit: "contain" }) })) : (_jsxs(Box, { display: "flex", flexDirection: "row", gap: '3V', children: [RadioProps && (_jsx(Box, { mt: 'auto', mb: 'auto', children: _jsx(RadioGroup.Input, { id: `${title}--radio`, size: "md", ...RadioProps }) })), IconProps && (_jsx(Box, { mt: 'auto', mb: 'auto', children: _jsx(LucideIcon, { size: "sm", color: styles.defaultIcon.color, ...IconProps }) })), AvatarProps && (_jsx(Box, { mt: 'auto', mb: 'auto', children: _jsx(Avatar, { size: "xs", ...AvatarProps }) }))] })), _jsxs(Box, { style: styles.detail, children: [showSeparateur && _jsx(Box, { style: styles.separateur }), _jsxs(Box, { style: styles.principal, children: [_jsx(Typography, { style: styles.title, children: title }), description && _jsx(Typography, { style: styles.description, children: description })] }), trailing && trailing()] }), loading && (_jsx(Box, { style: styles.loading, children: _jsx(Spinner, { size: "sm" }) }))] }), children] }));
|
|
11
18
|
};
|
|
@@ -109,6 +109,8 @@ export declare const WithoutSeparator: () => import("react").JSX.Element;
|
|
|
109
109
|
export declare const WithIcon: () => import("react").JSX.Element;
|
|
110
110
|
export declare const WithAvatar: () => import("react").JSX.Element;
|
|
111
111
|
export declare const WithPreviewImage: () => import("react").JSX.Element;
|
|
112
|
+
export declare const ItemRadio: () => import("react").JSX.Element;
|
|
113
|
+
export declare const ItemRadioWithIcon: () => import("react").JSX.Element;
|
|
112
114
|
/** Sans prop `onPress`, l’effet de hover n’apparaît pas. */
|
|
113
115
|
export declare const withoutHover: () => import("react").JSX.Element;
|
|
114
116
|
export * as Sources from './ListItem.stories.sources';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/ListItem/ListItem.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ListItem.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/ListItem/ListItem.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAQkB;AAElB,eAAO,MAAM,OAAO,mCAQnB,CAAC;AAEF,eAAO,MAAM,YAAY,mCASxB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,WAAW,mCASvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,mCAS5B,CAAC;AAEF,eAAO,MAAM,QAAQ,mCASpB,CAAC;AAEF,eAAO,MAAM,UAAU,mCAYtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,mCAS5B,CAAC;AAEF,eAAO,MAAM,SAAS,mCAcrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,mCAe7B,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,YAAY,mCAA6D,CAAC;AAEvF,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { ButtonIcon } from '../Button';
|
|
3
4
|
import { ListItem } from './ListItem';
|
|
4
5
|
import { useStyles } from './ListItem.styles';
|
|
@@ -40,6 +41,22 @@ export const WithAvatar = () => (_jsx(ListItem, { title: "Titre", description: "
|
|
|
40
41
|
export const WithPreviewImage = () => (_jsx(ListItem, { title: "Titre", description: "Description", preview_url: "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400", onPress: () => {
|
|
41
42
|
window.alert('click !');
|
|
42
43
|
} }));
|
|
44
|
+
export const ItemRadio = () => {
|
|
45
|
+
const [value, setValue] = useState();
|
|
46
|
+
return (_jsx(ListItem, { title: "Titre", description: "Description", RadioProps: {
|
|
47
|
+
value: 'tutu',
|
|
48
|
+
checked: value === 'tutu',
|
|
49
|
+
onChange: v => setValue(v),
|
|
50
|
+
} }));
|
|
51
|
+
};
|
|
52
|
+
export const ItemRadioWithIcon = () => {
|
|
53
|
+
const [value, setValue] = useState();
|
|
54
|
+
return (_jsx(ListItem, { title: "Titre", description: "Description", IconProps: { name: 'Settings' }, RadioProps: {
|
|
55
|
+
value: 'tutu',
|
|
56
|
+
checked: value === 'tutu',
|
|
57
|
+
onChange: v => setValue(v),
|
|
58
|
+
} }));
|
|
59
|
+
};
|
|
43
60
|
/** Sans prop `onPress`, l’effet de hover n’apparaît pas. */
|
|
44
61
|
export const withoutHover = () => _jsx(ListItem, { title: "Titre", description: "Description" });
|
|
45
62
|
export * as Sources from './ListItem.stories.sources';
|
|
@@ -5,6 +5,8 @@ export declare const WithoutSeparator: () => string;
|
|
|
5
5
|
export declare const WithIcon: () => string;
|
|
6
6
|
export declare const WithAvatar: () => string;
|
|
7
7
|
export declare const WithPreviewImage: () => string;
|
|
8
|
+
export declare const ItemRadio: () => string;
|
|
9
|
+
export declare const ItemRadioWithIcon: () => string;
|
|
8
10
|
export declare const withoutHover: () => string;
|
|
9
11
|
export declare const storySources: {
|
|
10
12
|
readonly Default: () => string;
|
|
@@ -14,6 +16,8 @@ export declare const storySources: {
|
|
|
14
16
|
readonly WithIcon: () => string;
|
|
15
17
|
readonly WithAvatar: () => string;
|
|
16
18
|
readonly WithPreviewImage: () => string;
|
|
19
|
+
readonly ItemRadio: () => string;
|
|
20
|
+
readonly ItemRadioWithIcon: () => string;
|
|
17
21
|
readonly withoutHover: () => string;
|
|
18
22
|
};
|
|
19
23
|
export type StorySourceName = keyof typeof storySources;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/ListItem/ListItem.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAoL,CAAC;AAEzM,eAAO,MAAM,YAAY,cAA0S,CAAC;AAEpU,eAAO,MAAM,WAAW,cAA4M,CAAC;AAErO,eAAO,MAAM,gBAAgB,cAAyN,CAAC;AAEvP,eAAO,MAAM,QAAQ,cAA6O,CAAC;AAEnQ,eAAO,MAAM,UAAU,cAAyU,CAAC;AAEjW,eAAO,MAAM,gBAAgB,cAAqR,CAAC;AAEnT,eAAO,MAAM,YAAY,cAAsG,CAAC;AAEhI,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"ListItem.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/ListItem/ListItem.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAAoL,CAAC;AAEzM,eAAO,MAAM,YAAY,cAA0S,CAAC;AAEpU,eAAO,MAAM,WAAW,cAA4M,CAAC;AAErO,eAAO,MAAM,gBAAgB,cAAyN,CAAC;AAEvP,eAAO,MAAM,QAAQ,cAA6O,CAAC;AAEnQ,eAAO,MAAM,UAAU,cAAyU,CAAC;AAEjW,eAAO,MAAM,gBAAgB,cAAqR,CAAC;AAEnT,eAAO,MAAM,SAAS,cAAqU,CAAC;AAE5V,eAAO,MAAM,iBAAiB,cAAqX,CAAC;AAEpZ,eAAO,MAAM,YAAY,cAAsG,CAAC;AAEhI,eAAO,MAAM,YAAY;;;;;;;;;;;CAWf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC;AAExD,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAGtE,CAAC"}
|
|
@@ -7,6 +7,8 @@ export const WithoutSeparator = () => "export const WithoutSeparator = () => (\n
|
|
|
7
7
|
export const WithIcon = () => "export const WithIcon = () => (\n <ListItem\n title=\"Titre\"\n description=\"Description\"\n IconProps={{ name: 'Settings', color: 'primary' }}\n onPress={() => {\n window.alert('click !');\n }}\n />\n);";
|
|
8
8
|
export const WithAvatar = () => "export const WithAvatar = () => (\n <ListItem\n title=\"Titre\"\n description=\"Description\"\n AvatarProps={{\n fallbackText: 'Jean Pierre',\n src: 'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400',\n }}\n onPress={() => {\n window.alert('click !');\n }}\n />\n);";
|
|
9
9
|
export const WithPreviewImage = () => "export const WithPreviewImage = () => (\n <ListItem\n title=\"Titre\"\n description=\"Description\"\n preview_url=\"https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400\"\n onPress={() => {\n window.alert('click !');\n }}\n />\n);";
|
|
10
|
+
export const ItemRadio = () => "export const ItemRadio = () => {\n const [value, setValue] = useState<string>();\n\n return (\n <ListItem\n title=\"Titre\"\n description=\"Description\"\n RadioProps={{\n value: 'tutu',\n checked: value === 'tutu',\n onChange: v => setValue(v),\n }}\n />\n );\n};";
|
|
11
|
+
export const ItemRadioWithIcon = () => "export const ItemRadioWithIcon = () => {\n const [value, setValue] = useState<string>();\n\n return (\n <ListItem\n title=\"Titre\"\n description=\"Description\"\n IconProps={{ name: 'Settings' }}\n RadioProps={{\n value: 'tutu',\n checked: value === 'tutu',\n onChange: v => setValue(v),\n }}\n />\n );\n};";
|
|
10
12
|
export const withoutHover = () => "export const withoutHover = () => <ListItem title=\"Titre\" description=\"Description\" />;";
|
|
11
13
|
export const storySources = {
|
|
12
14
|
Default,
|
|
@@ -16,6 +18,8 @@ export const storySources = {
|
|
|
16
18
|
WithIcon,
|
|
17
19
|
WithAvatar,
|
|
18
20
|
WithPreviewImage,
|
|
21
|
+
ItemRadio,
|
|
22
|
+
ItemRadioWithIcon,
|
|
19
23
|
withoutHover,
|
|
20
24
|
};
|
|
21
25
|
export const storyDescriptions = {
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
} & import("react").RefAttributes<import("tamagui").TamaguiElement>> & {
|
|
18
18
|
Item: (props: import("./RadioGroupItem").RadioGroupItemProps) => import("react").JSX.Element;
|
|
19
19
|
Card: (props: import("./RadioGroupCard").RadioGroupCardProps) => import("react").JSX.Element;
|
|
20
|
+
Input: (props: import("./RadioInput").RadioInputProps) => import("react").JSX.Element;
|
|
20
21
|
};
|
|
21
22
|
styleFn: () => {
|
|
22
23
|
container: {
|
|
@@ -162,5 +163,6 @@ export default _default;
|
|
|
162
163
|
export declare const Default: () => import("react").JSX.Element;
|
|
163
164
|
export declare const Cards: () => import("react").JSX.Element;
|
|
164
165
|
export declare const WithError: () => import("react").JSX.Element;
|
|
166
|
+
export declare const RadioInput: () => import("react").JSX.Element;
|
|
165
167
|
export * as Sources from './RadioGroup.stories.sources';
|
|
166
168
|
//# sourceMappingURL=RadioGroup.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioGroup/RadioGroup.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RadioGroup.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioGroup/RadioGroup.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAOkB;AAElB,eAAO,MAAM,OAAO,mCASnB,CAAC;AAEF,eAAO,MAAM,KAAK,mCAQjB,CAAC;AAEF,eAAO,MAAM,SAAS,mCAOrB,CAAC;AAEF,eAAO,MAAM,UAAU,mCAStB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAC"}
|
|
@@ -20,4 +20,8 @@ export const Cards = () => {
|
|
|
20
20
|
return (_jsxs(RadioGroup, { value: value, onChange: setValue, label: "Confirmez-vous ?", children: [_jsx(RadioGroup.Card, { value: "oui", label: "Oui", icon: "Check" }), _jsx(RadioGroup.Card, { value: "non", label: "Non", icon: "X" })] }));
|
|
21
21
|
};
|
|
22
22
|
export const WithError = () => (_jsx(Box, { display: "flex", flexDirection: "column", gap: 24, children: _jsxs(RadioGroup, { value: "a", label: "Avec erreur", error: "Veuillez faire un choix", children: [_jsx(RadioGroup.Item, { value: "a", children: "Option A" }), _jsx(RadioGroup.Item, { value: "b", children: "Option B" })] }) }));
|
|
23
|
+
export const RadioInput = () => {
|
|
24
|
+
const [value, setValue] = useState('tutu');
|
|
25
|
+
return (_jsxs(Box, { display: "flex", flexDirection: "column", gap: 24, children: [_jsx(RadioGroup.Input, { id: "exemple-input", size: "sm", value: "tutu", checked: value === 'tutu', onChange: setValue }), _jsx(RadioGroup.Input, { id: "exemple-input-md", size: "md", value: "toto", checked: value === 'toto', onChange: setValue })] }));
|
|
26
|
+
};
|
|
23
27
|
export * as Sources from './RadioGroup.stories.sources';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export declare const Default: () => string;
|
|
2
2
|
export declare const Cards: () => string;
|
|
3
3
|
export declare const WithError: () => string;
|
|
4
|
+
export declare const RadioInput: () => string;
|
|
4
5
|
export declare const storySources: {
|
|
5
6
|
readonly Default: () => string;
|
|
6
7
|
readonly Cards: () => string;
|
|
7
8
|
readonly WithError: () => string;
|
|
9
|
+
readonly RadioInput: () => string;
|
|
8
10
|
};
|
|
9
11
|
export type StorySourceName = keyof typeof storySources;
|
|
10
12
|
//# sourceMappingURL=RadioGroup.stories.sources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioGroup/RadioGroup.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAA+X,CAAC;AAEpZ,eAAO,MAAM,KAAK,cAAqV,CAAC;AAExW,eAAO,MAAM,SAAS,cAA4V,CAAC;AAEnX,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"RadioGroup.stories.sources.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioGroup/RadioGroup.stories.sources.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,cAA+X,CAAC;AAEpZ,eAAO,MAAM,KAAK,cAAqV,CAAC;AAExW,eAAO,MAAM,SAAS,cAA4V,CAAC;AAEnX,eAAO,MAAM,UAAU,cAAsb,CAAC;AAE9c,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,YAAY,CAAC"}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
export const Default = () => "export const Default = () => {\n const [value, setValue] = useState('a');\n return (\n <RadioGroup value={value} onChange={setValue} label=\"Choix\">\n <RadioGroup.Item value=\"a\">Option A</RadioGroup.Item>\n <RadioGroup.Item value=\"b\">Option B</RadioGroup.Item>\n <RadioGroup.Item value=\"c\">Option C</RadioGroup.Item>\n </RadioGroup>\n );\n};";
|
|
4
4
|
export const Cards = () => "export const Cards = () => {\n const [value, setValue] = useState('oui');\n return (\n <RadioGroup value={value} onChange={setValue} label=\"Confirmez-vous ?\">\n <RadioGroup.Card value=\"oui\" label=\"Oui\" icon=\"Check\" />\n <RadioGroup.Card value=\"non\" label=\"Non\" icon=\"X\" />\n </RadioGroup>\n );\n};";
|
|
5
5
|
export const WithError = () => "export const WithError = () => (\n <Box display=\"flex\" flexDirection=\"column\" gap={24}>\n <RadioGroup value=\"a\" label=\"Avec erreur\" error=\"Veuillez faire un choix\">\n <RadioGroup.Item value=\"a\">Option A</RadioGroup.Item>\n <RadioGroup.Item value=\"b\">Option B</RadioGroup.Item>\n </RadioGroup>\n </Box>\n);";
|
|
6
|
+
export const RadioInput = () => "export const RadioInput = () => {\n const [value, setValue] = useState('tutu');\n\n return (\n <Box display=\"flex\" flexDirection=\"column\" gap={24}>\n <RadioGroup.Input id=\"exemple-input\" size=\"sm\" value=\"tutu\" checked={value === 'tutu'} onChange={setValue} />\n <RadioGroup.Input id=\"exemple-input-md\" size=\"md\" value=\"toto\" checked={value === 'toto'} onChange={setValue} />\n </Box>\n );\n};";
|
|
6
7
|
export const storySources = {
|
|
7
8
|
Default,
|
|
8
9
|
Cards,
|
|
9
10
|
WithError,
|
|
11
|
+
RadioInput,
|
|
10
12
|
};
|
|
@@ -2,6 +2,8 @@ export type RadioInputProps = {
|
|
|
2
2
|
value: string;
|
|
3
3
|
id: string;
|
|
4
4
|
size: 'sm' | 'md';
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
onChange?: (value: string) => void;
|
|
5
7
|
};
|
|
6
8
|
export declare const RadioInput: (props: RadioInputProps) => import("react").JSX.Element;
|
|
7
9
|
//# sourceMappingURL=RadioInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioInput.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioGroup/RadioInput.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioInput.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioGroup/RadioInput.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,eAAe,gCAuChD,CAAC"}
|
|
@@ -3,11 +3,19 @@ import { RadioGroup as TamaguiRadioGroup } from 'tamagui';
|
|
|
3
3
|
import { useStyles } from './RadioGroup.styles';
|
|
4
4
|
import { useRadioGroup } from './RadioGroupContext';
|
|
5
5
|
export const RadioInput = (props) => {
|
|
6
|
-
const { value, id, size = 'md' } = props;
|
|
7
|
-
const { value: selectedValue, onChange } = useRadioGroup();
|
|
8
|
-
const isSelected = selectedValue === value;
|
|
6
|
+
const { value, id, size = 'md', checked, onChange: onInputChange } = props;
|
|
7
|
+
const { value: selectedValue, onChange: onGroupChange } = useRadioGroup();
|
|
8
|
+
const isSelected = checked ?? selectedValue === value;
|
|
9
9
|
const styles = useStyles();
|
|
10
10
|
const itemStyles = { ...styles.itemContainer, ...(size === 'sm' ? styles.itemContainerSm : styles.itemContainerMd) };
|
|
11
11
|
const indicatorStyle = { ...styles.itemContainer, ...(isSelected ? styles.itemContainerActive : {}) };
|
|
12
|
-
|
|
12
|
+
const handleChange = () => {
|
|
13
|
+
onInputChange?.(value);
|
|
14
|
+
onGroupChange?.(value);
|
|
15
|
+
};
|
|
16
|
+
const input = (_jsx(TamaguiRadioGroup.Item, { value: value, id: id, style: itemStyles, focusStyle: styles.itemContainerActive, hoverStyle: indicatorStyle, pressStyle: styles.itemContainerActive, onPress: checked == null ? handleChange : undefined, children: _jsx(TamaguiRadioGroup.Indicator, { style: styles.itemIndicator }) }));
|
|
17
|
+
if (checked == null) {
|
|
18
|
+
return input;
|
|
19
|
+
}
|
|
20
|
+
return (_jsx(TamaguiRadioGroup, { value: isSelected ? value : '', onValueChange: () => handleChange(), children: input }));
|
|
13
21
|
};
|
|
@@ -2,6 +2,7 @@ export { RadioGroupElement, RadioGroupProps } from './RadioGroup';
|
|
|
2
2
|
export { RadioGroupCardProps } from './RadioGroupCard';
|
|
3
3
|
export { RadioGroupCtx } from './RadioGroupContext';
|
|
4
4
|
export { RadioGroupItemProps } from './RadioGroupItem';
|
|
5
|
+
export { RadioInputProps } from './RadioInput';
|
|
5
6
|
export declare const RadioGroup: import("react").ForwardRefExoticComponent<Omit<import("tamagui").RadioGroupProps, "direction" | "value" | "onValueChange"> & import("..").FormControlCaptionProps & {
|
|
6
7
|
label: string;
|
|
7
8
|
labelRight?: React.ReactNode;
|
|
@@ -16,5 +17,6 @@ export declare const RadioGroup: import("react").ForwardRefExoticComponent<Omit<
|
|
|
16
17
|
} & import("react").RefAttributes<import("tamagui").TamaguiElement>> & {
|
|
17
18
|
Item: (props: import("./RadioGroupItem").RadioGroupItemProps) => import("react").JSX.Element;
|
|
18
19
|
Card: (props: import("./RadioGroupCard").RadioGroupCardProps) => import("react").JSX.Element;
|
|
20
|
+
Input: (props: import("./RadioInput").RadioInputProps) => import("react").JSX.Element;
|
|
19
21
|
};
|
|
20
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioGroup/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/RadioGroup/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;CAIrB,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { RadioGroup as RadioGroupComponent } from './RadioGroup';
|
|
2
2
|
import { RadioGroupCard } from './RadioGroupCard';
|
|
3
3
|
import { RadioGroupItem } from './RadioGroupItem';
|
|
4
|
+
import { RadioInput } from './RadioInput';
|
|
4
5
|
export const RadioGroup = Object.assign(RadioGroupComponent, {
|
|
5
6
|
Item: RadioGroupItem,
|
|
6
7
|
Card: RadioGroupCard,
|
|
8
|
+
Input: RadioInput,
|
|
7
9
|
});
|
package/dist/ui/Toast/Toast.js
CHANGED
|
@@ -7,7 +7,7 @@ import { useStyles } from './Toast.styles';
|
|
|
7
7
|
import { ToastType } from './ToastType';
|
|
8
8
|
export function ToastView({ title, message, variant = 'default', icon, onClose }) {
|
|
9
9
|
const styles = useStyles();
|
|
10
|
-
return (_jsxs(Box, { style: styles.container, children: [_jsx(ToastType, { variant: variant, icon: icon }), _jsxs(Box, { style: styles.contenu, children: [_jsxs(Box, { style: styles.titleContainer, children: [_jsx(Typography, { style: styles.title, children: title }), _jsx(Pressable, { onPress: onClose, children: _jsx(LucideIcon, { name: "X", size: "md" }) })] }), message && (_jsx(Box, { children: _jsx(Typography, { style: styles.message, children: message }) }))] })] }));
|
|
10
|
+
return (_jsxs(Box, { style: [styles.dualContainer, styles.container], children: [_jsx(ToastType, { variant: variant, icon: icon }), _jsxs(Box, { style: styles.contenu, children: [_jsxs(Box, { style: styles.titleContainer, children: [_jsx(Typography, { style: styles.title, children: title }), _jsx(Pressable, { onPress: onClose, children: _jsx(LucideIcon, { name: "X", size: "md" }) })] }), message && (_jsx(Box, { children: _jsx(Typography, { style: styles.message, children: message }) }))] })] }));
|
|
11
11
|
}
|
|
12
12
|
export function Toast() {
|
|
13
13
|
const toast = useToastState();
|
|
@@ -15,5 +15,5 @@ export function Toast() {
|
|
|
15
15
|
const styles = useStyles();
|
|
16
16
|
if (!toast)
|
|
17
17
|
return null;
|
|
18
|
-
return (_jsx(TamaguiToast, { duration: toast.duration, enterStyle: { opacity: 0, y: 10, scale: 0.98 }, exitStyle: { opacity: 0, y: 10, scale: 0.98 }, viewportName: "app-toasts", style: styles.
|
|
18
|
+
return (_jsx(TamaguiToast, { duration: toast.duration, enterStyle: { opacity: 0, y: 10, scale: 0.98 }, exitStyle: { opacity: 0, y: 10, scale: 0.98 }, viewportName: "app-toasts", style: [styles.dualContainer, styles.tamaguiToastContainer], children: _jsx(ToastView, { title: toast.title, message: toast.message, variant: toast.customData?.variant ?? 'default', icon: toast.customData?.icon, onClose: () => controller.hide() }) }, toast.id));
|
|
19
19
|
}
|
|
@@ -8,15 +8,21 @@ declare const _default: {
|
|
|
8
8
|
shortDescription: string;
|
|
9
9
|
component: typeof Toast;
|
|
10
10
|
styleFn: () => {
|
|
11
|
+
dualContainer: {
|
|
12
|
+
padding: number;
|
|
13
|
+
width: number | `${string}%` | undefined;
|
|
14
|
+
};
|
|
15
|
+
tamaguiToastContainer: {
|
|
16
|
+
backgroundColor: "transparent";
|
|
17
|
+
borderRadius: number;
|
|
18
|
+
};
|
|
11
19
|
container: {
|
|
12
20
|
backgroundColor: string;
|
|
13
|
-
width: number;
|
|
14
21
|
borderRadius: import("@alveole/theme").Radius;
|
|
15
22
|
display: "flex";
|
|
16
23
|
flexDirection: "row";
|
|
17
24
|
gap: string | number;
|
|
18
25
|
overflow: "hidden";
|
|
19
|
-
padding: number;
|
|
20
26
|
} | {
|
|
21
27
|
shadowColor: import("@alveole/theme").Color;
|
|
22
28
|
shadowOffset: {
|
|
@@ -27,23 +33,19 @@ declare const _default: {
|
|
|
27
33
|
shadowRadius: number;
|
|
28
34
|
elevation: number;
|
|
29
35
|
backgroundColor: string;
|
|
30
|
-
width: number;
|
|
31
36
|
borderRadius: import("@alveole/theme").Radius;
|
|
32
37
|
display: "flex";
|
|
33
38
|
flexDirection: "row";
|
|
34
39
|
gap: string | number;
|
|
35
40
|
overflow: "hidden";
|
|
36
|
-
padding: number;
|
|
37
41
|
} | {
|
|
38
42
|
boxShadow: string;
|
|
39
43
|
backgroundColor: string;
|
|
40
|
-
width: number;
|
|
41
44
|
borderRadius: import("@alveole/theme").Radius;
|
|
42
45
|
display: "flex";
|
|
43
46
|
flexDirection: "row";
|
|
44
47
|
gap: string | number;
|
|
45
48
|
overflow: "hidden";
|
|
46
|
-
padding: number;
|
|
47
49
|
};
|
|
48
50
|
contenu: {
|
|
49
51
|
display: "flex";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Toast/Toast.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"Toast.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Toast/Toast.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM3C,wBASkB;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,GAAG,mCA+Bf,CAAC;AAEF,eAAO,MAAM,WAAW,mCAEvB,CAAC;AAEF,eAAO,MAAM,cAAc,mCAE1B,CAAC;AAEF,eAAO,MAAM,YAAY,mCAExB,CAAC;AAEF,eAAO,MAAM,cAAc,mCAE1B,CAAC;AAEF,eAAO,MAAM,cAAc,mCAE1B,CAAC;AAEF,eAAO,MAAM,0BAA0B,mCAA2E,CAAC;AAEnH,eAAO,MAAM,6BAA6B,mCAEzC,CAAC;AAEF,eAAO,MAAM,WAAW,mCAOvB,CAAC;AAEF,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
export declare const useStyles: () => {
|
|
2
|
+
dualContainer: {
|
|
3
|
+
padding: number;
|
|
4
|
+
width: number | `${string}%` | undefined;
|
|
5
|
+
};
|
|
6
|
+
tamaguiToastContainer: {
|
|
7
|
+
backgroundColor: "transparent";
|
|
8
|
+
borderRadius: number;
|
|
9
|
+
};
|
|
2
10
|
container: {
|
|
3
11
|
backgroundColor: string;
|
|
4
|
-
width: number;
|
|
5
12
|
borderRadius: import("@alveole/theme").Radius;
|
|
6
13
|
display: "flex";
|
|
7
14
|
flexDirection: "row";
|
|
8
15
|
gap: string | number;
|
|
9
16
|
overflow: "hidden";
|
|
10
|
-
padding: number;
|
|
11
17
|
} | {
|
|
12
18
|
shadowColor: import("@alveole/theme").Color;
|
|
13
19
|
shadowOffset: {
|
|
@@ -18,23 +24,19 @@ export declare const useStyles: () => {
|
|
|
18
24
|
shadowRadius: number;
|
|
19
25
|
elevation: number;
|
|
20
26
|
backgroundColor: string;
|
|
21
|
-
width: number;
|
|
22
27
|
borderRadius: import("@alveole/theme").Radius;
|
|
23
28
|
display: "flex";
|
|
24
29
|
flexDirection: "row";
|
|
25
30
|
gap: string | number;
|
|
26
31
|
overflow: "hidden";
|
|
27
|
-
padding: number;
|
|
28
32
|
} | {
|
|
29
33
|
boxShadow: string;
|
|
30
34
|
backgroundColor: string;
|
|
31
|
-
width: number;
|
|
32
35
|
borderRadius: import("@alveole/theme").Radius;
|
|
33
36
|
display: "flex";
|
|
34
37
|
flexDirection: "row";
|
|
35
38
|
gap: string | number;
|
|
36
39
|
overflow: "hidden";
|
|
37
|
-
padding: number;
|
|
38
40
|
};
|
|
39
41
|
contenu: {
|
|
40
42
|
display: "flex";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/Toast/Toast.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Toast.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/Toast/Toast.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0EnB,CAAC"}
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { makeStyles } from '@alveole/theme';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
2
3
|
export const useStyles = makeStyles(({ text, color, radius, spacing, shadows }) => ({
|
|
3
4
|
// Container
|
|
5
|
+
dualContainer: {
|
|
6
|
+
padding: 0,
|
|
7
|
+
width: Platform.select({ web: 384, default: '100%' }),
|
|
8
|
+
},
|
|
9
|
+
tamaguiToastContainer: {
|
|
10
|
+
backgroundColor: 'transparent',
|
|
11
|
+
borderRadius: 0,
|
|
12
|
+
},
|
|
4
13
|
container: {
|
|
5
14
|
backgroundColor: color.light.background['default-grey'],
|
|
6
|
-
width: 384,
|
|
7
15
|
borderRadius: radius('sm'),
|
|
8
16
|
display: 'flex',
|
|
9
17
|
flexDirection: 'row',
|
|
10
18
|
gap: spacing('1W'),
|
|
11
19
|
overflow: 'hidden',
|
|
12
|
-
padding: 0,
|
|
13
20
|
...shadows(3),
|
|
14
21
|
},
|
|
15
22
|
contenu: {
|
package/dist/ui/Toast/Toasts.js
CHANGED
|
@@ -6,7 +6,7 @@ import { ToastBridge } from './ToastBridge';
|
|
|
6
6
|
import { ToastContext } from './ToastContext';
|
|
7
7
|
export function Toasts(props) {
|
|
8
8
|
const { children } = props;
|
|
9
|
-
return (_jsx(ToastProvider, { swipeDirection: "horizontal",
|
|
9
|
+
return (_jsx(ToastProvider, { swipeDirection: "horizontal", children: _jsxs(ToastBridge, { children: [_jsx(Toast, {}), _jsx(ToastViewport, { name: "app-toasts", multipleToasts: true, bottom: 32, left: 0, right: 0 }), children] }) }));
|
|
10
10
|
}
|
|
11
11
|
export function useToast() {
|
|
12
12
|
const ctx = React.useContext(ToastContext);
|