vpt-sebraeds 0.0.91 → 0.0.93
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 +13 -11
- package/assets/fonts/Figtree-Black.ttf +0 -0
- package/assets/fonts/Figtree-BlackItalic.ttf +0 -0
- package/assets/fonts/Figtree-Bold.ttf +0 -0
- package/assets/fonts/Figtree-BoldItalic.ttf +0 -0
- package/assets/fonts/Figtree-ExtraBold.ttf +0 -0
- package/assets/fonts/Figtree-ExtraBoldItalic.ttf +0 -0
- package/assets/fonts/Figtree-Italic.ttf +0 -0
- package/assets/fonts/Figtree-Light.ttf +0 -0
- package/assets/fonts/Figtree-LightItalic.ttf +0 -0
- package/assets/fonts/Figtree-Medium.ttf +0 -0
- package/assets/fonts/Figtree-MediumItalic.ttf +0 -0
- package/assets/fonts/Figtree-Regular.ttf +0 -0
- package/assets/fonts/Figtree-SemiBold.ttf +0 -0
- package/assets/fonts/Figtree-SemiBoldItalic.ttf +0 -0
- package/components/Accordion/Accordion.stories.jsx +1 -1
- package/components/Accordion/README.md +1 -1
- package/components/Accordion/index.jsx +1 -1
- package/components/Avatar/index.jsx +1 -1
- package/components/BottomSheet/BottomSheet.jsx +1 -1
- package/components/BottomSheet/BottomSheet.stories.jsx +1 -2
- package/components/Bullet/index.jsx +1 -1
- package/components/Button/index.jsx +68 -5
- package/components/ButtonGroup/index.tsx +1 -1
- package/components/CNAESelectItem/index.jsx +1 -1
- package/components/CNAESelectItem/padrao.js +1 -1
- package/components/Card/index.jsx +190 -190
- package/components/Checkbox/index.jsx +2 -2
- package/components/EventListItem/index.tsx +1 -1
- package/components/ExpandableNumberDisplay/index.tsx +1 -1
- package/components/FilterTag/index.jsx +1 -1
- package/components/FilterableMultiSelect/index.jsx +3 -3
- package/components/FilterableUniSelect/index.jsx +3 -3
- package/components/GeneralInformationCard/index.tsx +1 -1
- package/components/Header/v1/components/SwitchAccount.jsx +1 -1
- package/components/Header/v1/components/Variants.jsx +1 -1
- package/components/Header/v2/README.md +5 -5
- package/components/Header/v2/parts/Hero.jsx +1 -1
- package/components/Header/v2/parts/SwitchAccount.jsx +1 -1
- package/components/Header/v2/parts/Variants.jsx +1 -1
- package/components/Input/InputUnderline.tsx +1 -1
- package/components/Input/index.jsx +1 -1
- package/components/Link/index.jsx +1 -1
- package/components/ListItem/index.jsx +12 -12
- package/components/MiniEventCard/index.jsx +1 -1
- package/components/NavigationItem/index.tsx +1 -1
- package/components/NotificationDialog/index.jsx +1 -1
- package/components/NumberDisplay/index.jsx +8 -8
- package/components/ProgressChart/index.jsx +1 -1
- package/components/RangeSlider/index.tsx +1 -1
- package/components/Search/index.jsx +1 -1
- package/components/Select/index.jsx +1 -1
- package/components/SelectableOption/SelectableOption.stories.jsx +139 -139
- package/components/SelectableOption/index.jsx +261 -261
- package/components/Shortcut/index.jsx +1 -1
- package/components/ShuffleItem/index.jsx +1 -1
- package/components/Spacer/index.jsx +10 -0
- package/components/StackedBar/StackedBar.stories.jsx +122 -122
- package/components/StackedBar/index.jsx +241 -241
- package/components/Table/index.jsx +1 -1
- package/components/TaggedInputText/index.jsx +2 -2
- package/components/TaskCard/index.jsx +1 -1
- package/components/Templates/Loading/Icons/index.jsx +189 -0
- package/components/Templates/Loading/Loading.stories.jsx +200 -0
- package/components/Templates/Loading/README.md +41 -0
- package/components/Templates/Loading/assets/almost-there.svg +111 -0
- package/components/Templates/Loading/assets/something-wrong.svg +55 -0
- package/components/Templates/Loading/context/index.jsx +24 -0
- package/components/Templates/Loading/index.jsx +540 -0
- package/components/Templates/StatusFeedback/Icons/index.jsx +121 -0
- package/components/Templates/StatusFeedback/README.md +33 -0
- package/components/Templates/StatusFeedback/StatusFeedback.stories.jsx +96 -0
- package/components/Templates/StatusFeedback/assets/action-success.svg +22 -0
- package/components/Templates/StatusFeedback/assets/action-unsuccess.svg +26 -0
- package/components/Templates/StatusFeedback/assets/not-found.svg +19 -0
- package/components/Templates/StatusFeedback/context/index.jsx +26 -0
- package/components/Templates/StatusFeedback/index.jsx +381 -0
- package/components/Tools/NavigationButton/NavigationButton.stories.jsx +1 -1
- package/components/Tools/NavigationButton/index.jsx +1 -1
- package/components/Tools/SearchResult/index.jsx +1 -1
- package/components/TooltipCard/index.jsx +1 -1
- package/components/Typography/RichText/index.d.ts +2 -0
- package/components/Typography/RichText/index.js +8 -0
- package/components/{SEText → Typography/SEText}/index.d.ts +3 -1
- package/components/Typography/SEText/index.js +248 -0
- package/components/{SEText → Typography/SEText}/styles.js +19 -1
- package/components/Typography/Typography.stories.jsx +28 -203
- package/components/Typography/index.jsx +5 -61
- package/components/styles/tokens/colors.ts +2 -0
- package/components/styles/tokens/palette.ts +4 -4
- package/components/styles/tokens/typography.ts +18 -13
- package/dist/assets/fonts/Figtree-Black.ttf +0 -0
- package/dist/assets/fonts/Figtree-BlackItalic.ttf +0 -0
- package/dist/assets/fonts/Figtree-Bold.ttf +0 -0
- package/dist/assets/fonts/Figtree-BoldItalic.ttf +0 -0
- package/dist/assets/fonts/Figtree-ExtraBold.ttf +0 -0
- package/dist/assets/fonts/Figtree-ExtraBoldItalic.ttf +0 -0
- package/dist/assets/fonts/Figtree-Italic.ttf +0 -0
- package/dist/assets/fonts/Figtree-Light.ttf +0 -0
- package/dist/assets/fonts/Figtree-LightItalic.ttf +0 -0
- package/dist/assets/fonts/Figtree-Medium.ttf +0 -0
- package/dist/assets/fonts/Figtree-MediumItalic.ttf +0 -0
- package/dist/assets/fonts/Figtree-Regular.ttf +0 -0
- package/dist/assets/fonts/Figtree-SemiBold.ttf +0 -0
- package/dist/assets/fonts/Figtree-SemiBoldItalic.ttf +0 -0
- package/dist/components/Accordion/index.js +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/BottomSheet/BottomSheet.js +1 -1
- package/dist/components/Bullet/index.js +1 -1
- package/dist/components/Button/index.d.ts +12 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +46 -6
- package/dist/components/ButtonGroup/index.js +1 -1
- package/dist/components/CNAESelectItem/index.js +1 -1
- package/dist/components/CNAESelectItem/padrao.js +1 -1
- package/dist/components/Card/index.js +16 -16
- package/dist/components/Checkbox/index.js +2 -2
- package/dist/components/EventListItem/index.js +1 -1
- package/dist/components/ExpandableNumberDisplay/index.js +1 -1
- package/dist/components/FilterTag/index.js +1 -1
- package/dist/components/FilterableMultiSelect/index.js +3 -3
- package/dist/components/FilterableUniSelect/index.js +3 -3
- package/dist/components/GeneralInformationCard/index.js +1 -1
- package/dist/components/Header/v1/components/SwitchAccount.js +1 -1
- package/dist/components/Header/v1/components/Variants.js +1 -1
- package/dist/components/Header/v2/parts/Hero.js +1 -1
- package/dist/components/Header/v2/parts/SwitchAccount.js +1 -1
- package/dist/components/Header/v2/parts/Variants.js +1 -1
- package/dist/components/Input/InputUnderline.js +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/Link/index.js +1 -1
- package/dist/components/ListItem/index.js +12 -12
- package/dist/components/MiniEventCard/index.js +1 -1
- package/dist/components/NavigationItem/index.js +1 -1
- package/dist/components/NotificationDialog/index.js +1 -1
- package/dist/components/NumberDisplay/index.js +8 -8
- package/dist/components/ProgressChart/index.js +1 -1
- package/dist/components/RangeSlider/index.js +1 -1
- package/dist/components/SEText/index.js +114 -114
- package/dist/components/Search/Search.js +7 -7
- package/dist/components/Search/index.js +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SelectableOption/index.js +17 -17
- package/dist/components/Shortcut/index.js +1 -1
- package/dist/components/ShuffleItem/index.js +1 -1
- package/dist/components/Spacer/index.d.ts +3 -0
- package/dist/components/Spacer/index.d.ts.map +1 -0
- package/dist/components/Spacer/index.js +9 -0
- package/dist/components/StackedBar/index.js +23 -23
- package/dist/components/Table/index.js +1 -1
- package/dist/components/TaggedInputText/index.js +2 -2
- package/dist/components/TaskCard/index.js +1 -1
- package/dist/components/Templates/Loading/Icons/index.d.ts +12 -0
- package/dist/components/Templates/Loading/Icons/index.d.ts.map +1 -0
- package/dist/components/Templates/Loading/Icons/index.js +174 -0
- package/dist/components/Templates/Loading/assets/almost-there.svg +111 -0
- package/dist/components/Templates/Loading/assets/something-wrong.svg +55 -0
- package/dist/components/Templates/Loading/context/index.d.ts +9 -0
- package/dist/components/Templates/Loading/context/index.d.ts.map +1 -0
- package/dist/components/Templates/Loading/context/index.js +16 -0
- package/dist/components/Templates/Loading/index.d.ts +141 -0
- package/dist/components/Templates/Loading/index.d.ts.map +1 -0
- package/dist/components/Templates/Loading/index.js +316 -0
- package/dist/components/Templates/StatusFeedback/Icons/index.d.ts +21 -0
- package/dist/components/Templates/StatusFeedback/Icons/index.d.ts.map +1 -0
- package/dist/components/Templates/StatusFeedback/Icons/index.js +87 -0
- package/dist/components/Templates/StatusFeedback/assets/action-success.svg +22 -0
- package/dist/components/Templates/StatusFeedback/assets/action-unsuccess.svg +26 -0
- package/dist/components/Templates/StatusFeedback/assets/not-found.svg +19 -0
- package/dist/components/Templates/StatusFeedback/context/index.d.ts +9 -0
- package/dist/components/Templates/StatusFeedback/context/index.d.ts.map +1 -0
- package/dist/components/Templates/StatusFeedback/context/index.js +16 -0
- package/dist/components/Templates/StatusFeedback/index.d.ts +102 -0
- package/dist/components/Templates/StatusFeedback/index.d.ts.map +1 -0
- package/dist/components/Templates/StatusFeedback/index.js +234 -0
- package/dist/components/Tools/NavigationButton/index.js +1 -1
- package/dist/components/Tools/SearchResult/index.js +1 -1
- package/dist/components/TooltipCard/index.js +1 -1
- package/dist/components/Typography/RichText/index.d.ts +4 -0
- package/dist/components/Typography/RichText/index.d.ts.map +1 -0
- package/dist/components/Typography/RichText/index.js +6 -0
- package/dist/components/Typography/SEText/index.d.ts +60 -0
- package/dist/components/Typography/SEText/index.d.ts.map +1 -0
- package/dist/components/Typography/SEText/index.js +172 -0
- package/dist/components/Typography/SEText/styles.d.ts +442 -0
- package/dist/components/Typography/SEText/styles.d.ts.map +1 -0
- package/dist/components/Typography/SEText/styles.js +36 -0
- package/dist/components/Typography/index.d.ts +6 -13
- package/dist/components/Typography/index.d.ts.map +1 -1
- package/dist/components/Typography/index.js +5 -42
- package/dist/components/styles/tokens/colors.d.ts +5 -3
- package/dist/components/styles/tokens/colors.d.ts.map +1 -1
- package/dist/components/styles/tokens/colors.js +2 -0
- package/dist/components/styles/tokens/index.d.ts +9 -7
- package/dist/components/styles/tokens/index.d.ts.map +1 -1
- package/dist/components/styles/tokens/palette.d.ts +4 -4
- package/dist/components/styles/tokens/palette.js +4 -4
- package/dist/components/styles/tokens/typography.d.ts.map +1 -1
- package/dist/components/styles/tokens/typography.js +18 -13
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
- 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/SEText/index.js +0 -154
- 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/README.md
CHANGED
|
@@ -19,14 +19,15 @@ Este é o repositório do Design System em React Native desenvolvido para o proj
|
|
|
19
19
|
- **Composition Pattern**: componentes devem priorizar composição sobre herança, com subcomponentes acessados via `Parent.Child` quando fizer sentido.
|
|
20
20
|
- **Tokenização obrigatória**: cores, tipografia, surfaces, bordas, elevações e demais aspectos visuais devem nascer em `components/styles/tokens/`.
|
|
21
21
|
- **Sem hardcodes visuais estruturais**: componentes não devem declarar diretamente `color`, `backgroundColor`, `borderColor`, `fontFamily`, `fontSize`, `fontWeight`, `shadow*` ou `elevation` fora do sistema de tokens.
|
|
22
|
-
- **Tipografia centralizada**: a família atual é
|
|
22
|
+
- **Tipografia centralizada**: a família atual é Figtree, com adaptação entre iOS e Android encapsulada no domínio de tipografia do Design System.
|
|
23
23
|
|
|
24
24
|
Referências diretas:
|
|
25
25
|
|
|
26
26
|
- Tokens por aspecto: [components/styles/tokens/](file:///Users/tegra/sebrae/storybook/dev/components/styles/tokens)
|
|
27
27
|
- Entry point compatível: [components/styles/tokens.ts](file:///Users/tegra/sebrae/storybook/dev/components/styles/tokens.ts)
|
|
28
28
|
- Tipografia centralizada: [typography.ts](file:///Users/tegra/sebrae/storybook/dev/components/styles/tokens/typography.ts)
|
|
29
|
-
- Texto padronizado: [
|
|
29
|
+
- Texto padronizado: [Typography/RichText/index.js](file:///Users/tegra/sebrae/storybook/dev/components/Typography/RichText/index.js)
|
|
30
|
+
- Base compatível de tipografia: [Typography/SEText/index.js](file:///Users/tegra/sebrae/storybook/dev/components/Typography/SEText/index.js)
|
|
30
31
|
- Regras do projeto: [AGENTS.md](file:///Users/tegra/sebrae/storybook/dev/AGENTS.md)
|
|
31
32
|
|
|
32
33
|
## ✅ Requisitos
|
|
@@ -53,13 +54,14 @@ npm install
|
|
|
53
54
|
Padrão de construção esperado:
|
|
54
55
|
|
|
55
56
|
- Componentes novos devem seguir composição e contexto quando houver partes acopladas semanticamente.
|
|
56
|
-
- Tipografia deve ser aplicada com `SEText` ou via `tokens.textStyles`/`tokens.typography`.
|
|
57
|
+
- Tipografia deve ser aplicada com `RichText`, `SEText` compatível ou via `tokens.textStyles`/`tokens.typography`.
|
|
57
58
|
- Estilos estáticos devem usar `StyleSheet.create` e tokens semânticos.
|
|
58
59
|
|
|
59
60
|
Exemplos de componentes:
|
|
60
61
|
|
|
61
62
|
- Accordion, Button, Checkbox, FilterTag, Input, Modal, Navbar, Pagination,
|
|
62
|
-
Datepicker, Dropdown, Card, Toast, Typography, SEIcon, SEText,
|
|
63
|
+
Datepicker, Dropdown, Card, Toast, Typography, SEIcon, RichText, SEText,
|
|
64
|
+
e muitos outros.
|
|
63
65
|
|
|
64
66
|
## 🚀 Como Usar
|
|
65
67
|
|
|
@@ -128,7 +130,7 @@ Uso recomendado em componentes:
|
|
|
128
130
|
|
|
129
131
|
```tsx
|
|
130
132
|
import { StyleSheet, View } from 'react-native'
|
|
131
|
-
import
|
|
133
|
+
import RichText from 'vpt-sebraeds/components/Typography/RichText'
|
|
132
134
|
import tokens from 'vpt-sebraeds/components/styles/tokens'
|
|
133
135
|
|
|
134
136
|
const styles = StyleSheet.create({
|
|
@@ -145,10 +147,10 @@ const styles = StyleSheet.create({
|
|
|
145
147
|
export function ExemploTokenizado() {
|
|
146
148
|
return (
|
|
147
149
|
<View style={styles.card}>
|
|
148
|
-
<
|
|
149
|
-
<
|
|
150
|
+
<RichText type="ns-heading-5">Título</RichText>
|
|
151
|
+
<RichText type="ns-sm-body" color={tokens.colors.text.secondary}>
|
|
150
152
|
Conteúdo seguindo os tokens do projeto
|
|
151
|
-
</
|
|
153
|
+
</RichText>
|
|
152
154
|
</View>
|
|
153
155
|
)
|
|
154
156
|
}
|
|
@@ -170,10 +172,10 @@ Exemplo conceitual:
|
|
|
170
172
|
```tsx
|
|
171
173
|
<Card>
|
|
172
174
|
<Card.Header>
|
|
173
|
-
<
|
|
175
|
+
<RichText type="ns-heading-5">Título</RichText>
|
|
174
176
|
</Card.Header>
|
|
175
177
|
<Card.Body>
|
|
176
|
-
<
|
|
178
|
+
<RichText type="ns-sm-body">Conteúdo</RichText>
|
|
177
179
|
</Card.Body>
|
|
178
180
|
</Card>
|
|
179
181
|
```
|
|
@@ -242,7 +244,7 @@ Observação: nesta biblioteca, o campo "name" é `vpt-sebraeds`.
|
|
|
242
244
|
|
|
243
245
|
Dependências e pós-instalação:
|
|
244
246
|
- Instale todos os peerDependencies declarados pelo Design System (ex.: react, react-dom, bibliotecas de estilo/animação se aplicável). Verifique o `package.json` do repositório.
|
|
245
|
-
- Configure a fonte
|
|
247
|
+
- Configure a fonte Figtree no app consumidor. Veja [FONTES_CONFIGURACAO.md](file:///Users/tegra/sebrae/storybook/dev/FONTES_CONFIGURACAO.md).
|
|
246
248
|
|
|
247
249
|
Exemplo de uso:
|
|
248
250
|
|
|
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
|
|
Binary file
|
|
@@ -15,7 +15,7 @@ Referências diretas no código:
|
|
|
15
15
|
**Novidades:**
|
|
16
16
|
- **Padrão de Composição (Recomendado)**: Maior flexibilidade para personalizar cabeçalho e conteúdo.
|
|
17
17
|
- **Variantes de Estado**: Suporte visual nativo para estados de `success`, `alert` e `error`.
|
|
18
|
-
- **Tipografia Atualizada**: Uso de tokens `ns-*` (
|
|
18
|
+
- **Tipografia Atualizada**: Uso de tokens `ns-*` (Figtree) via `SEText`.
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
@@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect, useContext, createContext } from 'r
|
|
|
2
2
|
import { View, TouchableOpacity, StyleSheet, Animated, LayoutAnimation, Platform, UIManager } from 'react-native';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Icon from '../Icon';
|
|
5
|
-
import SEText from '../SEText';
|
|
5
|
+
import SEText from '../Typography/SEText';
|
|
6
6
|
import tokens from '../styles/tokens';
|
|
7
7
|
|
|
8
8
|
if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'react-native';
|
|
12
12
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
13
13
|
import Icon from '../Icon';
|
|
14
|
-
import SEText from '../SEText';
|
|
14
|
+
import SEText from '../Typography/SEText';
|
|
15
15
|
|
|
16
16
|
const { height: screenHeight, width: screenWidth } = Dimensions.get('window');
|
|
17
17
|
|
|
@@ -4,7 +4,7 @@ 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
|
+
import SEText from "../Typography/SEText";
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
const meta = {
|
|
@@ -538,4 +538,3 @@ export const AlinhadoAoCentro = {
|
|
|
538
538
|
<BottomSheetMock showIcon={true} showSlot={true} actions="two-vertical" headerAlignment="center" />
|
|
539
539
|
),
|
|
540
540
|
};
|
|
541
|
-
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useMemo, useState } from 'react';
|
|
2
2
|
import { TouchableOpacity, StyleSheet, View } from 'react-native';
|
|
3
3
|
import Icon from '../Icon';
|
|
4
|
-
import SEText from '../SEText';
|
|
4
|
+
import SEText from '../Typography/SEText';
|
|
5
5
|
|
|
6
6
|
const Button = ({
|
|
7
|
+
children,
|
|
7
8
|
label,
|
|
8
9
|
size = 'medium',
|
|
9
10
|
variant = 'filled',
|
|
@@ -16,9 +17,26 @@ const Button = ({
|
|
|
16
17
|
iconColor,
|
|
17
18
|
badge,
|
|
18
19
|
testID,
|
|
20
|
+
style,
|
|
21
|
+
contentStyle,
|
|
22
|
+
textStyle,
|
|
23
|
+
backgroundColor,
|
|
24
|
+
borderColor,
|
|
25
|
+
textColor,
|
|
26
|
+
borderStyle,
|
|
27
|
+
borderWidth,
|
|
28
|
+
borderRadius,
|
|
29
|
+
contentAlignment = 'center',
|
|
19
30
|
}) => {
|
|
20
31
|
const [isFocused, setIsFocused] = useState(false);
|
|
21
|
-
const
|
|
32
|
+
const content = children ?? label;
|
|
33
|
+
const hasContent = content !== undefined && content !== null && content !== false;
|
|
34
|
+
const shouldWrapContent = typeof content === 'string' || typeof content === 'number';
|
|
35
|
+
const shouldUseCustomContentLayout =
|
|
36
|
+
children !== undefined ||
|
|
37
|
+
contentAlignment !== 'center' ||
|
|
38
|
+
!!contentStyle;
|
|
39
|
+
const iconOnly = useMemo(() => !hasContent && iconName, [hasContent, iconName]);
|
|
22
40
|
|
|
23
41
|
const sizeOptions = {
|
|
24
42
|
large: {
|
|
@@ -123,6 +141,14 @@ const Button = ({
|
|
|
123
141
|
// if (disabled) baseStyle.push(styles.containerDisabled);
|
|
124
142
|
if (isFocused && !disabled) baseStyle.push(variantOptions[variant].focused);
|
|
125
143
|
|
|
144
|
+
baseStyle.push({
|
|
145
|
+
...(backgroundColor ? { backgroundColor } : {}),
|
|
146
|
+
...(borderColor ? { borderColor } : {}),
|
|
147
|
+
...(borderStyle ? { borderStyle } : {}),
|
|
148
|
+
...(borderWidth !== undefined ? { borderWidth } : {}),
|
|
149
|
+
...(borderRadius !== undefined ? { borderRadius } : {}),
|
|
150
|
+
});
|
|
151
|
+
|
|
126
152
|
return baseStyle;
|
|
127
153
|
};
|
|
128
154
|
|
|
@@ -135,9 +161,34 @@ const Button = ({
|
|
|
135
161
|
// Estado
|
|
136
162
|
if (disabled) baseStyle.push(styles.labelDisabled);
|
|
137
163
|
|
|
164
|
+
if (textColor) {
|
|
165
|
+
baseStyle.push({ color: textColor });
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (textStyle) {
|
|
169
|
+
baseStyle.push(textStyle);
|
|
170
|
+
}
|
|
171
|
+
|
|
138
172
|
return baseStyle;
|
|
139
173
|
};
|
|
140
174
|
|
|
175
|
+
const getContentContainerStyle = () => {
|
|
176
|
+
const alignmentMap = {
|
|
177
|
+
left: 'flex-start',
|
|
178
|
+
center: 'center',
|
|
179
|
+
right: 'flex-end',
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
return [
|
|
183
|
+
styles.contentContainer,
|
|
184
|
+
shouldUseCustomContentLayout && styles.contentContainerFlexible,
|
|
185
|
+
shouldUseCustomContentLayout && {
|
|
186
|
+
justifyContent: alignmentMap[contentAlignment] || alignmentMap.center,
|
|
187
|
+
},
|
|
188
|
+
contentStyle,
|
|
189
|
+
];
|
|
190
|
+
};
|
|
191
|
+
|
|
141
192
|
const getIconSize = () => {
|
|
142
193
|
switch (size) {
|
|
143
194
|
case 'large':
|
|
@@ -202,7 +253,8 @@ const Button = ({
|
|
|
202
253
|
style={[
|
|
203
254
|
getContainerStyle(),
|
|
204
255
|
iconOnly && styles.iconOnlyContainer,
|
|
205
|
-
expand && styles.expand
|
|
256
|
+
expand && styles.expand,
|
|
257
|
+
style,
|
|
206
258
|
]}
|
|
207
259
|
onPress={onPress}
|
|
208
260
|
disabled={disabled}
|
|
@@ -211,7 +263,7 @@ const Button = ({
|
|
|
211
263
|
activeOpacity={0.95}
|
|
212
264
|
testID={testID}
|
|
213
265
|
>
|
|
214
|
-
<View style={
|
|
266
|
+
<View style={getContentContainerStyle()}>
|
|
215
267
|
{iconOnly && renderIcon()}
|
|
216
268
|
|
|
217
269
|
{!iconOnly && (
|
|
@@ -221,7 +273,15 @@ const Button = ({
|
|
|
221
273
|
iconPosition === 'both') &&
|
|
222
274
|
renderIcon()
|
|
223
275
|
}
|
|
224
|
-
|
|
276
|
+
{hasContent && (
|
|
277
|
+
shouldWrapContent ? (
|
|
278
|
+
<SEText type={getSETextType()} style={getLabelStyle()}>
|
|
279
|
+
{content}
|
|
280
|
+
</SEText>
|
|
281
|
+
) : (
|
|
282
|
+
content
|
|
283
|
+
)
|
|
284
|
+
)}
|
|
225
285
|
{renderBadge()}
|
|
226
286
|
{(
|
|
227
287
|
iconPosition === 'right' ||
|
|
@@ -240,6 +300,9 @@ const styles = StyleSheet.create({
|
|
|
240
300
|
flexDirection: 'row',
|
|
241
301
|
alignItems: 'center',
|
|
242
302
|
},
|
|
303
|
+
contentContainerFlexible: {
|
|
304
|
+
width: '100%',
|
|
305
|
+
},
|
|
243
306
|
container: {
|
|
244
307
|
alignItems: 'center',
|
|
245
308
|
justifyContent: 'center',
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Pressable, StyleSheet, View } from 'react-native';
|
|
4
4
|
import SEIcon from '../SEIcon';
|
|
5
|
-
import SEText from '../SEText';
|
|
5
|
+
import SEText from '../Typography/SEText';
|
|
6
6
|
|
|
7
7
|
const COLORS = {
|
|
8
8
|
white: '#FFFFFF',
|
|
@@ -1126,7 +1126,7 @@ const styles = StyleSheet.create({
|
|
|
1126
1126
|
|
|
1127
1127
|
bottomSearchInputText: {
|
|
1128
1128
|
fontSize: 16,
|
|
1129
|
-
fontFamily: Platform.OS === 'ios' ? '
|
|
1129
|
+
fontFamily: Platform.OS === 'ios' ? 'Figtree-Regular' : 'Figtree-Regular',
|
|
1130
1130
|
},
|
|
1131
1131
|
|
|
1132
1132
|
loadingContainer: {
|