@alveole/components 1.6.5 → 1.7.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/ListItem/ListItem.d.ts +3 -1
- package/dist/ui/ListItem/ListItem.d.ts.map +1 -1
- package/dist/ui/ListItem/ListItem.js +5 -2
- package/dist/ui/ListItem/ListItem.stories.d.ts +1 -0
- package/dist/ui/ListItem/ListItem.stories.d.ts.map +1 -1
- package/dist/ui/ListItem/ListItem.stories.js +9 -0
- package/dist/ui/ListItem/ListItem.stories.sources.d.ts +2 -0
- package/dist/ui/ListItem/ListItem.stories.sources.d.ts.map +1 -1
- package/dist/ui/ListItem/ListItem.stories.sources.js +2 -0
- 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.7.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ALVEOLE_COMPONENTS_VERSION = "1.
|
|
1
|
+
export const ALVEOLE_COMPONENTS_VERSION = "1.7.0";
|
|
@@ -8,7 +8,9 @@ export type ListItemProps = BoxProps & {
|
|
|
8
8
|
description?: string;
|
|
9
9
|
IconProps?: Pick<IconProps, 'color' | 'name'>;
|
|
10
10
|
AvatarProps?: Pick<AvatarProps, 'fallbackText' | 'src'>;
|
|
11
|
-
RadioProps?: Pick<RadioInputProps, 'checked' | 'onChange' | 'value'
|
|
11
|
+
RadioProps?: Pick<RadioInputProps, 'checked' | 'onChange' | 'value'> & {
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
};
|
|
12
14
|
preview_url?: string;
|
|
13
15
|
trailing?: () => React.ReactNode;
|
|
14
16
|
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;AAE1B,OAAO,EAAO,QAAQ,EAAqB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAU,WAAW,EAAE,MAAM,WAAW,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;AAEhD,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,GAAG;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC9F,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,sBA4G5C,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box, Image, Typography } from '../../core';
|
|
4
4
|
import { Avatar } from '../Avatar';
|
|
5
|
+
import { CheckboxContainer, CheckboxIndicator } from '../Checkbox';
|
|
5
6
|
import { LucideIcon } from '../LucideIcon';
|
|
6
7
|
import { RadioGroup } from '../RadioGroup';
|
|
7
8
|
import { Spinner } from '../Spinner';
|
|
@@ -14,7 +15,9 @@ export const ListItem = (props) => {
|
|
|
14
15
|
onPress?.(event);
|
|
15
16
|
}, [RadioProps, onPress]);
|
|
16
17
|
const styles = useStyles();
|
|
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', onPress: event => {
|
|
18
|
+
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 && RadioProps.multiple !== true && (_jsx(Box, { mt: 'auto', mb: 'auto', onPress: event => {
|
|
18
19
|
event.stopPropagation();
|
|
19
|
-
}, children: _jsx(RadioGroup.Input, { id: `${title}--radio`, size: "md", ...RadioProps }) })),
|
|
20
|
+
}, children: _jsx(RadioGroup.Input, { id: `${title}--radio`, size: "md", ...RadioProps }) })), RadioProps && RadioProps.multiple === true && (_jsx(Box, { mt: 'auto', mb: 'auto', onPress: event => {
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
}, children: _jsx(CheckboxContainer, { id: `${title}--checkbox`, checked: RadioProps.checked, onCheckedChange: () => RadioProps.onChange?.(RadioProps.value), children: _jsx(CheckboxIndicator, {}) }) })), 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] }));
|
|
20
23
|
};
|
|
@@ -110,6 +110,7 @@ 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
112
|
export declare const ItemRadio: () => import("react").JSX.Element;
|
|
113
|
+
export declare const ItemRadioMultiple: () => import("react").JSX.Element;
|
|
113
114
|
export declare const ItemRadioWithIcon: () => import("react").JSX.Element;
|
|
114
115
|
/** Sans prop `onPress`, l’effet de hover n’apparaît pas. */
|
|
115
116
|
export declare const withoutHover: () => import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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,eAAO,MAAM,iBAAiB,mCAe7B,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,YAAY,mCAA6D,CAAC;AAEvF,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC"}
|
|
@@ -49,6 +49,15 @@ export const ItemRadio = () => {
|
|
|
49
49
|
onChange: v => setValue(v),
|
|
50
50
|
} }));
|
|
51
51
|
};
|
|
52
|
+
export const ItemRadioMultiple = () => {
|
|
53
|
+
const [value, setValue] = useState();
|
|
54
|
+
return (_jsx(ListItem, { title: "Titre", description: "Description", RadioProps: {
|
|
55
|
+
value: 'tutu',
|
|
56
|
+
checked: value === 'tutu',
|
|
57
|
+
onChange: v => setValue(v),
|
|
58
|
+
multiple: true,
|
|
59
|
+
} }));
|
|
60
|
+
};
|
|
52
61
|
export const ItemRadioWithIcon = () => {
|
|
53
62
|
const [value, setValue] = useState();
|
|
54
63
|
return (_jsx(ListItem, { title: "Titre", description: "Description", IconProps: { name: 'Settings' }, RadioProps: {
|
|
@@ -6,6 +6,7 @@ export declare const WithIcon: () => string;
|
|
|
6
6
|
export declare const WithAvatar: () => string;
|
|
7
7
|
export declare const WithPreviewImage: () => string;
|
|
8
8
|
export declare const ItemRadio: () => string;
|
|
9
|
+
export declare const ItemRadioMultiple: () => string;
|
|
9
10
|
export declare const ItemRadioWithIcon: () => string;
|
|
10
11
|
export declare const withoutHover: () => string;
|
|
11
12
|
export declare const storySources: {
|
|
@@ -17,6 +18,7 @@ export declare const storySources: {
|
|
|
17
18
|
readonly WithAvatar: () => string;
|
|
18
19
|
readonly WithPreviewImage: () => string;
|
|
19
20
|
readonly ItemRadio: () => string;
|
|
21
|
+
readonly ItemRadioMultiple: () => string;
|
|
20
22
|
readonly ItemRadioWithIcon: () => string;
|
|
21
23
|
readonly withoutHover: () => string;
|
|
22
24
|
};
|
|
@@ -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,SAAS,cAAqU,CAAC;AAE5V,eAAO,MAAM,iBAAiB,cAAqX,CAAC;AAEpZ,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,cAAsW,CAAC;AAErY,eAAO,MAAM,iBAAiB,cAAqX,CAAC;AAEpZ,eAAO,MAAM,YAAY,cAAsG,CAAC;AAEhI,eAAO,MAAM,YAAY;;;;;;;;;;;;CAYf,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"}
|
|
@@ -8,6 +8,7 @@ export const WithIcon = () => "export const WithIcon = () => (\n <ListItem\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
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 ItemRadioMultiple = () => "export const ItemRadioMultiple = () => {\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 multiple: true,\n }}\n />\n );\n};";
|
|
11
12
|
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};";
|
|
12
13
|
export const withoutHover = () => "export const withoutHover = () => <ListItem title=\"Titre\" description=\"Description\" />;";
|
|
13
14
|
export const storySources = {
|
|
@@ -19,6 +20,7 @@ export const storySources = {
|
|
|
19
20
|
WithAvatar,
|
|
20
21
|
WithPreviewImage,
|
|
21
22
|
ItemRadio,
|
|
23
|
+
ItemRadioMultiple,
|
|
22
24
|
ItemRadioWithIcon,
|
|
23
25
|
withoutHover,
|
|
24
26
|
};
|