vpt-sebraeds 0.0.95 → 0.0.97

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.
Files changed (198) hide show
  1. package/components/Accordion/index.jsx +1 -1
  2. package/components/BottomSheet/BottomSheet.jsx +2 -1
  3. package/components/Bullet/index.jsx +1 -1
  4. package/components/Button/ButtonPrimary.stories.jsx +1 -1
  5. package/components/ButtonV2/Badge.jsx +68 -0
  6. package/components/ButtonV2/ButtonV2.stories.jsx +321 -0
  7. package/components/ButtonV2/FAB.jsx +64 -0
  8. package/components/ButtonV2/Icon.jsx +36 -0
  9. package/components/ButtonV2/Label.jsx +23 -0
  10. package/components/ButtonV2/Leading.jsx +25 -0
  11. package/components/ButtonV2/Root.jsx +163 -0
  12. package/components/ButtonV2/Spinner.jsx +23 -0
  13. package/components/ButtonV2/Trailing.jsx +25 -0
  14. package/components/ButtonV2/index.jsx +30 -0
  15. package/components/ButtonV2/tokens.js +226 -0
  16. package/components/ButtonV2/types.d.ts +109 -0
  17. package/components/DesignTokens/Elevations.stories.jsx +335 -0
  18. package/components/EventListItem/index.tsx +1 -1
  19. package/components/Header/v2/parts/BackButton.jsx +2 -1
  20. package/components/Header/v2/parts/Hero.jsx +3 -3
  21. package/components/Header/v2/parts/SwitchAccount.jsx +13 -3
  22. package/components/Input/InputUnderline.tsx +1 -1
  23. package/components/Input/index.jsx +1 -1
  24. package/components/NotificationDialog/index.jsx +1 -1
  25. package/components/RadioButton/index.jsx +5 -2
  26. package/components/StackedBar/index.jsx +3 -0
  27. package/components/Tab/index.jsx +1 -1
  28. package/components/Templates/Loading/Loading.stories.jsx +1 -1
  29. package/components/Templates/Loading/index.jsx +1 -1
  30. package/components/Templates/StatusFeedback/Icons/index.jsx +1 -1
  31. package/components/Templates/StatusFeedback/index.jsx +1 -1
  32. package/components/Typography/RichText/index.js +25 -0
  33. package/components/Typography/SEText/index.d.ts +12 -0
  34. package/components/Typography/SEText/index.js +97 -76
  35. package/components/Typography/SEText/styles.js +2 -1
  36. package/components/Typography/Typography.stories.jsx +1 -1
  37. package/components/utils/fontFamily.js +1 -1
  38. package/dist/components/Accordion/index.js +1 -1
  39. package/dist/components/BottomSheet/BottomSheet.d.ts +2 -1
  40. package/dist/components/BottomSheet/BottomSheet.d.ts.map +1 -1
  41. package/dist/components/BottomSheet/BottomSheet.js +2 -2
  42. package/dist/components/Bullet/index.js +1 -1
  43. package/dist/components/ButtonV2/Badge.d.ts +11 -0
  44. package/dist/components/ButtonV2/Badge.d.ts.map +1 -0
  45. package/dist/components/ButtonV2/Badge.js +60 -0
  46. package/dist/components/ButtonV2/FAB.d.ts +4 -0
  47. package/dist/components/ButtonV2/FAB.d.ts.map +1 -0
  48. package/dist/components/ButtonV2/FAB.js +32 -0
  49. package/dist/components/ButtonV2/Icon.d.ts +12 -0
  50. package/dist/components/ButtonV2/Icon.d.ts.map +1 -0
  51. package/dist/components/ButtonV2/Icon.js +26 -0
  52. package/dist/components/ButtonV2/Label.d.ts +10 -0
  53. package/dist/components/ButtonV2/Label.d.ts.map +1 -0
  54. package/dist/components/ButtonV2/Label.js +15 -0
  55. package/dist/components/ButtonV2/Leading.d.ts +8 -0
  56. package/dist/components/ButtonV2/Leading.d.ts.map +1 -0
  57. package/dist/components/ButtonV2/Leading.js +19 -0
  58. package/dist/components/ButtonV2/Root.d.ts +17 -0
  59. package/dist/components/ButtonV2/Root.d.ts.map +1 -0
  60. package/dist/components/ButtonV2/Root.js +115 -0
  61. package/dist/components/ButtonV2/Spinner.d.ts +10 -0
  62. package/dist/components/ButtonV2/Spinner.d.ts.map +1 -0
  63. package/dist/components/ButtonV2/Spinner.js +14 -0
  64. package/dist/components/ButtonV2/Trailing.d.ts +8 -0
  65. package/dist/components/ButtonV2/Trailing.d.ts.map +1 -0
  66. package/dist/components/ButtonV2/Trailing.js +19 -0
  67. package/dist/components/ButtonV2/index.d.ts +21 -0
  68. package/dist/components/ButtonV2/index.d.ts.map +1 -0
  69. package/dist/components/ButtonV2/index.js +27 -0
  70. package/dist/components/ButtonV2/tokens.d.ts +99 -0
  71. package/dist/components/ButtonV2/tokens.d.ts.map +1 -0
  72. package/dist/components/ButtonV2/tokens.js +198 -0
  73. package/dist/components/EventListItem/index.js +1 -1
  74. package/dist/components/Header/v2/parts/BackButton.d.ts.map +1 -1
  75. package/dist/components/Header/v2/parts/BackButton.js +2 -2
  76. package/dist/components/Header/v2/parts/Hero.js +3 -3
  77. package/dist/components/Header/v2/parts/SwitchAccount.d.ts.map +1 -1
  78. package/dist/components/Header/v2/parts/SwitchAccount.js +10 -3
  79. package/dist/components/Input/InputUnderline.js +1 -1
  80. package/dist/components/Input/index.js +1 -1
  81. package/dist/components/NotificationDialog/index.js +1 -1
  82. package/dist/components/RadioButton/index.d.ts +5 -1
  83. package/dist/components/RadioButton/index.d.ts.map +1 -1
  84. package/dist/components/RadioButton/index.js +5 -3
  85. package/dist/components/StackedBar/index.d.ts +3 -1
  86. package/dist/components/StackedBar/index.d.ts.map +1 -1
  87. package/dist/components/StackedBar/index.js +3 -2
  88. package/dist/components/Tab/index.js +1 -1
  89. package/dist/components/Templates/Loading/index.js +1 -1
  90. package/dist/components/Templates/StatusFeedback/Icons/index.js +1 -1
  91. package/dist/components/Templates/StatusFeedback/index.js +1 -1
  92. package/dist/components/Typography/RichText/index.d.ts +26 -1
  93. package/dist/components/Typography/RichText/index.d.ts.map +1 -1
  94. package/dist/components/Typography/RichText/index.js +24 -0
  95. package/dist/components/Typography/SEText/index.d.ts +103 -49
  96. package/dist/components/Typography/SEText/index.d.ts.map +1 -1
  97. package/dist/components/Typography/SEText/index.js +95 -75
  98. package/dist/components/Typography/SEText/styles.d.ts +88 -0
  99. package/dist/components/Typography/SEText/styles.js +2 -1
  100. package/dist/components/utils/fontFamily.js +1 -1
  101. package/dist/src/index.d.ts +5 -3
  102. package/dist/src/index.d.ts.map +1 -1
  103. package/dist/src/index.js +7 -2
  104. package/dist/styles/colors.d.ts +182 -0
  105. package/dist/styles/colors.d.ts.map +1 -0
  106. package/dist/styles/colors.js +184 -0
  107. package/dist/styles/fonts.d.ts +15 -0
  108. package/dist/styles/fonts.d.ts.map +1 -0
  109. package/dist/styles/fonts.js +19 -0
  110. package/dist/styles/foundation/hooks/index.d.ts +3 -0
  111. package/dist/styles/foundation/hooks/index.d.ts.map +1 -0
  112. package/dist/styles/foundation/hooks/index.js +2 -0
  113. package/dist/styles/foundation/hooks/useElevation.d.ts +63 -0
  114. package/dist/styles/foundation/hooks/useElevation.d.ts.map +1 -0
  115. package/dist/styles/foundation/hooks/useElevation.js +93 -0
  116. package/dist/styles/foundation/hooks/useFocus.d.ts +12 -0
  117. package/dist/styles/foundation/hooks/useFocus.d.ts.map +1 -0
  118. package/dist/styles/foundation/hooks/useFocus.js +23 -0
  119. package/dist/styles/foundation/index.d.ts +9 -0
  120. package/dist/styles/foundation/index.d.ts.map +1 -0
  121. package/dist/styles/foundation/index.js +5 -0
  122. package/dist/styles/foundation/tokens/elevations.d.ts +127 -0
  123. package/dist/styles/foundation/tokens/elevations.d.ts.map +1 -0
  124. package/dist/styles/foundation/tokens/elevations.js +41 -0
  125. package/dist/styles/foundation/tokens/index.d.ts +4 -0
  126. package/dist/styles/foundation/tokens/index.d.ts.map +1 -0
  127. package/dist/styles/foundation/tokens/index.js +3 -0
  128. package/dist/styles/foundation/tokens/spacing.d.ts +71 -0
  129. package/dist/styles/foundation/tokens/spacing.d.ts.map +1 -0
  130. package/dist/styles/foundation/tokens/spacing.js +41 -0
  131. package/dist/styles/foundation/tokens/typography.d.ts +97 -0
  132. package/dist/styles/foundation/tokens/typography.d.ts.map +1 -0
  133. package/dist/styles/foundation/tokens/typography.js +106 -0
  134. package/dist/styles/index.d.ts +18 -0
  135. package/dist/styles/index.d.ts.map +1 -0
  136. package/dist/styles/index.js +6 -0
  137. package/dist/styles/metrics.d.ts +10 -0
  138. package/dist/styles/metrics.d.ts.map +1 -0
  139. package/dist/styles/metrics.js +15 -0
  140. package/dist/styles/tokens/borders.d.ts +14 -0
  141. package/dist/styles/tokens/borders.d.ts.map +1 -0
  142. package/dist/styles/tokens/borders.js +13 -0
  143. package/dist/styles/tokens/colors.d.ts +81 -0
  144. package/dist/styles/tokens/colors.d.ts.map +1 -0
  145. package/dist/styles/tokens/colors.js +82 -0
  146. package/dist/styles/tokens/elevations.d.ts +127 -0
  147. package/dist/styles/tokens/elevations.d.ts.map +1 -0
  148. package/dist/styles/tokens/elevations.js +47 -0
  149. package/dist/styles/tokens/index.d.ts +1128 -0
  150. package/dist/styles/tokens/index.d.ts.map +1 -0
  151. package/dist/styles/tokens/index.js +45 -0
  152. package/dist/styles/tokens/opacity.d.ts +12 -0
  153. package/dist/styles/tokens/opacity.d.ts.map +1 -0
  154. package/dist/styles/tokens/opacity.js +11 -0
  155. package/dist/styles/tokens/palette.d.ts +87 -0
  156. package/dist/styles/tokens/palette.d.ts.map +1 -0
  157. package/dist/styles/tokens/palette.js +86 -0
  158. package/dist/styles/tokens/radius.d.ts +21 -0
  159. package/dist/styles/tokens/radius.d.ts.map +1 -0
  160. package/dist/styles/tokens/radius.js +11 -0
  161. package/dist/styles/tokens/spacing.d.ts +25 -0
  162. package/dist/styles/tokens/spacing.d.ts.map +1 -0
  163. package/dist/styles/tokens/spacing.js +24 -0
  164. package/dist/styles/tokens/surfaces.d.ts +27 -0
  165. package/dist/styles/tokens/surfaces.d.ts.map +1 -0
  166. package/dist/styles/tokens/surfaces.js +27 -0
  167. package/dist/styles/tokens/typography.d.ts +456 -0
  168. package/dist/styles/tokens/typography.d.ts.map +1 -0
  169. package/dist/styles/tokens/typography.js +264 -0
  170. package/dist/styles/tokens.d.ts +3 -0
  171. package/dist/styles/tokens.d.ts.map +1 -0
  172. package/dist/styles/tokens.js +1 -0
  173. package/dist/styles/useElevation.d.ts +2 -0
  174. package/dist/styles/useElevation.d.ts.map +1 -0
  175. package/dist/styles/useElevation.js +1 -0
  176. package/dist/styles/useFocus.d.ts +1 -11
  177. package/dist/styles/useFocus.d.ts.map +1 -1
  178. package/dist/styles/useFocus.js +1 -22
  179. package/dist/styles/usePressableElevation.d.ts +44 -0
  180. package/dist/styles/usePressableElevation.d.ts.map +1 -0
  181. package/dist/styles/usePressableElevation.js +38 -0
  182. package/package.json +3 -2
  183. package/src/index.ts +35 -3
  184. package/components/styles/colors.js +0 -204
  185. package/components/styles/fonts.js +0 -17
  186. package/components/styles/index,js +0 -37
  187. package/components/styles/metrics.js +0 -13
  188. package/components/styles/tokens/borders.ts +0 -13
  189. package/components/styles/tokens/colors.ts +0 -83
  190. package/components/styles/tokens/elevations.ts +0 -49
  191. package/components/styles/tokens/index.ts +0 -47
  192. package/components/styles/tokens/opacity.ts +0 -11
  193. package/components/styles/tokens/palette.ts +0 -86
  194. package/components/styles/tokens/radius.ts +0 -12
  195. package/components/styles/tokens/spacing.ts +0 -25
  196. package/components/styles/tokens/surfaces.ts +0 -28
  197. package/components/styles/tokens/typography.ts +0 -287
  198. package/components/styles/tokens.ts +0 -18
