@alveole/components 0.33.1 → 0.34.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/stories/index.d.ts +1 -0
- package/dist/stories/index.d.ts.map +1 -1
- package/dist/stories/index.js +1 -0
- package/dist/ui/ProgressBar/ProgressBar.d.ts +15 -0
- package/dist/ui/ProgressBar/ProgressBar.d.ts.map +1 -0
- package/dist/ui/ProgressBar/ProgressBar.js +20 -0
- package/dist/ui/ProgressBar/ProgressBar.stories.d.ts +76 -0
- package/dist/ui/ProgressBar/ProgressBar.stories.d.ts.map +1 -0
- package/dist/ui/ProgressBar/ProgressBar.stories.js +26 -0
- package/dist/ui/ProgressBar/ProgressBar.styles.d.ts +63 -0
- package/dist/ui/ProgressBar/ProgressBar.styles.d.ts.map +1 -0
- package/dist/ui/ProgressBar/ProgressBar.styles.js +60 -0
- package/dist/ui/ProgressBar/ProgressBarDeterminate.d.ts +7 -0
- package/dist/ui/ProgressBar/ProgressBarDeterminate.d.ts.map +1 -0
- package/dist/ui/ProgressBar/ProgressBarDeterminate.js +28 -0
- package/dist/ui/ProgressBar/ProgressBarIndeterminate.d.ts +4 -0
- package/dist/ui/ProgressBar/ProgressBarIndeterminate.d.ts.map +1 -0
- package/dist/ui/ProgressBar/ProgressBarIndeterminate.js +43 -0
- package/dist/ui/ProgressBar/ProgressBarLoop.d.ts +4 -0
- package/dist/ui/ProgressBar/ProgressBarLoop.d.ts.map +1 -0
- package/dist/ui/ProgressBar/ProgressBarLoop.js +37 -0
- package/dist/ui/ProgressBar/index.d.ts +2 -0
- package/dist/ui/ProgressBar/index.d.ts.map +1 -0
- package/dist/ui/ProgressBar/index.js +1 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +1 -0
- package/package.json +1 -1
package/dist/stories/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export * as ListItemStory from '../ui/ListItem/ListItem.stories';
|
|
|
22
22
|
export * as LucideIconStory from '../ui/LucideIcon/LucideIcon.stories';
|
|
23
23
|
export * as PageHeaderStory from '../ui/PageHeader/PageHeader.stories';
|
|
24
24
|
export * as PopoverStory from '../ui/Popover/Popover.stories';
|
|
25
|
+
export * as ProgressBarStory from '../ui/ProgressBar/ProgressBar.stories';
|
|
25
26
|
export * as ResourceListStory from '../ui/ResourceList/ResourceList.stories';
|
|
26
27
|
export * as SidebarStory from '../ui/Sidebar/Sidebar.stories';
|
|
27
28
|
export * as TabsStory from '../ui/Tabs/Tabs.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,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,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,eAAe,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,YAAY,MAAM,iCAAiC,CAAC;AAGhE,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,gBAAgB,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,mBAAmB,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,aAAa,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,iBAAiB,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,qBAAqB,MAAM,iDAAiD,CAAC;AACzF,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC"}
|
|
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,QAAQ,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAC1D,OAAO,KAAK,WAAW,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,QAAQ,MAAM,yBAAyB,CAAC;AACpD,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,eAAe,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,YAAY,MAAM,iCAAiC,CAAC;AAGhE,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,gBAAgB,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,mBAAmB,MAAM,6CAA6C,CAAC;AACnF,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,aAAa,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,gBAAgB,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,iBAAiB,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,YAAY,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,KAAK,qBAAqB,MAAM,iDAAiD,CAAC;AACzF,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC"}
|
package/dist/stories/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export * as ListItemStory from '../ui/ListItem/ListItem.stories';
|
|
|
24
24
|
export * as LucideIconStory from '../ui/LucideIcon/LucideIcon.stories';
|
|
25
25
|
export * as PageHeaderStory from '../ui/PageHeader/PageHeader.stories';
|
|
26
26
|
export * as PopoverStory from '../ui/Popover/Popover.stories';
|
|
27
|
+
export * as ProgressBarStory from '../ui/ProgressBar/ProgressBar.stories';
|
|
27
28
|
export * as ResourceListStory from '../ui/ResourceList/ResourceList.stories';
|
|
28
29
|
export * as SidebarStory from '../ui/Sidebar/Sidebar.stories';
|
|
29
30
|
export * as TabsStory from '../ui/Tabs/Tabs.stories';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BoxProps } from '@alveole/components';
|
|
2
|
+
type ProgressBarMode = 'determinate' | 'indeterminate' | 'loop';
|
|
3
|
+
export declare const PROGRESS_BAR_GAP = 8;
|
|
4
|
+
export declare const PROGRESS_BAR_HEIGHT = 8;
|
|
5
|
+
export declare const PROGRESS_DURATION = 2000;
|
|
6
|
+
export declare const PROGRESS_DETERMINATE_DURATION = 400;
|
|
7
|
+
export type ProgressBarProps = BoxProps & {
|
|
8
|
+
value?: number;
|
|
9
|
+
visible?: boolean;
|
|
10
|
+
indicator?: boolean;
|
|
11
|
+
mode?: ProgressBarMode;
|
|
12
|
+
};
|
|
13
|
+
export declare const ProgressBar: (props: ProgressBarProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=ProgressBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../src/ui/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAK/C,KAAK,eAAe,GAAG,aAAa,GAAG,eAAe,GAAG,MAAM,CAAC;AAEhE,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,mDAclD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ProgressBarDeterminate } from './ProgressBarDeterminate';
|
|
3
|
+
import { ProgressBarIndeterminate } from './ProgressBarIndeterminate';
|
|
4
|
+
import { ProgressBarLoop } from './ProgressBarLoop';
|
|
5
|
+
export const PROGRESS_BAR_GAP = 8;
|
|
6
|
+
export const PROGRESS_BAR_HEIGHT = 8;
|
|
7
|
+
export const PROGRESS_DURATION = 2000;
|
|
8
|
+
export const PROGRESS_DETERMINATE_DURATION = 400;
|
|
9
|
+
export const ProgressBar = (props) => {
|
|
10
|
+
const { visible = true, value, mode } = props;
|
|
11
|
+
const clampedValue = typeof value === 'number' ? Math.max(0, Math.min(1, value)) : undefined;
|
|
12
|
+
const resolvedMode = mode ?? (typeof clampedValue === 'number' ? 'determinate' : 'indeterminate');
|
|
13
|
+
if (!visible)
|
|
14
|
+
return null;
|
|
15
|
+
if (resolvedMode === 'determinate' && typeof clampedValue === 'number')
|
|
16
|
+
return _jsx(ProgressBarDeterminate, { clamped: clampedValue, ...props });
|
|
17
|
+
if (resolvedMode === 'loop')
|
|
18
|
+
return _jsx(ProgressBarLoop, { ...props });
|
|
19
|
+
return _jsx(ProgressBarIndeterminate, { ...props });
|
|
20
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
title: string;
|
|
3
|
+
tags: "Kit"[];
|
|
4
|
+
experimental: false;
|
|
5
|
+
description: string;
|
|
6
|
+
component: (props: import("@alveole/components").ProgressBarProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
styleFn: () => {
|
|
8
|
+
determinate: {
|
|
9
|
+
width: "100%";
|
|
10
|
+
flexDirection: "row";
|
|
11
|
+
alignItems: "center";
|
|
12
|
+
};
|
|
13
|
+
progressTrack: {
|
|
14
|
+
width: "100%";
|
|
15
|
+
overflow: "hidden";
|
|
16
|
+
position: "relative";
|
|
17
|
+
};
|
|
18
|
+
progressed: {
|
|
19
|
+
height: "100%";
|
|
20
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
21
|
+
backgroundColor: "#D2E8FE";
|
|
22
|
+
};
|
|
23
|
+
progressedAbsolute: {
|
|
24
|
+
position: "absolute";
|
|
25
|
+
top: number;
|
|
26
|
+
bottom: number;
|
|
27
|
+
left: number;
|
|
28
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
29
|
+
backgroundColor: "#D2E8FE";
|
|
30
|
+
};
|
|
31
|
+
remaining: {
|
|
32
|
+
height: "100%";
|
|
33
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
34
|
+
backgroundColor: "#DEE3EC";
|
|
35
|
+
};
|
|
36
|
+
remainingAbsolute: {
|
|
37
|
+
position: "absolute";
|
|
38
|
+
top: number;
|
|
39
|
+
bottom: number;
|
|
40
|
+
right: number;
|
|
41
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
42
|
+
backgroundColor: "#DEE3EC";
|
|
43
|
+
};
|
|
44
|
+
progress: {
|
|
45
|
+
backgroundColor: "#D2E8FE";
|
|
46
|
+
width: "100%";
|
|
47
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
48
|
+
overflow: "hidden";
|
|
49
|
+
};
|
|
50
|
+
bar: {
|
|
51
|
+
position: "absolute";
|
|
52
|
+
top: number;
|
|
53
|
+
bottom: number;
|
|
54
|
+
width: "100%";
|
|
55
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
56
|
+
backgroundColor: "#DEE3EC";
|
|
57
|
+
};
|
|
58
|
+
indicator: {
|
|
59
|
+
color: "#033B72";
|
|
60
|
+
marginTop: import("@alveole/theme").Spacing;
|
|
61
|
+
marginLeft: string;
|
|
62
|
+
marginRight: string;
|
|
63
|
+
fontFamily: "Barlow-Light" | "Barlow-Regular" | "Barlow-Medium" | "Barlow-SemiBold" | "Barlow-Bold" | "Inter-Light" | "Inter-Regular" | "Inter-Medium" | "Inter-SemiBold" | "Inter-Bold";
|
|
64
|
+
fontSize: 12;
|
|
65
|
+
lineHeight: 20;
|
|
66
|
+
letterSpacing: 0;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export default _default;
|
|
71
|
+
export declare const Determinate: () => import("react/jsx-runtime").JSX.Element;
|
|
72
|
+
export declare const Loop: () => import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
export declare const Indeterminate: () => import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
export declare const WithIndicator: () => import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
export declare const Usage: () => import("react/jsx-runtime").JSX.Element;
|
|
76
|
+
//# sourceMappingURL=ProgressBar.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/ProgressBar/ProgressBar.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAOkB;AAElB,eAAO,MAAM,WAAW,+CAAwD,CAAC;AAEjF,eAAO,MAAM,IAAI,+CAAoC,CAAC;AAEtD,eAAO,MAAM,aAAa,+CAA6C,CAAC;AAExE,eAAO,MAAM,aAAa,+CAAkE,CAAC;AAE7F,eAAO,MAAM,KAAK,+CAmBjB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Button } from '@alveole/components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { ProgressBar } from './ProgressBar';
|
|
5
|
+
import { useStyles } from './ProgressBar.styles';
|
|
6
|
+
export default {
|
|
7
|
+
title: 'ProgressBar',
|
|
8
|
+
tags: ['Kit'],
|
|
9
|
+
experimental: false,
|
|
10
|
+
description: 'bar de progression',
|
|
11
|
+
component: ProgressBar,
|
|
12
|
+
styleFn: useStyles,
|
|
13
|
+
};
|
|
14
|
+
export const Determinate = () => _jsx(ProgressBar, { mode: "determinate", value: 0.25 });
|
|
15
|
+
export const Loop = () => _jsx(ProgressBar, { mode: "loop" });
|
|
16
|
+
export const Indeterminate = () => _jsx(ProgressBar, { mode: "indeterminate" });
|
|
17
|
+
export const WithIndicator = () => _jsx(ProgressBar, { mode: "determinate", indicator: true, value: 0.25 });
|
|
18
|
+
export const Usage = () => {
|
|
19
|
+
const [value, setValue] = React.useState(0.25);
|
|
20
|
+
return (_jsxs(Box, { children: [_jsx(ProgressBar, { value: value }), _jsx(Box, { mt: '2W', width: 150, children: _jsx(Button, { title: value < 1 ? 'Augmenter' : 'Réduire', variant: "secondary", onPress: () => {
|
|
21
|
+
if (value < 1)
|
|
22
|
+
setValue(v => v + 0.25);
|
|
23
|
+
else
|
|
24
|
+
setValue(v => v - 0.25);
|
|
25
|
+
} }) })] }));
|
|
26
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const useStyles: () => {
|
|
2
|
+
determinate: {
|
|
3
|
+
width: "100%";
|
|
4
|
+
flexDirection: "row";
|
|
5
|
+
alignItems: "center";
|
|
6
|
+
};
|
|
7
|
+
progressTrack: {
|
|
8
|
+
width: "100%";
|
|
9
|
+
overflow: "hidden";
|
|
10
|
+
position: "relative";
|
|
11
|
+
};
|
|
12
|
+
progressed: {
|
|
13
|
+
height: "100%";
|
|
14
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
15
|
+
backgroundColor: "#D2E8FE";
|
|
16
|
+
};
|
|
17
|
+
progressedAbsolute: {
|
|
18
|
+
position: "absolute";
|
|
19
|
+
top: number;
|
|
20
|
+
bottom: number;
|
|
21
|
+
left: number;
|
|
22
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
23
|
+
backgroundColor: "#D2E8FE";
|
|
24
|
+
};
|
|
25
|
+
remaining: {
|
|
26
|
+
height: "100%";
|
|
27
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
28
|
+
backgroundColor: "#DEE3EC";
|
|
29
|
+
};
|
|
30
|
+
remainingAbsolute: {
|
|
31
|
+
position: "absolute";
|
|
32
|
+
top: number;
|
|
33
|
+
bottom: number;
|
|
34
|
+
right: number;
|
|
35
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
36
|
+
backgroundColor: "#DEE3EC";
|
|
37
|
+
};
|
|
38
|
+
progress: {
|
|
39
|
+
backgroundColor: "#D2E8FE";
|
|
40
|
+
width: "100%";
|
|
41
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
42
|
+
overflow: "hidden";
|
|
43
|
+
};
|
|
44
|
+
bar: {
|
|
45
|
+
position: "absolute";
|
|
46
|
+
top: number;
|
|
47
|
+
bottom: number;
|
|
48
|
+
width: "100%";
|
|
49
|
+
borderRadius: import("@alveole/theme/dist/constants/Radius").Radius;
|
|
50
|
+
backgroundColor: "#DEE3EC";
|
|
51
|
+
};
|
|
52
|
+
indicator: {
|
|
53
|
+
color: "#033B72";
|
|
54
|
+
marginTop: import("@alveole/theme").Spacing;
|
|
55
|
+
marginLeft: string;
|
|
56
|
+
marginRight: string;
|
|
57
|
+
fontFamily: "Barlow-Light" | "Barlow-Regular" | "Barlow-Medium" | "Barlow-SemiBold" | "Barlow-Bold" | "Inter-Light" | "Inter-Regular" | "Inter-Medium" | "Inter-SemiBold" | "Inter-Bold";
|
|
58
|
+
fontSize: 12;
|
|
59
|
+
lineHeight: 20;
|
|
60
|
+
letterSpacing: 0;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=ProgressBar.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.styles.d.ts","sourceRoot":"","sources":["../../../src/ui/ProgressBar/ProgressBar.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DnB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { makeStyles } from '@alveole/theme';
|
|
2
|
+
export const useStyles = makeStyles(({ text, color, spacing, radius }) => ({
|
|
3
|
+
determinate: {
|
|
4
|
+
width: '100%',
|
|
5
|
+
flexDirection: 'row',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
},
|
|
8
|
+
progressTrack: {
|
|
9
|
+
width: '100%',
|
|
10
|
+
overflow: 'hidden',
|
|
11
|
+
position: 'relative',
|
|
12
|
+
},
|
|
13
|
+
progressed: {
|
|
14
|
+
height: '100%',
|
|
15
|
+
borderRadius: radius('sm'),
|
|
16
|
+
backgroundColor: color.light.background['action-low-primary'],
|
|
17
|
+
},
|
|
18
|
+
progressedAbsolute: {
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
top: 0,
|
|
21
|
+
bottom: 0,
|
|
22
|
+
left: 0,
|
|
23
|
+
borderRadius: radius('sm'),
|
|
24
|
+
backgroundColor: color.light.background['action-low-primary'],
|
|
25
|
+
},
|
|
26
|
+
remaining: {
|
|
27
|
+
height: '100%',
|
|
28
|
+
borderRadius: radius('sm'),
|
|
29
|
+
backgroundColor: color.light.border['default-grey'],
|
|
30
|
+
},
|
|
31
|
+
remainingAbsolute: {
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
top: 0,
|
|
34
|
+
bottom: 0,
|
|
35
|
+
right: 0,
|
|
36
|
+
borderRadius: radius('sm'),
|
|
37
|
+
backgroundColor: color.light.border['default-grey'],
|
|
38
|
+
},
|
|
39
|
+
progress: {
|
|
40
|
+
backgroundColor: color.light.background['action-low-primary'],
|
|
41
|
+
width: '100%',
|
|
42
|
+
borderRadius: radius('sm'),
|
|
43
|
+
overflow: 'hidden',
|
|
44
|
+
},
|
|
45
|
+
bar: {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
top: 0,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
width: '100%',
|
|
50
|
+
borderRadius: radius('sm'),
|
|
51
|
+
backgroundColor: color.light.border['default-grey'],
|
|
52
|
+
},
|
|
53
|
+
indicator: {
|
|
54
|
+
...text['Corps de texte'].XS.Regular,
|
|
55
|
+
color: color.light.artwork['major-primary'],
|
|
56
|
+
marginTop: spacing('1W'),
|
|
57
|
+
marginLeft: 'auto',
|
|
58
|
+
marginRight: 'auto',
|
|
59
|
+
},
|
|
60
|
+
}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BoxProps } from '@alveole/components';
|
|
2
|
+
export type ProgressBarDeterminateProps = BoxProps & {
|
|
3
|
+
indicator?: boolean;
|
|
4
|
+
clamped: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const ProgressBarDeterminate: (props: ProgressBarDeterminateProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=ProgressBarDeterminate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarDeterminate.d.ts","sourceRoot":"","sources":["../../../src/ui/ProgressBar/ProgressBarDeterminate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAc,MAAM,qBAAqB,CAAC;AAMhE,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,OAAO,2BAA2B,4CA2CxE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from '@alveole/components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Animated, Easing } from 'react-native';
|
|
5
|
+
import { PROGRESS_BAR_GAP, PROGRESS_BAR_HEIGHT, PROGRESS_DETERMINATE_DURATION } from './ProgressBar';
|
|
6
|
+
import { useStyles } from './ProgressBar.styles';
|
|
7
|
+
export const ProgressBarDeterminate = (props) => {
|
|
8
|
+
const { clamped, indicator, style, onLayout, ...boxProps } = props;
|
|
9
|
+
const styles = useStyles();
|
|
10
|
+
const animatedProgress = React.useRef(new Animated.Value(clamped)).current;
|
|
11
|
+
const remaining = React.useMemo(() => Animated.subtract(1, animatedProgress), [animatedProgress]);
|
|
12
|
+
const animatedGap = React.useMemo(() => animatedProgress.interpolate({
|
|
13
|
+
inputRange: [0, 0.0001, 0.9999, 1],
|
|
14
|
+
outputRange: [0, PROGRESS_BAR_GAP, PROGRESS_BAR_GAP, 0],
|
|
15
|
+
extrapolate: 'clamp',
|
|
16
|
+
}), [animatedProgress]);
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
const anim = Animated.timing(animatedProgress, {
|
|
19
|
+
toValue: clamped,
|
|
20
|
+
duration: PROGRESS_DETERMINATE_DURATION,
|
|
21
|
+
easing: Easing.out(Easing.ease),
|
|
22
|
+
useNativeDriver: false,
|
|
23
|
+
});
|
|
24
|
+
anim.start();
|
|
25
|
+
return () => anim.stop();
|
|
26
|
+
}, [animatedProgress, clamped]);
|
|
27
|
+
return (_jsxs(Box, { children: [_jsxs(Box, { style: [styles.determinate, { height: PROGRESS_BAR_HEIGHT }, style], ...boxProps, children: [_jsx(Animated.View, { style: [styles.progressed, { flex: animatedProgress }] }), _jsx(Animated.View, { style: { width: animatedGap } }), _jsx(Animated.View, { style: [styles.remaining, { flex: remaining }] })] }), indicator && (_jsx(Box, { children: _jsxs(Typography, { style: styles.indicator, children: [clamped * 100, "%"] }) }))] }));
|
|
28
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BoxProps } from '@alveole/components';
|
|
2
|
+
export type ProgressBarIndeterminateProps = BoxProps;
|
|
3
|
+
export declare const ProgressBarIndeterminate: (props: ProgressBarIndeterminateProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
//# sourceMappingURL=ProgressBarIndeterminate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarIndeterminate.d.ts","sourceRoot":"","sources":["../../../src/ui/ProgressBar/ProgressBarIndeterminate.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAAC;AAErD,eAAO,MAAM,wBAAwB,GAAI,OAAO,6BAA6B,4CA6D5E,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@alveole/components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Animated, Easing } from 'react-native';
|
|
5
|
+
import { PROGRESS_BAR_HEIGHT, PROGRESS_DURATION } from './ProgressBar';
|
|
6
|
+
import { useStyles } from './ProgressBar.styles';
|
|
7
|
+
export const ProgressBarIndeterminate = (props) => {
|
|
8
|
+
const { style, ...boxProps } = props;
|
|
9
|
+
const progress = React.useRef(new Animated.Value(0)).current;
|
|
10
|
+
const styles = useStyles();
|
|
11
|
+
const translateRange = React.useMemo(() => progress.interpolate({
|
|
12
|
+
inputRange: [0, 1],
|
|
13
|
+
outputRange: ['-50%', '150%'],
|
|
14
|
+
}), [progress]);
|
|
15
|
+
const scaleRange = React.useMemo(() => progress.interpolate({
|
|
16
|
+
inputRange: [0, 0.5, 1],
|
|
17
|
+
outputRange: [0.2, 1, 0.2],
|
|
18
|
+
}), [progress]);
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
let anim = null;
|
|
21
|
+
const run = () => {
|
|
22
|
+
progress.setValue(0);
|
|
23
|
+
anim = Animated.timing(progress, {
|
|
24
|
+
toValue: 1,
|
|
25
|
+
duration: PROGRESS_DURATION,
|
|
26
|
+
easing: Easing.inOut(Easing.ease),
|
|
27
|
+
useNativeDriver: true,
|
|
28
|
+
});
|
|
29
|
+
anim.start(({ finished }) => {
|
|
30
|
+
if (finished)
|
|
31
|
+
run();
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
run();
|
|
35
|
+
return () => anim?.stop();
|
|
36
|
+
}, [progress]);
|
|
37
|
+
return (_jsx(Box, { style: [styles.progress, { height: PROGRESS_BAR_HEIGHT, marginTop: -PROGRESS_BAR_HEIGHT }, style], ...boxProps, children: _jsx(Animated.View, { style: [
|
|
38
|
+
{
|
|
39
|
+
transform: [{ translateX: translateRange }, { scaleX: scaleRange }],
|
|
40
|
+
},
|
|
41
|
+
styles.bar,
|
|
42
|
+
] }) }));
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBarLoop.d.ts","sourceRoot":"","sources":["../../../src/ui/ProgressBar/ProgressBarLoop.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAE5C,eAAO,MAAM,eAAe,GAAI,OAAO,oBAAoB,4CA2D1D,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@alveole/components';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { Animated, Easing } from 'react-native';
|
|
5
|
+
import { PROGRESS_BAR_GAP, PROGRESS_BAR_HEIGHT, PROGRESS_DURATION } from './ProgressBar';
|
|
6
|
+
import { useStyles } from './ProgressBar.styles';
|
|
7
|
+
export const ProgressBarLoop = (props) => {
|
|
8
|
+
const { style, onLayout, ...boxProps } = props;
|
|
9
|
+
const progress = React.useRef(new Animated.Value(0)).current;
|
|
10
|
+
const styles = useStyles();
|
|
11
|
+
const [width, setWidth] = React.useState(0);
|
|
12
|
+
const loopProgressWidth = React.useMemo(() => Math.max(width - PROGRESS_BAR_GAP, 0), [width]);
|
|
13
|
+
const loopFillWidth = React.useMemo(() => progress.interpolate({
|
|
14
|
+
inputRange: [0, 1],
|
|
15
|
+
outputRange: [0, loopProgressWidth],
|
|
16
|
+
}), [loopProgressWidth, progress]);
|
|
17
|
+
const loopRemainingLeft = React.useMemo(() => progress.interpolate({
|
|
18
|
+
inputRange: [0, 1],
|
|
19
|
+
outputRange: [Math.min(PROGRESS_BAR_GAP, width), width],
|
|
20
|
+
}), [progress, width]);
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
const anim = Animated.loop(Animated.timing(progress, {
|
|
23
|
+
toValue: 1,
|
|
24
|
+
duration: PROGRESS_DURATION,
|
|
25
|
+
easing: Easing.linear,
|
|
26
|
+
useNativeDriver: false,
|
|
27
|
+
}));
|
|
28
|
+
progress.setValue(0);
|
|
29
|
+
anim.start();
|
|
30
|
+
return () => anim.stop();
|
|
31
|
+
}, [progress]);
|
|
32
|
+
const handleLayout = React.useCallback((event) => {
|
|
33
|
+
setWidth(event.nativeEvent.layout.width);
|
|
34
|
+
onLayout?.(event);
|
|
35
|
+
}, [onLayout]);
|
|
36
|
+
return (_jsxs(Box, { style: [styles.progressTrack, { height: PROGRESS_BAR_HEIGHT }, style], onLayout: handleLayout, ...boxProps, children: [_jsx(Animated.View, { style: [styles.progressedAbsolute, { width: loopFillWidth }] }), _jsx(Animated.View, { style: [styles.remainingAbsolute, { left: loopRemainingLeft }] })] }));
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/ProgressBar/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ProgressBar';
|
package/dist/ui/index.d.ts
CHANGED
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
|
package/dist/ui/index.js
CHANGED