@pagopa/io-app-design-system 5.11.12 → 5.11.13

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 (76) hide show
  1. package/lib/commonjs/components/banner/BannerErrorState.js +3 -2
  2. package/lib/commonjs/components/banner/BannerErrorState.js.map +1 -1
  3. package/lib/commonjs/components/buttons/__test__/button.test.js +13 -9
  4. package/lib/commonjs/components/buttons/__test__/button.test.js.map +1 -1
  5. package/lib/commonjs/components/buttons/index.js +0 -33
  6. package/lib/commonjs/components/buttons/index.js.map +1 -1
  7. package/lib/commonjs/components/listitems/ListItemHeader.js +2 -1
  8. package/lib/commonjs/components/listitems/ListItemHeader.js.map +1 -1
  9. package/lib/commonjs/components/listitems/ListItemInfo.js +2 -1
  10. package/lib/commonjs/components/listitems/ListItemInfo.js.map +1 -1
  11. package/lib/commonjs/components/modules/ModuleCheckout.js +2 -1
  12. package/lib/commonjs/components/modules/ModuleCheckout.js.map +1 -1
  13. package/lib/commonjs/components/pictograms/Pictogram.js +2 -0
  14. package/lib/commonjs/components/pictograms/Pictogram.js.map +1 -1
  15. package/lib/commonjs/components/pictograms/svg/PictogramPinSecurity.js +64 -0
  16. package/lib/commonjs/components/pictograms/svg/PictogramPinSecurity.js.map +1 -0
  17. package/lib/commonjs/components/pictograms/svg/originals/PictogramPinSecurity.svg +1 -0
  18. package/lib/module/components/banner/BannerErrorState.js +3 -2
  19. package/lib/module/components/banner/BannerErrorState.js.map +1 -1
  20. package/lib/module/components/buttons/__test__/button.test.js +13 -9
  21. package/lib/module/components/buttons/__test__/button.test.js.map +1 -1
  22. package/lib/module/components/buttons/index.js +0 -3
  23. package/lib/module/components/buttons/index.js.map +1 -1
  24. package/lib/module/components/listitems/ListItemHeader.js +3 -2
  25. package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
  26. package/lib/module/components/listitems/ListItemInfo.js +3 -2
  27. package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
  28. package/lib/module/components/modules/ModuleCheckout.js +3 -2
  29. package/lib/module/components/modules/ModuleCheckout.js.map +1 -1
  30. package/lib/module/components/pictograms/Pictogram.js +2 -0
  31. package/lib/module/components/pictograms/Pictogram.js.map +1 -1
  32. package/lib/module/components/pictograms/svg/PictogramPinSecurity.js +59 -0
  33. package/lib/module/components/pictograms/svg/PictogramPinSecurity.js.map +1 -0
  34. package/lib/module/components/pictograms/svg/originals/PictogramPinSecurity.svg +1 -0
  35. package/lib/typescript/components/banner/BannerErrorState.d.ts.map +1 -1
  36. package/lib/typescript/components/buttons/index.d.ts +0 -3
  37. package/lib/typescript/components/buttons/index.d.ts.map +1 -1
  38. package/lib/typescript/components/listitems/ListItemHeader.d.ts +2 -2
  39. package/lib/typescript/components/listitems/ListItemHeader.d.ts.map +1 -1
  40. package/lib/typescript/components/listitems/ListItemInfo.d.ts +2 -2
  41. package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
  42. package/lib/typescript/components/pictograms/Pictogram.d.ts +1 -0
  43. package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
  44. package/lib/typescript/components/pictograms/svg/PictogramPinSecurity.d.ts +5 -0
  45. package/lib/typescript/components/pictograms/svg/PictogramPinSecurity.d.ts.map +1 -0
  46. package/package.json +1 -1
  47. package/src/components/banner/BannerErrorState.tsx +7 -2
  48. package/src/components/buttons/__test__/button.test.tsx +15 -13
  49. package/src/components/buttons/index.tsx +0 -3
  50. package/src/components/listitems/ListItemHeader.tsx +3 -3
  51. package/src/components/listitems/ListItemInfo.tsx +4 -3
  52. package/src/components/modules/ModuleCheckout.tsx +2 -2
  53. package/src/components/pictograms/Pictogram.tsx +2 -0
  54. package/src/components/pictograms/svg/PictogramPinSecurity.tsx +44 -0
  55. package/src/components/pictograms/svg/originals/PictogramPinSecurity.svg +1 -0
  56. package/lib/commonjs/components/buttons/ButtonLink.js +0 -157
  57. package/lib/commonjs/components/buttons/ButtonLink.js.map +0 -1
  58. package/lib/commonjs/components/buttons/ButtonOutline.js +0 -173
  59. package/lib/commonjs/components/buttons/ButtonOutline.js.map +0 -1
  60. package/lib/commonjs/components/buttons/ButtonSolid.js +0 -194
  61. package/lib/commonjs/components/buttons/ButtonSolid.js.map +0 -1
  62. package/lib/module/components/buttons/ButtonLink.js +0 -152
  63. package/lib/module/components/buttons/ButtonLink.js.map +0 -1
  64. package/lib/module/components/buttons/ButtonOutline.js +0 -168
  65. package/lib/module/components/buttons/ButtonOutline.js.map +0 -1
  66. package/lib/module/components/buttons/ButtonSolid.js +0 -188
  67. package/lib/module/components/buttons/ButtonSolid.js.map +0 -1
  68. package/lib/typescript/components/buttons/ButtonLink.d.ts +0 -36
  69. package/lib/typescript/components/buttons/ButtonLink.d.ts.map +0 -1
  70. package/lib/typescript/components/buttons/ButtonOutline.d.ts +0 -26
  71. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +0 -1
  72. package/lib/typescript/components/buttons/ButtonSolid.d.ts +0 -52
  73. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +0 -1
  74. package/src/components/buttons/ButtonLink.tsx +0 -222
  75. package/src/components/buttons/ButtonOutline.tsx +0 -261
  76. package/src/components/buttons/ButtonSolid.tsx +0 -285
