@ds-autonomie/react-native 0.2.0 → 0.4.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.2XHLIGU3.js +16 -0
- package/dist/chunks/chunk.4GJSNQET.js +48 -0
- package/dist/chunks/chunk.523CLSSB.js +22 -0
- package/dist/chunks/{chunk.QOZS5EA3.js → chunk.65RCE3RB.js} +7 -25
- package/dist/chunks/{chunk.MCKLJGG3.js → chunk.7H4YRP4X.js} +2 -2
- package/dist/chunks/chunk.DE3QWY2X.js +51 -0
- package/dist/chunks/chunk.DGZYY7CA.js +47 -0
- package/dist/chunks/chunk.DMHRBYRF.js +69 -0
- package/dist/chunks/{chunk.2HOUMFYI.js → chunk.DMWLLPBB.js} +2 -2
- package/dist/chunks/chunk.I5NPEO25.js +147 -0
- package/dist/chunks/chunk.JQRCUHR6.js +65 -0
- package/dist/{components/search/SearchField.js → chunks/chunk.KVGKM2JI.js} +3 -2
- package/dist/chunks/chunk.LN5IVTGU.js +60 -0
- package/dist/chunks/chunk.LR5V6SDZ.js +22 -0
- package/dist/chunks/chunk.SZJKAIPC.js +20 -0
- package/dist/chunks/chunk.TWXAL56H.js +21 -0
- package/dist/chunks/chunk.VPRSFOFO.js +40 -0
- package/dist/chunks/chunk.WVKTSG5X.js +22 -0
- package/dist/chunks/chunk.XCMNSIIN.js +72 -0
- package/dist/components/button/Button.js +4 -64
- package/dist/components/checkbox/Checkbox.js +4 -67
- 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/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.js +3 -55
- package/dist/components/searchField/SearchField.js +7 -0
- package/dist/components/{search → searchField}/SearchField.styles.js +1 -1
- package/dist/components/tabs/Tabs.d.ts +18 -0
- package/dist/components/tabs/Tabs.js +7 -0
- package/dist/components/tabs/Tabs.styles.d.ts +10 -0
- package/dist/components/tabs/Tabs.styles.js +6 -0
- package/dist/components/tabs/tabItem/TabItem.d.ts +40 -0
- package/dist/components/tabs/tabItem/TabItem.js +9 -0
- package/dist/components/tabs/tabItem/TabItem.styles.d.ts +33 -0
- package/dist/components/tabs/tabItem/TabItem.styles.js +7 -0
- package/dist/components/textInput/TextInput.js +9 -0
- package/dist/components/{text-input → textInput}/TextInput.styles.d.ts +8 -0
- package/dist/components/{text-input → textInput}/TextInput.styles.js +2 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +52 -3
- package/dist/styles/fonts.d.ts +25 -0
- package/package.json +2 -2
- package/dist/components/text-input/TextInput.js +0 -8
- /package/dist/components/{search → searchField}/SearchField.d.ts +0 -0
- /package/dist/components/{search → searchField}/SearchField.styles.d.ts +0 -0
- /package/dist/components/{text-input → textInput}/TextInput.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @ds-autonomie/react-native
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8987c49: `Tabs`,`TabItem`: Implémentation des composants Tabs et TabItem
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- @ds-autonomie/assets@1.1.1
|
|
12
|
+
|
|
13
|
+
## 0.3.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- 76ac0b5: `ListItem`: implémentation du composant ListItem
|
|
18
|
+
- 2e76d7e: `divider`: Implémentation du composant divider
|
|
19
|
+
- 8273161: `listTitle`: Implémentation du ListTitle
|
|
20
|
+
`listCaption`: Implémentation du ListCaption
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- f98a445: docs: repasse documentaire
|
|
25
|
+
|
|
3
26
|
## 0.2.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/components/tabs/Tabs.styles.ts
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
var tabsStyles = StyleSheet.create({
|
|
4
|
+
container: {
|
|
5
|
+
flexDirection: "row"
|
|
6
|
+
},
|
|
7
|
+
indicator: {
|
|
8
|
+
position: "absolute",
|
|
9
|
+
height: 2,
|
|
10
|
+
bottom: 0
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
tabsStyles
|
|
16
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/styles/fonts.ts
|
|
2
|
+
import { StyleSheet } from "react-native";
|
|
3
|
+
var fonts = StyleSheet.create({
|
|
4
|
+
bodyLarge: {
|
|
5
|
+
fontSize: 16,
|
|
6
|
+
fontFamily: "Cabin-Regular",
|
|
7
|
+
fontWeight: "400",
|
|
8
|
+
lineHeight: 24,
|
|
9
|
+
letterSpacing: 0.5
|
|
10
|
+
},
|
|
11
|
+
bodyMedium: {
|
|
12
|
+
fontSize: 14,
|
|
13
|
+
fontWeight: "400",
|
|
14
|
+
lineHeight: 20,
|
|
15
|
+
fontFamily: "Cabin-Regular",
|
|
16
|
+
letterSpacing: 0.25
|
|
17
|
+
},
|
|
18
|
+
bodySmall: {
|
|
19
|
+
fontSize: 12,
|
|
20
|
+
fontFamily: "Cabin-Regular",
|
|
21
|
+
letterSpacing: 0.36
|
|
22
|
+
},
|
|
23
|
+
titleSmall: {
|
|
24
|
+
fontSize: 14,
|
|
25
|
+
fontWeight: "500",
|
|
26
|
+
lineHeight: 20,
|
|
27
|
+
fontFamily: "Cabin-Regular",
|
|
28
|
+
letterSpacing: 0.5
|
|
29
|
+
},
|
|
30
|
+
labelMedium: {
|
|
31
|
+
fontSize: 12,
|
|
32
|
+
fontWeight: "500",
|
|
33
|
+
lineHeight: 16,
|
|
34
|
+
fontFamily: "Cabin-Regular",
|
|
35
|
+
letterSpacing: 0.5
|
|
36
|
+
},
|
|
37
|
+
labelLarge: {
|
|
38
|
+
fontFamily: "Cabin-Regular",
|
|
39
|
+
fontWeight: "500",
|
|
40
|
+
fontSize: 14,
|
|
41
|
+
lineHeight: 20,
|
|
42
|
+
letterSpacing: 0.1
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
fonts
|
|
48
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fonts
|
|
3
|
+
} from "./chunk.4GJSNQET.js";
|
|
4
|
+
|
|
5
|
+
// src/components/listTitle/ListTitle.styles.ts
|
|
6
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
7
|
+
import { StyleSheet } from "react-native";
|
|
8
|
+
var listTitleStyles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
paddingHorizontal: theme.primitives.spacing[16],
|
|
11
|
+
paddingTop: theme.primitives.spacing[8],
|
|
12
|
+
paddingBottom: theme.primitives.spacing[12]
|
|
13
|
+
},
|
|
14
|
+
text: {
|
|
15
|
+
...fonts.titleSmall,
|
|
16
|
+
paddingHorizontal: theme.primitives.spacing[16]
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
listTitleStyles
|
|
22
|
+
};
|
|
@@ -1,29 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
fonts
|
|
3
|
+
} from "./chunk.4GJSNQET.js";
|
|
4
4
|
|
|
5
|
-
// src/
|
|
5
|
+
// src/components/textInput/TextInput.styles.ts
|
|
6
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
6
7
|
import { StyleSheet } from "react-native";
|
|
7
|
-
var
|
|
8
|
-
bodyLarge: {
|
|
9
|
-
fontSize: 16,
|
|
10
|
-
fontFamily: "Cabin-Regular",
|
|
11
|
-
letterSpacing: 0.5
|
|
12
|
-
},
|
|
13
|
-
bodyMedium: {
|
|
14
|
-
fontSize: 14,
|
|
15
|
-
fontFamily: "Cabin-Regular",
|
|
16
|
-
letterSpacing: 0.25
|
|
17
|
-
},
|
|
18
|
-
bodySmall: {
|
|
19
|
-
fontSize: 12,
|
|
20
|
-
fontFamily: "Cabin-Regular",
|
|
21
|
-
letterSpacing: 0.36
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// src/components/text-input/TextInput.styles.ts
|
|
26
|
-
var styles = StyleSheet2.create({
|
|
8
|
+
var styles = StyleSheet.create({
|
|
27
9
|
container: {
|
|
28
10
|
display: "flex",
|
|
29
11
|
flex: 1
|
|
@@ -71,7 +53,7 @@ var styles = StyleSheet2.create({
|
|
|
71
53
|
color: theme.collection.input.hint
|
|
72
54
|
}
|
|
73
55
|
});
|
|
74
|
-
var inputWrapperStyles =
|
|
56
|
+
var inputWrapperStyles = StyleSheet.create({
|
|
75
57
|
default: {
|
|
76
58
|
backgroundColor: theme.collection.input.background.default,
|
|
77
59
|
borderColor: theme.collection.input.border.default,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// src/components/
|
|
1
|
+
// src/components/searchField/SearchField.styles.tsx
|
|
2
2
|
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
3
3
|
import { StyleSheet } from "react-native";
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ import { Platform } from "react-native";
|
|
|
7
7
|
var isIOS = Platform.OS === "ios";
|
|
8
8
|
var isAndroid = Platform.OS === "android";
|
|
9
9
|
|
|
10
|
-
// src/components/
|
|
10
|
+
// src/components/searchField/SearchField.styles.tsx
|
|
11
11
|
var placeholderTextColor = "#3C3C4399";
|
|
12
12
|
var styles = StyleSheet.create({
|
|
13
13
|
container: {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fonts
|
|
3
|
+
} from "./chunk.4GJSNQET.js";
|
|
4
|
+
|
|
5
|
+
// src/components/listItem/ListItem.styles.ts
|
|
6
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
7
|
+
import { StyleSheet } from "react-native";
|
|
8
|
+
var styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
borderBottomWidth: 1,
|
|
11
|
+
borderBottomColor: theme.collection.background.divider,
|
|
12
|
+
backgroundColor: theme.collection["list item"].background,
|
|
13
|
+
paddingHorizontal: theme.primitives.spacing[16],
|
|
14
|
+
paddingVertical: theme.primitives.spacing[8],
|
|
15
|
+
display: "flex",
|
|
16
|
+
height: "auto",
|
|
17
|
+
flexDirection: "row",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
gap: theme.primitives.spacing[16]
|
|
20
|
+
},
|
|
21
|
+
large: {
|
|
22
|
+
minHeight: 60
|
|
23
|
+
},
|
|
24
|
+
lastItem: {
|
|
25
|
+
borderBottomWidth: 0,
|
|
26
|
+
paddingBottom: theme.primitives.spacing[8] + 1
|
|
27
|
+
},
|
|
28
|
+
title: {
|
|
29
|
+
...fonts.bodyLarge,
|
|
30
|
+
color: theme.collection["list item"].label
|
|
31
|
+
},
|
|
32
|
+
subtitle: {
|
|
33
|
+
...fonts.bodyMedium,
|
|
34
|
+
color: theme.collection["list item"].subtitle
|
|
35
|
+
},
|
|
36
|
+
inset: {
|
|
37
|
+
marginHorizontal: theme.primitives.spacing[16]
|
|
38
|
+
},
|
|
39
|
+
insetFirst: {
|
|
40
|
+
borderTopRightRadius: theme.primitives.radius[8],
|
|
41
|
+
borderTopLeftRadius: theme.primitives.radius[8]
|
|
42
|
+
},
|
|
43
|
+
insetLast: {
|
|
44
|
+
borderBottomRightRadius: theme.primitives.radius[8],
|
|
45
|
+
borderBottomLeftRadius: theme.primitives.radius[8]
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
styles
|
|
51
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
tabItemStyles
|
|
3
|
+
} from "./chunk.VPRSFOFO.js";
|
|
4
|
+
import {
|
|
5
|
+
Icon
|
|
6
|
+
} from "./chunk.OQSCGAEY.js";
|
|
7
|
+
|
|
8
|
+
// src/components/tabs/tabItem/TabItem.tsx
|
|
9
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
10
|
+
import React, { useState } from "react";
|
|
11
|
+
import {
|
|
12
|
+
Text,
|
|
13
|
+
Pressable
|
|
14
|
+
} from "react-native";
|
|
15
|
+
var TabItem = React.forwardRef(function TabItem2({ icon, title, active = false, style, ...restProps }, ref) {
|
|
16
|
+
const [isFocus, setIsFocus] = useState(false);
|
|
17
|
+
return <Pressable
|
|
18
|
+
ref={ref}
|
|
19
|
+
{...restProps}
|
|
20
|
+
accessibilityLabel="tab"
|
|
21
|
+
accessibilityRole="tab"
|
|
22
|
+
accessible
|
|
23
|
+
accessibilityState={{
|
|
24
|
+
selected: active
|
|
25
|
+
}}
|
|
26
|
+
role="tab"
|
|
27
|
+
onFocus={() => setIsFocus(true)}
|
|
28
|
+
style={[
|
|
29
|
+
style,
|
|
30
|
+
tabItemStyles.container,
|
|
31
|
+
active && tabItemStyles.selected,
|
|
32
|
+
isFocus && tabItemStyles.focus,
|
|
33
|
+
active && isFocus && tabItemStyles.focusSelected
|
|
34
|
+
]}
|
|
35
|
+
>
|
|
36
|
+
{icon && <Icon
|
|
37
|
+
name={icon}
|
|
38
|
+
size={18}
|
|
39
|
+
color={active ? theme.collection.tab.selected["on-enabled"] : theme.collection.tab.unselected["on-enabled"]}
|
|
40
|
+
/>}
|
|
41
|
+
<Text style={[tabItemStyles.text, active && tabItemStyles.selected]}>{title}</Text>
|
|
42
|
+
</Pressable>;
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
TabItem
|
|
47
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getContainerStyle,
|
|
3
|
+
getIconColor,
|
|
4
|
+
getTextStyle
|
|
5
|
+
} from "./chunk.RNOZ5AW4.js";
|
|
6
|
+
import {
|
|
7
|
+
Icon
|
|
8
|
+
} from "./chunk.OQSCGAEY.js";
|
|
9
|
+
|
|
10
|
+
// src/components/button/Button.tsx
|
|
11
|
+
import React from "react";
|
|
12
|
+
import {
|
|
13
|
+
Pressable,
|
|
14
|
+
Text
|
|
15
|
+
} from "react-native";
|
|
16
|
+
var Button = React.forwardRef(function Toggle({
|
|
17
|
+
variant = "primary",
|
|
18
|
+
style,
|
|
19
|
+
disabled = false,
|
|
20
|
+
endIcon,
|
|
21
|
+
size = "medium",
|
|
22
|
+
startIcon,
|
|
23
|
+
children,
|
|
24
|
+
...props
|
|
25
|
+
}, ref) {
|
|
26
|
+
const hasOnlyOneIcon = [!!startIcon, !!endIcon].filter(Boolean).length === 1 && !children;
|
|
27
|
+
return <Pressable
|
|
28
|
+
ref={ref}
|
|
29
|
+
{...props}
|
|
30
|
+
accessibilityLabel="button"
|
|
31
|
+
accessibilityRole="button"
|
|
32
|
+
accessible
|
|
33
|
+
aria-disabled={disabled}
|
|
34
|
+
accessibilityState={{
|
|
35
|
+
disabled
|
|
36
|
+
}}
|
|
37
|
+
disabled={disabled}
|
|
38
|
+
role="button"
|
|
39
|
+
style={({ pressed }) => [
|
|
40
|
+
style,
|
|
41
|
+
getContainerStyle({ variant, size, hasOnlyOneIcon, disabled, pressed })
|
|
42
|
+
]}
|
|
43
|
+
>{({ pressed }) => {
|
|
44
|
+
const iconColor = getIconColor({
|
|
45
|
+
pressed,
|
|
46
|
+
disabled,
|
|
47
|
+
variant
|
|
48
|
+
});
|
|
49
|
+
return <>
|
|
50
|
+
{startIcon && <Icon name={startIcon} color={iconColor} size={24} />}
|
|
51
|
+
{children !== void 0 && <Text
|
|
52
|
+
style={[
|
|
53
|
+
getTextStyle({
|
|
54
|
+
variant,
|
|
55
|
+
size,
|
|
56
|
+
hasOnlyOneIcon,
|
|
57
|
+
disabled,
|
|
58
|
+
pressed
|
|
59
|
+
})
|
|
60
|
+
]}
|
|
61
|
+
>{children}</Text>}
|
|
62
|
+
{endIcon && <Icon name={endIcon} color={iconColor} size={24} />}
|
|
63
|
+
</>;
|
|
64
|
+
}}</Pressable>;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
Button
|
|
69
|
+
};
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
getCursorColors,
|
|
3
3
|
inputWrapperStyles,
|
|
4
4
|
styles
|
|
5
|
-
} from "./chunk.
|
|
5
|
+
} from "./chunk.65RCE3RB.js";
|
|
6
6
|
import {
|
|
7
7
|
Icon
|
|
8
8
|
} from "./chunk.OQSCGAEY.js";
|
|
9
9
|
|
|
10
|
-
// src/components/
|
|
10
|
+
// src/components/textInput/TextInput.tsx
|
|
11
11
|
import React, { useState } from "react";
|
|
12
12
|
import {
|
|
13
13
|
TextInput as NativeTextInput,
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import {
|
|
2
|
+
tabsStyles
|
|
3
|
+
} from "./chunk.2XHLIGU3.js";
|
|
4
|
+
|
|
5
|
+
// src/components/tabs/Tabs.tsx
|
|
6
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import {
|
|
9
|
+
View,
|
|
10
|
+
Animated,
|
|
11
|
+
ScrollView,
|
|
12
|
+
Platform
|
|
13
|
+
} from "react-native";
|
|
14
|
+
var sumTabItemWidthToIndex = (tabItemPositions, index) => {
|
|
15
|
+
let total = 0;
|
|
16
|
+
for (let i = 0; i <= index; i++) {
|
|
17
|
+
total += tabItemPositions[i]?.width || 0;
|
|
18
|
+
}
|
|
19
|
+
return total;
|
|
20
|
+
};
|
|
21
|
+
var SCROLL_ANIMATED_DURATION = 170;
|
|
22
|
+
var Tabs = ({
|
|
23
|
+
children,
|
|
24
|
+
value = 0,
|
|
25
|
+
onChange,
|
|
26
|
+
scrollable = false,
|
|
27
|
+
style,
|
|
28
|
+
...rest
|
|
29
|
+
}) => {
|
|
30
|
+
const animationRef = React.useRef(new Animated.Value(0));
|
|
31
|
+
const scrollViewRef = React.useRef(null);
|
|
32
|
+
const scrollViewPosition = React.useRef(0);
|
|
33
|
+
const tabItemPositions = React.useRef([]);
|
|
34
|
+
const [tabContainerWidth, setTabContainerWidth] = React.useState(0);
|
|
35
|
+
const tabs = React.Children.toArray(children);
|
|
36
|
+
const scrollHandler = React.useCallback(
|
|
37
|
+
(currentTabIndex) => {
|
|
38
|
+
const isScrollableTabs = tabItemPositions.current.length > currentTabIndex;
|
|
39
|
+
if (isScrollableTabs) {
|
|
40
|
+
const tabPositions = tabItemPositions.current.map(
|
|
41
|
+
({ position }, index) => {
|
|
42
|
+
return Platform.OS === "ios" ? sumTabItemWidthToIndex(tabItemPositions.current, index) : position;
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
const previousTabItemXPosition = currentTabIndex === 0 ? 0 : tabPositions[currentTabIndex - 1];
|
|
46
|
+
const currentTabItemXPosition = tabPositions[currentTabIndex];
|
|
47
|
+
const scrollCurrentPosition = scrollViewPosition.current;
|
|
48
|
+
let scrollX = scrollCurrentPosition;
|
|
49
|
+
if (previousTabItemXPosition < scrollCurrentPosition) {
|
|
50
|
+
scrollX += previousTabItemXPosition - scrollCurrentPosition;
|
|
51
|
+
} else if (scrollCurrentPosition + tabContainerWidth < currentTabItemXPosition) {
|
|
52
|
+
scrollX += currentTabItemXPosition - (scrollCurrentPosition + tabContainerWidth);
|
|
53
|
+
}
|
|
54
|
+
scrollViewRef.current && scrollViewRef.current.scrollTo({
|
|
55
|
+
x: scrollX,
|
|
56
|
+
y: 0,
|
|
57
|
+
animated: true
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
[tabContainerWidth]
|
|
62
|
+
);
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
Animated.timing(animationRef.current, {
|
|
65
|
+
toValue: value,
|
|
66
|
+
useNativeDriver: true,
|
|
67
|
+
duration: SCROLL_ANIMATED_DURATION
|
|
68
|
+
}).start();
|
|
69
|
+
scrollable && requestAnimationFrame(() => scrollHandler(value));
|
|
70
|
+
}, [animationRef, value, scrollable, scrollHandler]);
|
|
71
|
+
const onScrollHandler = (event) => {
|
|
72
|
+
scrollViewPosition.current = event.nativeEvent.contentOffset.x;
|
|
73
|
+
};
|
|
74
|
+
const indicatorTransitionInterpolate = React.useMemo(() => {
|
|
75
|
+
const countItems = tabs.length;
|
|
76
|
+
if (countItems < 2 || tabItemPositions.current.length === 0) {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
const inputRange = Array.from(Array(countItems + 1).keys());
|
|
80
|
+
const outputRange = tabItemPositions.current.map(
|
|
81
|
+
({ position }, index) => {
|
|
82
|
+
return Platform.OS === "ios" ? sumTabItemWidthToIndex(tabItemPositions.current, index) : position;
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
if (inputRange.length - 1 !== outputRange.length || outputRange.includes(void 0)) {
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
return animationRef.current.interpolate({
|
|
89
|
+
inputRange,
|
|
90
|
+
outputRange: [0, ...outputRange]
|
|
91
|
+
});
|
|
92
|
+
}, [animationRef, tabs, tabItemPositions.current.length]);
|
|
93
|
+
const tabIndicatorWidth = tabItemPositions.current[value]?.width;
|
|
94
|
+
return <View
|
|
95
|
+
{...rest}
|
|
96
|
+
accessibilityRole="tablist"
|
|
97
|
+
style={[tabsStyles.container, style]}
|
|
98
|
+
onLayout={({ nativeEvent: { layout } }) => {
|
|
99
|
+
setTabContainerWidth(layout.width);
|
|
100
|
+
}}
|
|
101
|
+
>{React.createElement(
|
|
102
|
+
scrollable ? ScrollView : React.Fragment,
|
|
103
|
+
{
|
|
104
|
+
...scrollable && {
|
|
105
|
+
horizontal: true,
|
|
106
|
+
ref: scrollViewRef,
|
|
107
|
+
onScroll: onScrollHandler,
|
|
108
|
+
scrollEventThrottle: 1,
|
|
109
|
+
showsHorizontalScrollIndicator: false
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
<>
|
|
113
|
+
{tabs.map(
|
|
114
|
+
(tab, index) => React.cloneElement(tab, {
|
|
115
|
+
onPress: () => onChange(index),
|
|
116
|
+
onLayout: (event) => {
|
|
117
|
+
const { width } = event.nativeEvent.layout;
|
|
118
|
+
const previousItemPosition = tabItemPositions.current[index - 1]?.position || 0;
|
|
119
|
+
tabItemPositions.current[index] = {
|
|
120
|
+
position: previousItemPosition + width,
|
|
121
|
+
width
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
active: index === value
|
|
125
|
+
})
|
|
126
|
+
)}
|
|
127
|
+
<Animated.View
|
|
128
|
+
style={[
|
|
129
|
+
tabsStyles.indicator,
|
|
130
|
+
{
|
|
131
|
+
backgroundColor: theme.collection.tab.selected["on-enabled"],
|
|
132
|
+
transform: [
|
|
133
|
+
{
|
|
134
|
+
translateX: indicatorTransitionInterpolate ?? 0
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
width: tabIndicatorWidth
|
|
138
|
+
}
|
|
139
|
+
]}
|
|
140
|
+
/>
|
|
141
|
+
</>
|
|
142
|
+
)}</View>;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export {
|
|
146
|
+
Tabs
|
|
147
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
styles
|
|
3
|
+
} from "./chunk.DE3QWY2X.js";
|
|
4
|
+
import {
|
|
5
|
+
Icon
|
|
6
|
+
} from "./chunk.OQSCGAEY.js";
|
|
7
|
+
|
|
8
|
+
// src/components/listItem/ListItem.tsx
|
|
9
|
+
import theme from "@ds-autonomie/assets/js/dsa-theme";
|
|
10
|
+
import React from "react";
|
|
11
|
+
import {
|
|
12
|
+
View,
|
|
13
|
+
Text,
|
|
14
|
+
Pressable
|
|
15
|
+
} from "react-native";
|
|
16
|
+
var ListItem = React.forwardRef(
|
|
17
|
+
function ListItem2({
|
|
18
|
+
label,
|
|
19
|
+
subtitle,
|
|
20
|
+
prefix,
|
|
21
|
+
isLast = false,
|
|
22
|
+
isFirst = false,
|
|
23
|
+
suffix,
|
|
24
|
+
style,
|
|
25
|
+
inset = false,
|
|
26
|
+
...restProps
|
|
27
|
+
}, ref) {
|
|
28
|
+
const isLarge = subtitle !== void 0 && subtitle !== "" || suffix !== void 0 || prefix !== void 0 || inset;
|
|
29
|
+
return <Pressable
|
|
30
|
+
ref={ref}
|
|
31
|
+
{...restProps}
|
|
32
|
+
accessibilityLabel={label}
|
|
33
|
+
accessible
|
|
34
|
+
style={[
|
|
35
|
+
style,
|
|
36
|
+
styles.container,
|
|
37
|
+
isLarge && styles.large,
|
|
38
|
+
isLast && styles.lastItem,
|
|
39
|
+
inset && styles.inset,
|
|
40
|
+
inset && isLast && styles.insetLast,
|
|
41
|
+
inset && isFirst && styles.insetFirst
|
|
42
|
+
]}
|
|
43
|
+
>
|
|
44
|
+
{prefix}
|
|
45
|
+
<View style={{ flex: 1 }}>
|
|
46
|
+
<Text numberOfLines={1} style={styles.title}>{label}</Text>
|
|
47
|
+
{subtitle && <Text style={styles.subtitle}>{subtitle}</Text>}
|
|
48
|
+
</View>
|
|
49
|
+
{suffix}
|
|
50
|
+
</Pressable>;
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
var ChevronSuffix = ({ title }) => <View style={{ flexDirection: "row", alignItems: "center" }}>
|
|
54
|
+
<Text style={{ color: theme.collection["list item"]["end slot"].detail }}>{title}</Text>
|
|
55
|
+
<Icon
|
|
56
|
+
color={theme.collection["list item"]["end slot"].chevron}
|
|
57
|
+
name="chevron-right"
|
|
58
|
+
size={20}
|
|
59
|
+
/>
|
|
60
|
+
</View>;
|
|
61
|
+
ListItem.ChevronSuffix = ChevronSuffix;
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
ListItem
|
|
65
|
+
};
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
placeholderTextColor,
|
|
4
4
|
plateformStyles,
|
|
5
5
|
styles
|
|
6
|
-
} from "
|
|
6
|
+
} from "./chunk.7H4YRP4X.js";
|
|
7
7
|
|
|
8
|
-
// src/components/
|
|
8
|
+
// src/components/searchField/SearchField.tsx
|
|
9
9
|
import React, { useEffect, useState } from "react";
|
|
10
10
|
import {
|
|
11
11
|
View,
|
|
@@ -67,6 +67,7 @@ var SearchField = React.forwardRef(
|
|
|
67
67
|
</View>;
|
|
68
68
|
}
|
|
69
69
|
);
|
|
70
|
+
|
|
70
71
|
export {
|
|
71
72
|
SearchField
|
|
72
73
|
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listCaptionStyles
|
|
3
|
+
} from "./chunk.TWXAL56H.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
|
+
};
|