vpt-sebraeds 0.0.6 → 0.0.7
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/README.md +73 -73
- package/assets/Vector.png +0 -0
- package/assets/edit-icon.png +0 -0
- package/components/Accordion/Accordion.stories.jsx +91 -91
- package/components/Accordion/index.jsx +145 -145
- package/components/AdBanner/AdBanner.stories.jsx +62 -62
- package/components/AdBanner/index.jsx +89 -89
- package/components/Avatar/Avatar.stories.jsx +59 -59
- package/components/Avatar/index.jsx +89 -89
- package/components/BottomSheet/BottomSheet.stories.jsx +378 -378
- package/components/BottomSheet/Components/ListaDeEstados.jsx +336 -336
- package/components/BottomSheet/index.jsx +299 -299
- package/components/Breadcrumb/Breadcrumb.stories.jsx +62 -62
- package/components/Breadcrumb/index.jsx +88 -88
- package/components/Button/ButtonPrimary.stories.jsx +311 -311
- package/components/Button/index.jsx +364 -364
- package/components/CardNumber/CardNumber.stories.jsx +60 -60
- package/components/CardNumber/index.jsx +133 -133
- package/components/Checkbox/Checkbox.stories.jsx +70 -70
- package/components/Checkbox/index.jsx +120 -120
- package/components/ContentBlock/ContentBlock.stories.tsx +48 -48
- package/components/ContentBlock/ContentBlock.tsx +50 -50
- package/components/ContentCard/ContentCard.stories.jsx +98 -98
- package/components/ContentCard/index.jsx +288 -288
- package/components/ContentRelatedCard/ContentRelatedCard.stories.jsx +79 -79
- package/components/ContentRelatedCard/index.jsx +79 -79
- package/components/ContentSlot/ContentSlot.stories.jsx +276 -276
- package/components/ContentSlot/index.jsx +195 -195
- package/components/Datepicker/Datepicker.stories.jsx +239 -239
- package/components/Datepicker/MonthSelector.jsx +322 -322
- package/components/Datepicker/TimeSelector.jsx +260 -260
- package/components/Datepicker/index.jsx +449 -449
- package/components/DonutChart/DonutChart.stories.jsx +220 -220
- package/components/DonutChart/index.jsx +190 -190
- package/components/Dropdown/Dropdown.stories.jsx +331 -331
- package/components/Dropdown/index.jsx +371 -371
- package/components/DropdownCommitments/index.js +147 -147
- package/components/EmptySlot/EmptySlot.stories.jsx +114 -114
- package/components/EmptySlot/index.jsx +151 -151
- package/components/FilterTag/FilterTag.stories.jsx +54 -54
- package/components/FilterTag/index.jsx +72 -72
- package/components/FilterableMultiSelect/FilterableMultiSelect.stories.jsx +63 -63
- package/components/FilterableMultiSelect/index.jsx +208 -208
- package/components/GettingStarted.jsx +38 -38
- package/components/Header/Header.stories.jsx +838 -838
- package/components/Header/components/Context.jsx +41 -41
- package/components/Header/components/Information.jsx +80 -80
- package/components/Header/components/Shortcut.jsx +48 -48
- package/components/Header/components/SwitchAccount.jsx +276 -276
- package/components/Header/components/Variants.jsx +181 -181
- package/components/Header/components/index.jsx +11 -11
- package/components/Header/index.jsx +206 -206
- package/components/Icon/iconEnums.ts +30 -30
- package/components/Icon/index.jsx +13 -13
- package/components/Image/Image.stories.jsx +250 -250
- package/components/Image/index.jsx +175 -175
- package/components/Input/Input.stories.jsx +303 -303
- package/components/Input/index.jsx +292 -292
- package/components/Legend/Legend.stories.jsx +110 -110
- package/components/Legend/index.jsx +86 -86
- package/components/Link/Link.stories.jsx +78 -78
- package/components/Link/index.jsx +62 -62
- package/components/List/List.stories.jsx +57 -57
- package/components/List/index.jsx +63 -63
- package/components/MenuAccordion/index.jsx +1 -1
- package/components/Modal/Modal.stories.jsx +151 -151
- package/components/Modal/index.jsx +247 -247
- package/components/Navbar/Navbar.stories.jsx +244 -244
- package/components/Navbar/index.jsx +129 -129
- package/components/NavigationItem/NavigationItem.stories.tsx +454 -454
- package/components/NavigationItem/index.tsx +526 -524
- package/components/NotificationBanner/NotificationBanner.stories.jsx +57 -57
- package/components/NotificationBanner/index.jsx +153 -153
- package/components/NotificationCard/NotificationCard.stories.jsx +93 -93
- package/components/NotificationCard/index.jsx +337 -337
- package/components/Pagination/Pagination.stories.jsx +170 -170
- package/components/Pagination/index.jsx +228 -228
- package/components/ProgressBar/ProgressBar.stories.jsx +354 -354
- package/components/ProgressBar/index.jsx +90 -90
- package/components/ProgressChart/ProgressChart.stories.jsx +312 -312
- package/components/ProgressChart/index.jsx +189 -189
- package/components/Quote/Quote.stories.tsx +32 -32
- package/components/Quote/Quote.tsx +60 -60
- package/components/RadioButton/RadioButton.stories.jsx +112 -112
- package/components/RadioButton/index.jsx +113 -113
- package/components/Rating/Rating.stories.jsx +157 -157
- package/components/Rating/index.jsx +145 -145
- package/components/SEIcon/index.js +30 -30
- package/components/SEText/index.d.ts +58 -58
- package/components/SEText/index.js +160 -160
- package/components/SEText/styles.js +333 -333
- package/components/ScrollBar/ScrollBar.stories.tsx +65 -65
- package/components/ScrollBar/index.tsx +118 -118
- package/components/Search/Search.jsx +328 -328
- package/components/Search/Search.stories.jsx +92 -92
- package/components/Select/Select.stories.jsx +415 -415
- package/components/Select/index.jsx +307 -307
- package/components/SelectItem/SelectItem.stories.jsx +608 -608
- package/components/SelectItem/index.jsx +173 -173
- package/components/Shortcut/Shortcut.stories.jsx +145 -145
- package/components/Shortcut/index.jsx +182 -182
- package/components/ShowMore/ShowMore.stories.jsx +70 -70
- package/components/ShowMore/index.jsx +67 -67
- package/components/ShuffleItem/ShuffleItem.stories.jsx +278 -278
- package/components/ShuffleItem/index.jsx +701 -701
- package/components/Slider/Slider.stories.jsx +248 -248
- package/components/Slider/index.jsx +210 -210
- package/components/Tab/Tab.stories.jsx +323 -323
- package/components/Tab/index.jsx +482 -482
- package/components/Table/Table.stories.jsx +253 -253
- package/components/Table/index.jsx +291 -291
- package/components/Tag/Tag.stories.jsx +78 -78
- package/components/Tag/index.d.ts +10 -10
- package/components/Tag/index.jsx +128 -128
- package/components/TaskCard/TaskCard.stories.jsx +467 -467
- package/components/TaskCard/assets/README.md +22 -22
- package/components/TaskCard/assets/example.js +10 -10
- package/components/TaskCard/components/EditIcon.jsx +78 -81
- package/components/TaskCard/components/SuccessContent.jsx +52 -52
- package/components/TaskCard/components/SuccessIcon.jsx +52 -52
- package/components/TaskCard/components/SuccessTitle.jsx +48 -48
- package/components/TaskCard/components/Tag.jsx +79 -79
- package/components/TaskCard/components/TagGroup.jsx +60 -60
- package/components/TaskCard/components/TaskDescription.jsx +50 -50
- package/components/TaskCard/components/index.js +7 -7
- package/components/TaskCard/index.jsx +295 -295
- package/components/Toast/Toast.stories.jsx +238 -238
- package/components/Toast/index.jsx +307 -307
- package/components/Toggle/Toggle.stories.jsx +160 -160
- package/components/Toggle/index.jsx +143 -143
- package/components/TooltipCard/TooltipCard.stories.jsx +88 -88
- package/components/TooltipCard/index.jsx +353 -353
- package/components/Typography/Typography.stories.jsx +261 -261
- package/components/Typography/index.jsx +136 -136
- package/components/styles/colors.js +204 -204
- package/components/styles/fonts.js +15 -15
- package/components/styles/index,js +6 -6
- package/components/styles/metrics.js +13 -13
- package/components/styles.ts +79 -79
- package/dist/components/Accordion/index.js +16 -16
- package/dist/components/AdBanner/index.js +12 -12
- package/dist/components/Avatar/index.js +6 -6
- package/dist/components/BottomSheet/Components/ListaDeEstados.js +10 -10
- package/dist/components/BottomSheet/index.js +33 -33
- package/dist/components/Breadcrumb/index.js +7 -7
- package/dist/components/Button/index.js +12 -12
- package/dist/components/CardNumber/index.js +16 -16
- package/dist/components/Checkbox/index.js +7 -7
- package/dist/components/ContentBlock/ContentBlock.js +7 -7
- package/dist/components/ContentCard/index.js +48 -48
- package/dist/components/ContentRelatedCard/index.js +10 -10
- package/dist/components/ContentSlot/index.js +31 -31
- package/dist/components/Datepicker/MonthSelector.js +13 -13
- package/dist/components/Datepicker/TimeSelector.js +15 -15
- package/dist/components/Datepicker/index.js +60 -60
- package/dist/components/DonutChart/index.js +19 -19
- package/dist/components/Dropdown/index.js +46 -46
- package/dist/components/DropdownCommitments/index.js +24 -24
- package/dist/components/EmptySlot/index.js +19 -19
- package/dist/components/FilterTag/index.js +7 -7
- package/dist/components/FilterableMultiSelect/index.js +22 -22
- package/dist/components/GettingStarted.js +8 -8
- package/dist/components/Header/components/Context.js +2 -2
- package/dist/components/Header/components/Information.js +12 -12
- package/dist/components/Header/components/SwitchAccount.js +43 -43
- package/dist/components/Header/components/Variants.js +31 -31
- package/dist/components/Header/index.js +5 -5
- package/dist/components/Image/index.js +22 -22
- package/dist/components/Input/index.js +9 -9
- package/dist/components/Legend/index.js +8 -8
- package/dist/components/Link/index.js +5 -5
- package/dist/components/List/index.js +7 -7
- package/dist/components/MenuAccordion/index.js +1 -1
- package/dist/components/Modal/index.js +38 -38
- package/dist/components/Navbar/index.js +9 -9
- package/dist/components/NavigationItem/index.d.ts.map +1 -1
- package/dist/components/NavigationItem/index.js +32 -32
- package/dist/components/NotificationBanner/index.js +8 -8
- package/dist/components/NotificationCard/index.js +41 -41
- package/dist/components/Pagination/index.js +23 -23
- package/dist/components/ProgressBar/index.js +14 -14
- package/dist/components/ProgressChart/index.js +29 -29
- package/dist/components/Quote/Quote.js +9 -9
- package/dist/components/RadioButton/index.js +7 -7
- package/dist/components/Rating/index.js +9 -9
- package/dist/components/SEText/index.js +2 -2
- package/dist/components/ScrollBar/index.js +7 -7
- package/dist/components/Search/Search.js +45 -45
- package/dist/components/Select/index.js +16 -16
- package/dist/components/SelectItem/index.js +6 -6
- package/dist/components/Shortcut/index.js +6 -6
- package/dist/components/ShowMore/index.js +7 -7
- package/dist/components/ShuffleItem/index.js +98 -98
- package/dist/components/Slider/index.js +20 -20
- package/dist/components/Tab/index.js +26 -26
- package/dist/components/Table/index.js +36 -36
- package/dist/components/Tag/index.js +5 -5
- package/dist/components/TaskCard/components/EditIcon.d.ts.map +1 -1
- package/dist/components/TaskCard/components/EditIcon.js +4 -6
- package/dist/components/TaskCard/components/SuccessContent.js +3 -3
- package/dist/components/TaskCard/components/SuccessIcon.js +2 -2
- package/dist/components/TaskCard/components/SuccessTitle.js +2 -2
- package/dist/components/TaskCard/components/Tag.js +4 -4
- package/dist/components/TaskCard/components/TagGroup.js +4 -4
- package/dist/components/TaskCard/components/TaskDescription.js +2 -2
- package/dist/components/TaskCard/index.js +50 -50
- package/dist/components/Toast/index.js +45 -45
- package/dist/components/Toggle/index.js +3 -3
- package/dist/components/TooltipCard/index.js +46 -46
- package/dist/components/Typography/index.js +2 -2
- package/package.json +125 -125
package/README.md
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<img alt="Sebrae" src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Sebrae.svg/2560px-Sebrae.svg.png" width="200" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h1 align="center">
|
|
6
|
-
Sebrae Design System - React Native
|
|
7
|
-
</h1>
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
Design System em React Native para o projeto Sebrae Na Palma da Mão
|
|
11
|
-
</p>
|
|
12
|
-
|
|
13
|
-
## 📋 Sobre o Projeto
|
|
14
|
-
|
|
15
|
-
Este é o repositório do Design System em React Native desenvolvido para o projeto Sebrae Na Palma da Mão. O objetivo é fornecer uma biblioteca de componentes reutilizáveis que seguem os padrões visuais e de interação do Sebrae, garantindo consistência e eficiência no desenvolvimento do aplicativo principal.
|
|
16
|
-
|
|
17
|
-
## 🎨 Componentes Disponíveis
|
|
18
|
-
|
|
19
|
-
Atualmente, o Design System conta com os seguintes componentes:
|
|
20
|
-
|
|
21
|
-
- **Accordeon**: Componente expansível para exibição de conteúdo organizado
|
|
22
|
-
- **Button**: Botões primários seguindo o padrão visual do Sebrae
|
|
23
|
-
- **Checkbox**: Componente de seleção múltipla
|
|
24
|
-
- **FilterTag**: Tags para filtros e categorização
|
|
25
|
-
- **Input**: Campos de entrada de texto padronizados
|
|
26
|
-
|
|
27
|
-
## 🚀 Como Usar
|
|
28
|
-
|
|
29
|
-
1. **Instalação das dependências:**
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
yarn
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
2. **Executando o Storybook:**
|
|
36
|
-
|
|
37
|
-
Para iOS:
|
|
38
|
-
```bash
|
|
39
|
-
yarn storybook:ios
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Para Android:
|
|
43
|
-
```bash
|
|
44
|
-
yarn storybook:android
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## 📚 Storybook
|
|
48
|
-
|
|
49
|
-
Cada componente possui sua própria história no Storybook, permitindo visualizar e testar diferentes estados e propriedades. As histórias estão localizadas junto aos componentes com o padrão de nomenclatura `*.stories.jsx`.
|
|
50
|
-
|
|
51
|
-
## 🔗 Integração com o Projeto Principal
|
|
52
|
-
|
|
53
|
-
Este Design System é um artefato do projeto principal [Sebrae Na Palma da Mão], um aplicativo móvel que funciona como uma agência do Sebrae na palma da mão. O aplicativo principal inclui diversas funcionalidades como:
|
|
54
|
-
|
|
55
|
-
- Integração com redes sociais
|
|
56
|
-
- Recursos de geolocalização e mapas
|
|
57
|
-
- Funcionalidades de câmera e scanner QR Code
|
|
58
|
-
- Recursos de compartilhamento e calendário
|
|
59
|
-
- Suporte a chat e preview de links
|
|
60
|
-
- E muito mais
|
|
61
|
-
|
|
62
|
-
## 🤝 Contribuição
|
|
63
|
-
|
|
64
|
-
Antes de adicionar novos componentes ou fazer modificações:
|
|
65
|
-
|
|
66
|
-
1. Verifique se o componente segue os padrões visuais do Sebrae
|
|
67
|
-
2. Adicione a documentação apropriada no Storybook
|
|
68
|
-
3. Teste o componente em diferentes dispositivos
|
|
69
|
-
4. Certifique-se de que as alterações não quebram a compatibilidade com o projeto principal
|
|
70
|
-
|
|
71
|
-
## 📝 Licença
|
|
72
|
-
|
|
73
|
-
Este projeto está sob a licença MIT.
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="Sebrae" src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/Sebrae.svg/2560px-Sebrae.svg.png" width="200" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">
|
|
6
|
+
Sebrae Design System - React Native
|
|
7
|
+
</h1>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
Design System em React Native para o projeto Sebrae Na Palma da Mão
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
## 📋 Sobre o Projeto
|
|
14
|
+
|
|
15
|
+
Este é o repositório do Design System em React Native desenvolvido para o projeto Sebrae Na Palma da Mão. O objetivo é fornecer uma biblioteca de componentes reutilizáveis que seguem os padrões visuais e de interação do Sebrae, garantindo consistência e eficiência no desenvolvimento do aplicativo principal.
|
|
16
|
+
|
|
17
|
+
## 🎨 Componentes Disponíveis
|
|
18
|
+
|
|
19
|
+
Atualmente, o Design System conta com os seguintes componentes:
|
|
20
|
+
|
|
21
|
+
- **Accordeon**: Componente expansível para exibição de conteúdo organizado
|
|
22
|
+
- **Button**: Botões primários seguindo o padrão visual do Sebrae
|
|
23
|
+
- **Checkbox**: Componente de seleção múltipla
|
|
24
|
+
- **FilterTag**: Tags para filtros e categorização
|
|
25
|
+
- **Input**: Campos de entrada de texto padronizados
|
|
26
|
+
|
|
27
|
+
## 🚀 Como Usar
|
|
28
|
+
|
|
29
|
+
1. **Instalação das dependências:**
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
yarn
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
2. **Executando o Storybook:**
|
|
36
|
+
|
|
37
|
+
Para iOS:
|
|
38
|
+
```bash
|
|
39
|
+
yarn storybook:ios
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Para Android:
|
|
43
|
+
```bash
|
|
44
|
+
yarn storybook:android
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 📚 Storybook
|
|
48
|
+
|
|
49
|
+
Cada componente possui sua própria história no Storybook, permitindo visualizar e testar diferentes estados e propriedades. As histórias estão localizadas junto aos componentes com o padrão de nomenclatura `*.stories.jsx`.
|
|
50
|
+
|
|
51
|
+
## 🔗 Integração com o Projeto Principal
|
|
52
|
+
|
|
53
|
+
Este Design System é um artefato do projeto principal [Sebrae Na Palma da Mão], um aplicativo móvel que funciona como uma agência do Sebrae na palma da mão. O aplicativo principal inclui diversas funcionalidades como:
|
|
54
|
+
|
|
55
|
+
- Integração com redes sociais
|
|
56
|
+
- Recursos de geolocalização e mapas
|
|
57
|
+
- Funcionalidades de câmera e scanner QR Code
|
|
58
|
+
- Recursos de compartilhamento e calendário
|
|
59
|
+
- Suporte a chat e preview de links
|
|
60
|
+
- E muito mais
|
|
61
|
+
|
|
62
|
+
## 🤝 Contribuição
|
|
63
|
+
|
|
64
|
+
Antes de adicionar novos componentes ou fazer modificações:
|
|
65
|
+
|
|
66
|
+
1. Verifique se o componente segue os padrões visuais do Sebrae
|
|
67
|
+
2. Adicione a documentação apropriada no Storybook
|
|
68
|
+
3. Teste o componente em diferentes dispositivos
|
|
69
|
+
4. Certifique-se de que as alterações não quebram a compatibilidade com o projeto principal
|
|
70
|
+
|
|
71
|
+
## 📝 Licença
|
|
72
|
+
|
|
73
|
+
Este projeto está sob a licença MIT.
|
|
Binary file
|
|
Binary file
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
import { Text, View } from "react-native";
|
|
2
|
-
import Accordion from ".";
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: "Atom/Accordion",
|
|
6
|
-
component: Accordion,
|
|
7
|
-
render: (props) => (
|
|
8
|
-
<Accordion
|
|
9
|
-
{...props}
|
|
10
|
-
content={
|
|
11
|
-
<View style={{ flexDirection: 'column' }}>
|
|
12
|
-
<Text>{props.content}</Text>
|
|
13
|
-
<Accordion
|
|
14
|
-
nested
|
|
15
|
-
title="Item 01"
|
|
16
|
-
content={
|
|
17
|
-
<Text>
|
|
18
|
-
Sed nulla quam, fermentum tincidunt lacus at, viverra vehicula eros. Etiam neque libero, vulputate sed consectetur nec, imperdiet sed turpis.
|
|
19
|
-
</Text>
|
|
20
|
-
}
|
|
21
|
-
/>
|
|
22
|
-
</View>
|
|
23
|
-
}
|
|
24
|
-
/>
|
|
25
|
-
),
|
|
26
|
-
tags: ["autodocs"],
|
|
27
|
-
parameters: {
|
|
28
|
-
layout: "centered",
|
|
29
|
-
backgrounds: {
|
|
30
|
-
default: "light",
|
|
31
|
-
values: [
|
|
32
|
-
{
|
|
33
|
-
name: "light",
|
|
34
|
-
value: "#f4f4f4"
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
argTypes: {
|
|
40
|
-
title: {
|
|
41
|
-
description: "Título do acordeon",
|
|
42
|
-
control: "text",
|
|
43
|
-
},
|
|
44
|
-
content: {
|
|
45
|
-
description: "Conteúdo que será exibido quando o acordeon estiver aberto",
|
|
46
|
-
control: "text",
|
|
47
|
-
},
|
|
48
|
-
initiallyOpen: {
|
|
49
|
-
description: "Define se o acordeon deve iniciar aberto",
|
|
50
|
-
control: "boolean",
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default meta;
|
|
56
|
-
|
|
57
|
-
// Estado Padrão
|
|
58
|
-
export const Default = {
|
|
59
|
-
args: {
|
|
60
|
-
title: "Item",
|
|
61
|
-
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut finibus malesuada magna vitae dapibus. Etiam bibendum, tortor a mattis mattis, arcu quam imperdiet quam, at aliquam ex risus nec turpis. Suspendisse semper turpis ante, quis iaculis metus varius sed. Donec iaculis tortor nec auctor egestas.",
|
|
62
|
-
initiallyOpen: false,
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
// Estado Hover
|
|
67
|
-
// export const Hover = {
|
|
68
|
-
// args: {
|
|
69
|
-
// ...Padrao.args,
|
|
70
|
-
// },
|
|
71
|
-
// parameters: {
|
|
72
|
-
// pseudo: { hover: true },
|
|
73
|
-
// },
|
|
74
|
-
// };
|
|
75
|
-
|
|
76
|
-
// Estado com Foco
|
|
77
|
-
// export const Foco = {
|
|
78
|
-
// args: {
|
|
79
|
-
// ...Padrao.args,
|
|
80
|
-
// },
|
|
81
|
-
// parameters: {
|
|
82
|
-
// pseudo: { focus: true },
|
|
83
|
-
// },
|
|
84
|
-
// };
|
|
85
|
-
|
|
86
|
-
// Estado Ativo (Aberto)
|
|
87
|
-
export const Open = {
|
|
88
|
-
args: {
|
|
89
|
-
...Default.args,
|
|
90
|
-
initiallyOpen: true,
|
|
91
|
-
},
|
|
1
|
+
import { Text, View } from "react-native";
|
|
2
|
+
import Accordion from ".";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Atom/Accordion",
|
|
6
|
+
component: Accordion,
|
|
7
|
+
render: (props) => (
|
|
8
|
+
<Accordion
|
|
9
|
+
{...props}
|
|
10
|
+
content={
|
|
11
|
+
<View style={{ flexDirection: 'column' }}>
|
|
12
|
+
<Text>{props.content}</Text>
|
|
13
|
+
<Accordion
|
|
14
|
+
nested
|
|
15
|
+
title="Item 01"
|
|
16
|
+
content={
|
|
17
|
+
<Text>
|
|
18
|
+
Sed nulla quam, fermentum tincidunt lacus at, viverra vehicula eros. Etiam neque libero, vulputate sed consectetur nec, imperdiet sed turpis.
|
|
19
|
+
</Text>
|
|
20
|
+
}
|
|
21
|
+
/>
|
|
22
|
+
</View>
|
|
23
|
+
}
|
|
24
|
+
/>
|
|
25
|
+
),
|
|
26
|
+
tags: ["autodocs"],
|
|
27
|
+
parameters: {
|
|
28
|
+
layout: "centered",
|
|
29
|
+
backgrounds: {
|
|
30
|
+
default: "light",
|
|
31
|
+
values: [
|
|
32
|
+
{
|
|
33
|
+
name: "light",
|
|
34
|
+
value: "#f4f4f4"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
argTypes: {
|
|
40
|
+
title: {
|
|
41
|
+
description: "Título do acordeon",
|
|
42
|
+
control: "text",
|
|
43
|
+
},
|
|
44
|
+
content: {
|
|
45
|
+
description: "Conteúdo que será exibido quando o acordeon estiver aberto",
|
|
46
|
+
control: "text",
|
|
47
|
+
},
|
|
48
|
+
initiallyOpen: {
|
|
49
|
+
description: "Define se o acordeon deve iniciar aberto",
|
|
50
|
+
control: "boolean",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
|
|
57
|
+
// Estado Padrão
|
|
58
|
+
export const Default = {
|
|
59
|
+
args: {
|
|
60
|
+
title: "Item",
|
|
61
|
+
content: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut finibus malesuada magna vitae dapibus. Etiam bibendum, tortor a mattis mattis, arcu quam imperdiet quam, at aliquam ex risus nec turpis. Suspendisse semper turpis ante, quis iaculis metus varius sed. Donec iaculis tortor nec auctor egestas.",
|
|
62
|
+
initiallyOpen: false,
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Estado Hover
|
|
67
|
+
// export const Hover = {
|
|
68
|
+
// args: {
|
|
69
|
+
// ...Padrao.args,
|
|
70
|
+
// },
|
|
71
|
+
// parameters: {
|
|
72
|
+
// pseudo: { hover: true },
|
|
73
|
+
// },
|
|
74
|
+
// };
|
|
75
|
+
|
|
76
|
+
// Estado com Foco
|
|
77
|
+
// export const Foco = {
|
|
78
|
+
// args: {
|
|
79
|
+
// ...Padrao.args,
|
|
80
|
+
// },
|
|
81
|
+
// parameters: {
|
|
82
|
+
// pseudo: { focus: true },
|
|
83
|
+
// },
|
|
84
|
+
// };
|
|
85
|
+
|
|
86
|
+
// Estado Ativo (Aberto)
|
|
87
|
+
export const Open = {
|
|
88
|
+
args: {
|
|
89
|
+
...Default.args,
|
|
90
|
+
initiallyOpen: true,
|
|
91
|
+
},
|
|
92
92
|
};
|
|
@@ -1,145 +1,145 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { View, Text, TouchableOpacity, StyleSheet, Animated, LayoutAnimation, Platform, UIManager } from 'react-native';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
|
|
5
|
-
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
6
|
-
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const Accordion = ({ title, content, nested = false, initiallyOpen = false }) => {
|
|
10
|
-
const [isOpen, setIsOpen] = useState(initiallyOpen);
|
|
11
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
12
|
-
const animation = useRef(new Animated.Value(initiallyOpen ? 1 : 0)).current;
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
Animated.timing(animation, {
|
|
16
|
-
toValue: isOpen ? 1 : 0,
|
|
17
|
-
duration: 300,
|
|
18
|
-
useNativeDriver: false,
|
|
19
|
-
}).start();
|
|
20
|
-
}, [isOpen]);
|
|
21
|
-
|
|
22
|
-
const toggleAccordion = () => {
|
|
23
|
-
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
24
|
-
setIsOpen(prev => !prev);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const contentHeight = animation.interpolate({
|
|
28
|
-
inputRange: [0, 1],
|
|
29
|
-
outputRange: [0, 500],
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const contentOpacity = animation.interpolate({
|
|
33
|
-
inputRange: [0, 1],
|
|
34
|
-
outputRange: [0, 1],
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const iconRotation = animation.interpolate({
|
|
38
|
-
inputRange: [0, 1],
|
|
39
|
-
outputRange: ['0deg', '180deg'],
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<View style={[
|
|
44
|
-
styles.container,
|
|
45
|
-
nested && styles.containerNested,
|
|
46
|
-
]}>
|
|
47
|
-
<TouchableOpacity
|
|
48
|
-
activeOpacity={0.8}
|
|
49
|
-
style={[
|
|
50
|
-
styles.header,
|
|
51
|
-
isFocused && !isOpen && styles.headerFocused,
|
|
52
|
-
isOpen && !nested && styles.headerActive,
|
|
53
|
-
]}
|
|
54
|
-
onPress={toggleAccordion}
|
|
55
|
-
onPressIn={() => setIsFocused(true)}
|
|
56
|
-
onPressOut={() => setIsFocused(false)}
|
|
57
|
-
>
|
|
58
|
-
<Text style={[styles.headerText, isOpen && !nested && styles.headerTextActive]}>
|
|
59
|
-
{title}
|
|
60
|
-
</Text>
|
|
61
|
-
<Animated.View style={{ transform: [{ rotate: iconRotation }] }}>
|
|
62
|
-
<Icon
|
|
63
|
-
name="arrow-up-s-line"
|
|
64
|
-
size={20}
|
|
65
|
-
color={isOpen &&!nested? '#FFFFFF' : '#4F7CFE'}
|
|
66
|
-
/>
|
|
67
|
-
</Animated.View>
|
|
68
|
-
</TouchableOpacity>
|
|
69
|
-
|
|
70
|
-
<Animated.View style={[
|
|
71
|
-
styles.animatedContent,
|
|
72
|
-
{ maxHeight: contentHeight, opacity: contentOpacity }
|
|
73
|
-
]}>
|
|
74
|
-
<View style={[
|
|
75
|
-
styles.content,
|
|
76
|
-
!nested && {
|
|
77
|
-
borderTopColor: '#96ACFF',
|
|
78
|
-
borderTopWidth: 2,
|
|
79
|
-
},
|
|
80
|
-
]}>
|
|
81
|
-
{content}
|
|
82
|
-
{/* <Text style={styles.contentText}>{content}</Text> */}
|
|
83
|
-
</View>
|
|
84
|
-
</Animated.View>
|
|
85
|
-
</View>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const styles = StyleSheet.create({
|
|
90
|
-
container: {
|
|
91
|
-
borderRadius: 8,
|
|
92
|
-
overflow: 'hidden',
|
|
93
|
-
marginVertical: 8,
|
|
94
|
-
borderWidth: 2,
|
|
95
|
-
borderColor: '#96ACFF',
|
|
96
|
-
backgroundColor: '#FFF'
|
|
97
|
-
},
|
|
98
|
-
containerNested: {
|
|
99
|
-
borderColor: '#E2E9FC',
|
|
100
|
-
borderWidth: 1,
|
|
101
|
-
},
|
|
102
|
-
header: {
|
|
103
|
-
borderRadius: 8,
|
|
104
|
-
borderTop: 8,
|
|
105
|
-
flexDirection: 'row',
|
|
106
|
-
justifyContent: 'space-between',
|
|
107
|
-
alignItems: 'center',
|
|
108
|
-
padding: 16,
|
|
109
|
-
borderWidth: 2,
|
|
110
|
-
borderColor: 'transparent',
|
|
111
|
-
margin: -1,
|
|
112
|
-
},
|
|
113
|
-
headerFocused: {
|
|
114
|
-
borderColor: '#4F7CFE',
|
|
115
|
-
},
|
|
116
|
-
headerActive: {
|
|
117
|
-
borderBottomStartRadius: 0,
|
|
118
|
-
borderBottomEndRadius: 0,
|
|
119
|
-
backgroundColor: '#4F7CFE',
|
|
120
|
-
borderColor: '#4F7CFE',
|
|
121
|
-
},
|
|
122
|
-
headerText: {
|
|
123
|
-
fontSize: 16,
|
|
124
|
-
fontWeight: '500',
|
|
125
|
-
color: '#1B244B',
|
|
126
|
-
},
|
|
127
|
-
headerTextActive: {
|
|
128
|
-
color: '#FFFFFF',
|
|
129
|
-
},
|
|
130
|
-
animatedContent: {
|
|
131
|
-
overflow: 'hidden',
|
|
132
|
-
},
|
|
133
|
-
content: {
|
|
134
|
-
backgroundColor: '#FFFFFF',
|
|
135
|
-
padding: 16,
|
|
136
|
-
width: '100%',
|
|
137
|
-
},
|
|
138
|
-
contentText: {
|
|
139
|
-
fontSize: 14,
|
|
140
|
-
lineHeight: 20,
|
|
141
|
-
color: '#1B244B',
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
export default Accordion;
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet, Animated, LayoutAnimation, Platform, UIManager } from 'react-native';
|
|
3
|
+
import Icon from '../Icon';
|
|
4
|
+
|
|
5
|
+
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
6
|
+
UIManager.setLayoutAnimationEnabledExperimental(true);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const Accordion = ({ title, content, nested = false, initiallyOpen = false }) => {
|
|
10
|
+
const [isOpen, setIsOpen] = useState(initiallyOpen);
|
|
11
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
12
|
+
const animation = useRef(new Animated.Value(initiallyOpen ? 1 : 0)).current;
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
Animated.timing(animation, {
|
|
16
|
+
toValue: isOpen ? 1 : 0,
|
|
17
|
+
duration: 300,
|
|
18
|
+
useNativeDriver: false,
|
|
19
|
+
}).start();
|
|
20
|
+
}, [isOpen]);
|
|
21
|
+
|
|
22
|
+
const toggleAccordion = () => {
|
|
23
|
+
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
|
|
24
|
+
setIsOpen(prev => !prev);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const contentHeight = animation.interpolate({
|
|
28
|
+
inputRange: [0, 1],
|
|
29
|
+
outputRange: [0, 500],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const contentOpacity = animation.interpolate({
|
|
33
|
+
inputRange: [0, 1],
|
|
34
|
+
outputRange: [0, 1],
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const iconRotation = animation.interpolate({
|
|
38
|
+
inputRange: [0, 1],
|
|
39
|
+
outputRange: ['0deg', '180deg'],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View style={[
|
|
44
|
+
styles.container,
|
|
45
|
+
nested && styles.containerNested,
|
|
46
|
+
]}>
|
|
47
|
+
<TouchableOpacity
|
|
48
|
+
activeOpacity={0.8}
|
|
49
|
+
style={[
|
|
50
|
+
styles.header,
|
|
51
|
+
isFocused && !isOpen && styles.headerFocused,
|
|
52
|
+
isOpen && !nested && styles.headerActive,
|
|
53
|
+
]}
|
|
54
|
+
onPress={toggleAccordion}
|
|
55
|
+
onPressIn={() => setIsFocused(true)}
|
|
56
|
+
onPressOut={() => setIsFocused(false)}
|
|
57
|
+
>
|
|
58
|
+
<Text style={[styles.headerText, isOpen && !nested && styles.headerTextActive]}>
|
|
59
|
+
{title}
|
|
60
|
+
</Text>
|
|
61
|
+
<Animated.View style={{ transform: [{ rotate: iconRotation }] }}>
|
|
62
|
+
<Icon
|
|
63
|
+
name="arrow-up-s-line"
|
|
64
|
+
size={20}
|
|
65
|
+
color={isOpen &&!nested? '#FFFFFF' : '#4F7CFE'}
|
|
66
|
+
/>
|
|
67
|
+
</Animated.View>
|
|
68
|
+
</TouchableOpacity>
|
|
69
|
+
|
|
70
|
+
<Animated.View style={[
|
|
71
|
+
styles.animatedContent,
|
|
72
|
+
{ maxHeight: contentHeight, opacity: contentOpacity }
|
|
73
|
+
]}>
|
|
74
|
+
<View style={[
|
|
75
|
+
styles.content,
|
|
76
|
+
!nested && {
|
|
77
|
+
borderTopColor: '#96ACFF',
|
|
78
|
+
borderTopWidth: 2,
|
|
79
|
+
},
|
|
80
|
+
]}>
|
|
81
|
+
{content}
|
|
82
|
+
{/* <Text style={styles.contentText}>{content}</Text> */}
|
|
83
|
+
</View>
|
|
84
|
+
</Animated.View>
|
|
85
|
+
</View>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const styles = StyleSheet.create({
|
|
90
|
+
container: {
|
|
91
|
+
borderRadius: 8,
|
|
92
|
+
overflow: 'hidden',
|
|
93
|
+
marginVertical: 8,
|
|
94
|
+
borderWidth: 2,
|
|
95
|
+
borderColor: '#96ACFF',
|
|
96
|
+
backgroundColor: '#FFF'
|
|
97
|
+
},
|
|
98
|
+
containerNested: {
|
|
99
|
+
borderColor: '#E2E9FC',
|
|
100
|
+
borderWidth: 1,
|
|
101
|
+
},
|
|
102
|
+
header: {
|
|
103
|
+
borderRadius: 8,
|
|
104
|
+
borderTop: 8,
|
|
105
|
+
flexDirection: 'row',
|
|
106
|
+
justifyContent: 'space-between',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
padding: 16,
|
|
109
|
+
borderWidth: 2,
|
|
110
|
+
borderColor: 'transparent',
|
|
111
|
+
margin: -1,
|
|
112
|
+
},
|
|
113
|
+
headerFocused: {
|
|
114
|
+
borderColor: '#4F7CFE',
|
|
115
|
+
},
|
|
116
|
+
headerActive: {
|
|
117
|
+
borderBottomStartRadius: 0,
|
|
118
|
+
borderBottomEndRadius: 0,
|
|
119
|
+
backgroundColor: '#4F7CFE',
|
|
120
|
+
borderColor: '#4F7CFE',
|
|
121
|
+
},
|
|
122
|
+
headerText: {
|
|
123
|
+
fontSize: 16,
|
|
124
|
+
fontWeight: '500',
|
|
125
|
+
color: '#1B244B',
|
|
126
|
+
},
|
|
127
|
+
headerTextActive: {
|
|
128
|
+
color: '#FFFFFF',
|
|
129
|
+
},
|
|
130
|
+
animatedContent: {
|
|
131
|
+
overflow: 'hidden',
|
|
132
|
+
},
|
|
133
|
+
content: {
|
|
134
|
+
backgroundColor: '#FFFFFF',
|
|
135
|
+
padding: 16,
|
|
136
|
+
width: '100%',
|
|
137
|
+
},
|
|
138
|
+
contentText: {
|
|
139
|
+
fontSize: 14,
|
|
140
|
+
lineHeight: 20,
|
|
141
|
+
color: '#1B244B',
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
export default Accordion;
|