@ds-autonomie/react-native 0.1.0 → 0.3.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/CHANGELOG.md +23 -0
- package/dist/chunks/chunk.3QXPJAHY.js +22 -0
- package/dist/chunks/chunk.4MPJJ7EN.js +65 -0
- package/dist/chunks/chunk.4SSEOHVB.js +41 -0
- package/dist/chunks/chunk.4ZX27FCY.js +21 -0
- package/dist/chunks/chunk.6DY4BFMZ.js +22 -0
- package/dist/chunks/chunk.73S52VD6.js +94 -0
- package/dist/chunks/chunk.7H4YRP4X.js +70 -0
- package/dist/chunks/{chunk.NNC6C337.js → chunk.B2JV2E47.js} +3 -3
- package/dist/chunks/chunk.CIHQLL6Y.js +93 -0
- package/dist/chunks/chunk.DMHRBYRF.js +69 -0
- package/dist/chunks/chunk.H2AL2E3A.js +47 -0
- package/dist/chunks/chunk.INEDXDER.js +51 -0
- package/dist/chunks/chunk.KVGKM2JI.js +73 -0
- package/dist/chunks/chunk.KVXJ2L2C.js +22 -0
- package/dist/chunks/chunk.LN5IVTGU.js +60 -0
- package/dist/chunks/{chunk.4EJ4MEUR.js → chunk.OQSCGAEY.js} +4 -2
- package/dist/chunks/chunk.RNOZ5AW4.js +71 -0
- package/dist/chunks/chunk.SZJKAIPC.js +20 -0
- package/dist/chunks/chunk.XCMNSIIN.js +72 -0
- package/dist/chunks/chunk.YWEWQ2LT.js +39 -0
- package/dist/components/button/Button.d.ts +65 -0
- package/dist/components/button/Button.js +8 -0
- package/dist/components/button/Button.styles.d.ts +38 -0
- package/dist/components/button/Button.styles.js +14 -0
- package/dist/components/checkbox/Checkbox.d.ts +55 -0
- package/dist/components/checkbox/Checkbox.js +8 -0
- package/dist/components/checkbox/Checkbox.styles.d.ts +38 -0
- package/dist/components/checkbox/Checkbox.styles.js +8 -0
- package/dist/components/divider/Divider.d.ts +7 -0
- package/dist/components/divider/Divider.js +24 -0
- package/dist/components/divider/Divider.styles.d.ts +13 -0
- package/dist/components/divider/Divider.styles.js +6 -0
- package/dist/components/icon/Icon.d.ts +10 -4
- package/dist/components/icon/Icon.js +1 -1
- package/dist/components/listCaption/ListCaption.d.ts +7 -0
- package/dist/components/listCaption/ListCaption.js +8 -0
- package/dist/components/listCaption/ListCaption.styles.d.ts +14 -0
- package/dist/components/listCaption/ListCaption.styles.js +7 -0
- package/dist/components/listItem/ListItem.d.ts +34 -0
- package/dist/components/listItem/ListItem.js +9 -0
- package/dist/components/listItem/ListItem.styles.d.ts +48 -0
- package/dist/components/listItem/ListItem.styles.js +7 -0
- package/dist/components/listTitle/ListTitle.d.ts +7 -0
- package/dist/components/listTitle/ListTitle.js +8 -0
- package/dist/components/listTitle/ListTitle.styles.d.ts +15 -0
- package/dist/components/listTitle/ListTitle.styles.js +7 -0
- package/dist/components/radio/Radio.d.ts +55 -0
- package/dist/components/radio/Radio.js +7 -0
- package/dist/components/radio/Radio.styles.d.ts +30 -0
- package/dist/components/radio/Radio.styles.js +8 -0
- package/dist/components/searchField/SearchField.d.ts +14 -0
- package/dist/components/searchField/SearchField.js +7 -0
- package/dist/components/searchField/SearchField.styles.d.ts +42 -0
- package/dist/components/searchField/SearchField.styles.js +10 -0
- package/dist/components/textInput/TextInput.d.ts +54 -0
- package/dist/components/textInput/TextInput.js +9 -0
- package/dist/components/textInput/TextInput.styles.d.ts +94 -0
- package/dist/components/textInput/TextInput.styles.js +11 -0
- package/dist/components/toggle/Toggle.js +2 -2
- package/dist/index.d.ts +10 -1
- package/dist/index.js +46 -2
- package/dist/styles/fonts.d.ts +35 -0
- package/dist/utils/device.d.ts +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isIOS,
|
|
3
|
+
placeholderTextColor,
|
|
4
|
+
plateformStyles,
|
|
5
|
+
styles
|
|
6
|
+
} from "./chunk.7H4YRP4X.js";
|
|
7
|
+
|
|
8
|
+
// src/components/searchField/SearchField.tsx
|
|
9
|
+
import React, { useEffect, useState } from "react";
|
|
10
|
+
import {
|
|
11
|
+
View,
|
|
12
|
+
TextInput
|
|
13
|
+
} from "react-native";
|
|
14
|
+
import Icon from "react-native-vector-icons/MaterialIcons";
|
|
15
|
+
var INIT_PLACEHOLDER = isIOS ? "Recherche" : "Rechercher un...";
|
|
16
|
+
var SearchField = React.forwardRef(
|
|
17
|
+
function SearchField2({
|
|
18
|
+
onChangeText,
|
|
19
|
+
placeholder = INIT_PLACEHOLDER,
|
|
20
|
+
style,
|
|
21
|
+
value = "",
|
|
22
|
+
disabled = false,
|
|
23
|
+
...props
|
|
24
|
+
}, ref) {
|
|
25
|
+
const [text, setText] = useState(value);
|
|
26
|
+
useEffect(
|
|
27
|
+
function onValueUpdate() {
|
|
28
|
+
setText(value);
|
|
29
|
+
},
|
|
30
|
+
[value]
|
|
31
|
+
);
|
|
32
|
+
function handleKeypress(text2) {
|
|
33
|
+
if (disabled) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
onChangeText?.(text2);
|
|
37
|
+
setText(text2);
|
|
38
|
+
}
|
|
39
|
+
return <View
|
|
40
|
+
style={[
|
|
41
|
+
style,
|
|
42
|
+
styles.container,
|
|
43
|
+
isIOS && styles.iOScontainer,
|
|
44
|
+
disabled && styles.disabledContainer
|
|
45
|
+
]}
|
|
46
|
+
>
|
|
47
|
+
<Icon
|
|
48
|
+
name="search"
|
|
49
|
+
{...plateformStyles}
|
|
50
|
+
accessibilityRole="button"
|
|
51
|
+
accessibilityLabel="search"
|
|
52
|
+
/>
|
|
53
|
+
<TextInput
|
|
54
|
+
ref={ref}
|
|
55
|
+
{...props}
|
|
56
|
+
editable={!disabled}
|
|
57
|
+
accessibilityLabel="search"
|
|
58
|
+
accessibilityRole="search"
|
|
59
|
+
accessibilityState={{ disabled }}
|
|
60
|
+
onChangeText={handleKeypress}
|
|
61
|
+
placeholder={placeholder}
|
|
62
|
+
placeholderTextColor={placeholderTextColor}
|
|
63
|
+
returnKeyType="search"
|
|
64
|
+
style={[styles.input, isIOS ? styles.iOSInput : styles.androidInput]}
|
|
65
|
+
value={text}
|
|
66
|
+
/>
|
|
67
|
+
</View>;
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
SearchField
|
|
73
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listCaptionStyles
|
|
3
|
+
} from "./chunk.4ZX27FCY.js";
|
|
4
|
+
|
|
5
|
+
// src/components/listCaption/ListCaption.tsx
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { View, Text } from "react-native";
|
|
8
|
+
var ListCaption = React.forwardRef(
|
|
9
|
+
function ListCaption2({ style, children, ...restProps }, ref) {
|
|
10
|
+
return <View
|
|
11
|
+
ref={ref}
|
|
12
|
+
{...restProps}
|
|
13
|
+
accessibilityRole="text"
|
|
14
|
+
accessible
|
|
15
|
+
style={[style, listCaptionStyles.container]}
|
|
16
|
+
><Text style={[listCaptionStyles.text]}>{children}</Text></View>;
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
ListCaption
|
|
22
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {
|
|
2
|
+
radioContainerStyles,
|
|
3
|
+
radioDotStyles
|
|
4
|
+
} from "./chunk.YWEWQ2LT.js";
|
|
5
|
+
|
|
6
|
+
// src/components/radio/Radio.tsx
|
|
7
|
+
import React, { useEffect, useState } from "react";
|
|
8
|
+
import { Pressable, View } from "react-native";
|
|
9
|
+
var Radio = React.forwardRef(function Checkbox({
|
|
10
|
+
value = false,
|
|
11
|
+
disabled = false,
|
|
12
|
+
onValueChange,
|
|
13
|
+
style: styleProps,
|
|
14
|
+
...restProps
|
|
15
|
+
}, ref) {
|
|
16
|
+
const [checked, setChecked] = useState(value);
|
|
17
|
+
useEffect(
|
|
18
|
+
function onValueUpdate() {
|
|
19
|
+
setChecked(value);
|
|
20
|
+
},
|
|
21
|
+
[value]
|
|
22
|
+
);
|
|
23
|
+
function handlePress() {
|
|
24
|
+
if (disabled || checked) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
onValueChange?.(true);
|
|
28
|
+
setChecked(true);
|
|
29
|
+
}
|
|
30
|
+
return <Pressable
|
|
31
|
+
ref={ref}
|
|
32
|
+
{...restProps}
|
|
33
|
+
accessibilityLabel="radio"
|
|
34
|
+
accessibilityRole="radio"
|
|
35
|
+
accessibilityState={{ checked, disabled }}
|
|
36
|
+
accessible
|
|
37
|
+
aria-checked={checked}
|
|
38
|
+
aria-disabled={disabled}
|
|
39
|
+
aria-pressed={checked}
|
|
40
|
+
onPress={handlePress}
|
|
41
|
+
hitSlop={14}
|
|
42
|
+
role="radio"
|
|
43
|
+
style={[
|
|
44
|
+
styleProps,
|
|
45
|
+
radioContainerStyles.default,
|
|
46
|
+
checked && radioContainerStyles.active,
|
|
47
|
+
disabled && radioContainerStyles.disabled
|
|
48
|
+
]}
|
|
49
|
+
>{checked && <View
|
|
50
|
+
style={[
|
|
51
|
+
radioDotStyles.default,
|
|
52
|
+
checked && radioDotStyles.active,
|
|
53
|
+
disabled && radioDotStyles.disabled
|
|
54
|
+
]}
|
|
55
|
+
/>}</Pressable>;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
Radio
|
|
60
|
+
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
// src/components/icon/Icon.tsx
|
|
2
|
+
import { forwardRef } from "react";
|
|
2
3
|
import MaterialIcons from "react-native-vector-icons/MaterialIcons";
|
|
3
|
-
|
|
4
|
+
var Icon = forwardRef(function Icon2({ size = 16, ...restProps }, ref) {
|
|
4
5
|
return <MaterialIcons
|
|
5
6
|
{...restProps}
|
|
7
|
+
ref={ref}
|
|
6
8
|
size={size}
|
|
7
9
|
selectable={false}
|
|
8
10
|
importantForAccessibility="no-hide-descendants"
|
|
9
11
|
accessibilityElementsHidden
|
|
10
12
|
/>;
|
|
11
|
-
}
|
|
13
|
+
});
|
|
12
14
|
|
|
13
15
|
export {
|
|
14
16
|
Icon
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// src/components/button/Button.styles.ts
|
|
2
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
3
|
+
import {
|
|
4
|
+
StyleSheet
|
|
5
|
+
} from "react-native";
|
|
6
|
+
var variants = Object.keys(
|
|
7
|
+
theme.collection.button
|
|
8
|
+
);
|
|
9
|
+
var sizes = ["small", "medium"];
|
|
10
|
+
function getIconColor({ pressed, disabled, variant }) {
|
|
11
|
+
const buttonTheme = theme.collection.button[variant];
|
|
12
|
+
if (disabled)
|
|
13
|
+
return buttonTheme["on-disabled"];
|
|
14
|
+
if (pressed)
|
|
15
|
+
return buttonTheme["on-pressed"];
|
|
16
|
+
return buttonTheme["on-enabled"];
|
|
17
|
+
}
|
|
18
|
+
function getContainerStyle({
|
|
19
|
+
disabled,
|
|
20
|
+
hasOnlyOneIcon,
|
|
21
|
+
pressed,
|
|
22
|
+
size,
|
|
23
|
+
variant
|
|
24
|
+
}) {
|
|
25
|
+
const isMedium = size === "medium";
|
|
26
|
+
const isLink = variant === "link";
|
|
27
|
+
const state = disabled ? "disabled" : pressed ? "pressed" : "enabled";
|
|
28
|
+
const verticalPadding = theme.primitives.spacing[isMedium ? 16 : 8];
|
|
29
|
+
const horizontalPadding = hasOnlyOneIcon ? theme.primitives.spacing[isMedium ? 16 : 8] : theme.primitives.spacing[isMedium ? 24 : 16];
|
|
30
|
+
return StyleSheet.create({
|
|
31
|
+
container: {
|
|
32
|
+
position: "relative",
|
|
33
|
+
flexDirection: "row",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
borderRadius: theme.primitives.radius[8],
|
|
36
|
+
paddingLeft: horizontalPadding,
|
|
37
|
+
paddingRight: horizontalPadding,
|
|
38
|
+
paddingTop: verticalPadding,
|
|
39
|
+
paddingBottom: verticalPadding,
|
|
40
|
+
gap: theme.primitives.spacing[isMedium ? 8 : 4],
|
|
41
|
+
backgroundColor: isLink ? void 0 : theme.collection.button[variant][state],
|
|
42
|
+
opacity: !isLink && disabled ? 0.4 : void 0
|
|
43
|
+
}
|
|
44
|
+
}).container;
|
|
45
|
+
}
|
|
46
|
+
function getTextStyle({
|
|
47
|
+
disabled,
|
|
48
|
+
pressed,
|
|
49
|
+
size,
|
|
50
|
+
variant
|
|
51
|
+
}) {
|
|
52
|
+
const isMedium = size === "medium";
|
|
53
|
+
const state = disabled ? "disabled" : pressed ? "pressed" : "enabled";
|
|
54
|
+
return StyleSheet.create({
|
|
55
|
+
text: {
|
|
56
|
+
fontFamily: "Cabin-Regular",
|
|
57
|
+
fontWeight: "700",
|
|
58
|
+
fontSize: isMedium ? 16 : 14,
|
|
59
|
+
letterSpacing: isMedium ? 0.5 : 0.25,
|
|
60
|
+
color: theme.collection.button[variant][`on-${state}`]
|
|
61
|
+
}
|
|
62
|
+
}).text;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {
|
|
66
|
+
variants,
|
|
67
|
+
sizes,
|
|
68
|
+
getIconColor,
|
|
69
|
+
getContainerStyle,
|
|
70
|
+
getTextStyle
|
|
71
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/components/divider/Divider.styles.ts
|
|
2
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
var dividerStyles = StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
backgroundColor: theme.collection.background.divider
|
|
7
|
+
},
|
|
8
|
+
horizontal: {
|
|
9
|
+
height: 1,
|
|
10
|
+
width: "100%"
|
|
11
|
+
},
|
|
12
|
+
vertical: {
|
|
13
|
+
width: 1,
|
|
14
|
+
height: "100%"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
dividerStyles
|
|
20
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkboxCheckStyles,
|
|
3
|
+
checkboxContainerStyles
|
|
4
|
+
} from "./chunk.H2AL2E3A.js";
|
|
5
|
+
import {
|
|
6
|
+
Icon
|
|
7
|
+
} from "./chunk.OQSCGAEY.js";
|
|
8
|
+
|
|
9
|
+
// src/components/checkbox/Checkbox.tsx
|
|
10
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
11
|
+
import React, { useEffect, useState } from "react";
|
|
12
|
+
import { Pressable, View } from "react-native";
|
|
13
|
+
var Checkbox = React.forwardRef(function Checkbox2({
|
|
14
|
+
value = false,
|
|
15
|
+
disabled = false,
|
|
16
|
+
error = false,
|
|
17
|
+
onValueChange,
|
|
18
|
+
style: styleProps,
|
|
19
|
+
...restProps
|
|
20
|
+
}, ref) {
|
|
21
|
+
const [checked, setChecked] = useState(value);
|
|
22
|
+
useEffect(
|
|
23
|
+
function onValueUpdate() {
|
|
24
|
+
setChecked(value);
|
|
25
|
+
},
|
|
26
|
+
[value]
|
|
27
|
+
);
|
|
28
|
+
function handlePress() {
|
|
29
|
+
if (disabled) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
onValueChange?.(!checked);
|
|
33
|
+
setChecked(!checked);
|
|
34
|
+
}
|
|
35
|
+
return <Pressable
|
|
36
|
+
ref={ref}
|
|
37
|
+
{...restProps}
|
|
38
|
+
accessibilityLabel="checkbox"
|
|
39
|
+
accessibilityRole="checkbox"
|
|
40
|
+
accessibilityState={{ checked, disabled }}
|
|
41
|
+
accessible
|
|
42
|
+
aria-checked={checked}
|
|
43
|
+
aria-disabled={disabled}
|
|
44
|
+
aria-invalid={error}
|
|
45
|
+
aria-pressed={checked}
|
|
46
|
+
onPress={handlePress}
|
|
47
|
+
role="checkbox"
|
|
48
|
+
hitSlop={15}
|
|
49
|
+
style={[
|
|
50
|
+
styleProps,
|
|
51
|
+
checkboxContainerStyles.default,
|
|
52
|
+
checked && checkboxContainerStyles.active,
|
|
53
|
+
error && checkboxContainerStyles.error,
|
|
54
|
+
disabled && checkboxContainerStyles.disabled
|
|
55
|
+
]}
|
|
56
|
+
>{checked && <View
|
|
57
|
+
style={[
|
|
58
|
+
checkboxCheckStyles.default,
|
|
59
|
+
checked && checkboxCheckStyles.active,
|
|
60
|
+
error && checkboxCheckStyles.error,
|
|
61
|
+
disabled && checkboxCheckStyles.disabled
|
|
62
|
+
]}
|
|
63
|
+
><Icon
|
|
64
|
+
name="check"
|
|
65
|
+
color={theme.primitives.color.neutral[100]}
|
|
66
|
+
size={18}
|
|
67
|
+
/></View>}</Pressable>;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
Checkbox
|
|
72
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/components/radio/Radio.styles.ts
|
|
2
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
3
|
+
import { StyleSheet } from "react-native";
|
|
4
|
+
var radioTheme = theme.collection["toggle item"]["toggle item"].radio;
|
|
5
|
+
var radioContainerStyles = StyleSheet.create({
|
|
6
|
+
default: {
|
|
7
|
+
width: 20,
|
|
8
|
+
height: 20,
|
|
9
|
+
borderWidth: 2,
|
|
10
|
+
borderRadius: 20,
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
borderColor: radioTheme.default
|
|
14
|
+
},
|
|
15
|
+
active: {
|
|
16
|
+
borderColor: radioTheme.active
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
borderColor: radioTheme.disabled
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var radioDotStyles = StyleSheet.create({
|
|
23
|
+
default: {
|
|
24
|
+
width: 10,
|
|
25
|
+
height: 10,
|
|
26
|
+
borderRadius: 20
|
|
27
|
+
},
|
|
28
|
+
disabled: {
|
|
29
|
+
backgroundColor: radioTheme.disabled
|
|
30
|
+
},
|
|
31
|
+
active: {
|
|
32
|
+
backgroundColor: radioTheme.active
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
radioContainerStyles,
|
|
38
|
+
radioDotStyles
|
|
39
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, PressableProps, View } from 'react-native';
|
|
3
|
+
import { Size, Variant } from './Button.styles';
|
|
4
|
+
type OmittedPressableProps = 'accessibilityLabel' | 'accessibilityRole' | 'accessibilityState' | 'accessible' | 'aria-disabled' | 'children' | 'disabled' | 'role' | 'style';
|
|
5
|
+
export type ButtonProps = {
|
|
6
|
+
/**
|
|
7
|
+
* Variant of button.
|
|
8
|
+
*/
|
|
9
|
+
variant?: Variant;
|
|
10
|
+
/**
|
|
11
|
+
* If `style` is defined, it will extend the container style.
|
|
12
|
+
*/
|
|
13
|
+
style?: StyleProp<ViewStyle>;
|
|
14
|
+
/**
|
|
15
|
+
* Text displayed in button.
|
|
16
|
+
*/
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Name of element placed before the title.
|
|
20
|
+
*/
|
|
21
|
+
startIcon?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Name of element placed after the title.
|
|
24
|
+
*/
|
|
25
|
+
endIcon?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The size of the component.
|
|
28
|
+
*/
|
|
29
|
+
size?: Size;
|
|
30
|
+
/**
|
|
31
|
+
* Disabled the button.
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
} & Omit<PressableProps, OmittedPressableProps>;
|
|
35
|
+
export declare const Button: React.ForwardRefExoticComponent<{
|
|
36
|
+
/**
|
|
37
|
+
* Variant of button.
|
|
38
|
+
*/
|
|
39
|
+
variant?: "link" | "primary" | "secondary" | "tertiary" | "destructive" | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* If `style` is defined, it will extend the container style.
|
|
42
|
+
*/
|
|
43
|
+
style?: StyleProp<ViewStyle>;
|
|
44
|
+
/**
|
|
45
|
+
* Text displayed in button.
|
|
46
|
+
*/
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Name of element placed before the title.
|
|
50
|
+
*/
|
|
51
|
+
startIcon?: string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Name of element placed after the title.
|
|
54
|
+
*/
|
|
55
|
+
endIcon?: string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* The size of the component.
|
|
58
|
+
*/
|
|
59
|
+
size?: Size | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Disabled the button.
|
|
62
|
+
*/
|
|
63
|
+
disabled?: boolean | undefined;
|
|
64
|
+
} & Omit<PressableProps, OmittedPressableProps> & React.RefAttributes<View>>;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import theme from '@ds-autonomie/assets/js/dsa-theme';
|
|
2
|
+
import { PressableStateCallbackType } from 'react-native';
|
|
3
|
+
import { ButtonProps } from './Button';
|
|
4
|
+
export type Variant = keyof typeof theme.collection.button;
|
|
5
|
+
export declare const variants: Variant[];
|
|
6
|
+
export type Size = 'small' | 'medium';
|
|
7
|
+
export declare const sizes: Size[];
|
|
8
|
+
type State = {
|
|
9
|
+
pressed: PressableStateCallbackType['pressed'];
|
|
10
|
+
disabled: ButtonProps['disabled'];
|
|
11
|
+
variant: Variant;
|
|
12
|
+
};
|
|
13
|
+
export declare function getIconColor({ pressed, disabled, variant }: State): "#540abdff" | "#ffffffff";
|
|
14
|
+
type GetStylesProps = {
|
|
15
|
+
hasOnlyOneIcon: boolean;
|
|
16
|
+
size: Size;
|
|
17
|
+
} & State;
|
|
18
|
+
export declare function getContainerStyle({ disabled, hasOnlyOneIcon, pressed, size, variant, }: GetStylesProps): {
|
|
19
|
+
position: "relative";
|
|
20
|
+
flexDirection: "row";
|
|
21
|
+
alignItems: "center";
|
|
22
|
+
borderRadius: 8;
|
|
23
|
+
paddingLeft: number;
|
|
24
|
+
paddingRight: number;
|
|
25
|
+
paddingTop: number;
|
|
26
|
+
paddingBottom: number;
|
|
27
|
+
gap: 4 | 8;
|
|
28
|
+
backgroundColor: "#ede4faff" | "#cbb0ecff" | "#540abdff" | "#451292ff" | "#ffffffff" | "#dd1708ff" | "#530000ff" | undefined;
|
|
29
|
+
opacity: number | undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare function getTextStyle({ disabled, pressed, size, variant, }: GetStylesProps): {
|
|
32
|
+
fontFamily: string;
|
|
33
|
+
fontWeight: "700";
|
|
34
|
+
fontSize: number;
|
|
35
|
+
letterSpacing: number;
|
|
36
|
+
color: "#540abdff" | "#ffffffff";
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { PressableProps, StyleProp, ViewStyle } from 'react-native/types';
|
|
4
|
+
type OmittedPressableProps = 'accessibilityLabel' | 'accessibilityRole' | 'accessibilityState' | 'accessible' | 'aria-checked' | 'aria-invalid' | 'aria-disabled' | 'aria-pressed' | 'style' | 'onPress' | 'children' | 'role';
|
|
5
|
+
export type CheckboxProps = {
|
|
6
|
+
/**
|
|
7
|
+
* When set to `true`, component is checked.
|
|
8
|
+
*/
|
|
9
|
+
value?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* When set to `true`, component is in error.
|
|
12
|
+
*/
|
|
13
|
+
error?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When set to `true`, component is disabled.
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Callback when component is checked.
|
|
20
|
+
*
|
|
21
|
+
* @param {boolean} value
|
|
22
|
+
*/
|
|
23
|
+
onValueChange?: (value: boolean) => void;
|
|
24
|
+
/**
|
|
25
|
+
* If `style` is defined, it will extend the container style.
|
|
26
|
+
* If a similar property is defined, the new property will be ignored.
|
|
27
|
+
* * */
|
|
28
|
+
style?: StyleProp<ViewStyle>;
|
|
29
|
+
} & Omit<PressableProps, OmittedPressableProps>;
|
|
30
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<{
|
|
31
|
+
/**
|
|
32
|
+
* When set to `true`, component is checked.
|
|
33
|
+
*/
|
|
34
|
+
value?: boolean | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* When set to `true`, component is in error.
|
|
37
|
+
*/
|
|
38
|
+
error?: boolean | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* When set to `true`, component is disabled.
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Callback when component is checked.
|
|
45
|
+
*
|
|
46
|
+
* @param {boolean} value
|
|
47
|
+
*/
|
|
48
|
+
onValueChange?: ((value: boolean) => void) | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* If `style` is defined, it will extend the container style.
|
|
51
|
+
* If a similar property is defined, the new property will be ignored.
|
|
52
|
+
* * */
|
|
53
|
+
style?: StyleProp<ViewStyle>;
|
|
54
|
+
} & Omit<PressableProps, OmittedPressableProps> & React.RefAttributes<View>>;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const checkboxContainerStyles: {
|
|
2
|
+
default: {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
borderWidth: number;
|
|
6
|
+
borderRadius: number;
|
|
7
|
+
alignItems: "center";
|
|
8
|
+
justifyContent: "center";
|
|
9
|
+
borderColor: "#666666ff";
|
|
10
|
+
};
|
|
11
|
+
error: {
|
|
12
|
+
borderColor: "#dd1708ff";
|
|
13
|
+
};
|
|
14
|
+
disabled: {
|
|
15
|
+
borderColor: "#d7d7d7ff";
|
|
16
|
+
};
|
|
17
|
+
active: {
|
|
18
|
+
borderColor: "#540abdff";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const checkboxCheckStyles: {
|
|
22
|
+
default: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
borderRadius: number;
|
|
26
|
+
alignItems: "center";
|
|
27
|
+
justifyContent: "center";
|
|
28
|
+
};
|
|
29
|
+
disabled: {
|
|
30
|
+
backgroundColor: "#d7d7d7ff";
|
|
31
|
+
};
|
|
32
|
+
error: {
|
|
33
|
+
backgroundColor: "#dd1708ff";
|
|
34
|
+
};
|
|
35
|
+
active: {
|
|
36
|
+
backgroundColor: "#540abdff";
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
type DividerProps = {
|
|
4
|
+
orientation?: 'horizontal' | 'vertical';
|
|
5
|
+
} & ViewProps;
|
|
6
|
+
export declare const Divider: ({ orientation, style, ...rest }: DividerProps) => React.JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dividerStyles
|
|
3
|
+
} from "../../chunks/chunk.SZJKAIPC.js";
|
|
4
|
+
|
|
5
|
+
// src/components/divider/Divider.tsx
|
|
6
|
+
import { View } from "react-native";
|
|
7
|
+
var Divider = ({
|
|
8
|
+
orientation = "horizontal",
|
|
9
|
+
style,
|
|
10
|
+
...rest
|
|
11
|
+
}) => {
|
|
12
|
+
return <View
|
|
13
|
+
{...rest}
|
|
14
|
+
style={[
|
|
15
|
+
style,
|
|
16
|
+
dividerStyles.container,
|
|
17
|
+
orientation === "vertical" && dividerStyles.vertical,
|
|
18
|
+
orientation === "horizontal" && dividerStyles.horizontal
|
|
19
|
+
]}
|
|
20
|
+
/>;
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
Divider
|
|
24
|
+
};
|