@pagopa/io-app-design-system 5.3.9 → 5.4.1

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 (253) hide show
  1. package/README.md +3 -2
  2. package/lib/commonjs/components/accordion/AccordionItem.js +4 -2
  3. package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
  4. package/lib/commonjs/components/alert/Alert.js +5 -11
  5. package/lib/commonjs/components/alert/Alert.js.map +1 -1
  6. package/lib/commonjs/components/alert/AlertEdgeToEdge.js +3 -2
  7. package/lib/commonjs/components/alert/AlertEdgeToEdge.js.map +1 -1
  8. package/lib/commonjs/components/alert/AlertEdgeToEdgeWrapper.js +3 -2
  9. package/lib/commonjs/components/alert/AlertEdgeToEdgeWrapper.js.map +1 -1
  10. package/lib/commonjs/components/buttons/ButtonLink.js +5 -2
  11. package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
  12. package/lib/commonjs/components/buttons/ButtonOutline.js +20 -15
  13. package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
  14. package/lib/commonjs/components/buttons/ButtonSolid.js +4 -1
  15. package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
  16. package/lib/commonjs/components/buttons/IOButton/IOButton.js +230 -0
  17. package/lib/commonjs/components/buttons/IOButton/IOButton.js.map +1 -0
  18. package/lib/commonjs/components/buttons/IOButton/__test__/IOButton.test.js +43 -0
  19. package/lib/commonjs/components/buttons/IOButton/__test__/IOButton.test.js.map +1 -0
  20. package/lib/commonjs/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +391 -0
  21. package/lib/commonjs/components/buttons/IOButton/index.js +17 -0
  22. package/lib/commonjs/components/buttons/IOButton/index.js.map +1 -0
  23. package/lib/commonjs/components/buttons/IOButton/styles.js +166 -0
  24. package/lib/commonjs/components/buttons/IOButton/styles.js.map +1 -0
  25. package/lib/commonjs/components/buttons/IconButton.js +2 -3
  26. package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
  27. package/lib/commonjs/components/buttons/IconButtonContained.js +1 -2
  28. package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
  29. package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -402
  30. package/lib/commonjs/components/buttons/__test__/button.test.js +0 -24
  31. package/lib/commonjs/components/buttons/__test__/button.test.js.map +1 -1
  32. package/lib/commonjs/components/buttons/index.js +11 -0
  33. package/lib/commonjs/components/buttons/index.js.map +1 -1
  34. package/lib/commonjs/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +13 -30
  35. package/lib/commonjs/components/icons/Icon.js +11 -9
  36. package/lib/commonjs/components/icons/Icon.js.map +1 -1
  37. package/lib/commonjs/components/layout/FooterActions.js +10 -9
  38. package/lib/commonjs/components/layout/FooterActions.js.map +1 -1
  39. package/lib/commonjs/components/layout/FooterActionsInline.js +8 -8
  40. package/lib/commonjs/components/layout/FooterActionsInline.js.map +1 -1
  41. package/lib/commonjs/components/layout/GradientBottomActions.js +8 -8
  42. package/lib/commonjs/components/layout/GradientBottomActions.js.map +1 -1
  43. package/lib/commonjs/components/layout/GradientScrollView.js.map +1 -1
  44. package/lib/commonjs/components/layout/ModalBSHeader.js +3 -1
  45. package/lib/commonjs/components/layout/ModalBSHeader.js.map +1 -1
  46. package/lib/commonjs/components/listitems/ListItemAmount.js +3 -1
  47. package/lib/commonjs/components/listitems/ListItemAmount.js.map +1 -1
  48. package/lib/commonjs/components/listitems/ListItemCheckbox.js +3 -2
  49. package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
  50. package/lib/commonjs/components/listitems/ListItemHeader.js +4 -2
  51. package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
  52. package/lib/commonjs/components/listitems/ListItemInfo.js +3 -1
  53. package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
  54. package/lib/commonjs/components/listitems/ListItemInfoCopy.js +3 -1
  55. package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
  56. package/lib/commonjs/components/listitems/ListItemNav.js +1 -1
  57. package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
  58. package/lib/commonjs/components/listitems/ListItemNavAlert.js +3 -1
  59. package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
  60. package/lib/commonjs/components/listitems/ListItemRadio.js +10 -2
  61. package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
  62. package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -40
  63. package/lib/commonjs/components/loadingSpinner/LoadingSpinner.js +6 -6
  64. package/lib/commonjs/components/loadingSpinner/LoadingSpinner.js.map +1 -1
  65. package/lib/commonjs/components/numberpad/NumberButton.js +15 -2
  66. package/lib/commonjs/components/numberpad/NumberButton.js.map +1 -1
  67. package/lib/commonjs/components/numberpad/NumberPad.js +9 -6
  68. package/lib/commonjs/components/numberpad/NumberPad.js.map +1 -1
  69. package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +42 -96
  70. package/lib/commonjs/components/otpInput/OTPInput.js +3 -3
  71. package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
  72. package/lib/commonjs/components/radio/RadioButtonLabel.js +3 -3
  73. package/lib/commonjs/components/radio/RadioButtonLabel.js.map +1 -1
  74. package/lib/commonjs/components/stepper/Stepper.js +5 -2
  75. package/lib/commonjs/components/stepper/Stepper.js.map +1 -1
  76. package/lib/commonjs/components/typography/IOText.js +4 -1
  77. package/lib/commonjs/components/typography/IOText.js.map +1 -1
  78. package/lib/commonjs/core/IOStyles.js +3 -53
  79. package/lib/commonjs/core/IOStyles.js.map +1 -1
  80. package/lib/module/components/accordion/AccordionItem.js +5 -3
  81. package/lib/module/components/accordion/AccordionItem.js.map +1 -1
  82. package/lib/module/components/alert/Alert.js +6 -12
  83. package/lib/module/components/alert/Alert.js.map +1 -1
  84. package/lib/module/components/alert/AlertEdgeToEdge.js +3 -2
  85. package/lib/module/components/alert/AlertEdgeToEdge.js.map +1 -1
  86. package/lib/module/components/alert/AlertEdgeToEdgeWrapper.js +3 -2
  87. package/lib/module/components/alert/AlertEdgeToEdgeWrapper.js.map +1 -1
  88. package/lib/module/components/buttons/ButtonLink.js +6 -3
  89. package/lib/module/components/buttons/ButtonLink.js.map +1 -1
  90. package/lib/module/components/buttons/ButtonOutline.js +21 -16
  91. package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
  92. package/lib/module/components/buttons/ButtonSolid.js +4 -1
  93. package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
  94. package/lib/module/components/buttons/IOButton/IOButton.js +223 -0
  95. package/lib/module/components/buttons/IOButton/IOButton.js.map +1 -0
  96. package/lib/module/components/buttons/IOButton/__test__/IOButton.test.js +40 -0
  97. package/lib/module/components/buttons/IOButton/__test__/IOButton.test.js.map +1 -0
  98. package/lib/module/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +391 -0
  99. package/lib/module/components/buttons/IOButton/index.js +4 -0
  100. package/lib/module/components/buttons/IOButton/index.js.map +1 -0
  101. package/lib/module/components/buttons/IOButton/styles.js +160 -0
  102. package/lib/module/components/buttons/IOButton/styles.js.map +1 -0
  103. package/lib/module/components/buttons/IconButton.js +4 -5
  104. package/lib/module/components/buttons/IconButton.js.map +1 -1
  105. package/lib/module/components/buttons/IconButtonContained.js +2 -3
  106. package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
  107. package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -402
  108. package/lib/module/components/buttons/__test__/button.test.js +0 -24
  109. package/lib/module/components/buttons/__test__/button.test.js.map +1 -1
  110. package/lib/module/components/buttons/index.js +1 -0
  111. package/lib/module/components/buttons/index.js.map +1 -1
  112. package/lib/module/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +13 -30
  113. package/lib/module/components/icons/Icon.js +10 -7
  114. package/lib/module/components/icons/Icon.js.map +1 -1
  115. package/lib/module/components/layout/FooterActions.js +11 -10
  116. package/lib/module/components/layout/FooterActions.js.map +1 -1
  117. package/lib/module/components/layout/FooterActionsInline.js +9 -9
  118. package/lib/module/components/layout/FooterActionsInline.js.map +1 -1
  119. package/lib/module/components/layout/GradientBottomActions.js +9 -9
  120. package/lib/module/components/layout/GradientBottomActions.js.map +1 -1
  121. package/lib/module/components/layout/GradientScrollView.js.map +1 -1
  122. package/lib/module/components/layout/ModalBSHeader.js +4 -2
  123. package/lib/module/components/layout/ModalBSHeader.js.map +1 -1
  124. package/lib/module/components/listitems/ListItemAmount.js +4 -2
  125. package/lib/module/components/listitems/ListItemAmount.js.map +1 -1
  126. package/lib/module/components/listitems/ListItemCheckbox.js +4 -3
  127. package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
  128. package/lib/module/components/listitems/ListItemHeader.js +5 -3
  129. package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
  130. package/lib/module/components/listitems/ListItemInfo.js +4 -2
  131. package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
  132. package/lib/module/components/listitems/ListItemInfoCopy.js +4 -2
  133. package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
  134. package/lib/module/components/listitems/ListItemNav.js +2 -2
  135. package/lib/module/components/listitems/ListItemNav.js.map +1 -1
  136. package/lib/module/components/listitems/ListItemNavAlert.js +4 -2
  137. package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
  138. package/lib/module/components/listitems/ListItemRadio.js +11 -3
  139. package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
  140. package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -40
  141. package/lib/module/components/loadingSpinner/LoadingSpinner.js +6 -6
  142. package/lib/module/components/loadingSpinner/LoadingSpinner.js.map +1 -1
  143. package/lib/module/components/numberpad/NumberButton.js +16 -3
  144. package/lib/module/components/numberpad/NumberButton.js.map +1 -1
  145. package/lib/module/components/numberpad/NumberPad.js +10 -7
  146. package/lib/module/components/numberpad/NumberPad.js.map +1 -1
  147. package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +42 -96
  148. package/lib/module/components/otpInput/OTPInput.js +3 -3
  149. package/lib/module/components/otpInput/OTPInput.js.map +1 -1
  150. package/lib/module/components/radio/RadioButtonLabel.js +3 -3
  151. package/lib/module/components/radio/RadioButtonLabel.js.map +1 -1
  152. package/lib/module/components/stepper/Stepper.js +6 -3
  153. package/lib/module/components/stepper/Stepper.js.map +1 -1
  154. package/lib/module/components/typography/IOText.js +2 -0
  155. package/lib/module/components/typography/IOText.js.map +1 -1
  156. package/lib/module/core/IOStyles.js +3 -53
  157. package/lib/module/core/IOStyles.js.map +1 -1
  158. package/lib/typescript/components/accordion/AccordionItem.d.ts.map +1 -1
  159. package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
  160. package/lib/typescript/components/alert/AlertEdgeToEdge.d.ts.map +1 -1
  161. package/lib/typescript/components/alert/AlertEdgeToEdgeWrapper.d.ts.map +1 -1
  162. package/lib/typescript/components/buttons/ButtonLink.d.ts +3 -0
  163. package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
  164. package/lib/typescript/components/buttons/ButtonOutline.d.ts +3 -0
  165. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
  166. package/lib/typescript/components/buttons/ButtonSolid.d.ts +3 -0
  167. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
  168. package/lib/typescript/components/buttons/IOButton/IOButton.d.ts +57 -0
  169. package/lib/typescript/components/buttons/IOButton/IOButton.d.ts.map +1 -0
  170. package/lib/typescript/components/buttons/IOButton/__test__/IOButton.test.d.ts +2 -0
  171. package/lib/typescript/components/buttons/IOButton/__test__/IOButton.test.d.ts.map +1 -0
  172. package/lib/typescript/components/buttons/IOButton/index.d.ts +2 -0
  173. package/lib/typescript/components/buttons/IOButton/index.d.ts.map +1 -0
  174. package/lib/typescript/components/buttons/IOButton/styles.d.ts +35 -0
  175. package/lib/typescript/components/buttons/IOButton/styles.d.ts.map +1 -0
  176. package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
  177. package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
  178. package/lib/typescript/components/buttons/index.d.ts +1 -0
  179. package/lib/typescript/components/buttons/index.d.ts.map +1 -1
  180. package/lib/typescript/components/icons/Icon.d.ts +1 -4
  181. package/lib/typescript/components/icons/Icon.d.ts.map +1 -1
  182. package/lib/typescript/components/icons/types.d.ts +3 -2
  183. package/lib/typescript/components/icons/types.d.ts.map +1 -1
  184. package/lib/typescript/components/layout/FooterActions.d.ts +10 -8
  185. package/lib/typescript/components/layout/FooterActions.d.ts.map +1 -1
  186. package/lib/typescript/components/layout/FooterActionsInline.d.ts +5 -4
  187. package/lib/typescript/components/layout/FooterActionsInline.d.ts.map +1 -1
  188. package/lib/typescript/components/layout/GradientBottomActions.d.ts +12 -6
  189. package/lib/typescript/components/layout/GradientBottomActions.d.ts.map +1 -1
  190. package/lib/typescript/components/layout/GradientScrollView.d.ts.map +1 -1
  191. package/lib/typescript/components/listitems/ListItemAmount.d.ts.map +1 -1
  192. package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -1
  193. package/lib/typescript/components/listitems/ListItemHeader.d.ts.map +1 -1
  194. package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
  195. package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
  196. package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
  197. package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
  198. package/lib/typescript/components/loadingSpinner/LoadingSpinner.d.ts +2 -2
  199. package/lib/typescript/components/loadingSpinner/LoadingSpinner.d.ts.map +1 -1
  200. package/lib/typescript/components/numberpad/NumberButton.d.ts +11 -0
  201. package/lib/typescript/components/numberpad/NumberButton.d.ts.map +1 -1
  202. package/lib/typescript/components/numberpad/NumberPad.d.ts.map +1 -1
  203. package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
  204. package/lib/typescript/components/radio/RadioButtonLabel.d.ts.map +1 -1
  205. package/lib/typescript/components/stepper/Stepper.d.ts.map +1 -1
  206. package/lib/typescript/components/typography/IOText.d.ts +1 -0
  207. package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
  208. package/lib/typescript/core/IOStyles.d.ts +0 -47
  209. package/lib/typescript/core/IOStyles.d.ts.map +1 -1
  210. package/package.json +1 -1
  211. package/src/components/accordion/AccordionItem.tsx +7 -14
  212. package/src/components/alert/Alert.tsx +7 -21
  213. package/src/components/alert/AlertEdgeToEdge.tsx +1 -2
  214. package/src/components/alert/AlertEdgeToEdgeWrapper.tsx +1 -2
  215. package/src/components/buttons/ButtonLink.tsx +6 -6
  216. package/src/components/buttons/ButtonOutline.tsx +21 -21
  217. package/src/components/buttons/ButtonSolid.tsx +4 -1
  218. package/src/components/buttons/IOButton/IOButton.tsx +363 -0
  219. package/src/components/buttons/IOButton/__test__/IOButton.test.tsx +46 -0
  220. package/src/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +391 -0
  221. package/src/components/buttons/IOButton/index.tsx +1 -0
  222. package/src/components/buttons/IOButton/styles.tsx +228 -0
  223. package/src/components/buttons/IconButton.tsx +4 -9
  224. package/src/components/buttons/IconButtonContained.tsx +3 -6
  225. package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -402
  226. package/src/components/buttons/__test__/button.test.tsx +1 -33
  227. package/src/components/buttons/index.tsx +1 -0
  228. package/src/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +13 -30
  229. package/src/components/icons/Icon.tsx +12 -3
  230. package/src/components/icons/types.ts +3 -2
  231. package/src/components/layout/FooterActions.tsx +26 -14
  232. package/src/components/layout/FooterActionsInline.tsx +19 -12
  233. package/src/components/layout/GradientBottomActions.tsx +17 -18
  234. package/src/components/layout/GradientScrollView.tsx +2 -1
  235. package/src/components/layout/ModalBSHeader.tsx +2 -2
  236. package/src/components/listitems/ListItemAmount.tsx +1 -2
  237. package/src/components/listitems/ListItemCheckbox.tsx +8 -11
  238. package/src/components/listitems/ListItemHeader.tsx +2 -3
  239. package/src/components/listitems/ListItemInfo.tsx +1 -2
  240. package/src/components/listitems/ListItemInfoCopy.tsx +1 -2
  241. package/src/components/listitems/ListItemNav.tsx +1 -1
  242. package/src/components/listitems/ListItemNavAlert.tsx +1 -2
  243. package/src/components/listitems/ListItemRadio.tsx +7 -7
  244. package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -40
  245. package/src/components/loadingSpinner/LoadingSpinner.tsx +8 -8
  246. package/src/components/numberpad/NumberButton.tsx +18 -11
  247. package/src/components/numberpad/NumberPad.tsx +8 -10
  248. package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +42 -96
  249. package/src/components/otpInput/OTPInput.tsx +1 -2
  250. package/src/components/radio/RadioButtonLabel.tsx +7 -10
  251. package/src/components/stepper/Stepper.tsx +7 -12
  252. package/src/components/typography/IOText.tsx +3 -0
  253. package/src/core/IOStyles.ts +3 -55
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.IOButton = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeHapticFeedback = _interopRequireDefault(require("react-native-haptic-feedback"));
10
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
11
+ var _core = require("../../../core");
12
+ var _hooks = require("../../../hooks");
13
+ var _icons = require("../../icons");
14
+ var _loadingSpinner = require("../../loadingSpinner");
15
+ var _typography = require("../../typography");
16
+ var _ButtonText = require("../../typography/ButtonText");
17
+ var _styles = require("./styles");
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
+ const IOButton = exports.IOButton = /*#__PURE__*/(0, _react.forwardRef)(({
23
+ variant = "solid",
24
+ color = "primary",
25
+ label,
26
+ fullWidth = false,
27
+ disabled = false,
28
+ loading = false,
29
+ numberOfLines = 1,
30
+ textAlign = "auto",
31
+ icon,
32
+ iconPosition = "start",
33
+ onPress,
34
+ accessibilityLabel,
35
+ accessibilityHint,
36
+ accessibilityRole = "button",
37
+ testID
38
+ }, ref) => {
39
+ const mapColorStates = (0, _styles.useButtonColorMap)(variant);
40
+ const {
41
+ progress,
42
+ onPressIn,
43
+ onPressOut,
44
+ scaleAnimatedStyle
45
+ } = (0, _hooks.useScaleAnimation)();
46
+ const {
47
+ buttonAnimatedStyle,
48
+ labelAnimatedStyle,
49
+ iconColorAnimatedStyle
50
+ } = (0, _styles.useButtonAnimatedStyles)(variant, color, progress);
51
+ const reducedMotion = (0, _reactNativeReanimated.useReducedMotion)();
52
+ const {
53
+ newTypefaceEnabled
54
+ } = (0, _core.useIONewTypeface)();
55
+ const isLinkButton = variant === "link";
56
+
57
+ // ---------------------------------------
58
+ // VISUAL ATTRIBUTES
59
+ // ---------------------------------------
60
+ const btnIconSizeMap = {
61
+ solid: 20,
62
+ outline: 20,
63
+ link: 24
64
+ };
65
+ const btnBorderWidthMap = {
66
+ solid: 0,
67
+ outline: 2,
68
+ link: 0
69
+ };
70
+ const btnPaddingHorizontalMap = {
71
+ default: 24,
72
+ fullWidth: 16,
73
+ link: 0
74
+ };
75
+ const btnLinkHitSlop = {
76
+ top: 14,
77
+ right: 24,
78
+ bottom: 14,
79
+ left: 24
80
+ };
81
+ const btnIconSize = btnIconSizeMap[variant];
82
+ const btnBorderWidth = btnBorderWidthMap[variant];
83
+ const btnBorderRadius = 8;
84
+ const btnSizeDefault = 48;
85
+ const ICON_MARGIN = 8;
86
+ const DISABLED_OPACITY = 0.5;
87
+
88
+ // Background color
89
+ const backgroundColor = disabled ? mapColorStates[color].background.disabled : mapColorStates[color].background.default;
90
+
91
+ // Label & Icons colors
92
+ const foregroundColor = disabled ? mapColorStates[color]?.foreground?.disabled : mapColorStates[color]?.foreground?.default;
93
+
94
+ // ---------------------------------------
95
+ // BUTTON INNER LOGIC
96
+ // ---------------------------------------
97
+
98
+ /* Prevent the component from triggering the `isEntering' transition
99
+ on the on the first render. Solution from this discussion:
100
+ https://github.com/software-mansion/react-native-reanimated/discussions/2513
101
+ */
102
+ const isMounted = (0, _react.useRef)(false);
103
+ (0, _react.useEffect)(() => {
104
+ // eslint-disable-next-line functional/immutable-data
105
+ isMounted.current = true;
106
+ }, []);
107
+ const handleOnPress = (0, _react.useCallback)(event => {
108
+ /* Don't call `onPress` if the button is
109
+ in loading state */
110
+ if (loading) {
111
+ return;
112
+ }
113
+ _reactNativeHapticFeedback.default.trigger("impactLight");
114
+ onPress(event);
115
+ }, [loading, onPress]);
116
+
117
+ // ---------------------------------------
118
+ // BUTTON INNER CONTENT
119
+ // ---------------------------------------
120
+ const renderButtonContent = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
121
+ children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
122
+ style: styles.buttonInner,
123
+ entering: isMounted.current ? _core.enterTransitionInnerContentSmall : undefined,
124
+ exiting: _core.exitTransitionInnerContent,
125
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_loadingSpinner.LoadingSpinner, {
126
+ color: foregroundColor
127
+ })
128
+ }), !loading && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
129
+ style: [styles.buttonInner, {
130
+ columnGap: ICON_MARGIN
131
+ }, iconPosition === "end" && {
132
+ flexDirection: "row-reverse"
133
+ }],
134
+ entering: isMounted.current ? _core.enterTransitionInnerContent : undefined,
135
+ children: [icon && (!disabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AnimatedIconWithColorTransition, {
136
+ allowFontScaling: true,
137
+ name: icon,
138
+ animatedProps: iconColorAnimatedStyle,
139
+ size: btnIconSize
140
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AnimatedIcon, {
141
+ allowFontScaling: true,
142
+ name: icon,
143
+ color: mapColorStates[color]?.foreground?.disabled,
144
+ size: btnIconSize
145
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.AnimatedIOText, {
146
+ font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
147
+ weight: "Semibold",
148
+ size: _ButtonText.buttonTextFontSize,
149
+ lineHeight: isLinkButton ? _ButtonText.buttonTextLineHeight : undefined,
150
+ accessible: false,
151
+ accessibilityElementsHidden: true,
152
+ importantForAccessibility: "no-hide-descendants",
153
+ numberOfLines: numberOfLines,
154
+ ellipsizeMode: "tail",
155
+ style: [{
156
+ textAlign
157
+ }, disabled ? {
158
+ color: mapColorStates[color]?.foreground?.disabled
159
+ } : {
160
+ ...labelAnimatedStyle
161
+ }],
162
+ children: label
163
+ })]
164
+ })]
165
+ });
166
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
167
+ ref: ref,
168
+ accessible: true
169
+ // Using || operator because empty string is not an accepted value
170
+ ,
171
+ accessibilityLabel: accessibilityLabel || label,
172
+ accessibilityHint: accessibilityHint,
173
+ accessibilityRole: accessibilityRole,
174
+ accessibilityState: {
175
+ busy: loading,
176
+ disabled: disabled || false
177
+ },
178
+ onPress: handleOnPress,
179
+ onPressIn: onPressIn,
180
+ onPressOut: onPressOut,
181
+ disabled: disabled,
182
+ hitSlop: isLinkButton ? btnLinkHitSlop : undefined,
183
+ style: isLinkButton ? {
184
+ alignSelf: "flex-start"
185
+ } : fullWidth ? {
186
+ flexShrink: 0,
187
+ alignSelf: "stretch"
188
+ } : {
189
+ flexShrink: 1,
190
+ alignSelf: "auto"
191
+ },
192
+ testID: testID,
193
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
194
+ style: [styles.button, {
195
+ paddingHorizontal: isLinkButton ? btnPaddingHorizontalMap.link : fullWidth ? btnPaddingHorizontalMap.fullWidth : btnPaddingHorizontalMap.default
196
+ }, {
197
+ height: isLinkButton ? undefined : btnSizeDefault,
198
+ backgroundColor,
199
+ borderWidth: btnBorderWidth,
200
+ borderRadius: btnBorderRadius,
201
+ borderColor: foregroundColor
202
+ }, disabled ? {
203
+ opacity: DISABLED_OPACITY
204
+ } : {},
205
+ /* Prevent Reanimated from overriding background colors
206
+ if button is disabled */
207
+ !disabled && !reducedMotion && scaleAnimatedStyle, !disabled && buttonAnimatedStyle],
208
+ children: renderButtonContent()
209
+ })
210
+ });
211
+ });
212
+ const styles = _reactNative.StyleSheet.create({
213
+ button: {
214
+ flexDirection: "row",
215
+ alignItems: "center",
216
+ justifyContent: "center",
217
+ textAlignVertical: "center",
218
+ // Prop supported on Android only
219
+ borderCurve: "continuous",
220
+ overflow: "hidden",
221
+ elevation: 0
222
+ },
223
+ buttonInner: {
224
+ flexDirection: "row",
225
+ alignItems: "center",
226
+ justifyContent: "center"
227
+ }
228
+ });
229
+ var _default = exports.default = IOButton;
230
+ //# sourceMappingURL=IOButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeHapticFeedback","_interopRequireDefault","_reactNativeReanimated","_core","_hooks","_icons","_loadingSpinner","_typography","_ButtonText","_styles","_jsxRuntime","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IOButton","exports","forwardRef","variant","color","label","fullWidth","disabled","loading","numberOfLines","textAlign","icon","iconPosition","onPress","accessibilityLabel","accessibilityHint","accessibilityRole","testID","ref","mapColorStates","useButtonColorMap","progress","onPressIn","onPressOut","scaleAnimatedStyle","useScaleAnimation","buttonAnimatedStyle","labelAnimatedStyle","iconColorAnimatedStyle","useButtonAnimatedStyles","reducedMotion","useReducedMotion","newTypefaceEnabled","useIONewTypeface","isLinkButton","btnIconSizeMap","solid","outline","link","btnBorderWidthMap","btnPaddingHorizontalMap","btnLinkHitSlop","top","right","bottom","left","btnIconSize","btnBorderWidth","btnBorderRadius","btnSizeDefault","ICON_MARGIN","DISABLED_OPACITY","backgroundColor","background","foregroundColor","foreground","isMounted","useRef","useEffect","current","handleOnPress","useCallback","event","ReactNativeHapticFeedback","trigger","renderButtonContent","jsxs","Fragment","children","jsx","View","style","styles","buttonInner","entering","enterTransitionInnerContentSmall","undefined","exiting","exitTransitionInnerContent","LoadingSpinner","columnGap","flexDirection","enterTransitionInnerContent","AnimatedIconWithColorTransition","allowFontScaling","name","animatedProps","size","AnimatedIcon","AnimatedIOText","font","weight","buttonTextFontSize","lineHeight","buttonTextLineHeight","accessible","accessibilityElementsHidden","importantForAccessibility","ellipsizeMode","Pressable","accessibilityState","busy","hitSlop","alignSelf","flexShrink","button","paddingHorizontal","height","borderWidth","borderRadius","borderColor","opacity","StyleSheet","create","alignItems","justifyContent","textAlignVertical","borderCurve","overflow","elevation","_default"],"sourceRoot":"../../../../../src","sources":["components/buttons/IOButton/IOButton.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AAYA,IAAAE,0BAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAL,uBAAA,CAA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,CAAC;EACD9C,WAAW,EAAE;IACXQ,aAAa,EAAE,KAAK;IACpBiC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC;AAAC,IAAAK,QAAA,GAAAvH,OAAA,CAAAnB,OAAA,GAEYkB,QAAQ","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ var _react = _interopRequireDefault(require("react"));
4
+ var _reactNative = require("react-native");
5
+ var TestRenderer = _interopRequireWildcard(require("react-test-renderer"));
6
+ var _IOButton = _interopRequireDefault(require("../IOButton"));
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ const onButtonPress = () => {
12
+ _reactNative.Alert.alert("Alert", "Action triggered");
13
+ };
14
+ describe("Test Buttons Components", () => {
15
+ it("IOButton Snapshot · Solid variant", () => {
16
+ const buttonSolid = TestRenderer.create(/*#__PURE__*/(0, _jsxRuntime.jsx)(_IOButton.default, {
17
+ variant: "solid",
18
+ label: "label",
19
+ accessibilityLabel: "accessibilityLabel",
20
+ onPress: onButtonPress
21
+ })).toJSON();
22
+ expect(buttonSolid).toMatchSnapshot();
23
+ });
24
+ it("IOButton Snapshot · Link variant", () => {
25
+ const buttonLink = TestRenderer.create(/*#__PURE__*/(0, _jsxRuntime.jsx)(_IOButton.default, {
26
+ variant: "link",
27
+ label: "label",
28
+ accessibilityLabel: "accessibilityLabel",
29
+ onPress: onButtonPress
30
+ })).toJSON();
31
+ expect(buttonLink).toMatchSnapshot();
32
+ });
33
+ it("IOButton Snapshot · Outline variant", () => {
34
+ const buttonOutline = TestRenderer.create(/*#__PURE__*/(0, _jsxRuntime.jsx)(_IOButton.default, {
35
+ variant: "outline",
36
+ label: "label",
37
+ accessibilityLabel: "accessibilityLabel",
38
+ onPress: onButtonPress
39
+ })).toJSON();
40
+ expect(buttonOutline).toMatchSnapshot();
41
+ });
42
+ });
43
+ //# sourceMappingURL=IOButton.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","TestRenderer","_interopRequireWildcard","_IOButton","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","onButtonPress","Alert","alert","describe","it","buttonSolid","create","jsx","variant","label","accessibilityLabel","onPress","toJSON","expect","toMatchSnapshot","buttonLink","buttonOutline"],"sourceRoot":"../../../../../../src","sources":["components/buttons/IOButton/__test__/IOButton.test.tsx"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,SAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAmC,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE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CAAA4B,GAAA,EAAC7B,SAAA,CAAAQ,OAAQ;MACPsB,OAAO,EAAC,OAAO;MACfC,KAAK,EAAE,OAAQ;MACfC,kBAAkB,EAAE,oBAAqB;MACzCC,OAAO,EAAEX;IAAc,CACd,CACb,CAAC,CAACY,MAAM,CAAC,CAAC;IACVC,MAAM,CAACR,WAAW,CAAC,CAACS,eAAe,CAAC,CAAC;EACvC,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,MAAM;IAC3C,MAAMW,UAAU,GAAGvC,YAAY,CAAC8B,MAAM,cACpC,IAAA3B,WAAA,CAAA4B,GAAA,EAAC7B,SAAA,CAAAQ,OAAQ;MACPsB,OAAO,EAAC,MAAM;MACdC,KAAK,EAAE,OAAQ;MACfC,kBAAkB,EAAE,oBAAqB;MACzCC,OAAO,EAAEX;IAAc,CACd,CACb,CAAC,CAACY,MAAM,CAAC,CAAC;IACVC,MAAM,CAACE,UAAU,CAAC,CAACD,eAAe,CAAC,CAAC;EACtC,CAAC,CAAC;EAEFV,EAAE,CAAC,qCAAqC,EAAE,MAAM;IAC9C,MAAMY,aAAa,GAAGxC,YAAY,CAAC8B,MAAM,cACvC,IAAA3B,WAAA,CAAA4B,GAAA,EAAC7B,SAAA,CAAAQ,OAAQ;MACPsB,OAAO,EAAC,SAAS;MACjBC,KAAK,EAAE,OAAQ;MACfC,kBAAkB,EAAE,oBAAqB;MACzCC,OAAO,EAAEX;IAAc,CACd,CACb,CAAC,CAACY,MAAM,CAAC,CAAC;IACVC,MAAM,CAACG,aAAa,CAAC,CAACF,eAAe,CAAC,CAAC;EACzC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,391 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Test Buttons Components IOButton Snapshot · Link variant 1`] = `
4
+ <View
5
+ accessibilityLabel="accessibilityLabel"
6
+ accessibilityRole="button"
7
+ accessibilityState={
8
+ {
9
+ "busy": false,
10
+ "checked": undefined,
11
+ "disabled": false,
12
+ "expanded": undefined,
13
+ "selected": undefined,
14
+ }
15
+ }
16
+ accessibilityValue={
17
+ {
18
+ "max": undefined,
19
+ "min": undefined,
20
+ "now": undefined,
21
+ "text": undefined,
22
+ }
23
+ }
24
+ accessible={true}
25
+ collapsable={false}
26
+ focusable={true}
27
+ hitSlop={
28
+ {
29
+ "bottom": 14,
30
+ "left": 24,
31
+ "right": 24,
32
+ "top": 14,
33
+ }
34
+ }
35
+ onBlur={[Function]}
36
+ onClick={[Function]}
37
+ onFocus={[Function]}
38
+ onResponderGrant={[Function]}
39
+ onResponderMove={[Function]}
40
+ onResponderRelease={[Function]}
41
+ onResponderTerminate={[Function]}
42
+ onResponderTerminationRequest={[Function]}
43
+ onStartShouldSetResponder={[Function]}
44
+ style={
45
+ {
46
+ "alignSelf": "flex-start",
47
+ }
48
+ }
49
+ >
50
+ <View
51
+ style={
52
+ [
53
+ {
54
+ "alignItems": "center",
55
+ "borderCurve": "continuous",
56
+ "elevation": 0,
57
+ "flexDirection": "row",
58
+ "justifyContent": "center",
59
+ "overflow": "hidden",
60
+ "textAlignVertical": "center",
61
+ },
62
+ {
63
+ "paddingHorizontal": 0,
64
+ },
65
+ {
66
+ "backgroundColor": "transparent",
67
+ "borderColor": "#0B3EE3",
68
+ "borderRadius": 8,
69
+ "borderWidth": 0,
70
+ "height": undefined,
71
+ },
72
+ {},
73
+ {
74
+ "transform": [
75
+ {
76
+ "scale": undefined,
77
+ },
78
+ ],
79
+ },
80
+ {},
81
+ ]
82
+ }
83
+ >
84
+ <View
85
+ style={
86
+ [
87
+ {
88
+ "alignItems": "center",
89
+ "flexDirection": "row",
90
+ "justifyContent": "center",
91
+ },
92
+ {
93
+ "columnGap": 8,
94
+ },
95
+ false,
96
+ ]
97
+ }
98
+ >
99
+ <Text
100
+ accessibilityElementsHidden={true}
101
+ accessible={false}
102
+ allowFontScaling={true}
103
+ ellipsizeMode="tail"
104
+ importantForAccessibility="no-hide-descendants"
105
+ maxFontSizeMultiplier={1.5}
106
+ numberOfLines={1}
107
+ style={
108
+ [
109
+ {},
110
+ {
111
+ "color": "#0E0F13",
112
+ "fontFamily": "Titillio",
113
+ "fontSize": 16,
114
+ "fontStyle": "normal",
115
+ "fontWeight": "600",
116
+ "lineHeight": 20,
117
+ },
118
+ [
119
+ {
120
+ "textAlign": "auto",
121
+ },
122
+ {
123
+ "color": undefined,
124
+ },
125
+ ],
126
+ ]
127
+ }
128
+ >
129
+ label
130
+ </Text>
131
+ </View>
132
+ </View>
133
+ </View>
134
+ `;
135
+
136
+ exports[`Test Buttons Components IOButton Snapshot · Outline variant 1`] = `
137
+ <View
138
+ accessibilityLabel="accessibilityLabel"
139
+ accessibilityRole="button"
140
+ accessibilityState={
141
+ {
142
+ "busy": false,
143
+ "checked": undefined,
144
+ "disabled": false,
145
+ "expanded": undefined,
146
+ "selected": undefined,
147
+ }
148
+ }
149
+ accessibilityValue={
150
+ {
151
+ "max": undefined,
152
+ "min": undefined,
153
+ "now": undefined,
154
+ "text": undefined,
155
+ }
156
+ }
157
+ accessible={true}
158
+ collapsable={false}
159
+ focusable={true}
160
+ onBlur={[Function]}
161
+ onClick={[Function]}
162
+ onFocus={[Function]}
163
+ onResponderGrant={[Function]}
164
+ onResponderMove={[Function]}
165
+ onResponderRelease={[Function]}
166
+ onResponderTerminate={[Function]}
167
+ onResponderTerminationRequest={[Function]}
168
+ onStartShouldSetResponder={[Function]}
169
+ style={
170
+ {
171
+ "alignSelf": "auto",
172
+ "flexShrink": 1,
173
+ }
174
+ }
175
+ >
176
+ <View
177
+ style={
178
+ [
179
+ {
180
+ "alignItems": "center",
181
+ "borderCurve": "continuous",
182
+ "elevation": 0,
183
+ "flexDirection": "row",
184
+ "justifyContent": "center",
185
+ "overflow": "hidden",
186
+ "textAlignVertical": "center",
187
+ },
188
+ {
189
+ "paddingHorizontal": 24,
190
+ },
191
+ {
192
+ "backgroundColor": "rgba(9,50,182,0)",
193
+ "borderColor": "#0B3EE3",
194
+ "borderRadius": 8,
195
+ "borderWidth": 2,
196
+ "height": 48,
197
+ },
198
+ {},
199
+ {
200
+ "transform": [
201
+ {
202
+ "scale": undefined,
203
+ },
204
+ ],
205
+ },
206
+ {
207
+ "backgroundColor": undefined,
208
+ "borderColor": undefined,
209
+ },
210
+ ]
211
+ }
212
+ >
213
+ <View
214
+ style={
215
+ [
216
+ {
217
+ "alignItems": "center",
218
+ "flexDirection": "row",
219
+ "justifyContent": "center",
220
+ },
221
+ {
222
+ "columnGap": 8,
223
+ },
224
+ false,
225
+ ]
226
+ }
227
+ >
228
+ <Text
229
+ accessibilityElementsHidden={true}
230
+ accessible={false}
231
+ allowFontScaling={true}
232
+ ellipsizeMode="tail"
233
+ importantForAccessibility="no-hide-descendants"
234
+ maxFontSizeMultiplier={1.5}
235
+ numberOfLines={1}
236
+ style={
237
+ [
238
+ {},
239
+ {
240
+ "color": "#0E0F13",
241
+ "fontFamily": "Titillio",
242
+ "fontSize": 16,
243
+ "fontStyle": "normal",
244
+ "fontWeight": "600",
245
+ "lineHeight": undefined,
246
+ },
247
+ [
248
+ {
249
+ "textAlign": "auto",
250
+ },
251
+ {
252
+ "color": undefined,
253
+ },
254
+ ],
255
+ ]
256
+ }
257
+ >
258
+ label
259
+ </Text>
260
+ </View>
261
+ </View>
262
+ </View>
263
+ `;
264
+
265
+ exports[`Test Buttons Components IOButton Snapshot · Solid variant 1`] = `
266
+ <View
267
+ accessibilityLabel="accessibilityLabel"
268
+ accessibilityRole="button"
269
+ accessibilityState={
270
+ {
271
+ "busy": false,
272
+ "checked": undefined,
273
+ "disabled": false,
274
+ "expanded": undefined,
275
+ "selected": undefined,
276
+ }
277
+ }
278
+ accessibilityValue={
279
+ {
280
+ "max": undefined,
281
+ "min": undefined,
282
+ "now": undefined,
283
+ "text": undefined,
284
+ }
285
+ }
286
+ accessible={true}
287
+ collapsable={false}
288
+ focusable={true}
289
+ onBlur={[Function]}
290
+ onClick={[Function]}
291
+ onFocus={[Function]}
292
+ onResponderGrant={[Function]}
293
+ onResponderMove={[Function]}
294
+ onResponderRelease={[Function]}
295
+ onResponderTerminate={[Function]}
296
+ onResponderTerminationRequest={[Function]}
297
+ onStartShouldSetResponder={[Function]}
298
+ style={
299
+ {
300
+ "alignSelf": "auto",
301
+ "flexShrink": 1,
302
+ }
303
+ }
304
+ >
305
+ <View
306
+ style={
307
+ [
308
+ {
309
+ "alignItems": "center",
310
+ "borderCurve": "continuous",
311
+ "elevation": 0,
312
+ "flexDirection": "row",
313
+ "justifyContent": "center",
314
+ "overflow": "hidden",
315
+ "textAlignVertical": "center",
316
+ },
317
+ {
318
+ "paddingHorizontal": 24,
319
+ },
320
+ {
321
+ "backgroundColor": "#0B3EE3",
322
+ "borderColor": "#FFFFFF",
323
+ "borderRadius": 8,
324
+ "borderWidth": 0,
325
+ "height": 48,
326
+ },
327
+ {},
328
+ {
329
+ "transform": [
330
+ {
331
+ "scale": undefined,
332
+ },
333
+ ],
334
+ },
335
+ {
336
+ "backgroundColor": undefined,
337
+ },
338
+ ]
339
+ }
340
+ >
341
+ <View
342
+ style={
343
+ [
344
+ {
345
+ "alignItems": "center",
346
+ "flexDirection": "row",
347
+ "justifyContent": "center",
348
+ },
349
+ {
350
+ "columnGap": 8,
351
+ },
352
+ false,
353
+ ]
354
+ }
355
+ >
356
+ <Text
357
+ accessibilityElementsHidden={true}
358
+ accessible={false}
359
+ allowFontScaling={true}
360
+ ellipsizeMode="tail"
361
+ importantForAccessibility="no-hide-descendants"
362
+ maxFontSizeMultiplier={1.5}
363
+ numberOfLines={1}
364
+ style={
365
+ [
366
+ {},
367
+ {
368
+ "color": "#0E0F13",
369
+ "fontFamily": "Titillio",
370
+ "fontSize": 16,
371
+ "fontStyle": "normal",
372
+ "fontWeight": "600",
373
+ "lineHeight": undefined,
374
+ },
375
+ [
376
+ {
377
+ "textAlign": "auto",
378
+ },
379
+ {
380
+ "color": undefined,
381
+ },
382
+ ],
383
+ ]
384
+ }
385
+ >
386
+ label
387
+ </Text>
388
+ </View>
389
+ </View>
390
+ </View>
391
+ `;