@alveole/components 0.31.3 → 0.31.4
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/ui/Button/Button.d.ts +2 -0
- package/dist/ui/Button/Button.d.ts.map +1 -1
- package/dist/ui/Button/Button.js +6 -6
- package/dist/ui/Button/Button.stories.d.ts +2 -0
- package/dist/ui/Button/Button.stories.d.ts.map +1 -1
- package/dist/ui/Button/Button.stories.js +1 -0
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ export type ButtonProps = Omit<PressableProps, 'children' | 'style'> & {
|
|
|
15
15
|
borderNone?: boolean;
|
|
16
16
|
leftAlign?: boolean;
|
|
17
17
|
type?: 'button' | 'submit';
|
|
18
|
+
active?: boolean;
|
|
18
19
|
isLoading?: boolean;
|
|
19
20
|
};
|
|
20
21
|
export declare const Button: React.ForwardRefExoticComponent<Omit<PressableProps, "children" | "style"> & {
|
|
@@ -30,6 +31,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<PressableProps
|
|
|
30
31
|
borderNone?: boolean;
|
|
31
32
|
leftAlign?: boolean;
|
|
32
33
|
type?: "button" | "submit";
|
|
34
|
+
active?: boolean;
|
|
33
35
|
isLoading?: boolean;
|
|
34
36
|
} & React.RefAttributes<View>>;
|
|
35
37
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAA0C,cAAc,EAA8B,IAAI,EAAE,MAAM,cAAc,CAAC;AACxH,OAAO,EAAO,QAAQ,EAAc,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,SAAS,EAAc,MAAM,eAAe,CAAC;AAOtD,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IAC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CAAC;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,MAAM;WAhBV,MAAM;WACN,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;aACvB,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM;gBACrD,SAAS,CAAC,MAAM,CAAC;cACnB,SAAS,CAAC,MAAM,CAAC;eAChB,OAAO;qBACD,QAAQ;gBACb,OAAO;gBACP,OAAO;iBACN,OAAO;gBACR,OAAO;WACZ,QAAQ,GAAG,QAAQ;aACjB,OAAO;gBACJ,OAAO;8BA4MnB,CAAC"}
|
package/dist/ui/Button/Button.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Box, Typography } from '../../core';
|
|
|
5
5
|
import { LucideIcon } from '../LucideIcon';
|
|
6
6
|
import { useStyles } from './Button.styles';
|
|
7
7
|
export const Button = React.forwardRef(function Button(props, ref) {
|
|
8
|
-
const { title, type, size, variant, disabled, startIcon, endIcon, noPadding, borderNone, leftAlign, isLoading, selected, fullWidth = false, ContainerProps = {}, ...buttonProps } = props;
|
|
8
|
+
const { title, type, size, variant, disabled, startIcon, endIcon, noPadding, borderNone, leftAlign, isLoading, selected, fullWidth = false, ContainerProps = {}, active = false, ...buttonProps } = props;
|
|
9
9
|
const { style, hoverStyle, ...containerProps } = ContainerProps;
|
|
10
10
|
const styles = useStyles();
|
|
11
11
|
const containerSize = size === 'sm'
|
|
@@ -42,35 +42,35 @@ export const Button = React.forwardRef(function Button(props, ref) {
|
|
|
42
42
|
applicableStyles = { ...applicableStyles, ...styles.primaryContainer };
|
|
43
43
|
if (disabled)
|
|
44
44
|
applicableStyles = { ...applicableStyles, ...styles.primaryContainerDisabled };
|
|
45
|
-
else if (state?.pressed)
|
|
45
|
+
else if (state?.pressed || active)
|
|
46
46
|
applicableStyles = { ...applicableStyles, ...styles.primaryContainerPressed };
|
|
47
47
|
}
|
|
48
48
|
else if (variant === 'secondary') {
|
|
49
49
|
applicableStyles = { ...applicableStyles, ...styles.secondaryContainer };
|
|
50
50
|
if (disabled)
|
|
51
51
|
applicableStyles = { ...applicableStyles, ...styles.secondaryContainerDisabled };
|
|
52
|
-
else if (state?.pressed)
|
|
52
|
+
else if (state?.pressed || active)
|
|
53
53
|
applicableStyles = { ...applicableStyles, ...styles.secondaryContainerPressed };
|
|
54
54
|
}
|
|
55
55
|
else if (variant === 'tertiary') {
|
|
56
56
|
applicableStyles = { ...applicableStyles, ...styles.tertiaryContainer };
|
|
57
57
|
if (disabled)
|
|
58
58
|
applicableStyles = { ...applicableStyles, ...styles.tertiaryContainerDisabled };
|
|
59
|
-
else if (state?.pressed)
|
|
59
|
+
else if (state?.pressed || active)
|
|
60
60
|
applicableStyles = { ...applicableStyles, ...styles.tertiaryContainerPressed };
|
|
61
61
|
}
|
|
62
62
|
else if (variant === 'danger') {
|
|
63
63
|
applicableStyles = { ...applicableStyles, ...styles.dangerContainer };
|
|
64
64
|
if (disabled)
|
|
65
65
|
applicableStyles = { ...applicableStyles, ...styles.dangerContainerDisabled };
|
|
66
|
-
else if (state?.pressed)
|
|
66
|
+
else if (state?.pressed || active)
|
|
67
67
|
applicableStyles = { ...applicableStyles, ...styles.dangerContainerPressed };
|
|
68
68
|
}
|
|
69
69
|
else if (variant === 'link') {
|
|
70
70
|
applicableStyles = { ...applicableStyles, ...styles.linkContainer };
|
|
71
71
|
if (disabled)
|
|
72
72
|
applicableStyles = { ...applicableStyles, ...styles.tertiaryContainerDisabled };
|
|
73
|
-
else if (state?.pressed)
|
|
73
|
+
else if (state?.pressed || active)
|
|
74
74
|
applicableStyles = { ...applicableStyles, ...styles.linkContainerPressed };
|
|
75
75
|
}
|
|
76
76
|
return {
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
borderNone?: boolean;
|
|
18
18
|
leftAlign?: boolean;
|
|
19
19
|
type?: "button" | "submit";
|
|
20
|
+
active?: boolean;
|
|
20
21
|
isLoading?: boolean;
|
|
21
22
|
} & import("react").RefAttributes<import("react-native").View>>;
|
|
22
23
|
styleFn: () => {
|
|
@@ -308,4 +309,5 @@ export declare const Link: () => import("react/jsx-runtime").JSX.Element;
|
|
|
308
309
|
export declare const Icons: () => import("react/jsx-runtime").JSX.Element;
|
|
309
310
|
export declare const FullWidth: () => import("react/jsx-runtime").JSX.Element;
|
|
310
311
|
export declare const Selected: () => import("react/jsx-runtime").JSX.Element;
|
|
312
|
+
export declare const Active: () => import("react/jsx-runtime").JSX.Element;
|
|
311
313
|
//# sourceMappingURL=Button.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.stories.d.ts","sourceRoot":"","sources":["../../../src/ui/Button/Button.stories.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAQkB;AAElB,eAAO,MAAM,KAAK,+CAMjB,CAAC;AAEF,eAAO,MAAM,OAAO,+CAKnB,CAAC;AAEF,eAAO,MAAM,SAAS,+CAKrB,CAAC;AAEF,eAAO,MAAM,QAAQ,+CAKpB,CAAC;AAEF,eAAO,MAAM,MAAM,+CAKlB,CAAC;AAEF,eAAO,MAAM,IAAI,+CAQhB,CAAC;AAEF,eAAO,MAAM,KAAK,+CAQjB,CAAC;AAEF,eAAO,MAAM,SAAS,+CAAkE,CAAC;AAEzF,eAAO,MAAM,QAAQ,+CAIpB,CAAC;AAEF,eAAO,MAAM,MAAM,+CAKlB,CAAC"}
|
|
@@ -21,3 +21,4 @@ export const Link = () => (_jsxs(_Fragment, { children: [_jsx(Typography, { chil
|
|
|
21
21
|
export const Icons = () => (_jsxs(Box, { display: "flex", flexDirection: "row", gap: 4, children: [_jsx(Button, { variant: "primary", title: "Start Icon", startIcon: "Plus" }), _jsx(Button, { variant: "primary", title: "End Icon", endIcon: "Plus" }), _jsx(Button, { variant: "primary", title: "End Icon", endIcon: "Plus" }), _jsx(ButtonIcon, { variant: "primary", icon: "CircleUser" }), _jsx(ButtonIcon, { variant: "primary", icon: "CircleUser" })] }));
|
|
22
22
|
export const FullWidth = () => _jsx(Button, { variant: "primary", title: "Full Width", fullWidth: true });
|
|
23
23
|
export const Selected = () => (_jsx(Box, { display: "flex", flexDirection: "row", gap: 4, children: _jsx(Button, { variant: "secondary", title: "Selected", selected: true }) }));
|
|
24
|
+
export const Active = () => (_jsxs(Box, { display: "flex", flexDirection: "row", gap: 4, children: [_jsx(Typography, { children: "Utilis\u00E9 quand le bouton est actif (ex: quand un menu est ouvert)" }), _jsx(Button, { variant: "secondary", title: "Active", active: true })] }));
|