@@ -3,7 +3,7 @@ import { View, TouchableOpacity, StyleSheet, Animated, LayoutAnimation, Platform
3
3
  import PropTypes from 'prop-types';
4
4
  import Icon from '../Icon';
5
5
  import SEText from '../Typography/SEText';
6
- import tokens from '../styles/tokens';
6
+ import tokens from '@styles/tokens';
7
7
 
8
8
  if (Platform.OS === 'android' && UIManager.setLayoutAnimationEnabledExperimental) {
9
9
  UIManager.setLayoutAnimationEnabledExperimental(true);
@@ -28,6 +28,7 @@ const BottomSheet = ({
28
28
  headerAlignment = 'left',
29
29
  showsVerticalScrollIndicator = true,
30
30
  footer,
31
+ closeButtonTestID,
31
32
  }) => {
32
33
  const insets = useSafeAreaInsets();
33
34
 
@@ -96,7 +97,7 @@ const BottomSheet = ({
96
97
  <View style={bottomSheetListStyle}>
97
98
  {showHeader && (
98
99
  <View style={[styles.modalHeader, fullScreen && { paddingTop: insets.top }]}>
99
- <TouchableOpacity onPress={() => setIsOpen(false)} style={styles.closeButton}>
100
+ <TouchableOpacity onPress={() => setIsOpen(false)} style={styles.closeButton} testID={closeButtonTestID}>
100
101
  <Icon name="close-line" size={20} color="#666666" />
101
102
  </TouchableOpacity>
102
103
  </View>
@@ -4,7 +4,7 @@ import { View, StyleSheet } from 'react-native';
4
4
 
5
5
  import Icon from '../Icon';
6
6
  import SEText from '../Typography/SEText';
7
- import tokens from '../styles/tokens';
7
+ import tokens from '@styles/tokens';
8
8
 
9
9
  const VARIANTS = {
10
10
  flat: {
@@ -2,7 +2,7 @@ import { View } from "react-native";
2
2
  import Button from "./index.jsx";
3
3
 
4
4
  const meta = {
5
- title: "Atom/Button",
5
+ title: "Atom/Button/V1",
6
6
  component: Button,
7
7
  render: (props) => (
8
8
  <View style={{ width: '100%', alignItems: 'center', marginTop: 12 }}>
@@ -0,0 +1,68 @@
1
+ import React, { useContext } from "react";
2
+ import { View } from "react-native";
3
+ import { ButtonV2Context } from "./Root";
4
+ import Typography from "../Typography";
5
+ import { radius } from "@styles/tokens/radius";
6
+ import palette from "@styles/tokens/palette";
7
+
8
+ const Badge = ({ children, floating = false, skin = "default", overrideColor }) => {
9
+ const ctx = useContext(ButtonV2Context);
10
+ if (!ctx) return children;
11
+
12
+ let dimension;
13
+ switch (ctx.size) {
14
+ case "sm":
15
+ dimension = 20;
16
+ break;
17
+ case "lg":
18
+ dimension = 28;
19
+ break;
20
+ case "md":
21
+ default:
22
+ dimension = 24;
23
+ break;
24
+ }
25
+
26
+ let backgroundColor;
27
+ if (overrideColor) {
28
+ backgroundColor = overrideColor;
29
+ } else if (skin === "danger") {
30
+ backgroundColor = palette.red[500];
31
+ } else {
32
+ backgroundColor = palette.brand[700];
33
+ }
34
+
35
+ const badgeStyle = {
36
+ minWidth: dimension,
37
+ height: dimension,
38
+ borderRadius: radius.full,
39
+ paddingHorizontal: 6,
40
+ alignItems: "center",
41
+ justifyContent: "center",
42
+ backgroundColor,
43
+ };
44
+
45
+ if (floating) {
46
+ badgeStyle.position = "absolute";
47
+ badgeStyle.right = -4;
48
+ badgeStyle.top = -4;
49
+ badgeStyle.zIndex = 10;
50
+ badgeStyle.marginLeft = 0;
51
+ } else {
52
+ badgeStyle.marginLeft = ctx.gapIconeLabel || 8;
53
+ }
54
+
55
+ return (
56
+ <View style={badgeStyle}>
57
+ <Typography.SEText
58
+ type="detail_2_highlight"
59
+ color={palette.neutral[0]}
60
+ >
61
+ {children}
62
+ </Typography.SEText>
63
+ </View>
64
+ );
65
+ };
66
+
67
+ Badge._isButtonV2Badge = true;
68
+ export default Badge;
@@ -0,0 +1,321 @@
1
+ import React from "react";
2
+ import { View, StyleSheet, ScrollView, Button as RNButton } from "react-native";
3
+ import ButtonV2, {
4
+ Root,
5
+ Label,
6
+ Leading,
7
+ Trailing,
8
+ Spinner,
9
+ Badge,
10
+ FAB,
11
+ } from "./index";
12
+ import { spacingScaleV2 } from "@styles/foundation/tokens/spacing";
13
+ import colors from "@styles/tokens/colors";
14
+ import palette from "@styles/tokens/palette";
15
+ import Typography from "../Typography";
16
+ import Avatar from "../Avatar";
17
+
18
+ const SKINS = ["neutral", "brand", "green", "yellow", "red", "blue", "purple"];
19
+ const INTENSITIES = [
20
+ "soft-1",
21
+ "soft-2",
22
+ "soft-3",
23
+ "soft-4",
24
+ "base-1",
25
+ "base-2",
26
+ "strong-1",
27
+ "strong-2",
28
+ ];
29
+ const STYLES = ["filled", "outlined", "tonal", "ghost"];
30
+ const SIZES = ["sm", "md", "lg"];
31
+ const SHAPES = ["default", "pill"];
32
+ const FAB_SIZES = ["md", "lg", "xl"];
33
+ const FAB_SHAPES = ["square", "circle"];
34
+
35
+ /**
36
+ * Placeholder de ícone fallback (usa SEText com símbolos texto)
37
+ * para evitar quebra de import SEIcon durante desenvolvimento de stories.
38
+ *
39
+ * @param {Object} props
40
+ * @param {string} [props.name="plus"] - Nome do ícone placeholder (plus/chevron-right/chevron-left/bookmark/check/star/search/close ou string livre)
41
+ * @param {string} [props.color] - Cor de override do texto/ícone (vem do Context por padrão)
42
+ * @param {number} [props.size=16] - Tamanho em px do caractere
43
+ */
44
+ function PlaceholderIcon({ name = "plus", color, size = 16 }) {
45
+ const sym = {
46
+ plus: "+",
47
+ "add-fill": "+",
48
+ "chevron-right": "›",
49
+ "chevron-left": "‹",
50
+ bookmark: "☆",
51
+ check: "✓",
52
+ star: "★",
53
+ search: "🔍",
54
+ close: "×",
55
+ };
56
+ return (
57
+ <Typography.SEText
58
+ type="body_1_highlight"
59
+ style={[{ color: color || undefined, fontSize: size || undefined }]}
60
+ >
61
+ {sym[name] || name}
62
+ </Typography.SEText>
63
+ );
64
+ }
65
+
66
+ export default {
67
+ title: "Atom/Button/V2",
68
+ component: Root,
69
+ argTypes: {
70
+ skin: { control: { type: "select", options: SKINS } },
71
+ intensity: { control: { type: "select", options: INTENSITIES } },
72
+ style: { control: { type: "select", options: STYLES } },
73
+ size: { control: { type: "select", options: SIZES } },
74
+ shape: { control: { type: "select", options: SHAPES } },
75
+ disabled: { control: "boolean" },
76
+ loading: { control: "boolean" },
77
+ expand: { control: "boolean" },
78
+ },
79
+ parameters: {
80
+ docs: {
81
+ description: {
82
+ component:
83
+ "**ButtonV2** — componente de botão com **Composition Pattern** e **Foundation Tokens V2**: elevations flat/+1/+2/+3, tipografia Figtree V2, spacing V2 Atomic, radius, palette 7 skins × 8 intensities × 4 estilos (filled/outlined/tonal/ghost). Sub-componentes: `.Root`, `.Label`, `.Leading`, `.Trailing`, `.Icon`, `.Spinner`, `.Badge` e `.FAB` (Floating Action Buttons).",
84
+ },
85
+ },
86
+ },
87
+ }
88
+
89
+ export const Default = (args) => (
90
+ <Root {...args}>
91
+ <Label>Label do botão</Label>
92
+ </Root>
93
+ );
94
+ Default.args = {
95
+ skin: "brand",
96
+ intensity: "base-1",
97
+ style: "filled",
98
+ size: "md",
99
+ shape: "default",
100
+ disabled: false,
101
+ loading: false,
102
+ expand: false,
103
+ };
104
+
105
+ export const SkinIntensityStyleGrade = () => {
106
+ const INTENSITIES_SAMPLE = ["soft-2", "base-1", "strong-1", "strong-2"];
107
+ return (
108
+ <ScrollView
109
+ style={{
110
+ padding: spacingScaleV2[24],
111
+ backgroundColor: palette.neutral[25],
112
+ }}
113
+ >
114
+ {STYLES.map((st) => (
115
+ <View key={st} style={{ marginBottom: spacingScaleV2[32] }}>
116
+ <Typography.SEText
117
+ type="heading_1"
118
+ style={{ marginBottom: spacingScaleV2[16] }}
119
+ >
120
+ Style: {st} (size=md, shape=default)
121
+ </Typography.SEText>
122
+ {SKINS.map((skin) => (
123
+ <View key={skin} style={{ marginBottom: spacingScaleV2[16] }}>
124
+ <Typography.SEText
125
+ type="detail_1_highlight"
126
+ style={{ marginBottom: spacingScaleV2[8] }}
127
+ >
128
+ skin = {skin}
129
+ </Typography.SEText>
130
+ <View style={[styles.row, { gap: spacingScaleV2[8] }]}>
131
+ {INTENSITIES_SAMPLE.map((int) => (
132
+ <Root
133
+ key={int}
134
+ skin={skin}
135
+ intensity={int}
136
+ style={st}
137
+ size="md"
138
+ shape="default"
139
+ >
140
+ <Label>{int}</Label>
141
+ </Root>
142
+ ))}
143
+ </View>
144
+ </View>
145
+ ))}
146
+ </View>
147
+ ))}
148
+ </ScrollView>
149
+ );
150
+ };
151
+ SkinIntensityStyleGrade.storyName = "Grade: Skin × Intensity × Style (amostra)";
152
+
153
+ export const FABsStory = () => (
154
+ <View style={{ padding: spacingScaleV2[24], gap: spacingScaleV2[32] }}>
155
+ {/* <Typography.SEText type="heading_1" style={{ marginBottom: spacingScaleV2[16] }}>
156
+ FABs (Figma 2 - 6 variantes)
157
+ </Typography.SEText> */}
158
+ {FAB_SHAPES.map((shp) => (
159
+ <View key={shp} style={{ marginBottom: spacingScaleV2[24] }}>
160
+ <Typography.SEText
161
+ type="heading_2"
162
+ style={{ marginBottom: spacingScaleV2[12] }}
163
+ >
164
+ shape = {shp}
165
+ </Typography.SEText>
166
+ <View style={[styles.row, { gap: spacingScaleV2[24] }]}>
167
+ {FAB_SIZES.map((sz) => (
168
+ <FAB
169
+ key={`${shp}-${sz}`}
170
+ size={sz}
171
+ shape={shp}
172
+ icon="add-fill"
173
+ skin="neutral"
174
+ intensity="soft-1"
175
+ iconColor="#4D4D4D"
176
+ style={{ backgroundColor: "#E6E6E6" }}
177
+ />
178
+ ))}
179
+ </View>
180
+ </View>
181
+ ))}
182
+ </View>
183
+ );
184
+ FABsStory.storyName = "FABs (Figma 2)";
185
+
186
+ export const CompositionExample = () => (
187
+ <ScrollView
188
+ style={{
189
+ padding: spacingScaleV2[24],
190
+ gap: spacingScaleV2[24],
191
+ backgroundColor: colors.surface.default,
192
+ }}
193
+ >
194
+ <Typography.SEText type="heading_1" style={{ marginBottom: spacingScaleV2[24] }}>
195
+ Exemplos de Composition Pattern
196
+ </Typography.SEText>
197
+
198
+ <View style={{ gap: spacingScaleV2[24] }}>
199
+ <View>
200
+ <Typography.SEText
201
+ type="detail_1_highlight"
202
+ style={{ marginBottom: spacingScaleV2[8] }}
203
+ >
204
+ ① Ícone à esquerda + Label
205
+ </Typography.SEText>
206
+ <ButtonV2.Root skin="brand" size="md">
207
+ <Leading>
208
+ <PlaceholderIcon name="plus" />
209
+ </Leading>
210
+ <Label>Criar Conta</Label>
211
+ </ButtonV2.Root>
212
+ </View>
213
+
214
+ <View>
215
+ <Typography.SEText
216
+ type="detail_1_highlight"
217
+ style={{ marginBottom: spacingScaleV2[8] }}
218
+ >
219
+ ② Badge + ícone trailing
220
+ </Typography.SEText>
221
+ <ButtonV2.Root skin="brand" intensity="base-2" size="md">
222
+ <Label>Notificações</Label>
223
+ <Badge skin="danger">3</Badge>
224
+ <Trailing>
225
+ <PlaceholderIcon name="chevron-right" />
226
+ </Trailing>
227
+ </ButtonV2.Root>
228
+ </View>
229
+
230
+ <View>
231
+ <Typography.SEText
232
+ type="detail_1_highlight"
233
+ style={{ marginBottom: spacingScaleV2[8] }}
234
+ >
235
+ ③ Loading state + Spinner explícito
236
+ </Typography.SEText>
237
+ <ButtonV2.Root skin="brand" size="lg" loading>
238
+ <Spinner />
239
+ <Label>Salvando...</Label>
240
+ </ButtonV2.Root>
241
+ </View>
242
+
243
+ <View>
244
+ <Typography.SEText
245
+ type="detail_1_highlight"
246
+ style={{ marginBottom: spacingScaleV2[8] }}
247
+ >
248
+ ④ Desabilitado
249
+ </Typography.SEText>
250
+ <ButtonV2.Root skin="green" intensity="strong-1" size="md" disabled>
251
+ <Label>Confirmado</Label>
252
+ </ButtonV2.Root>
253
+ </View>
254
+
255
+ <View>
256
+ <Typography.SEText
257
+ type="detail_1_highlight"
258
+ style={{ marginBottom: spacingScaleV2[8] }}
259
+ >
260
+ ⑤ Expand (largura 100%) + pill
261
+ </Typography.SEText>
262
+ <ButtonV2.Root skin="purple" intensity="strong-1" expand shape="pill">
263
+ <Leading>
264
+ <PlaceholderIcon name="check" />
265
+ </Leading>
266
+ <Label>Aprovar e continuar</Label>
267
+ </ButtonV2.Root>
268
+ </View>
269
+ </View>
270
+ </ScrollView>
271
+ );
272
+ CompositionExample.storyName = "Exemplos Composition";
273
+
274
+ export const KitchenSink = () => {
275
+ const [loading, setLoading] = React.useState(false);
276
+ const [disabled, setDisabled] = React.useState(false);
277
+ return (
278
+ <ScrollView style={{ padding: spacingScaleV2[24] }}>
279
+ <Typography.SEText type="heading_1" style={{ marginBottom: spacingScaleV2[16] }}>
280
+ Kitchen Sink (stress test)
281
+ </Typography.SEText>
282
+
283
+ <View style={[styles.row, { gap: spacingScaleV2[16], marginBottom: spacingScaleV2[24] }]}>
284
+ <RNButton
285
+ title={loading ? "Parar Loading" : "Ativar Loading"}
286
+ onPress={() => setLoading((l) => !l)}
287
+ />
288
+ <RNButton
289
+ title={disabled ? "Habilitar" : "Desabilitar"}
290
+ onPress={() => setDisabled((d) => !d)}
291
+ />
292
+ </View>
293
+
294
+ <ButtonV2.Root
295
+ skin="brand"
296
+ intensity="strong-1"
297
+ size="lg"
298
+ loading={loading}
299
+ disabled={disabled}
300
+ expand
301
+ >
302
+ <Leading>
303
+ <Avatar size={28} name="João" />
304
+ </Leading>
305
+ <Label numberOfLines={2}>João da Silva{"\n"}+ Dados do parceiro Sebrae</Label>
306
+ <Badge floating skin="danger">
307
+ 99+
308
+ </Badge>
309
+ <Trailing>
310
+ <PlaceholderIcon name="chevron-right" />
311
+ </Trailing>
312
+ </ButtonV2.Root>
313
+ </ScrollView>
314
+ );
315
+ };
316
+ KitchenSink.storyName = "Kitchen Sink";
317
+
318
+ const styles = StyleSheet.create({
319
+ row: { flexDirection: "row", alignItems: "center", flexWrap: "wrap" },
320
+ col: { flexDirection: "column" },
321
+ });
@@ -0,0 +1,64 @@
1
+ import React, { useContext } from "react";
2
+ import { StyleSheet } from "react-native";
3
+ import Root, { ButtonV2Context } from "./Root";
4
+ import Icon from "../Icon";
5
+ import Spinner from "./Spinner";
6
+ import { radius } from "@styles/tokens/radius";
7
+
8
+ function FAB(props) {
9
+ const {
10
+ size = "md",
11
+ shape = "square",
12
+ skin = "neutral",
13
+ intensity = "base-2",
14
+ icon,
15
+ onPress,
16
+ disabled = false,
17
+ loading = false,
18
+ testID,
19
+ style,
20
+ iconColor,
21
+ } = props;
22
+
23
+ const sizePx = { md: 56, lg: 80, xl: 112 }[size];
24
+ const iconSizePx = { md: 24, lg: 28, xl: 32 }[size];
25
+ const borderRadius = shape === "circle" ? radius.full : radius.lg;
26
+
27
+ return (
28
+ <Root
29
+ skin={skin}
30
+ intensity={intensity}
31
+ size="md"
32
+ onPress={onPress}
33
+ disabled={disabled}
34
+ loading={loading}
35
+ testID={testID}
36
+ style={StyleSheet.flatten([
37
+ {
38
+ width: sizePx,
39
+ height: sizePx,
40
+ aspectRatio: 1,
41
+ paddingHorizontal: 0,
42
+ justifyContent: "center",
43
+ alignItems: "center",
44
+ borderRadius,
45
+ },
46
+ style,
47
+ ])}
48
+ >
49
+ {loading ? (
50
+ <Spinner />
51
+ ) : icon ? (
52
+ <FABIconContent iconName={icon} iconSize={iconSizePx} overrideColor={iconColor} />
53
+ ) : null}
54
+ </Root>
55
+ );
56
+ }
57
+
58
+ function FABIconContent({ iconName, iconSize, overrideColor }) {
59
+ const ctx = useContext(ButtonV2Context);
60
+ const iconColor = overrideColor || ctx?.labelColor || undefined;
61
+ return <Icon name={iconName} size={iconSize} color={iconColor} />;
62
+ }
63
+
64
+ export default FAB;
@@ -0,0 +1,36 @@
1
+ import React, { useContext } from "react";
2
+ import { ButtonV2Context } from "./Root";
3
+ import Icon from "../Icon";
4
+ import Leading from "./Leading";
5
+ import Trailing from "./Trailing";
6
+
7
+ const ButtonV2Icon = ({ name, position = "left", color, size }) => {
8
+ const ctx = useContext(ButtonV2Context);
9
+
10
+ const finalSize = size || (ctx?.iconSize || 16);
11
+ const finalColor = color || (ctx?.iconColor || "black");
12
+
13
+ const iconNode = <Icon name={name} size={finalSize} color={finalColor} />;
14
+
15
+ if (position === "left") {
16
+ return <Leading>{iconNode}</Leading>;
17
+ }
18
+
19
+ if (position === "right") {
20
+ return <Trailing>{iconNode}</Trailing>;
21
+ }
22
+
23
+ if (position === "both") {
24
+ return (
25
+ <>
26
+ <Leading>{iconNode}</Leading>
27
+ <Trailing>{iconNode}</Trailing>
28
+ </>
29
+ );
30
+ }
31
+
32
+ return null;
33
+ };
34
+
35
+ ButtonV2Icon._isButtonV2Icon = true;
36
+ export default ButtonV2Icon;
@@ -0,0 +1,23 @@
1
+ import React, { useContext } from "react";
2
+ import { ButtonV2Context } from "./Root";
3
+ import Typography from "../Typography";
4
+
5
+ const Label = ({ children, textStyle, numberOfLines = 1 }) => {
6
+ const ctx = useContext(ButtonV2Context);
7
+ if (!ctx) return children;
8
+
9
+ if (ctx.isLoading === true) return null;
10
+
11
+ return (
12
+ <Typography.SEText
13
+ type={ctx.textType}
14
+ style={[{ color: ctx.labelColor, textAlign: "center" }, textStyle]}
15
+ numberOfLines={numberOfLines}
16
+ >
17
+ {children}
18
+ </Typography.SEText>
19
+ );
20
+ };
21
+
22
+ Label._isButtonV2Label = true;
23
+ export default Label;
@@ -0,0 +1,25 @@
1
+ import React, { useContext } from "react";
2
+ import { View } from "react-native";
3
+ import { ButtonV2Context } from "./Root";
4
+
5
+ const Leading = ({ children }) => {
6
+ const ctx = useContext(ButtonV2Context);
7
+ if (!ctx) return children;
8
+
9
+ if (ctx.isLoading === true) return null;
10
+
11
+ return (
12
+ <View
13
+ style={{
14
+ marginRight: ctx.gapIconeLabel,
15
+ flexDirection: "row",
16
+ alignItems: "center",
17
+ }}
18
+ >
19
+ {children}
20
+ </View>
21
+ );
22
+ };
23
+
24
+ Leading._isButtonV2Leading = true;
25
+ export default Leading;