vpt-sebraeds 0.0.42 → 0.0.43
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/assets/fonts/Campuni-Bold.ttf +0 -0
- package/assets/fonts/Campuni-Regular.ttf +0 -0
- package/assets/fonts/Campuni.ttf +0 -0
- package/assets/fonts/Mulish-Bold.ttf +0 -0
- package/assets/fonts/Mulish-Light.ttf +0 -0
- package/assets/fonts/Mulish-Regular.ttf +0 -0
- package/assets/fonts/Mulish-SemiBold.ttf +0 -0
- package/assets/fonts/Mulish.ttf +0 -0
- package/assets/fonts/NunitoSans_10pt-Black.ttf +0 -0
- package/assets/fonts/NunitoSans_10pt-Bold.ttf +0 -0
- package/assets/fonts/NunitoSans_10pt-Light.ttf +0 -0
- package/assets/fonts/NunitoSans_10pt-Medium.ttf +0 -0
- package/assets/fonts/NunitoSans_10pt-Regular.ttf +0 -0
- package/components/Accordion/Accordion.stories.jsx +41 -4
- package/components/Accordion/index.jsx +50 -9
- package/components/Avatar/index.jsx +8 -7
- package/components/BottomSheet/BottomSheet.jsx +235 -0
- package/components/BottomSheet/BottomSheet.stories.jsx +164 -1
- package/components/BottomSheet/BottomSheetNomeEmpresa.jsx +1 -1
- package/components/BottomSheet/index.jsx +2 -298
- package/components/ButtomGroup/ButtomGroup.stories.jsx +155 -0
- package/components/ButtomGroup/index.tsx +220 -0
- package/components/Button/ButtonPrimary.stories.jsx +63 -2
- package/components/Button/index.jsx +182 -31
- package/components/ExpandableNumberDisplay/ExpandableNumberDisplay.stories.jsx +92 -0
- package/components/ExpandableNumberDisplay/index.tsx +126 -0
- package/components/FilterableMultiSelect/index.jsx +112 -71
- package/components/FilterableUniSelect/FilterableUniSelect.stories.jsx +68 -0
- package/components/FilterableUniSelect/index.jsx +251 -0
- package/components/GeneralInformationCard/GeneralInformationCard.stories.jsx +62 -0
- package/components/GeneralInformationCard/index.tsx +123 -0
- package/components/Header/Header.stories.jsx +224 -1
- package/components/Header/components/Context.jsx +2 -13
- package/components/Header/components/Information.jsx +41 -15
- package/components/Header/components/Shortcut.jsx +5 -3
- package/components/Header/components/SwitchAccount.jsx +145 -208
- package/components/Header/components/Variants.jsx +341 -47
- package/components/Header/index.jsx +25 -2
- package/components/Input/Input.stories.jsx +56 -0
- package/components/Input/InputUnderline.tsx +161 -0
- package/components/Input/index.jsx +17 -8
- package/components/RangeSlider/RangeSlider.stories.jsx +165 -0
- package/components/RangeSlider/index.tsx +249 -0
- package/components/SEText/styles.js +8 -0
- package/components/ScrollBar/index.tsx +15 -4
- package/components/Search/Search.stories.jsx +130 -62
- package/components/Search/index.jsx +267 -0
- package/components/Shortcut/index.jsx +27 -14
- package/components/TaggedInputText/TaggedInputText.stories.jsx +106 -0
- package/components/TaggedInputText/index.jsx +232 -0
- package/dist/assets/fonts/Campuni-Bold.ttf +0 -0
- package/dist/assets/fonts/Campuni-Regular.ttf +0 -0
- package/dist/assets/fonts/Campuni.ttf +0 -0
- package/dist/assets/fonts/Mulish-Bold.ttf +0 -0
- package/dist/assets/fonts/Mulish-Light.ttf +0 -0
- package/dist/assets/fonts/Mulish-Regular.ttf +0 -0
- package/dist/assets/fonts/Mulish-SemiBold.ttf +0 -0
- package/dist/assets/fonts/Mulish.ttf +0 -0
- package/dist/assets/fonts/NunitoSans_10pt-Black.ttf +0 -0
- package/dist/assets/fonts/NunitoSans_10pt-Bold.ttf +0 -0
- package/dist/assets/fonts/NunitoSans_10pt-Light.ttf +0 -0
- package/dist/assets/fonts/NunitoSans_10pt-Medium.ttf +0 -0
- package/dist/assets/fonts/NunitoSans_10pt-Regular.ttf +0 -0
- package/dist/components/Accordion/index.d.ts +4 -1
- package/dist/components/Accordion/index.d.ts.map +1 -1
- package/dist/components/Accordion/index.js +34 -9
- package/dist/components/Avatar/index.d.ts.map +1 -1
- package/dist/components/Avatar/index.js +8 -7
- package/dist/components/BottomSheet/BottomSheet.d.ts +15 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheet.js +178 -0
- package/dist/components/BottomSheet/BottomSheetNomeEmpresa.js +1 -1
- package/dist/components/BottomSheet/index.d.ts +2 -13
- package/dist/components/BottomSheet/index.d.ts.map +1 -1
- package/dist/components/BottomSheet/index.js +2 -246
- package/dist/components/ButtomGroup/index.d.ts +26 -0
- package/dist/components/ButtomGroup/index.d.ts.map +1 -0
- package/dist/components/ButtomGroup/index.js +129 -0
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +172 -32
- package/dist/components/ExpandableNumberDisplay/index.d.ts +26 -0
- package/dist/components/ExpandableNumberDisplay/index.d.ts.map +1 -0
- package/dist/components/ExpandableNumberDisplay/index.js +71 -0
- package/dist/components/FilterableMultiSelect/index.d.ts.map +1 -1
- package/dist/components/FilterableMultiSelect/index.js +62 -36
- package/dist/components/FilterableUniSelect/index.d.ts +11 -0
- package/dist/components/FilterableUniSelect/index.d.ts.map +1 -0
- package/dist/components/FilterableUniSelect/index.js +171 -0
- package/dist/components/GeneralInformationCard/index.d.ts +26 -0
- package/dist/components/GeneralInformationCard/index.d.ts.map +1 -0
- package/dist/components/GeneralInformationCard/index.js +66 -0
- package/dist/components/Header/components/Context.d.ts.map +1 -1
- package/dist/components/Header/components/Context.js +2 -11
- package/dist/components/Header/components/Information.d.ts.map +1 -1
- package/dist/components/Header/components/Information.js +27 -9
- package/dist/components/Header/components/Shortcut.d.ts.map +1 -1
- package/dist/components/Header/components/Shortcut.js +4 -3
- package/dist/components/Header/components/SwitchAccount.d.ts +4 -3
- package/dist/components/Header/components/SwitchAccount.d.ts.map +1 -1
- package/dist/components/Header/components/SwitchAccount.js +127 -160
- package/dist/components/Header/components/Variants.d.ts +13 -0
- package/dist/components/Header/components/Variants.d.ts.map +1 -1
- package/dist/components/Header/components/Variants.js +281 -39
- package/dist/components/Header/components/index.d.ts +13 -0
- package/dist/components/Header/components/index.d.ts.map +1 -1
- package/dist/components/Header/index.d.ts.map +1 -1
- package/dist/components/Header/index.js +16 -2
- package/dist/components/Input/InputUnderline.d.ts +19 -0
- package/dist/components/Input/InputUnderline.d.ts.map +1 -0
- package/dist/components/Input/InputUnderline.js +112 -0
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +11 -4
- package/dist/components/RangeSlider/index.d.ts +42 -0
- package/dist/components/RangeSlider/index.d.ts.map +1 -0
- package/dist/components/RangeSlider/index.js +166 -0
- package/dist/components/SEText/styles.d.ts +14 -0
- package/dist/components/SEText/styles.js +8 -0
- package/dist/components/ScrollBar/index.d.ts +2 -2
- package/dist/components/ScrollBar/index.d.ts.map +1 -1
- package/dist/components/ScrollBar/index.js +3 -3
- package/dist/components/Search/index.d.ts +10 -0
- package/dist/components/Search/index.d.ts.map +1 -0
- package/dist/components/Search/index.js +229 -0
- package/dist/components/Shortcut/index.d.ts.map +1 -1
- package/dist/components/Shortcut/index.js +21 -14
- package/dist/components/TaggedInputText/index.d.ts +22 -0
- package/dist/components/TaggedInputText/index.d.ts.map +1 -0
- package/dist/components/TaggedInputText/index.js +179 -0
- package/dist/src/index.d.ts +3 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/package.json +1 -1
- package/src/index.ts +3 -1
- package/components/Search/Search.jsx +0 -329
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { View } from "react-native";
|
|
2
2
|
import Accordion from ".";
|
|
3
|
+
import SEText from "../SEText";
|
|
3
4
|
|
|
4
5
|
const meta = {
|
|
5
6
|
title: "Atom/Accordion",
|
|
@@ -9,14 +10,16 @@ const meta = {
|
|
|
9
10
|
{...props}
|
|
10
11
|
content={
|
|
11
12
|
<View style={{ flexDirection: 'column' }}>
|
|
12
|
-
<
|
|
13
|
+
<SEText type="ns-sm-body" style={{ marginBottom: 16 }}>
|
|
14
|
+
{props.content}
|
|
15
|
+
</SEText>
|
|
13
16
|
<Accordion
|
|
14
17
|
nested
|
|
15
18
|
title="Item 01"
|
|
16
19
|
content={
|
|
17
|
-
<
|
|
20
|
+
<SEText type="ns-sm-body">
|
|
18
21
|
Sed nulla quam, fermentum tincidunt lacus at, viverra vehicula eros. Etiam neque libero, vulputate sed consectetur nec, imperdiet sed turpis.
|
|
19
|
-
</
|
|
22
|
+
</SEText>
|
|
20
23
|
}
|
|
21
24
|
/>
|
|
22
25
|
</View>
|
|
@@ -41,6 +44,14 @@ const meta = {
|
|
|
41
44
|
description: "Título do acordeon",
|
|
42
45
|
control: "text",
|
|
43
46
|
},
|
|
47
|
+
avatarUrl: {
|
|
48
|
+
description: "URL da foto/avatar ao lado do título",
|
|
49
|
+
control: "text",
|
|
50
|
+
},
|
|
51
|
+
avatarName: {
|
|
52
|
+
description: "Nome para fallback de iniciais no avatar",
|
|
53
|
+
control: "text",
|
|
54
|
+
},
|
|
44
55
|
content: {
|
|
45
56
|
description: "Conteúdo que será exibido quando o acordeon estiver aberto",
|
|
46
57
|
control: "text",
|
|
@@ -89,4 +100,30 @@ export const Open = {
|
|
|
89
100
|
...Default.args,
|
|
90
101
|
initiallyOpen: true,
|
|
91
102
|
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const WithAvatar = {
|
|
106
|
+
args: {
|
|
107
|
+
...Default.args,
|
|
108
|
+
title: "Label",
|
|
109
|
+
avatarUrl: "https://i.pravatar.cc/100?img=12",
|
|
110
|
+
avatarName: "Label",
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const WithAvatarAndFooterButton = {
|
|
115
|
+
args: {
|
|
116
|
+
...Open.args,
|
|
117
|
+
title: "Label",
|
|
118
|
+
avatarUrl: "https://i.pravatar.cc/100?img=12",
|
|
119
|
+
avatarName: "Label",
|
|
120
|
+
footerButtonProps: {
|
|
121
|
+
label: "Label",
|
|
122
|
+
size: "medium",
|
|
123
|
+
variant: "filled",
|
|
124
|
+
iconName: "home-line",
|
|
125
|
+
iconPosition: "both",
|
|
126
|
+
disabled: false,
|
|
127
|
+
},
|
|
128
|
+
},
|
|
92
129
|
};
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { View,
|
|
2
|
+
import { View, TouchableOpacity, StyleSheet, Animated, LayoutAnimation, Platform, UIManager } from 'react-native';
|
|
3
|
+
import Avatar from '../Avatar';
|
|
4
|
+
import Button from '../Button';
|
|
3
5
|
import Icon from '../Icon';
|
|
6
|
+
import SEText from '../SEText';
|
|
4
7
|
|
|
5
8
|
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
6
9
|
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
7
10
|
}
|
|
8
11
|
|
|
9
|
-
const Accordion = ({
|
|
12
|
+
const Accordion = ({
|
|
13
|
+
title,
|
|
14
|
+
content,
|
|
15
|
+
nested = false,
|
|
16
|
+
initiallyOpen = false,
|
|
17
|
+
avatarUrl,
|
|
18
|
+
avatarName,
|
|
19
|
+
footerButtonProps,
|
|
20
|
+
}) => {
|
|
10
21
|
const [isOpen, setIsOpen] = useState(initiallyOpen);
|
|
11
22
|
const [isFocused, setIsFocused] = useState(false);
|
|
12
23
|
const animation = useRef(new Animated.Value(initiallyOpen ? 1 : 0)).current;
|
|
@@ -36,7 +47,7 @@ const Accordion = ({ title, content, nested = false, initiallyOpen = false }) =>
|
|
|
36
47
|
|
|
37
48
|
const iconRotation = animation.interpolate({
|
|
38
49
|
inputRange: [0, 1],
|
|
39
|
-
outputRange: ['
|
|
50
|
+
outputRange: ['180deg', '0deg'],
|
|
40
51
|
});
|
|
41
52
|
|
|
42
53
|
return (
|
|
@@ -55,9 +66,22 @@ const Accordion = ({ title, content, nested = false, initiallyOpen = false }) =>
|
|
|
55
66
|
onPressIn={() => setIsFocused(true)}
|
|
56
67
|
onPressOut={() => setIsFocused(false)}
|
|
57
68
|
>
|
|
58
|
-
<
|
|
59
|
-
{
|
|
60
|
-
|
|
69
|
+
<View style={styles.headerLeft}>
|
|
70
|
+
{(!!avatarUrl || !!avatarName) && (
|
|
71
|
+
<Avatar size="small" imageUrl={avatarUrl} name={avatarName} />
|
|
72
|
+
)}
|
|
73
|
+
<SEText
|
|
74
|
+
type="ns-xs-body-semibold"
|
|
75
|
+
size={16}
|
|
76
|
+
style={[
|
|
77
|
+
styles.headerText,
|
|
78
|
+
(!!avatarUrl || !!avatarName) && styles.headerTextWithAvatar,
|
|
79
|
+
isOpen && !nested && styles.headerTextActive,
|
|
80
|
+
]}
|
|
81
|
+
>
|
|
82
|
+
{title}
|
|
83
|
+
</SEText>
|
|
84
|
+
</View>
|
|
61
85
|
<Animated.View style={{ transform: [{ rotate: iconRotation }] }}>
|
|
62
86
|
<Icon
|
|
63
87
|
name="arrow-up-s-line"
|
|
@@ -79,6 +103,11 @@ const Accordion = ({ title, content, nested = false, initiallyOpen = false }) =>
|
|
|
79
103
|
},
|
|
80
104
|
]}>
|
|
81
105
|
{content}
|
|
106
|
+
{!!footerButtonProps && (
|
|
107
|
+
<View style={styles.footerButtonWrapper}>
|
|
108
|
+
<Button {...footerButtonProps} />
|
|
109
|
+
</View>
|
|
110
|
+
)}
|
|
82
111
|
{/* <Text style={styles.contentText}>{content}</Text> */}
|
|
83
112
|
</View>
|
|
84
113
|
</Animated.View>
|
|
@@ -110,19 +139,27 @@ const styles = StyleSheet.create({
|
|
|
110
139
|
borderColor: 'transparent',
|
|
111
140
|
margin: -1,
|
|
112
141
|
},
|
|
142
|
+
headerLeft: {
|
|
143
|
+
flexDirection: 'row',
|
|
144
|
+
alignItems: 'center',
|
|
145
|
+
flexShrink: 1,
|
|
146
|
+
},
|
|
113
147
|
headerFocused: {
|
|
114
148
|
borderColor: '#4F7CFE',
|
|
115
149
|
},
|
|
116
150
|
headerActive: {
|
|
117
151
|
borderBottomStartRadius: 0,
|
|
118
152
|
borderBottomEndRadius: 0,
|
|
119
|
-
backgroundColor: '#
|
|
153
|
+
backgroundColor: '#3F67FC',
|
|
120
154
|
borderColor: '#4F7CFE',
|
|
121
155
|
},
|
|
122
156
|
headerText: {
|
|
123
157
|
fontSize: 16,
|
|
124
|
-
|
|
125
|
-
|
|
158
|
+
color: '#485274',
|
|
159
|
+
flexShrink: 1,
|
|
160
|
+
},
|
|
161
|
+
headerTextWithAvatar: {
|
|
162
|
+
marginLeft: 8,
|
|
126
163
|
},
|
|
127
164
|
headerTextActive: {
|
|
128
165
|
color: '#FFFFFF',
|
|
@@ -135,6 +172,10 @@ const styles = StyleSheet.create({
|
|
|
135
172
|
padding: 16,
|
|
136
173
|
width: '100%',
|
|
137
174
|
},
|
|
175
|
+
footerButtonWrapper: {
|
|
176
|
+
marginTop: 16,
|
|
177
|
+
alignSelf: 'flex-start',
|
|
178
|
+
},
|
|
138
179
|
contentText: {
|
|
139
180
|
fontSize: 14,
|
|
140
181
|
lineHeight: 20,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TouchableOpacity, Image, StyleSheet,
|
|
2
|
+
import { TouchableOpacity, Image, StyleSheet, View } from 'react-native';
|
|
3
|
+
import SEText from '../SEText';
|
|
3
4
|
|
|
4
5
|
const Avatar = ({
|
|
5
6
|
size = 'medium',
|
|
@@ -12,25 +13,25 @@ const Avatar = ({
|
|
|
12
13
|
container: styles.containerXlarge, // Novo estilo
|
|
13
14
|
image: { width: 109, height: 109, borderRadius: 54 },
|
|
14
15
|
initials: { width: 109, height: 109, borderRadius: 54, alignItems: 'center', justifyContent: 'center', backgroundColor: '#E3E9FF' },
|
|
15
|
-
text: { fontSize: 20, color: '#2A4FDA'
|
|
16
|
+
text: { fontSize: 20, color: '#2A4FDA' },
|
|
16
17
|
},
|
|
17
18
|
large: {
|
|
18
19
|
container: styles.containerLarge,
|
|
19
20
|
image: { width: 64, height: 64, borderRadius: 32 },
|
|
20
21
|
initials: { width: 64, height: 64, borderRadius: 32, alignItems: 'center', justifyContent: 'center', backgroundColor: '#E3E9FF' },
|
|
21
|
-
text: { fontSize: 20, color: '#2A4FDA'
|
|
22
|
+
text: { fontSize: 20, color: '#2A4FDA' },
|
|
22
23
|
},
|
|
23
24
|
medium: {
|
|
24
25
|
container: styles.containerMedium,
|
|
25
26
|
image: { width: 40, height: 40, borderRadius: 20 },
|
|
26
27
|
initials: { width: 40, height: 40, borderRadius: 20, alignItems: 'center', justifyContent: 'center', backgroundColor: '#E3E9FF' },
|
|
27
|
-
text: { fontSize: 18, color: '#2A4FDA'
|
|
28
|
+
text: { fontSize: 18, color: '#2A4FDA' },
|
|
28
29
|
},
|
|
29
30
|
small: {
|
|
30
31
|
container: styles.containerSmall,
|
|
31
32
|
image: { width: 24, height: 24, borderRadius: 12 },
|
|
32
33
|
initials: { width: 24, height: 24, borderRadius: 12, alignItems: 'center', justifyContent: 'center', backgroundColor: '#E3E9FF' },
|
|
33
|
-
text: { fontSize: 12, color: '#2A4FDA'
|
|
34
|
+
text: { fontSize: 12, color: '#2A4FDA' },
|
|
34
35
|
},
|
|
35
36
|
};
|
|
36
37
|
|
|
@@ -62,9 +63,9 @@ const Avatar = ({
|
|
|
62
63
|
<Image source={{ uri: imageUrl }} style={getImageStyle()} />
|
|
63
64
|
) : (
|
|
64
65
|
<View style={sizeOptions[size]?.initials || sizeOptions.medium.initials}>
|
|
65
|
-
<
|
|
66
|
+
<SEText type="ns-sm-body-bold" style={sizeOptions[size]?.text || sizeOptions.medium.text}>
|
|
66
67
|
{getInitials(name)}
|
|
67
|
-
</
|
|
68
|
+
</SEText>
|
|
68
69
|
</View>
|
|
69
70
|
)}
|
|
70
71
|
</TouchableOpacity>
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
StyleSheet,
|
|
6
|
+
Modal,
|
|
7
|
+
Dimensions,
|
|
8
|
+
Platform,
|
|
9
|
+
ScrollView,
|
|
10
|
+
Pressable,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
13
|
+
import Icon from '../Icon';
|
|
14
|
+
import SEText from '../SEText';
|
|
15
|
+
|
|
16
|
+
const { height: screenHeight, width: screenWidth } = Dimensions.get('window');
|
|
17
|
+
|
|
18
|
+
const BottomSheet = ({
|
|
19
|
+
isOpen = false,
|
|
20
|
+
setIsOpen = () => {},
|
|
21
|
+
children,
|
|
22
|
+
title,
|
|
23
|
+
subtitle,
|
|
24
|
+
showHeader = true,
|
|
25
|
+
fullScreen = false,
|
|
26
|
+
tall = false,
|
|
27
|
+
headerIcon = null,
|
|
28
|
+
headerAlignment = 'left',
|
|
29
|
+
}) => {
|
|
30
|
+
const insets = useSafeAreaInsets();
|
|
31
|
+
|
|
32
|
+
const isHeaderCentered = headerAlignment === 'center';
|
|
33
|
+
|
|
34
|
+
const validTitle = title && typeof title === 'string' ? title : '';
|
|
35
|
+
const validSubtitle = subtitle && typeof subtitle === 'string' ? subtitle : '';
|
|
36
|
+
|
|
37
|
+
const modalContainerStyle = [
|
|
38
|
+
styles.modalContainer,
|
|
39
|
+
fullScreen && {
|
|
40
|
+
width: screenWidth,
|
|
41
|
+
height: screenHeight - insets.bottom,
|
|
42
|
+
maxHeight: undefined,
|
|
43
|
+
borderTopLeftRadius: 0,
|
|
44
|
+
borderTopRightRadius: 0,
|
|
45
|
+
paddingBottom: 20,
|
|
46
|
+
},
|
|
47
|
+
!fullScreen && tall && {
|
|
48
|
+
maxHeight: screenHeight * 0.92,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
const bottomSheetListStyle = [
|
|
53
|
+
styles.BottomSheetList,
|
|
54
|
+
fullScreen && {
|
|
55
|
+
height: screenHeight - insets.bottom,
|
|
56
|
+
maxHeight: undefined,
|
|
57
|
+
borderTopLeftRadius: 0,
|
|
58
|
+
borderTopRightRadius: 0,
|
|
59
|
+
flex: 1,
|
|
60
|
+
},
|
|
61
|
+
!fullScreen && tall && {
|
|
62
|
+
maxHeight: screenHeight * 0.92,
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const overlayStyle = [
|
|
67
|
+
styles.overlay,
|
|
68
|
+
fullScreen && {
|
|
69
|
+
justifyContent: 'flex-start',
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
|
|
73
|
+
const scrollViewStyle = fullScreen
|
|
74
|
+
? { flex: 1, height: screenHeight - 150 - insets.top - insets.bottom }
|
|
75
|
+
: {};
|
|
76
|
+
|
|
77
|
+
const handleOverlayPress = () => {
|
|
78
|
+
if (!fullScreen) setIsOpen(false);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<View style={styles.wrapper}>
|
|
83
|
+
<Modal
|
|
84
|
+
visible={isOpen}
|
|
85
|
+
transparent={true}
|
|
86
|
+
animationType={Platform.OS === 'ios' ? 'slide' : 'fade'}
|
|
87
|
+
presentationStyle="overFullScreen"
|
|
88
|
+
onRequestClose={() => setIsOpen(false)}
|
|
89
|
+
statusBarTranslucent={Platform.OS === 'android'}
|
|
90
|
+
>
|
|
91
|
+
<View style={overlayStyle}>
|
|
92
|
+
<Pressable onPress={handleOverlayPress} style={[StyleSheet.absoluteFill, { zIndex: 0 }]} />
|
|
93
|
+
<View style={[modalContainerStyle, { zIndex: 1 }]}>
|
|
94
|
+
<View style={bottomSheetListStyle}>
|
|
95
|
+
{showHeader && (
|
|
96
|
+
<View style={[styles.modalHeader, fullScreen && { paddingTop: insets.top }]}>
|
|
97
|
+
<TouchableOpacity onPress={() => setIsOpen(false)} style={styles.closeButton}>
|
|
98
|
+
<Icon name="close-line" size={20} color="#666666" />
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
</View>
|
|
101
|
+
)}
|
|
102
|
+
|
|
103
|
+
{validTitle.length > 0 && (
|
|
104
|
+
<View style={[styles.titleContainer, isHeaderCentered && styles.titleContainerCentered]}>
|
|
105
|
+
{headerIcon && (
|
|
106
|
+
<View style={styles.iconContainer}>
|
|
107
|
+
<Icon name={headerIcon} size={32} color="#2A4FDA" />
|
|
108
|
+
</View>
|
|
109
|
+
)}
|
|
110
|
+
<SEText type="ns-heading-1" style={[styles.modalTitle, isHeaderCentered && styles.modalTitleCentered]}>
|
|
111
|
+
{validTitle}
|
|
112
|
+
</SEText>
|
|
113
|
+
{validSubtitle.length > 0 && (
|
|
114
|
+
<SEText type="ns-sm-body" style={[styles.modalSubtitle, isHeaderCentered && styles.modalSubtitleCentered]}>
|
|
115
|
+
{validSubtitle}
|
|
116
|
+
</SEText>
|
|
117
|
+
)}
|
|
118
|
+
</View>
|
|
119
|
+
)}
|
|
120
|
+
|
|
121
|
+
<ScrollView
|
|
122
|
+
showsVerticalScrollIndicator={true}
|
|
123
|
+
contentContainerStyle={styles.scrollContent}
|
|
124
|
+
style={scrollViewStyle}
|
|
125
|
+
keyboardShouldPersistTaps="handled"
|
|
126
|
+
bounces={Platform.OS === 'ios'}
|
|
127
|
+
nestedScrollEnabled
|
|
128
|
+
scrollEventThrottle={16}
|
|
129
|
+
keyboardDismissMode="on-drag"
|
|
130
|
+
>
|
|
131
|
+
<View style={styles.contentContainer}>{children}</View>
|
|
132
|
+
</ScrollView>
|
|
133
|
+
</View>
|
|
134
|
+
</View>
|
|
135
|
+
</View>
|
|
136
|
+
</Modal>
|
|
137
|
+
</View>
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const styles = StyleSheet.create({
|
|
142
|
+
wrapper: {
|
|
143
|
+
width: '100%',
|
|
144
|
+
gap: 4,
|
|
145
|
+
},
|
|
146
|
+
overlay: {
|
|
147
|
+
flex: 1,
|
|
148
|
+
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
149
|
+
justifyContent: 'flex-end',
|
|
150
|
+
alignItems: 'stretch',
|
|
151
|
+
},
|
|
152
|
+
modalContainer: {
|
|
153
|
+
display: 'flex',
|
|
154
|
+
width: '100%',
|
|
155
|
+
padding: 12,
|
|
156
|
+
paddingHorizontal: 20,
|
|
157
|
+
paddingBottom: 56,
|
|
158
|
+
flexDirection: 'column',
|
|
159
|
+
alignItems: 'stretch',
|
|
160
|
+
gap: 16,
|
|
161
|
+
backgroundColor: 'white',
|
|
162
|
+
borderTopLeftRadius: 20,
|
|
163
|
+
borderTopRightRadius: 20,
|
|
164
|
+
maxHeight: screenHeight * 0.8,
|
|
165
|
+
minHeight: 200,
|
|
166
|
+
},
|
|
167
|
+
modalHeader: {
|
|
168
|
+
width: '100%',
|
|
169
|
+
alignItems: 'flex-end',
|
|
170
|
+
justifyContent: 'flex-end',
|
|
171
|
+
paddingHorizontal: 0,
|
|
172
|
+
paddingTop: 0,
|
|
173
|
+
paddingBottom: 0,
|
|
174
|
+
},
|
|
175
|
+
titleContainer: {
|
|
176
|
+
width: '100%',
|
|
177
|
+
paddingHorizontal: 0,
|
|
178
|
+
paddingBottom: 16,
|
|
179
|
+
alignItems: 'flex-start',
|
|
180
|
+
},
|
|
181
|
+
titleContainerCentered: {
|
|
182
|
+
alignItems: 'center',
|
|
183
|
+
},
|
|
184
|
+
iconContainer: {
|
|
185
|
+
width: 48,
|
|
186
|
+
height: 48,
|
|
187
|
+
borderRadius: 24,
|
|
188
|
+
alignItems: 'center',
|
|
189
|
+
justifyContent: 'center',
|
|
190
|
+
marginBottom: 10,
|
|
191
|
+
marginTop: 20,
|
|
192
|
+
},
|
|
193
|
+
modalTitle: {
|
|
194
|
+
fontSize: 24,
|
|
195
|
+
color: '#000',
|
|
196
|
+
textAlign: 'left',
|
|
197
|
+
lineHeight: 32,
|
|
198
|
+
},
|
|
199
|
+
modalTitleCentered: {
|
|
200
|
+
textAlign: 'center',
|
|
201
|
+
},
|
|
202
|
+
modalSubtitle: {
|
|
203
|
+
fontSize: 14,
|
|
204
|
+
color: '#666666',
|
|
205
|
+
textAlign: 'center',
|
|
206
|
+
marginTop: 4,
|
|
207
|
+
},
|
|
208
|
+
modalSubtitleCentered: {
|
|
209
|
+
textAlign: 'center',
|
|
210
|
+
},
|
|
211
|
+
scrollContent: {
|
|
212
|
+
paddingBottom: 20,
|
|
213
|
+
flexGrow: 1,
|
|
214
|
+
},
|
|
215
|
+
contentContainer: {
|
|
216
|
+
paddingHorizontal: 0,
|
|
217
|
+
flex: 1,
|
|
218
|
+
},
|
|
219
|
+
closeButton: {
|
|
220
|
+
width: 32,
|
|
221
|
+
height: 32,
|
|
222
|
+
borderRadius: 16,
|
|
223
|
+
backgroundColor: '#F5F5F5',
|
|
224
|
+
alignItems: 'center',
|
|
225
|
+
justifyContent: 'center',
|
|
226
|
+
},
|
|
227
|
+
BottomSheetList: {
|
|
228
|
+
backgroundColor: 'white',
|
|
229
|
+
borderTopLeftRadius: 20,
|
|
230
|
+
borderTopRightRadius: 20,
|
|
231
|
+
maxHeight: screenHeight * 0.8,
|
|
232
|
+
},
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
export default BottomSheet;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View, Text } from "react-native";
|
|
2
|
+
import { View, Text, Pressable, StyleSheet } from "react-native";
|
|
3
3
|
import BottomSheet, { BottomSheetNomeEmpresa } from ".";
|
|
4
4
|
import Button from "../Button";
|
|
5
5
|
import { ListaDeEstados } from "./Components/ListaDeEstados";
|
|
6
6
|
import ActionButtons from "./Components/ActionButtons";
|
|
7
|
+
import SEText from "../SEText";
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
const meta = {
|
|
@@ -80,11 +81,140 @@ const meta = {
|
|
|
80
81
|
description: "Adiciona separadores entre as opções",
|
|
81
82
|
control: "boolean",
|
|
82
83
|
},
|
|
84
|
+
headerAlignment: {
|
|
85
|
+
description: "Alinhamento do cabeçalho (ícone/título/subtítulo)",
|
|
86
|
+
control: { type: "select" },
|
|
87
|
+
options: ["left", "center"],
|
|
88
|
+
},
|
|
83
89
|
},
|
|
84
90
|
};
|
|
85
91
|
|
|
86
92
|
export default meta;
|
|
87
93
|
|
|
94
|
+
const MockSlot = () => {
|
|
95
|
+
return (
|
|
96
|
+
<Pressable style={mockStyles.slot}>
|
|
97
|
+
<SEText type="ns-sm-body" style={mockStyles.slotText}>
|
|
98
|
+
Change this component
|
|
99
|
+
</SEText>
|
|
100
|
+
</Pressable>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const MockActions = ({
|
|
105
|
+
variant = 'two-vertical',
|
|
106
|
+
}) => {
|
|
107
|
+
if (variant === 'none') return null;
|
|
108
|
+
|
|
109
|
+
if (variant === 'one') {
|
|
110
|
+
return (
|
|
111
|
+
<View style={mockStyles.actionsVertical}>
|
|
112
|
+
<Button label="Label" variant="filled" size="medium" expand />
|
|
113
|
+
</View>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (variant === 'two-horizontal') {
|
|
118
|
+
return (
|
|
119
|
+
<View style={mockStyles.actionsHorizontal}>
|
|
120
|
+
<View style={mockStyles.actionsItem}>
|
|
121
|
+
<Button label="Label" variant="transparent" size="medium" expand />
|
|
122
|
+
</View>
|
|
123
|
+
<View style={mockStyles.actionsItem}>
|
|
124
|
+
<Button label="Label" variant="filled" size="medium" expand />
|
|
125
|
+
</View>
|
|
126
|
+
</View>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<View style={mockStyles.actionsVertical}>
|
|
132
|
+
<Button label="Label" variant="filled" size="medium" expand />
|
|
133
|
+
<Button label="Label" variant="transparent" size="medium" expand />
|
|
134
|
+
</View>
|
|
135
|
+
);
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const BottomSheetMock = ({
|
|
139
|
+
showIcon = true,
|
|
140
|
+
showSlot = true,
|
|
141
|
+
actions = 'two-vertical',
|
|
142
|
+
headerAlignment = 'left',
|
|
143
|
+
}) => {
|
|
144
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<View style={mockStyles.storyRoot}>
|
|
148
|
+
{!isOpen && (
|
|
149
|
+
<View style={mockStyles.reopenButton}>
|
|
150
|
+
<Button label="Abrir BottomSheet" onPress={() => setIsOpen(true)} />
|
|
151
|
+
</View>
|
|
152
|
+
)}
|
|
153
|
+
|
|
154
|
+
<BottomSheet
|
|
155
|
+
isOpen={isOpen}
|
|
156
|
+
setIsOpen={setIsOpen}
|
|
157
|
+
title="Title"
|
|
158
|
+
subtitle="Description"
|
|
159
|
+
headerIcon={showIcon ? 'add-circle-line' : null}
|
|
160
|
+
headerAlignment={headerAlignment}
|
|
161
|
+
>
|
|
162
|
+
<View style={mockStyles.content}>
|
|
163
|
+
{showSlot && <MockSlot />}
|
|
164
|
+
<MockActions variant={actions} />
|
|
165
|
+
</View>
|
|
166
|
+
</BottomSheet>
|
|
167
|
+
</View>
|
|
168
|
+
);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const mockStyles = StyleSheet.create({
|
|
172
|
+
storyRoot: {
|
|
173
|
+
minHeight: 640,
|
|
174
|
+
width: 360,
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
justifyContent: 'center',
|
|
177
|
+
},
|
|
178
|
+
reopenButton: {
|
|
179
|
+
marginTop: 16,
|
|
180
|
+
},
|
|
181
|
+
content: {
|
|
182
|
+
paddingTop: 8,
|
|
183
|
+
gap: 24,
|
|
184
|
+
},
|
|
185
|
+
slot: {
|
|
186
|
+
width: '100%',
|
|
187
|
+
minHeight: 88,
|
|
188
|
+
borderRadius: 16,
|
|
189
|
+
borderWidth: 2,
|
|
190
|
+
borderStyle: 'dashed',
|
|
191
|
+
borderColor: '#6684FF',
|
|
192
|
+
backgroundColor: '#E3E9FF',
|
|
193
|
+
alignItems: 'center',
|
|
194
|
+
justifyContent: 'center',
|
|
195
|
+
paddingHorizontal: 16,
|
|
196
|
+
},
|
|
197
|
+
slotText: {
|
|
198
|
+
color: '#2A4FDA',
|
|
199
|
+
textAlign: 'center',
|
|
200
|
+
},
|
|
201
|
+
actionsVertical: {
|
|
202
|
+
// overflow: 'hidden',
|
|
203
|
+
// marginHorizontal: -4,
|
|
204
|
+
// paddingHorizontal: 4,
|
|
205
|
+
width: '100%',
|
|
206
|
+
gap: 12,
|
|
207
|
+
},
|
|
208
|
+
actionsHorizontal: {
|
|
209
|
+
width: '100%',
|
|
210
|
+
flexDirection: 'row',
|
|
211
|
+
gap: 12,
|
|
212
|
+
},
|
|
213
|
+
actionsItem: {
|
|
214
|
+
flex: 1,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
|
|
88
218
|
|
|
89
219
|
|
|
90
220
|
// Template base para reutilizar
|
|
@@ -376,3 +506,36 @@ export const NomeEmpresa = {
|
|
|
376
506
|
},
|
|
377
507
|
};
|
|
378
508
|
|
|
509
|
+
// ================== VARIAÇÕES (MOCK FIGMA) ==================
|
|
510
|
+
|
|
511
|
+
export const DoisBotoesVertical = {
|
|
512
|
+
render: () => <BottomSheetMock showIcon={true} showSlot={true} actions="two-vertical" />,
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
export const SemSlot = {
|
|
516
|
+
render: () => <BottomSheetMock showIcon={true} showSlot={false} actions="two-vertical" />,
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
export const UmBotao = {
|
|
520
|
+
render: () => <BottomSheetMock showIcon={true} showSlot={true} actions="one" />,
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
export const DoisBotoesHorizontal = {
|
|
524
|
+
render: () => <BottomSheetMock showIcon={true} showSlot={true} actions="two-horizontal" />,
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
export const SemBotoes = {
|
|
528
|
+
render: () => <BottomSheetMock showIcon={true} showSlot={true} actions="none" />,
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
export const SemIcone = {
|
|
532
|
+
render: () => <BottomSheetMock showIcon={false} showSlot={true} actions="two-vertical" />,
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
export const AlinhadoAoCentro = {
|
|
536
|
+
name: 'Alinhado ao centro',
|
|
537
|
+
render: () => (
|
|
538
|
+
<BottomSheetMock showIcon={true} showSlot={true} actions="two-vertical" headerAlignment="center" />
|
|
539
|
+
),
|
|
540
|
+
};
|
|
541
|
+
|