@@ -1,188 +0,0 @@
1
- "use strict";
2
-
3
- import React, { forwardRef, useCallback, useEffect, useRef } from "react";
4
- import { Pressable } from "react-native";
5
- import ReactNativeHapticFeedback from "react-native-haptic-feedback";
6
- import Animated, { interpolateColor, useAnimatedStyle, useReducedMotion } from "react-native-reanimated";
7
- import { useIOTheme } from "../../context";
8
- import { IOButtonStyles, IOColors, enterTransitionInnerContent, enterTransitionInnerContentSmall, exitTransitionInnerContent } from "../../core";
9
- import { useScaleAnimation } from "../../hooks";
10
- import { Icon } from "../icons";
11
- import { LoadingSpinner } from "../loadingSpinner";
12
- import { ButtonText } from "../typography/ButtonText";
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- const ICON_MARGIN = 8;
15
- const DISABLED_OPACITY = 0.5;
16
-
17
- // Icon size
18
- const iconSize = 20;
19
- /**
20
- * @deprecated Use `Button` with variant `solid` instead
21
- */
22
- export const ButtonSolid = /*#__PURE__*/forwardRef(({
23
- color = "primary",
24
- label,
25
- fullWidth = false,
26
- disabled = false,
27
- loading = false,
28
- icon,
29
- iconPosition = "start",
30
- onPress,
31
- accessibilityLabel,
32
- accessibilityHint,
33
- testID
34
- }, ref) => {
35
- const theme = useIOTheme();
36
- const {
37
- progress,
38
- onPressIn,
39
- onPressOut,
40
- scaleAnimatedStyle
41
- } = useScaleAnimation();
42
- const reducedMotion = useReducedMotion();
43
- const mapColorStates = {
44
- // Primary button
45
- primary: {
46
- background: {
47
- default: IOColors[theme["interactiveElem-default"]],
48
- pressed: IOColors[theme["interactiveElem-pressed"]],
49
- disabled: IOColors[theme["interactiveElem-disabled"]]
50
- },
51
- foreground: {
52
- default: theme["buttonText-default"],
53
- disabled: theme["buttonText-disabled"]
54
- }
55
- },
56
- // Danger button
57
- danger: {
58
- background: {
59
- default: IOColors["error-600"],
60
- pressed: IOColors["error-500"],
61
- disabled: IOColors[theme["interactiveElem-disabled"]]
62
- },
63
- foreground: {
64
- default: theme["buttonText-danger"],
65
- disabled: theme["buttonText-disabled"]
66
- }
67
- },
68
- // Contrast button
69
- contrast: {
70
- background: {
71
- default: IOColors.white,
72
- pressed: IOColors["blueIO-50"],
73
- disabled: IOColors["blueIO-50"]
74
- },
75
- foreground: {
76
- default: "blueIO-500",
77
- disabled: "blueIO-500"
78
- }
79
- }
80
- };
81
-
82
- /* Prevent the component from triggering the `isEntering' transition
83
- on the on the first render. Solution from this discussion:
84
- https://github.com/software-mansion/react-native-reanimated/discussions/2513
85
- */
86
- const isMounted = useRef(false);
87
- useEffect(() => {
88
- // eslint-disable-next-line functional/immutable-data
89
- isMounted.current = true;
90
- }, []);
91
-
92
- // Interpolate animation values from `isPressed` values
93
- const pressedAnimationStyle = useAnimatedStyle(() => {
94
- // Link color states to the pressed states
95
- const backgroundColor = interpolateColor(progress.value, [0, 1], [mapColorStates[color].background.default, mapColorStates[color].background.pressed]);
96
- return {
97
- backgroundColor
98
- };
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
- // Background
111
- const backgroundColor = disabled ? mapColorStates[color]?.background?.disabled : mapColorStates[color]?.background?.default;
112
-
113
- // Label & Icons colors
114
- const foregroundColor = disabled ? mapColorStates[color]?.foreground?.disabled : mapColorStates[color]?.foreground?.default;
115
- return /*#__PURE__*/_jsx(Pressable, {
116
- testID: testID,
117
- ref: ref,
118
- accessible: true
119
- // Using || operator because empty string is not an accepted value
120
- ,
121
- accessibilityLabel: accessibilityLabel || label,
122
- accessibilityHint: accessibilityHint,
123
- accessibilityState: {
124
- busy: loading,
125
- disabled: disabled || false
126
- },
127
- accessibilityRole: "button",
128
- onPress: handleOnPress,
129
- onPressIn: onPressIn,
130
- onPressOut: onPressOut,
131
- disabled: disabled,
132
- style: fullWidth ? {
133
- flexShrink: 0,
134
- alignSelf: "stretch"
135
- } : {
136
- flexShrink: 1,
137
- alignSelf: "auto"
138
- },
139
- children: /*#__PURE__*/_jsxs(Animated.View, {
140
- style: [IOButtonStyles.button, IOButtonStyles.buttonSizeDefault, {
141
- backgroundColor,
142
- overflow: "hidden"
143
- }, fullWidth && {
144
- paddingHorizontal: 16
145
- }, disabled ? {
146
- opacity: DISABLED_OPACITY
147
- } : {},
148
- /* Prevent Reanimated from overriding background colors
149
- if button is disabled */
150
- !disabled && !reducedMotion && scaleAnimatedStyle, !disabled && pressedAnimationStyle],
151
- children: [loading && /*#__PURE__*/_jsx(Animated.View, {
152
- style: IOButtonStyles.buttonInner,
153
- entering: isMounted.current ? enterTransitionInnerContentSmall : undefined,
154
- exiting: exitTransitionInnerContent,
155
- children: /*#__PURE__*/_jsx(LoadingSpinner, {
156
- color: IOColors[foregroundColor]
157
- })
158
- }), !loading && /*#__PURE__*/_jsxs(Animated.View, {
159
- style: [IOButtonStyles.buttonInner, {
160
- columnGap: ICON_MARGIN
161
- },
162
- /* If 'iconPosition' is set to 'end', we use
163
- reverse flex property to invert the position */
164
- iconPosition === "end" && {
165
- flexDirection: "row-reverse"
166
- }],
167
- entering: isMounted.current ? enterTransitionInnerContent : undefined,
168
- children: [icon && /*#__PURE__*/_jsx(Icon, {
169
- allowFontScaling: true,
170
- name: icon,
171
- size: iconSize,
172
- color: foregroundColor
173
- }), /*#__PURE__*/_jsx(ButtonText, {
174
- color: foregroundColor,
175
- style: IOButtonStyles.label,
176
- numberOfLines: 1,
177
- ellipsizeMode: "tail",
178
- accessible: false,
179
- accessibilityElementsHidden: true,
180
- importantForAccessibility: "no-hide-descendants",
181
- children: label
182
- })]
183
- })]
184
- })
185
- });
186
- });
187
- export default ButtonSolid;
188
- //# sourceMappingURL=ButtonSolid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","forwardRef","useCallback","useEffect","useRef","Pressable","ReactNativeHapticFeedback","Animated","interpolateColor","useAnimatedStyle","useReducedMotion","useIOTheme","IOButtonStyles","IOColors","enterTransitionInnerContent","enterTransitionInnerContentSmall","exitTransitionInnerContent","useScaleAnimation","Icon","LoadingSpinner","ButtonText","jsx","_jsx","jsxs","_jsxs","ICON_MARGIN","DISABLED_OPACITY","iconSize","ButtonSolid","color","label","fullWidth","disabled","loading","icon","iconPosition","onPress","accessibilityLabel","accessibilityHint","testID","ref","theme","progress","onPressIn","onPressOut","scaleAnimatedStyle","reducedMotion","mapColorStates","primary","background","default","pressed","foreground","danger","contrast","white","isMounted","current","pressedAnimationStyle","backgroundColor","value","handleOnPress","event","trigger","foregroundColor","accessible","accessibilityState","busy","accessibilityRole","style","flexShrink","alignSelf","children","View","button","buttonSizeDefault","overflow","paddingHorizontal","opacity","buttonInner","entering","undefined","exiting","columnGap","flexDirection","allowFontScaling","name","size","numberOfLines","ellipsizeMode","accessibilityElementsHidden","importantForAccessibility"],"sourceRoot":"../../../../src","sources":["components/buttons/ButtonSolid.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAEVC,UAAU,EACVC,WAAW,EACXC,SAAS,EACTC,MAAM,QACD,OAAO;AACd,SAGEC,SAAS,QAEJ,cAAc;AACrB,OAAOC,yBAAyB,MAAM,8BAA8B;AACpE,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,QACX,yBAAyB;AAChC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SACEC,cAAc,EACdC,QAAQ,EACRC,2BAA2B,EAC3BC,gCAAgC,EAChCC,0BAA0B,QACrB,YAAY;AACnB,SAASC,iBAAiB,QAAQ,aAAa;AAE/C,SAAmCC,IAAI,QAAQ,UAAU;AACzD,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SAASC,UAAU,QAAQ,0BAA0B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAgBtD,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,gBAAgB,GAAG,GAAG;;AAE5B;AACA,MAAMC,QAAyB,GAAG,EAAE;AA6BpC;AACA;AACA;AACA,OAAO,MAAMC,WAAW,gBAAG3B,UAAU,CACnC,CACE;EACE4B,KAAK,GAAG,SAAS;EACjBC,KAAK;EACLC,SAAS,GAAG,KAAK;EACjBC,QAAQ,GAAG,KAAK;EAChBC,OAAO,GAAG,KAAK;EACfC,IAAI;EACJC,YAAY,GAAG,OAAO;EACtBC,OAAO;EACPC,kBAAkB;EAClBC,iBAAiB;EACjBC;AACF,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,KAAK,GAAG9B,UAAU,CAAC,CAAC;EAC1B,MAAM;IAAE+B,QAAQ;IAAEC,SAAS;IAAEC,UAAU;IAAEC;EAAmB,CAAC,GAC3D5B,iBAAiB,CAAC,CAAC;EACrB,MAAM6B,aAAa,GAAGpC,gBAAgB,CAAC,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AS,CAACC,OAAO,GAAG3C,2BAA2B,GAAGmE,SACnD;QAAAT,QAAA,GAEAtC,IAAI,iBACHZ,IAAA,CAACJ,IAAI;UACHmE,gBAAgB;UAChBC,IAAI,EAAEpD,IAAK;UACXqD,IAAI,EAAE5D,QAAS;UACfE,KAAK,EAAEmC;QAAgB,CACxB,CACF,eACD1C,IAAA,CAACF,UAAU;UACTS,KAAK,EAAEmC,eAAgB;UACvBK,KAAK,EAAEzD,cAAc,CAACkB,KAAM;UAC5B0D,aAAa,EAAE,CAAE;UACjBC,aAAa,EAAC,MAAM;UACpBxB,UAAU,EAAE,KAAM;UAClByB,2BAA2B;UAC3BC,yBAAyB,EAAC,qBAAqB;UAAAnB,QAAA,EAE9C1C;QAAK,CACI,CAAC;MAAA,CACA,CAChB;IAAA,CACY;EAAC,CACP,CAAC;AAEhB,CACF,CAAC;AAED,eAAeF,WAAW","ignoreList":[]}
@@ -1,36 +0,0 @@
1
- import React from "react";
2
- import { AccessibilityRole, GestureResponderEvent, TextStyle, View } from "react-native";
3
- import { WithTestID } from "../../utils/types";
4
- import { IOIcons } from "../icons";
5
- export type ColorButtonLink = "primary" | "contrast";
6
- export type ButtonLinkProps = WithTestID<{
7
- color?: ColorButtonLink;
8
- label: string;
9
- disabled?: boolean;
10
- icon?: IOIcons;
11
- iconPosition?: "start" | "end";
12
- accessibilityLabel?: string;
13
- accessibilityRole?: Extract<AccessibilityRole, "button" | "link">;
14
- accessibilityHint?: string;
15
- numberOfLines?: number;
16
- textAlign?: TextStyle["textAlign"];
17
- onPress: (event: GestureResponderEvent) => void;
18
- }>;
19
- /**
20
- * @deprecated Use `Button` with variant `link` instead
21
- */
22
- export declare const ButtonLink: React.ForwardRefExoticComponent<{
23
- color?: ColorButtonLink;
24
- label: string;
25
- disabled?: boolean;
26
- icon?: IOIcons;
27
- iconPosition?: "start" | "end";
28
- accessibilityLabel?: string;
29
- accessibilityRole?: Extract<AccessibilityRole, "button" | "link">;
30
- accessibilityHint?: string;
31
- numberOfLines?: number;
32
- textAlign?: TextStyle["textAlign"];
33
- onPress: (event: GestureResponderEvent) => void;
34
- } & import("../../utils/types").TestID & React.RefAttributes<View>>;
35
- export default ButtonLink;
36
- //# sourceMappingURL=ButtonLink.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ButtonLink.d.ts","sourceRoot":"","sources":["../../../../src/components/buttons/ButtonLink.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EAErB,SAAS,EACT,IAAI,EACL,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACR,MAAM,UAAU,CAAC;AAOlB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC;IACvC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAE/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,OAAO,CAAC,iBAAiB,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAC;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAEnC,OAAO,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACjD,CAAC,CAAC;AAaH;;GAEG;AACH,eAAO,MAAM,UAAU;YA9Bb,eAAe;WAChB,MAAM;eACF,OAAO;WAEX,OAAO;mBACC,OAAO,GAAG,KAAK;yBAET,MAAM;wBACP,OAAO,CAAC,iBAAiB,EAAE,QAAQ,GAAG,MAAM,CAAC;wBAC7C,MAAM;oBACV,MAAM;gBACV,SAAS,CAAC,WAAW,CAAC;aAEzB,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI;mEAwKhD,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,26 +0,0 @@
1
- import React, { ComponentProps } from "react";
2
- import { GestureResponderEvent, Pressable, View } from "react-native";
3
- import { WithTestID } from "../../utils/types";
4
- import { IOIcons } from "../icons";
5
- type ColorButtonOutline = "primary" | "contrast";
6
- export type ButtonOutline = WithTestID<{
7
- color?: ColorButtonOutline;
8
- label: string;
9
- fullWidth?: boolean;
10
- icon?: IOIcons;
11
- iconPosition?: "start" | "end";
12
- onPress: (event: GestureResponderEvent) => void;
13
- } & Pick<ComponentProps<typeof Pressable>, "disabled" | "accessibilityLabel" | "accessibilityHint">>;
14
- /**
15
- * @deprecated Use `Button` with variant `outline` instead
16
- */
17
- export declare const ButtonOutline: React.ForwardRefExoticComponent<{
18
- color?: ColorButtonOutline;
19
- label: string;
20
- fullWidth?: boolean;
21
- icon?: IOIcons;
22
- iconPosition?: "start" | "end";
23
- onPress: (event: GestureResponderEvent) => void;
24
- } & Pick<import("react-native").PressableProps & React.RefAttributes<View>, "accessibilityLabel" | "accessibilityHint" | "disabled"> & import("../../utils/types").TestID & React.RefAttributes<View>>;
25
- export default ButtonOutline;
26
- //# sourceMappingURL=ButtonOutline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ButtonOutline.d.ts","sourceRoot":"","sources":["../../../../src/components/buttons/ButtonOutline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAc,MAAM,OAAO,CAAC;AAC1D,OAAO,EACL,qBAAqB,EACrB,SAAS,EAET,IAAI,EACL,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAIL,OAAO,EACR,MAAM,UAAU,CAAC;AAGlB,KAAK,kBAAkB,GAAG,SAAS,GAAG,UAAU,CAAC;AACjD,MAAM,MAAM,aAAa,GAAG,UAAU,CACpC;IACE,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAE/B,OAAO,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACjD,GAAG,IAAI,CACN,cAAc,CAAC,OAAO,SAAS,CAAC,EAChC,UAAU,GAAG,oBAAoB,GAAG,mBAAmB,CACxD,CACF,CAAC;AA2BF;;GAEG;AACH,eAAO,MAAM,aAAa;YA1Cd,kBAAkB;WACnB,MAAM;gBACD,OAAO;WAEZ,OAAO;mBACC,OAAO,GAAG,KAAK;aAErB,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI;sMA+NlD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,52 +0,0 @@
1
- import React, { ComponentProps } from "react";
2
- import { GestureResponderEvent, Pressable, View } from "react-native";
3
- import { WithTestID } from "../../utils/types";
4
- import { IOIcons } from "../icons";
5
- export type ButtonSolidColor = "primary" | "danger" | "contrast";
6
- export type ButtonSolidProps = WithTestID<{
7
- /**
8
- * @default primary
9
- */
10
- color?: ButtonSolidColor;
11
- label: string;
12
- /**
13
- * @default false
14
- */
15
- fullWidth?: boolean;
16
- /**
17
- * @default false
18
- */
19
- loading?: boolean;
20
- icon?: IOIcons;
21
- /**
22
- * @default start
23
- */
24
- iconPosition?: "start" | "end";
25
- onPress: (event: GestureResponderEvent) => void;
26
- } & Pick<ComponentProps<typeof Pressable>, "disabled" | "accessibilityLabel" | "accessibilityHint">>;
27
- /**
28
- * @deprecated Use `Button` with variant `solid` instead
29
- */
30
- export declare const ButtonSolid: React.ForwardRefExoticComponent<{
31
- /**
32
- * @default primary
33
- */
34
- color?: ButtonSolidColor;
35
- label: string;
36
- /**
37
- * @default false
38
- */
39
- fullWidth?: boolean;
40
- /**
41
- * @default false
42
- */
43
- loading?: boolean;
44
- icon?: IOIcons;
45
- /**
46
- * @default start
47
- */
48
- iconPosition?: "start" | "end";
49
- onPress: (event: GestureResponderEvent) => void;
50
- } & Pick<import("react-native").PressableProps & React.RefAttributes<View>, "accessibilityLabel" | "accessibilityHint" | "disabled"> & import("../../utils/types").TestID & React.RefAttributes<View>>;
51
- export default ButtonSolid;
52
- //# sourceMappingURL=ButtonSolid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ButtonSolid.d.ts","sourceRoot":"","sources":["../../../../src/components/buttons/ButtonSolid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,cAAc,EAKf,MAAM,OAAO,CAAC;AACf,OAAO,EAEL,qBAAqB,EACrB,SAAS,EACT,IAAI,EACL,MAAM,cAAc,CAAC;AAgBtB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAmB,OAAO,EAAQ,MAAM,UAAU,CAAC;AAI1D,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;AAoBjE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CACvC;IACE;;OAEG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACjD,GAAG,IAAI,CACN,cAAc,CAAC,OAAO,SAAS,CAAC,EAChC,UAAU,GAAG,oBAAoB,GAAG,mBAAmB,CACxD,CACF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;IA5BpB;;OAEG;YACK,gBAAgB;WACjB,MAAM;IACb;;OAEG;gBACS,OAAO;IACnB;;OAEG;cACO,OAAO;WACV,OAAO;IACd;;OAEG;mBACY,OAAO,GAAG,KAAK;aACrB,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI;sMAiNlD,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,222 +0,0 @@
1
- import React, { forwardRef } from "react";
2
- import {
3
- AccessibilityRole,
4
- GestureResponderEvent,
5
- Pressable,
6
- TextStyle,
7
- View
8
- } from "react-native";
9
- import Animated, {
10
- interpolateColor,
11
- useAnimatedProps,
12
- useAnimatedStyle,
13
- useReducedMotion
14
- } from "react-native-reanimated";
15
- import { useIONewTypeface, useIOTheme } from "../../context";
16
- import {
17
- IOButtonStyles,
18
- IOColors,
19
- IOSpacingScale,
20
- hexToRgba
21
- } from "../../core";
22
- import { useScaleAnimation } from "../../hooks";
23
- import { WithTestID } from "../../utils/types";
24
- import {
25
- AnimatedIcon,
26
- AnimatedIconWithColorTransition,
27
- IOIconSizeScale,
28
- IOIcons
29
- } from "../icons";
30
- import {
31
- IOText,
32
- buttonTextFontSize,
33
- buttonTextLineHeight
34
- } from "../typography";
35
-
36
- export type ColorButtonLink = "primary" | "contrast";
37
-
38
- export type ButtonLinkProps = WithTestID<{
39
- color?: ColorButtonLink;
40
- label: string;
41
- disabled?: boolean;
42
- // Icons
43
- icon?: IOIcons;
44
- iconPosition?: "start" | "end";
45
- // Accessibility
46
- accessibilityLabel?: string;
47
- accessibilityRole?: Extract<AccessibilityRole, "button" | "link">;
48
- accessibilityHint?: string;
49
- numberOfLines?: number;
50
- textAlign?: TextStyle["textAlign"];
51
- // Events
52
- onPress: (event: GestureResponderEvent) => void;
53
- }>;
54
-
55
- type ColorStates = {
56
- foreground: {
57
- default: string;
58
- pressed: string;
59
- disabled: string;
60
- };
61
- };
62
-
63
- const DISABLED_OPACITY = 0.5;
64
- const ICON_MARGIN = 8;
65
-
66
- /**
67
- * @deprecated Use `Button` with variant `link` instead
68
- */
69
- export const ButtonLink = forwardRef<View, ButtonLinkProps>(
70
- (
71
- {
72
- color = "primary",
73
- label,
74
- disabled = false,
75
- icon,
76
- iconPosition = "start",
77
- onPress,
78
- accessibilityLabel,
79
- accessibilityRole = "button",
80
- accessibilityHint,
81
- numberOfLines = 1,
82
- textAlign = "auto",
83
- testID
84
- },
85
- ref
86
- ) => {
87
- const theme = useIOTheme();
88
- const { newTypefaceEnabled } = useIONewTypeface();
89
- const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
90
- useScaleAnimation();
91
- const reducedMotion = useReducedMotion();
92
-
93
- const mapColorStates: Record<
94
- NonNullable<ButtonLinkProps["color"]>,
95
- ColorStates
96
- > = {
97
- // Primary button
98
- primary: {
99
- foreground: {
100
- default: IOColors[theme["interactiveElem-default"]],
101
- pressed: IOColors[theme["interactiveElem-pressed"]],
102
- disabled: hexToRgba(IOColors[theme["interactiveElem-default"]], 0.85)
103
- }
104
- },
105
- contrast: {
106
- foreground: {
107
- default: IOColors.white,
108
- pressed: hexToRgba(IOColors.white, 0.85),
109
- disabled: hexToRgba(IOColors.white, 0.5)
110
- }
111
- }
112
- };
113
-
114
- const AnimatedIOText = Animated.createAnimatedComponent(IOText);
115
-
116
- const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
117
- // Link color states to the pressed states
118
-
119
- const labelColor = interpolateColor(
120
- progress.value,
121
- [0, 1],
122
- [
123
- mapColorStates[color].foreground.default,
124
- mapColorStates[color].foreground.pressed
125
- ]
126
- );
127
-
128
- return {
129
- color: labelColor
130
- };
131
- });
132
-
133
- // Animate the <Icon> color prop
134
- const pressedColorIconAnimationStyle = useAnimatedProps(() => {
135
- const iconColor = interpolateColor(
136
- progress.value,
137
- [0, 1],
138
- [
139
- mapColorStates[color].foreground.default,
140
- mapColorStates[color].foreground.pressed
141
- ]
142
- );
143
-
144
- return { color: iconColor };
145
- });
146
-
147
- // Icon size
148
- const iconSize: IOIconSizeScale = 24;
149
- const iconMargin: IOSpacingScale = 8;
150
-
151
- return (
152
- <Pressable
153
- ref={ref}
154
- accessibilityLabel={accessibilityLabel || label}
155
- accessibilityHint={accessibilityHint}
156
- accessibilityRole={accessibilityRole}
157
- accessibilityState={{ disabled }}
158
- testID={testID}
159
- onPress={onPress}
160
- onPressIn={onPressIn}
161
- onPressOut={onPressOut}
162
- onTouchEnd={onPressOut}
163
- accessible={true}
164
- disabled={disabled}
165
- hitSlop={{ top: 14, right: 24, bottom: 14, left: 24 }}
166
- style={{ alignSelf: "flex-start" }}
167
- >
168
- <Animated.View
169
- style={[
170
- IOButtonStyles.buttonLink,
171
- iconPosition === "end" && { flexDirection: "row-reverse" },
172
- { columnGap: iconMargin },
173
- disabled ? { opacity: DISABLED_OPACITY } : {},
174
- { columnGap: ICON_MARGIN },
175
- /* Prevent Reanimated from overriding background colors
176
- if button is disabled */
177
- !disabled && !reducedMotion && scaleAnimatedStyle
178
- ]}
179
- >
180
- {icon &&
181
- (!disabled ? (
182
- <AnimatedIconWithColorTransition
183
- allowFontScaling
184
- name={icon}
185
- animatedProps={pressedColorIconAnimationStyle}
186
- color={mapColorStates[color]?.foreground?.default}
187
- size={iconSize}
188
- />
189
- ) : (
190
- <AnimatedIcon
191
- allowFontScaling
192
- name={icon}
193
- color={mapColorStates[color]?.foreground?.disabled}
194
- size={iconSize}
195
- />
196
- ))}
197
- <AnimatedIOText
198
- accessible={false}
199
- accessibilityElementsHidden
200
- importantForAccessibility="no-hide-descendants"
201
- font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
202
- weight={"Semibold"}
203
- size={buttonTextFontSize}
204
- lineHeight={buttonTextLineHeight}
205
- style={[
206
- disabled
207
- ? { color: mapColorStates[color]?.foreground?.disabled }
208
- : { ...pressedColorLabelAnimationStyle },
209
- { textAlign }
210
- ]}
211
- numberOfLines={numberOfLines}
212
- ellipsizeMode="tail"
213
- >
214
- {label}
215
- </AnimatedIOText>
216
- </Animated.View>
217
- </Pressable>
218
- );
219
- }
220
- );
221
-
222
- export default ButtonLink;