@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.
- package/README.md +3 -2
- package/lib/commonjs/components/accordion/AccordionItem.js +4 -2
- package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
- package/lib/commonjs/components/alert/Alert.js +5 -11
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/alert/AlertEdgeToEdge.js +3 -2
- package/lib/commonjs/components/alert/AlertEdgeToEdge.js.map +1 -1
- package/lib/commonjs/components/alert/AlertEdgeToEdgeWrapper.js +3 -2
- package/lib/commonjs/components/alert/AlertEdgeToEdgeWrapper.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonLink.js +5 -2
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +20 -15
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js +4 -1
- package/lib/commonjs/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/commonjs/components/buttons/IOButton/IOButton.js +230 -0
- package/lib/commonjs/components/buttons/IOButton/IOButton.js.map +1 -0
- package/lib/commonjs/components/buttons/IOButton/__test__/IOButton.test.js +43 -0
- package/lib/commonjs/components/buttons/IOButton/__test__/IOButton.test.js.map +1 -0
- package/lib/commonjs/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +391 -0
- package/lib/commonjs/components/buttons/IOButton/index.js +17 -0
- package/lib/commonjs/components/buttons/IOButton/index.js.map +1 -0
- package/lib/commonjs/components/buttons/IOButton/styles.js +166 -0
- package/lib/commonjs/components/buttons/IOButton/styles.js.map +1 -0
- package/lib/commonjs/components/buttons/IconButton.js +2 -3
- package/lib/commonjs/components/buttons/IconButton.js.map +1 -1
- package/lib/commonjs/components/buttons/IconButtonContained.js +1 -2
- package/lib/commonjs/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -402
- package/lib/commonjs/components/buttons/__test__/button.test.js +0 -24
- package/lib/commonjs/components/buttons/__test__/button.test.js.map +1 -1
- package/lib/commonjs/components/buttons/index.js +11 -0
- package/lib/commonjs/components/buttons/index.js.map +1 -1
- package/lib/commonjs/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +13 -30
- package/lib/commonjs/components/icons/Icon.js +11 -9
- package/lib/commonjs/components/icons/Icon.js.map +1 -1
- package/lib/commonjs/components/layout/FooterActions.js +10 -9
- package/lib/commonjs/components/layout/FooterActions.js.map +1 -1
- package/lib/commonjs/components/layout/FooterActionsInline.js +8 -8
- package/lib/commonjs/components/layout/FooterActionsInline.js.map +1 -1
- package/lib/commonjs/components/layout/GradientBottomActions.js +8 -8
- package/lib/commonjs/components/layout/GradientBottomActions.js.map +1 -1
- package/lib/commonjs/components/layout/GradientScrollView.js.map +1 -1
- package/lib/commonjs/components/layout/ModalBSHeader.js +3 -1
- package/lib/commonjs/components/layout/ModalBSHeader.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAmount.js +3 -1
- package/lib/commonjs/components/listitems/ListItemAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemCheckbox.js +3 -2
- package/lib/commonjs/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemHeader.js +4 -2
- package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfo.js +3 -1
- package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js +3 -1
- package/lib/commonjs/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNav.js +1 -1
- package/lib/commonjs/components/listitems/ListItemNav.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemNavAlert.js +3 -1
- package/lib/commonjs/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemRadio.js +10 -2
- package/lib/commonjs/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -40
- package/lib/commonjs/components/loadingSpinner/LoadingSpinner.js +6 -6
- package/lib/commonjs/components/loadingSpinner/LoadingSpinner.js.map +1 -1
- package/lib/commonjs/components/numberpad/NumberButton.js +15 -2
- package/lib/commonjs/components/numberpad/NumberButton.js.map +1 -1
- package/lib/commonjs/components/numberpad/NumberPad.js +9 -6
- package/lib/commonjs/components/numberpad/NumberPad.js.map +1 -1
- package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +42 -96
- package/lib/commonjs/components/otpInput/OTPInput.js +3 -3
- package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
- package/lib/commonjs/components/radio/RadioButtonLabel.js +3 -3
- package/lib/commonjs/components/radio/RadioButtonLabel.js.map +1 -1
- package/lib/commonjs/components/stepper/Stepper.js +5 -2
- package/lib/commonjs/components/stepper/Stepper.js.map +1 -1
- package/lib/commonjs/components/typography/IOText.js +4 -1
- package/lib/commonjs/components/typography/IOText.js.map +1 -1
- package/lib/commonjs/core/IOStyles.js +3 -53
- package/lib/commonjs/core/IOStyles.js.map +1 -1
- package/lib/module/components/accordion/AccordionItem.js +5 -3
- package/lib/module/components/accordion/AccordionItem.js.map +1 -1
- package/lib/module/components/alert/Alert.js +6 -12
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/alert/AlertEdgeToEdge.js +3 -2
- package/lib/module/components/alert/AlertEdgeToEdge.js.map +1 -1
- package/lib/module/components/alert/AlertEdgeToEdgeWrapper.js +3 -2
- package/lib/module/components/alert/AlertEdgeToEdgeWrapper.js.map +1 -1
- package/lib/module/components/buttons/ButtonLink.js +6 -3
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +21 -16
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/ButtonSolid.js +4 -1
- package/lib/module/components/buttons/ButtonSolid.js.map +1 -1
- package/lib/module/components/buttons/IOButton/IOButton.js +223 -0
- package/lib/module/components/buttons/IOButton/IOButton.js.map +1 -0
- package/lib/module/components/buttons/IOButton/__test__/IOButton.test.js +40 -0
- package/lib/module/components/buttons/IOButton/__test__/IOButton.test.js.map +1 -0
- package/lib/module/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +391 -0
- package/lib/module/components/buttons/IOButton/index.js +4 -0
- package/lib/module/components/buttons/IOButton/index.js.map +1 -0
- package/lib/module/components/buttons/IOButton/styles.js +160 -0
- package/lib/module/components/buttons/IOButton/styles.js.map +1 -0
- package/lib/module/components/buttons/IconButton.js +4 -5
- package/lib/module/components/buttons/IconButton.js.map +1 -1
- package/lib/module/components/buttons/IconButtonContained.js +2 -3
- package/lib/module/components/buttons/IconButtonContained.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -402
- package/lib/module/components/buttons/__test__/button.test.js +0 -24
- package/lib/module/components/buttons/__test__/button.test.js.map +1 -1
- package/lib/module/components/buttons/index.js +1 -0
- package/lib/module/components/buttons/index.js.map +1 -1
- package/lib/module/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +13 -30
- package/lib/module/components/icons/Icon.js +10 -7
- package/lib/module/components/icons/Icon.js.map +1 -1
- package/lib/module/components/layout/FooterActions.js +11 -10
- package/lib/module/components/layout/FooterActions.js.map +1 -1
- package/lib/module/components/layout/FooterActionsInline.js +9 -9
- package/lib/module/components/layout/FooterActionsInline.js.map +1 -1
- package/lib/module/components/layout/GradientBottomActions.js +9 -9
- package/lib/module/components/layout/GradientBottomActions.js.map +1 -1
- package/lib/module/components/layout/GradientScrollView.js.map +1 -1
- package/lib/module/components/layout/ModalBSHeader.js +4 -2
- package/lib/module/components/layout/ModalBSHeader.js.map +1 -1
- package/lib/module/components/listitems/ListItemAmount.js +4 -2
- package/lib/module/components/listitems/ListItemAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemCheckbox.js +4 -3
- package/lib/module/components/listitems/ListItemCheckbox.js.map +1 -1
- package/lib/module/components/listitems/ListItemHeader.js +5 -3
- package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfo.js +4 -2
- package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
- package/lib/module/components/listitems/ListItemInfoCopy.js +4 -2
- package/lib/module/components/listitems/ListItemInfoCopy.js.map +1 -1
- package/lib/module/components/listitems/ListItemNav.js +2 -2
- package/lib/module/components/listitems/ListItemNav.js.map +1 -1
- package/lib/module/components/listitems/ListItemNavAlert.js +4 -2
- package/lib/module/components/listitems/ListItemNavAlert.js.map +1 -1
- package/lib/module/components/listitems/ListItemRadio.js +11 -3
- package/lib/module/components/listitems/ListItemRadio.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -40
- package/lib/module/components/loadingSpinner/LoadingSpinner.js +6 -6
- package/lib/module/components/loadingSpinner/LoadingSpinner.js.map +1 -1
- package/lib/module/components/numberpad/NumberButton.js +16 -3
- package/lib/module/components/numberpad/NumberButton.js.map +1 -1
- package/lib/module/components/numberpad/NumberPad.js +10 -7
- package/lib/module/components/numberpad/NumberPad.js.map +1 -1
- package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +42 -96
- package/lib/module/components/otpInput/OTPInput.js +3 -3
- package/lib/module/components/otpInput/OTPInput.js.map +1 -1
- package/lib/module/components/radio/RadioButtonLabel.js +3 -3
- package/lib/module/components/radio/RadioButtonLabel.js.map +1 -1
- package/lib/module/components/stepper/Stepper.js +6 -3
- package/lib/module/components/stepper/Stepper.js.map +1 -1
- package/lib/module/components/typography/IOText.js +2 -0
- package/lib/module/components/typography/IOText.js.map +1 -1
- package/lib/module/core/IOStyles.js +3 -53
- package/lib/module/core/IOStyles.js.map +1 -1
- package/lib/typescript/components/accordion/AccordionItem.d.ts.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/alert/AlertEdgeToEdge.d.ts.map +1 -1
- package/lib/typescript/components/alert/AlertEdgeToEdgeWrapper.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts +3 -0
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts +3 -0
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonSolid.d.ts +3 -0
- package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IOButton/IOButton.d.ts +57 -0
- package/lib/typescript/components/buttons/IOButton/IOButton.d.ts.map +1 -0
- package/lib/typescript/components/buttons/IOButton/__test__/IOButton.test.d.ts +2 -0
- package/lib/typescript/components/buttons/IOButton/__test__/IOButton.test.d.ts.map +1 -0
- package/lib/typescript/components/buttons/IOButton/index.d.ts +2 -0
- package/lib/typescript/components/buttons/IOButton/index.d.ts.map +1 -0
- package/lib/typescript/components/buttons/IOButton/styles.d.ts +35 -0
- package/lib/typescript/components/buttons/IOButton/styles.d.ts.map +1 -0
- package/lib/typescript/components/buttons/IconButton.d.ts.map +1 -1
- package/lib/typescript/components/buttons/IconButtonContained.d.ts.map +1 -1
- package/lib/typescript/components/buttons/index.d.ts +1 -0
- package/lib/typescript/components/buttons/index.d.ts.map +1 -1
- package/lib/typescript/components/icons/Icon.d.ts +1 -4
- package/lib/typescript/components/icons/Icon.d.ts.map +1 -1
- package/lib/typescript/components/icons/types.d.ts +3 -2
- package/lib/typescript/components/icons/types.d.ts.map +1 -1
- package/lib/typescript/components/layout/FooterActions.d.ts +10 -8
- package/lib/typescript/components/layout/FooterActions.d.ts.map +1 -1
- package/lib/typescript/components/layout/FooterActionsInline.d.ts +5 -4
- package/lib/typescript/components/layout/FooterActionsInline.d.ts.map +1 -1
- package/lib/typescript/components/layout/GradientBottomActions.d.ts +12 -6
- package/lib/typescript/components/layout/GradientBottomActions.d.ts.map +1 -1
- package/lib/typescript/components/layout/GradientScrollView.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemAmount.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemCheckbox.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemHeader.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemInfoCopy.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemNavAlert.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemRadio.d.ts.map +1 -1
- package/lib/typescript/components/loadingSpinner/LoadingSpinner.d.ts +2 -2
- package/lib/typescript/components/loadingSpinner/LoadingSpinner.d.ts.map +1 -1
- package/lib/typescript/components/numberpad/NumberButton.d.ts +11 -0
- package/lib/typescript/components/numberpad/NumberButton.d.ts.map +1 -1
- package/lib/typescript/components/numberpad/NumberPad.d.ts.map +1 -1
- package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
- package/lib/typescript/components/radio/RadioButtonLabel.d.ts.map +1 -1
- package/lib/typescript/components/stepper/Stepper.d.ts.map +1 -1
- package/lib/typescript/components/typography/IOText.d.ts +1 -0
- package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
- package/lib/typescript/core/IOStyles.d.ts +0 -47
- package/lib/typescript/core/IOStyles.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/accordion/AccordionItem.tsx +7 -14
- package/src/components/alert/Alert.tsx +7 -21
- package/src/components/alert/AlertEdgeToEdge.tsx +1 -2
- package/src/components/alert/AlertEdgeToEdgeWrapper.tsx +1 -2
- package/src/components/buttons/ButtonLink.tsx +6 -6
- package/src/components/buttons/ButtonOutline.tsx +21 -21
- package/src/components/buttons/ButtonSolid.tsx +4 -1
- package/src/components/buttons/IOButton/IOButton.tsx +363 -0
- package/src/components/buttons/IOButton/__test__/IOButton.test.tsx +46 -0
- package/src/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +391 -0
- package/src/components/buttons/IOButton/index.tsx +1 -0
- package/src/components/buttons/IOButton/styles.tsx +228 -0
- package/src/components/buttons/IconButton.tsx +4 -9
- package/src/components/buttons/IconButtonContained.tsx +3 -6
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -402
- package/src/components/buttons/__test__/button.test.tsx +1 -33
- package/src/components/buttons/index.tsx +1 -0
- package/src/components/claimsSelector/__test__/__snapshots__/ClaimsSelector.test.tsx.snap +13 -30
- package/src/components/icons/Icon.tsx +12 -3
- package/src/components/icons/types.ts +3 -2
- package/src/components/layout/FooterActions.tsx +26 -14
- package/src/components/layout/FooterActionsInline.tsx +19 -12
- package/src/components/layout/GradientBottomActions.tsx +17 -18
- package/src/components/layout/GradientScrollView.tsx +2 -1
- package/src/components/layout/ModalBSHeader.tsx +2 -2
- package/src/components/listitems/ListItemAmount.tsx +1 -2
- package/src/components/listitems/ListItemCheckbox.tsx +8 -11
- package/src/components/listitems/ListItemHeader.tsx +2 -3
- package/src/components/listitems/ListItemInfo.tsx +1 -2
- package/src/components/listitems/ListItemInfoCopy.tsx +1 -2
- package/src/components/listitems/ListItemNav.tsx +1 -1
- package/src/components/listitems/ListItemNavAlert.tsx +1 -2
- package/src/components/listitems/ListItemRadio.tsx +7 -7
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +10 -40
- package/src/components/loadingSpinner/LoadingSpinner.tsx +8 -8
- package/src/components/numberpad/NumberButton.tsx +18 -11
- package/src/components/numberpad/NumberPad.tsx +8 -10
- package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +42 -96
- package/src/components/otpInput/OTPInput.tsx +1 -2
- package/src/components/radio/RadioButtonLabel.tsx +7 -10
- package/src/components/stepper/Stepper.tsx +7 -12
- package/src/components/typography/IOText.tsx +3 -0
- package/src/core/IOStyles.ts +3 -55
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { forwardRef, useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { Pressable, StyleSheet } from "react-native";
|
|
5
|
+
import ReactNativeHapticFeedback from "react-native-haptic-feedback";
|
|
6
|
+
import Animated, { useReducedMotion } from "react-native-reanimated";
|
|
7
|
+
import { enterTransitionInnerContent, enterTransitionInnerContentSmall, exitTransitionInnerContent, useIONewTypeface } from "../../../core";
|
|
8
|
+
import { useScaleAnimation } from "../../../hooks";
|
|
9
|
+
import { AnimatedIcon, AnimatedIconWithColorTransition } from "../../icons";
|
|
10
|
+
import { LoadingSpinner } from "../../loadingSpinner";
|
|
11
|
+
import { AnimatedIOText } from "../../typography";
|
|
12
|
+
import { buttonTextFontSize, buttonTextLineHeight } from "../../typography/ButtonText";
|
|
13
|
+
import { useButtonAnimatedStyles, useButtonColorMap } from "./styles";
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
|
+
export const IOButton = /*#__PURE__*/forwardRef(({
|
|
16
|
+
variant = "solid",
|
|
17
|
+
color = "primary",
|
|
18
|
+
label,
|
|
19
|
+
fullWidth = false,
|
|
20
|
+
disabled = false,
|
|
21
|
+
loading = false,
|
|
22
|
+
numberOfLines = 1,
|
|
23
|
+
textAlign = "auto",
|
|
24
|
+
icon,
|
|
25
|
+
iconPosition = "start",
|
|
26
|
+
onPress,
|
|
27
|
+
accessibilityLabel,
|
|
28
|
+
accessibilityHint,
|
|
29
|
+
accessibilityRole = "button",
|
|
30
|
+
testID
|
|
31
|
+
}, ref) => {
|
|
32
|
+
const mapColorStates = useButtonColorMap(variant);
|
|
33
|
+
const {
|
|
34
|
+
progress,
|
|
35
|
+
onPressIn,
|
|
36
|
+
onPressOut,
|
|
37
|
+
scaleAnimatedStyle
|
|
38
|
+
} = useScaleAnimation();
|
|
39
|
+
const {
|
|
40
|
+
buttonAnimatedStyle,
|
|
41
|
+
labelAnimatedStyle,
|
|
42
|
+
iconColorAnimatedStyle
|
|
43
|
+
} = useButtonAnimatedStyles(variant, color, progress);
|
|
44
|
+
const reducedMotion = useReducedMotion();
|
|
45
|
+
const {
|
|
46
|
+
newTypefaceEnabled
|
|
47
|
+
} = useIONewTypeface();
|
|
48
|
+
const isLinkButton = variant === "link";
|
|
49
|
+
|
|
50
|
+
// ---------------------------------------
|
|
51
|
+
// VISUAL ATTRIBUTES
|
|
52
|
+
// ---------------------------------------
|
|
53
|
+
const btnIconSizeMap = {
|
|
54
|
+
solid: 20,
|
|
55
|
+
outline: 20,
|
|
56
|
+
link: 24
|
|
57
|
+
};
|
|
58
|
+
const btnBorderWidthMap = {
|
|
59
|
+
solid: 0,
|
|
60
|
+
outline: 2,
|
|
61
|
+
link: 0
|
|
62
|
+
};
|
|
63
|
+
const btnPaddingHorizontalMap = {
|
|
64
|
+
default: 24,
|
|
65
|
+
fullWidth: 16,
|
|
66
|
+
link: 0
|
|
67
|
+
};
|
|
68
|
+
const btnLinkHitSlop = {
|
|
69
|
+
top: 14,
|
|
70
|
+
right: 24,
|
|
71
|
+
bottom: 14,
|
|
72
|
+
left: 24
|
|
73
|
+
};
|
|
74
|
+
const btnIconSize = btnIconSizeMap[variant];
|
|
75
|
+
const btnBorderWidth = btnBorderWidthMap[variant];
|
|
76
|
+
const btnBorderRadius = 8;
|
|
77
|
+
const btnSizeDefault = 48;
|
|
78
|
+
const ICON_MARGIN = 8;
|
|
79
|
+
const DISABLED_OPACITY = 0.5;
|
|
80
|
+
|
|
81
|
+
// Background color
|
|
82
|
+
const backgroundColor = disabled ? mapColorStates[color].background.disabled : mapColorStates[color].background.default;
|
|
83
|
+
|
|
84
|
+
// Label & Icons colors
|
|
85
|
+
const foregroundColor = disabled ? mapColorStates[color]?.foreground?.disabled : mapColorStates[color]?.foreground?.default;
|
|
86
|
+
|
|
87
|
+
// ---------------------------------------
|
|
88
|
+
// BUTTON INNER LOGIC
|
|
89
|
+
// ---------------------------------------
|
|
90
|
+
|
|
91
|
+
/* Prevent the component from triggering the `isEntering' transition
|
|
92
|
+
on the on the first render. Solution from this discussion:
|
|
93
|
+
https://github.com/software-mansion/react-native-reanimated/discussions/2513
|
|
94
|
+
*/
|
|
95
|
+
const isMounted = useRef(false);
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
// eslint-disable-next-line functional/immutable-data
|
|
98
|
+
isMounted.current = true;
|
|
99
|
+
}, []);
|
|
100
|
+
const handleOnPress = useCallback(event => {
|
|
101
|
+
/* Don't call `onPress` if the button is
|
|
102
|
+
in loading state */
|
|
103
|
+
if (loading) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
ReactNativeHapticFeedback.trigger("impactLight");
|
|
107
|
+
onPress(event);
|
|
108
|
+
}, [loading, onPress]);
|
|
109
|
+
|
|
110
|
+
// ---------------------------------------
|
|
111
|
+
// BUTTON INNER CONTENT
|
|
112
|
+
// ---------------------------------------
|
|
113
|
+
const renderButtonContent = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
114
|
+
children: [loading && /*#__PURE__*/_jsx(Animated.View, {
|
|
115
|
+
style: styles.buttonInner,
|
|
116
|
+
entering: isMounted.current ? enterTransitionInnerContentSmall : undefined,
|
|
117
|
+
exiting: exitTransitionInnerContent,
|
|
118
|
+
children: /*#__PURE__*/_jsx(LoadingSpinner, {
|
|
119
|
+
color: foregroundColor
|
|
120
|
+
})
|
|
121
|
+
}), !loading && /*#__PURE__*/_jsxs(Animated.View, {
|
|
122
|
+
style: [styles.buttonInner, {
|
|
123
|
+
columnGap: ICON_MARGIN
|
|
124
|
+
}, iconPosition === "end" && {
|
|
125
|
+
flexDirection: "row-reverse"
|
|
126
|
+
}],
|
|
127
|
+
entering: isMounted.current ? enterTransitionInnerContent : undefined,
|
|
128
|
+
children: [icon && (!disabled ? /*#__PURE__*/_jsx(AnimatedIconWithColorTransition, {
|
|
129
|
+
allowFontScaling: true,
|
|
130
|
+
name: icon,
|
|
131
|
+
animatedProps: iconColorAnimatedStyle,
|
|
132
|
+
size: btnIconSize
|
|
133
|
+
}) : /*#__PURE__*/_jsx(AnimatedIcon, {
|
|
134
|
+
allowFontScaling: true,
|
|
135
|
+
name: icon,
|
|
136
|
+
color: mapColorStates[color]?.foreground?.disabled,
|
|
137
|
+
size: btnIconSize
|
|
138
|
+
})), /*#__PURE__*/_jsx(AnimatedIOText, {
|
|
139
|
+
font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
|
|
140
|
+
weight: "Semibold",
|
|
141
|
+
size: buttonTextFontSize,
|
|
142
|
+
lineHeight: isLinkButton ? buttonTextLineHeight : undefined,
|
|
143
|
+
accessible: false,
|
|
144
|
+
accessibilityElementsHidden: true,
|
|
145
|
+
importantForAccessibility: "no-hide-descendants",
|
|
146
|
+
numberOfLines: numberOfLines,
|
|
147
|
+
ellipsizeMode: "tail",
|
|
148
|
+
style: [{
|
|
149
|
+
textAlign
|
|
150
|
+
}, disabled ? {
|
|
151
|
+
color: mapColorStates[color]?.foreground?.disabled
|
|
152
|
+
} : {
|
|
153
|
+
...labelAnimatedStyle
|
|
154
|
+
}],
|
|
155
|
+
children: label
|
|
156
|
+
})]
|
|
157
|
+
})]
|
|
158
|
+
});
|
|
159
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
160
|
+
ref: ref,
|
|
161
|
+
accessible: true
|
|
162
|
+
// Using || operator because empty string is not an accepted value
|
|
163
|
+
,
|
|
164
|
+
accessibilityLabel: accessibilityLabel || label,
|
|
165
|
+
accessibilityHint: accessibilityHint,
|
|
166
|
+
accessibilityRole: accessibilityRole,
|
|
167
|
+
accessibilityState: {
|
|
168
|
+
busy: loading,
|
|
169
|
+
disabled: disabled || false
|
|
170
|
+
},
|
|
171
|
+
onPress: handleOnPress,
|
|
172
|
+
onPressIn: onPressIn,
|
|
173
|
+
onPressOut: onPressOut,
|
|
174
|
+
disabled: disabled,
|
|
175
|
+
hitSlop: isLinkButton ? btnLinkHitSlop : undefined,
|
|
176
|
+
style: isLinkButton ? {
|
|
177
|
+
alignSelf: "flex-start"
|
|
178
|
+
} : fullWidth ? {
|
|
179
|
+
flexShrink: 0,
|
|
180
|
+
alignSelf: "stretch"
|
|
181
|
+
} : {
|
|
182
|
+
flexShrink: 1,
|
|
183
|
+
alignSelf: "auto"
|
|
184
|
+
},
|
|
185
|
+
testID: testID,
|
|
186
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
187
|
+
style: [styles.button, {
|
|
188
|
+
paddingHorizontal: isLinkButton ? btnPaddingHorizontalMap.link : fullWidth ? btnPaddingHorizontalMap.fullWidth : btnPaddingHorizontalMap.default
|
|
189
|
+
}, {
|
|
190
|
+
height: isLinkButton ? undefined : btnSizeDefault,
|
|
191
|
+
backgroundColor,
|
|
192
|
+
borderWidth: btnBorderWidth,
|
|
193
|
+
borderRadius: btnBorderRadius,
|
|
194
|
+
borderColor: foregroundColor
|
|
195
|
+
}, disabled ? {
|
|
196
|
+
opacity: DISABLED_OPACITY
|
|
197
|
+
} : {},
|
|
198
|
+
/* Prevent Reanimated from overriding background colors
|
|
199
|
+
if button is disabled */
|
|
200
|
+
!disabled && !reducedMotion && scaleAnimatedStyle, !disabled && buttonAnimatedStyle],
|
|
201
|
+
children: renderButtonContent()
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
const styles = StyleSheet.create({
|
|
206
|
+
button: {
|
|
207
|
+
flexDirection: "row",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
justifyContent: "center",
|
|
210
|
+
textAlignVertical: "center",
|
|
211
|
+
// Prop supported on Android only
|
|
212
|
+
borderCurve: "continuous",
|
|
213
|
+
overflow: "hidden",
|
|
214
|
+
elevation: 0
|
|
215
|
+
},
|
|
216
|
+
buttonInner: {
|
|
217
|
+
flexDirection: "row",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
justifyContent: "center"
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
export default IOButton;
|
|
223
|
+
//# sourceMappingURL=IOButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","forwardRef","useCallback","useEffect","useRef","Pressable","StyleSheet","ReactNativeHapticFeedback","Animated","useReducedMotion","enterTransitionInnerContent","enterTransitionInnerContentSmall","exitTransitionInnerContent","useIONewTypeface","useScaleAnimation","AnimatedIcon","AnimatedIconWithColorTransition","LoadingSpinner","AnimatedIOText","buttonTextFontSize","buttonTextLineHeight","useButtonAnimatedStyles","useButtonColorMap","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","IOButton","variant","color","label","fullWidth","disabled","loading","numberOfLines","textAlign","icon","iconPosition","onPress","accessibilityLabel","accessibilityHint","accessibilityRole","testID","ref","mapColorStates","progress","onPressIn","onPressOut","scaleAnimatedStyle","buttonAnimatedStyle","labelAnimatedStyle","iconColorAnimatedStyle","reducedMotion","newTypefaceEnabled","isLinkButton","btnIconSizeMap","solid","outline","link","btnBorderWidthMap","btnPaddingHorizontalMap","default","btnLinkHitSlop","top","right","bottom","left","btnIconSize","btnBorderWidth","btnBorderRadius","btnSizeDefault","ICON_MARGIN","DISABLED_OPACITY","backgroundColor","background","foregroundColor","foreground","isMounted","current","handleOnPress","event","trigger","renderButtonContent","children","View","style","styles","buttonInner","entering","undefined","exiting","columnGap","flexDirection","allowFontScaling","name","animatedProps","size","font","weight","lineHeight","accessible","accessibilityElementsHidden","importantForAccessibility","ellipsizeMode","accessibilityState","busy","hitSlop","alignSelf","flexShrink","button","paddingHorizontal","height","borderWidth","borderRadius","borderColor","opacity","create","alignItems","justifyContent","textAlignVertical","borderCurve","overflow","elevation"],"sourceRoot":"../../../../../src","sources":["components/buttons/IOButton/IOButton.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAEVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,MAAM,QACD,OAAO;AACd,SAIEC,SAAS,EAETC,UAAU,QAKL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AAc,EAAE;EAClB;AACF,CAAC,CAAC;AAEF,eAAe3F,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Alert } from "react-native";
|
|
5
|
+
import * as TestRenderer from "react-test-renderer";
|
|
6
|
+
import IOButton from "../IOButton";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const onButtonPress = () => {
|
|
9
|
+
Alert.alert("Alert", "Action triggered");
|
|
10
|
+
};
|
|
11
|
+
describe("Test Buttons Components", () => {
|
|
12
|
+
it("IOButton Snapshot · Solid variant", () => {
|
|
13
|
+
const buttonSolid = TestRenderer.create(/*#__PURE__*/_jsx(IOButton, {
|
|
14
|
+
variant: "solid",
|
|
15
|
+
label: "label",
|
|
16
|
+
accessibilityLabel: "accessibilityLabel",
|
|
17
|
+
onPress: onButtonPress
|
|
18
|
+
})).toJSON();
|
|
19
|
+
expect(buttonSolid).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
it("IOButton Snapshot · Link variant", () => {
|
|
22
|
+
const buttonLink = TestRenderer.create(/*#__PURE__*/_jsx(IOButton, {
|
|
23
|
+
variant: "link",
|
|
24
|
+
label: "label",
|
|
25
|
+
accessibilityLabel: "accessibilityLabel",
|
|
26
|
+
onPress: onButtonPress
|
|
27
|
+
})).toJSON();
|
|
28
|
+
expect(buttonLink).toMatchSnapshot();
|
|
29
|
+
});
|
|
30
|
+
it("IOButton Snapshot · Outline variant", () => {
|
|
31
|
+
const buttonOutline = TestRenderer.create(/*#__PURE__*/_jsx(IOButton, {
|
|
32
|
+
variant: "outline",
|
|
33
|
+
label: "label",
|
|
34
|
+
accessibilityLabel: "accessibilityLabel",
|
|
35
|
+
onPress: onButtonPress
|
|
36
|
+
})).toJSON();
|
|
37
|
+
expect(buttonOutline).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=IOButton.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Alert","TestRenderer","IOButton","jsx","_jsx","onButtonPress","alert","describe","it","buttonSolid","create","variant","label","accessibilityLabel","onPress","toJSON","expect","toMatchSnapshot","buttonLink","buttonOutline"],"sourceRoot":"../../../../../../src","sources":["components/buttons/IOButton/__test__/IOButton.test.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,KAAK,QAAQ,cAAc;AACpC,OAAO,KAAKC,YAAY,MAAM,qBAAqB;AACnD,OAAOC,QAAQ,MAAM,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,MAAMC,aAAa,GAAGA,CAAA,KAAM;EAC1BL,KAAK,CAACM,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC;AAC1C,CAAC;AAEDC,QAAQ,CAAC,yBAAyB,EAAE,MAAM;EACxCC,EAAE,CAAC,mCAAmC,EAAE,MAAM;IAC5C,MAAMC,WAAW,GAAGR,YAAY,CAACS,MAAM,cACrCN,IAAA,CAACF,QAAQ;MACPS,OAAO,EAAC,OAAO;MACfC,KAAK,EAAE,OAAQ;MACfC,kBAAkB,EAAE,oBAAqB;MACzCC,OAAO,EAAET;IAAc,CACd,CACb,CAAC,CAACU,MAAM,CAAC,CAAC;IACVC,MAAM,CAACP,WAAW,CAAC,CAACQ,eAAe,CAAC,CAAC;EACvC,CAAC,CAAC;EAEFT,EAAE,CAAC,kCAAkC,EAAE,MAAM;IAC3C,MAAMU,UAAU,GAAGjB,YAAY,CAACS,MAAM,cACpCN,IAAA,CAACF,QAAQ;MACPS,OAAO,EAAC,MAAM;MACdC,KAAK,EAAE,OAAQ;MACfC,kBAAkB,EAAE,oBAAqB;MACzCC,OAAO,EAAET;IAAc,CACd,CACb,CAAC,CAACU,MAAM,CAAC,CAAC;IACVC,MAAM,CAACE,UAAU,CAAC,CAACD,eAAe,CAAC,CAAC;EACtC,CAAC,CAAC;EAEFT,EAAE,CAAC,qCAAqC,EAAE,MAAM;IAC9C,MAAMW,aAAa,GAAGlB,YAAY,CAACS,MAAM,cACvCN,IAAA,CAACF,QAAQ;MACPS,OAAO,EAAC,SAAS;MACjBC,KAAK,EAAE,OAAQ;MACfC,kBAAkB,EAAE,oBAAqB;MACzCC,OAAO,EAAET;IAAc,CACd,CACb,CAAC,CAACU,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
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["components/buttons/IOButton/index.tsx"],"mappings":";;AAAA,cAAc,YAAY","ignoreList":[]}
|