@pagopa/io-app-design-system 5.11.13-0 → 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 (82) 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/commonjs/components/toast/ToastProvider.js +1 -5
  19. package/lib/commonjs/components/toast/ToastProvider.js.map +1 -1
  20. package/lib/module/components/banner/BannerErrorState.js +3 -2
  21. package/lib/module/components/banner/BannerErrorState.js.map +1 -1
  22. package/lib/module/components/buttons/__test__/button.test.js +13 -9
  23. package/lib/module/components/buttons/__test__/button.test.js.map +1 -1
  24. package/lib/module/components/buttons/index.js +0 -3
  25. package/lib/module/components/buttons/index.js.map +1 -1
  26. package/lib/module/components/listitems/ListItemHeader.js +3 -2
  27. package/lib/module/components/listitems/ListItemHeader.js.map +1 -1
  28. package/lib/module/components/listitems/ListItemInfo.js +3 -2
  29. package/lib/module/components/listitems/ListItemInfo.js.map +1 -1
  30. package/lib/module/components/modules/ModuleCheckout.js +3 -2
  31. package/lib/module/components/modules/ModuleCheckout.js.map +1 -1
  32. package/lib/module/components/pictograms/Pictogram.js +2 -0
  33. package/lib/module/components/pictograms/Pictogram.js.map +1 -1
  34. package/lib/module/components/pictograms/svg/PictogramPinSecurity.js +59 -0
  35. package/lib/module/components/pictograms/svg/PictogramPinSecurity.js.map +1 -0
  36. package/lib/module/components/pictograms/svg/originals/PictogramPinSecurity.svg +1 -0
  37. package/lib/module/components/toast/ToastProvider.js +2 -6
  38. package/lib/module/components/toast/ToastProvider.js.map +1 -1
  39. package/lib/typescript/components/banner/BannerErrorState.d.ts.map +1 -1
  40. package/lib/typescript/components/buttons/index.d.ts +0 -3
  41. package/lib/typescript/components/buttons/index.d.ts.map +1 -1
  42. package/lib/typescript/components/listitems/ListItemHeader.d.ts +2 -2
  43. package/lib/typescript/components/listitems/ListItemHeader.d.ts.map +1 -1
  44. package/lib/typescript/components/listitems/ListItemInfo.d.ts +2 -2
  45. package/lib/typescript/components/listitems/ListItemInfo.d.ts.map +1 -1
  46. package/lib/typescript/components/pictograms/Pictogram.d.ts +1 -0
  47. package/lib/typescript/components/pictograms/Pictogram.d.ts.map +1 -1
  48. package/lib/typescript/components/pictograms/svg/PictogramPinSecurity.d.ts +5 -0
  49. package/lib/typescript/components/pictograms/svg/PictogramPinSecurity.d.ts.map +1 -0
  50. package/lib/typescript/components/toast/ToastProvider.d.ts.map +1 -1
  51. package/package.json +1 -1
  52. package/src/components/banner/BannerErrorState.tsx +7 -2
  53. package/src/components/buttons/__test__/button.test.tsx +15 -13
  54. package/src/components/buttons/index.tsx +0 -3
  55. package/src/components/listitems/ListItemHeader.tsx +3 -3
  56. package/src/components/listitems/ListItemInfo.tsx +4 -3
  57. package/src/components/modules/ModuleCheckout.tsx +2 -2
  58. package/src/components/pictograms/Pictogram.tsx +2 -0
  59. package/src/components/pictograms/svg/PictogramPinSecurity.tsx +44 -0
  60. package/src/components/pictograms/svg/originals/PictogramPinSecurity.svg +1 -0
  61. package/src/components/toast/ToastProvider.tsx +1 -13
  62. package/lib/commonjs/components/buttons/ButtonLink.js +0 -157
  63. package/lib/commonjs/components/buttons/ButtonLink.js.map +0 -1
  64. package/lib/commonjs/components/buttons/ButtonOutline.js +0 -173
  65. package/lib/commonjs/components/buttons/ButtonOutline.js.map +0 -1
  66. package/lib/commonjs/components/buttons/ButtonSolid.js +0 -194
  67. package/lib/commonjs/components/buttons/ButtonSolid.js.map +0 -1
  68. package/lib/module/components/buttons/ButtonLink.js +0 -152
  69. package/lib/module/components/buttons/ButtonLink.js.map +0 -1
  70. package/lib/module/components/buttons/ButtonOutline.js +0 -168
  71. package/lib/module/components/buttons/ButtonOutline.js.map +0 -1
  72. package/lib/module/components/buttons/ButtonSolid.js +0 -188
  73. package/lib/module/components/buttons/ButtonSolid.js.map +0 -1
  74. package/lib/typescript/components/buttons/ButtonLink.d.ts +0 -36
  75. package/lib/typescript/components/buttons/ButtonLink.d.ts.map +0 -1
  76. package/lib/typescript/components/buttons/ButtonOutline.d.ts +0 -26
  77. package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +0 -1
  78. package/lib/typescript/components/buttons/ButtonSolid.d.ts +0 -52
  79. package/lib/typescript/components/buttons/ButtonSolid.d.ts.map +0 -1
  80. package/src/components/buttons/ButtonLink.tsx +0 -222
  81. package/src/components/buttons/ButtonOutline.tsx +0 -261
  82. package/src/components/buttons/ButtonSolid.tsx +0 -285
@@ -1,173 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.ButtonOutline = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
- var _context = require("../../context");
11
- var _core = require("../../core/");
12
- var _hooks = require("../../hooks");
13
- var _icons = require("../icons");
14
- var _typography = require("../typography");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
- // Icon size
18
- const iconSize = 20;
19
- const DISABLED_OPACITY = 0.5;
20
- const ICON_MARGIN = 8;
21
- const IOButtonStylesLocal = _reactNative.StyleSheet.create({
22
- buttonWithBorder: {
23
- borderWidth: 2
24
- }
25
- });
26
-
27
- /**
28
- * @deprecated Use `Button` with variant `outline` instead
29
- */
30
- const ButtonOutline = exports.ButtonOutline = /*#__PURE__*/(0, _react.forwardRef)(({
31
- color = "primary",
32
- label,
33
- fullWidth = false,
34
- disabled = false,
35
- icon,
36
- iconPosition = "start",
37
- onPress,
38
- accessibilityLabel,
39
- accessibilityHint,
40
- testID
41
- }, ref) => {
42
- const theme = (0, _context.useIOTheme)();
43
- const {
44
- newTypefaceEnabled
45
- } = (0, _context.useIONewTypeface)();
46
- const {
47
- progress,
48
- onPressIn,
49
- onPressOut,
50
- scaleAnimatedStyle
51
- } = (0, _hooks.useScaleAnimation)();
52
- const reducedMotion = (0, _reactNativeReanimated.useReducedMotion)();
53
- const AnimatedIOText = _reactNativeReanimated.default.createAnimatedComponent(_typography.IOText);
54
- const mapColorStates = {
55
- // Primary button
56
- primary: {
57
- background: {
58
- default: (0, _core.hexToRgba)(_core.IOColors[theme["interactiveElem-pressed"]], 0),
59
- pressed: (0, _core.hexToRgba)(_core.IOColors[theme["interactiveElem-pressed"]], 0.1),
60
- disabled: "transparent"
61
- },
62
- foreground: {
63
- default: _core.IOColors[theme["interactiveElem-default"]],
64
- pressed: _core.IOColors[theme["interactiveElem-pressed"]],
65
- disabled: _core.IOColors[theme["interactiveOutline-disabled"]]
66
- }
67
- },
68
- // Contrast button
69
- contrast: {
70
- background: {
71
- default: (0, _core.hexToRgba)(_core.IOColors["blueIO-600"], 0),
72
- pressed: (0, _core.hexToRgba)(_core.IOColors["blueIO-600"], 0.5),
73
- disabled: "transparent"
74
- },
75
- foreground: {
76
- default: _core.IOColors.white,
77
- pressed: _core.IOColors.white,
78
- disabled: _core.IOColors["blueIO-200"]
79
- }
80
- }
81
- };
82
-
83
- // Interpolate animation values from `isPressed` values
84
- const pressedAnimationStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
85
- // Link color states to the pressed states
86
- const backgroundColor = (0, _reactNativeReanimated.interpolateColor)(progress.value, [0, 1], [mapColorStates[color].background.default, mapColorStates[color].background.pressed]);
87
- const borderColor = (0, _reactNativeReanimated.interpolateColor)(progress.value, [0, 1], [mapColorStates[color].foreground.default, mapColorStates[color].foreground.pressed]);
88
- return {
89
- borderColor,
90
- backgroundColor
91
- };
92
- });
93
- const pressedColorLabelAnimationStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
94
- color: (0, _reactNativeReanimated.interpolateColor)(progress.value, [0, 1], [mapColorStates[color].foreground.default, mapColorStates[color].foreground.pressed])
95
- }));
96
-
97
- // Animate the <Icon> color prop
98
- const pressedColorIconAnimationStyle = (0, _reactNativeReanimated.useAnimatedProps)(() => ({
99
- color: (0, _reactNativeReanimated.interpolateColor)(progress.value, [0, 1], [mapColorStates[color].foreground.default, mapColorStates[color].foreground.pressed])
100
- }));
101
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
102
- ref: ref,
103
- accessible: true,
104
- accessibilityLabel: accessibilityLabel || label,
105
- accessibilityHint: accessibilityHint,
106
- accessibilityRole: "button",
107
- accessibilityState: {
108
- disabled: disabled || false
109
- },
110
- onPress: onPress,
111
- onPressIn: onPressIn,
112
- onPressOut: onPressOut,
113
- disabled: disabled,
114
- style: fullWidth ? {
115
- flexShrink: 0,
116
- alignSelf: "stretch"
117
- } : {
118
- flexShrink: 1,
119
- alignSelf: "auto"
120
- },
121
- testID: testID,
122
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
123
- style: [_core.IOButtonStyles.button, _core.IOButtonStyles.buttonSizeDefault, IOButtonStylesLocal.buttonWithBorder, fullWidth && {
124
- paddingHorizontal: 16
125
- }, {
126
- columnGap: ICON_MARGIN
127
- }, iconPosition === "end" && {
128
- flexDirection: "row-reverse"
129
- }, disabled ? {
130
- backgroundColor: mapColorStates[color]?.background?.disabled,
131
- borderColor: mapColorStates[color]?.foreground?.disabled,
132
- opacity: DISABLED_OPACITY
133
- } : {
134
- backgroundColor: mapColorStates[color]?.background?.default,
135
- borderColor: mapColorStates[color]?.foreground.default
136
- },
137
- /* Prevent Reanimated from overriding background colors
138
- if button is disabled */
139
- !reducedMotion && !disabled && scaleAnimatedStyle, !disabled && pressedAnimationStyle],
140
- children: [icon && (!disabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AnimatedIconWithColorTransition, {
141
- allowFontScaling: true,
142
- name: icon,
143
- animatedProps: pressedColorIconAnimationStyle,
144
- color: mapColorStates[color]?.foreground?.default,
145
- size: iconSize
146
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AnimatedIcon, {
147
- allowFontScaling: true,
148
- name: icon,
149
- color: mapColorStates[color]?.foreground?.disabled,
150
- size: iconSize
151
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedIOText, {
152
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
153
- weight: "Semibold",
154
- size: _typography.buttonTextFontSize,
155
- accessible: false,
156
- accessibilityElementsHidden: true,
157
- importantForAccessibility: "no-hide-descendants",
158
- numberOfLines: 1,
159
- ellipsizeMode: "tail",
160
- style: [{
161
- alignSelf: "center"
162
- }, disabled ? {
163
- color: mapColorStates[color]?.foreground?.disabled
164
- } : {
165
- ...pressedColorLabelAnimationStyle
166
- }],
167
- children: label
168
- })]
169
- })
170
- });
171
- });
172
- var _default = exports.default = ButtonOutline;
173
- //# sourceMappingURL=ButtonOutline.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_context","_core","_hooks","_icons","_typography","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","iconSize","DISABLED_OPACITY","ICON_MARGIN","IOButtonStylesLocal","StyleSheet","create","buttonWithBorder","borderWidth","ButtonOutline","exports","forwardRef","color","label","fullWidth","disabled","icon","iconPosition","onPress","accessibilityLabel","accessibilityHint","testID","ref","theme","useIOTheme","newTypefaceEnabled","useIONewTypeface","progress","onPressIn","onPressOut","scaleAnimatedStyle","useScaleAnimation","reducedMotion","useReducedMotion","AnimatedIOText","Animated","createAnimatedComponent","IOText","mapColorStates","primary","background","hexToRgba","IOColors","pressed","foreground","contrast","white","pressedAnimationStyle","useAnimatedStyle","backgroundColor","interpolateColor","value","borderColor","pressedColorLabelAnimationStyle","pressedColorIconAnimationStyle","useAnimatedProps","jsx","Pressable","accessible","accessibilityRole","accessibilityState","style","flexShrink","alignSelf","children","jsxs","View","IOButtonStyles","button","buttonSizeDefault","paddingHorizontal","columnGap","flexDirection","opacity","AnimatedIconWithColorTransition","allowFontScaling","name","animatedProps","size","AnimatedIcon","font","weight","buttonTextFontSize","accessibilityElementsHidden","importantForAccessibility","numberOfLines","ellipsizeMode","_default"],"sourceRoot":"../../../../src","sources":["components/buttons/ButtonOutline.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,sBAAA,G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AI,EAAE7E;MAAS,CAChB,CACF,CAAC,eACJ,IAAApB,WAAA,CAAA2E,GAAA,EAACtB,cAAc;QACb8C,IAAI,EAAEvD,kBAAkB,GAAG,UAAU,GAAG,kBAAmB;QAC3DwD,MAAM,EAAE,UAAW;QACnBH,IAAI,EAAEI,8BAAmB;QACzBxB,UAAU,EAAE,KAAM;QAClByB,2BAA2B;QAC3BC,yBAAyB,EAAC,qBAAqB;QAC/CC,aAAa,EAAE,CAAE;QACjBC,aAAa,EAAC,MAAM;QACpBzB,KAAK,EAAE,CACL;UAAEE,SAAS,EAAE;QAAS,CAAC,EACvBhD,QAAQ,GACJ;UAAEH,KAAK,EAAE0B,cAAc,CAAC1B,KAAK,CAAC,EAAEgC,UAAU,EAAE7B;QAAS,CAAC,GACtD;UAAE,GAAGsC;QAAgC,CAAC,CAC1C;QAAAW,QAAA,EAEDnD;MAAK,CACQ,CAAC;IAAA,CACJ;EAAC,CACP,CAAC;AAEhB,CACF,CAAC;AAAC,IAAA0E,QAAA,GAAA7E,OAAA,CAAAlB,OAAA,GAEaiB,aAAa","ignoreList":[]}
@@ -1,194 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.ButtonSolid = 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 _context = require("../../context");
12
- var _core = require("../../core");
13
- var _hooks = require("../../hooks");
14
- var _icons = require("../icons");
15
- var _loadingSpinner = require("../loadingSpinner");
16
- var _ButtonText = require("../typography/ButtonText");
17
- var _jsxRuntime = require("react/jsx-runtime");
18
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
20
- const ICON_MARGIN = 8;
21
- const DISABLED_OPACITY = 0.5;
22
-
23
- // Icon size
24
- const iconSize = 20;
25
- /**
26
- * @deprecated Use `Button` with variant `solid` instead
27
- */
28
- const ButtonSolid = exports.ButtonSolid = /*#__PURE__*/(0, _react.forwardRef)(({
29
- color = "primary",
30
- label,
31
- fullWidth = false,
32
- disabled = false,
33
- loading = false,
34
- icon,
35
- iconPosition = "start",
36
- onPress,
37
- accessibilityLabel,
38
- accessibilityHint,
39
- testID
40
- }, ref) => {
41
- const theme = (0, _context.useIOTheme)();
42
- const {
43
- progress,
44
- onPressIn,
45
- onPressOut,
46
- scaleAnimatedStyle
47
- } = (0, _hooks.useScaleAnimation)();
48
- const reducedMotion = (0, _reactNativeReanimated.useReducedMotion)();
49
- const mapColorStates = {
50
- // Primary button
51
- primary: {
52
- background: {
53
- default: _core.IOColors[theme["interactiveElem-default"]],
54
- pressed: _core.IOColors[theme["interactiveElem-pressed"]],
55
- disabled: _core.IOColors[theme["interactiveElem-disabled"]]
56
- },
57
- foreground: {
58
- default: theme["buttonText-default"],
59
- disabled: theme["buttonText-disabled"]
60
- }
61
- },
62
- // Danger button
63
- danger: {
64
- background: {
65
- default: _core.IOColors["error-600"],
66
- pressed: _core.IOColors["error-500"],
67
- disabled: _core.IOColors[theme["interactiveElem-disabled"]]
68
- },
69
- foreground: {
70
- default: theme["buttonText-danger"],
71
- disabled: theme["buttonText-disabled"]
72
- }
73
- },
74
- // Contrast button
75
- contrast: {
76
- background: {
77
- default: _core.IOColors.white,
78
- pressed: _core.IOColors["blueIO-50"],
79
- disabled: _core.IOColors["blueIO-50"]
80
- },
81
- foreground: {
82
- default: "blueIO-500",
83
- disabled: "blueIO-500"
84
- }
85
- }
86
- };
87
-
88
- /* Prevent the component from triggering the `isEntering' transition
89
- on the on the first render. Solution from this discussion:
90
- https://github.com/software-mansion/react-native-reanimated/discussions/2513
91
- */
92
- const isMounted = (0, _react.useRef)(false);
93
- (0, _react.useEffect)(() => {
94
- // eslint-disable-next-line functional/immutable-data
95
- isMounted.current = true;
96
- }, []);
97
-
98
- // Interpolate animation values from `isPressed` values
99
- const pressedAnimationStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
100
- // Link color states to the pressed states
101
- const backgroundColor = (0, _reactNativeReanimated.interpolateColor)(progress.value, [0, 1], [mapColorStates[color].background.default, mapColorStates[color].background.pressed]);
102
- return {
103
- backgroundColor
104
- };
105
- });
106
- const handleOnPress = (0, _react.useCallback)(event => {
107
- /* Don't call `onPress` if the button is
108
- in loading state */
109
- if (loading) {
110
- return;
111
- }
112
- _reactNativeHapticFeedback.default.trigger("impactLight");
113
- onPress(event);
114
- }, [loading, onPress]);
115
-
116
- // Background
117
- const backgroundColor = disabled ? mapColorStates[color]?.background?.disabled : mapColorStates[color]?.background?.default;
118
-
119
- // Label & Icons colors
120
- const foregroundColor = disabled ? mapColorStates[color]?.foreground?.disabled : mapColorStates[color]?.foreground?.default;
121
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
122
- testID: testID,
123
- ref: ref,
124
- accessible: true
125
- // Using || operator because empty string is not an accepted value
126
- ,
127
- accessibilityLabel: accessibilityLabel || label,
128
- accessibilityHint: accessibilityHint,
129
- accessibilityState: {
130
- busy: loading,
131
- disabled: disabled || false
132
- },
133
- accessibilityRole: "button",
134
- onPress: handleOnPress,
135
- onPressIn: onPressIn,
136
- onPressOut: onPressOut,
137
- disabled: disabled,
138
- style: fullWidth ? {
139
- flexShrink: 0,
140
- alignSelf: "stretch"
141
- } : {
142
- flexShrink: 1,
143
- alignSelf: "auto"
144
- },
145
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
146
- style: [_core.IOButtonStyles.button, _core.IOButtonStyles.buttonSizeDefault, {
147
- backgroundColor,
148
- overflow: "hidden"
149
- }, fullWidth && {
150
- paddingHorizontal: 16
151
- }, disabled ? {
152
- opacity: DISABLED_OPACITY
153
- } : {},
154
- /* Prevent Reanimated from overriding background colors
155
- if button is disabled */
156
- !disabled && !reducedMotion && scaleAnimatedStyle, !disabled && pressedAnimationStyle],
157
- children: [loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
158
- style: _core.IOButtonStyles.buttonInner,
159
- entering: isMounted.current ? _core.enterTransitionInnerContentSmall : undefined,
160
- exiting: _core.exitTransitionInnerContent,
161
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_loadingSpinner.LoadingSpinner, {
162
- color: _core.IOColors[foregroundColor]
163
- })
164
- }), !loading && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNativeReanimated.default.View, {
165
- style: [_core.IOButtonStyles.buttonInner, {
166
- columnGap: ICON_MARGIN
167
- },
168
- /* If 'iconPosition' is set to 'end', we use
169
- reverse flex property to invert the position */
170
- iconPosition === "end" && {
171
- flexDirection: "row-reverse"
172
- }],
173
- entering: isMounted.current ? _core.enterTransitionInnerContent : undefined,
174
- children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.Icon, {
175
- allowFontScaling: true,
176
- name: icon,
177
- size: iconSize,
178
- color: foregroundColor
179
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonText.ButtonText, {
180
- color: foregroundColor,
181
- style: _core.IOButtonStyles.label,
182
- numberOfLines: 1,
183
- ellipsizeMode: "tail",
184
- accessible: false,
185
- accessibilityElementsHidden: true,
186
- importantForAccessibility: "no-hide-descendants",
187
- children: label
188
- })]
189
- })]
190
- })
191
- });
192
- });
193
- var _default = exports.default = ButtonSolid;
194
- //# sourceMappingURL=ButtonSolid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeHapticFeedback","_interopRequireDefault","_reactNativeReanimated","_context","_core","_hooks","_icons","_loadingSpinner","_ButtonText","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ICON_MARGIN","DISABLED_OPACITY","iconSize","ButtonSolid","exports","forwardRef","color","label","fullWidth","disabled","loading","icon","iconPosition","onPress","accessibilityLabel","accessibilityHint","testID","ref","theme","useIOTheme","progress","onPressIn","onPressOut","scaleAnimatedStyle","useScaleAnimation","reducedMotion","useReducedMotion","mapColorStates","primary","background","IOColors","pressed","foreground","danger","contrast","white","isMounted","useRef","useEffect","current","pressedAnimationStyle","useAnimatedStyle","backgroundColor","interpolateColor","value","handleOnPress","useCallback","event","ReactNativeHapticFeedback","trigger","foregroundColor","jsx","Pressable","accessible","accessibilityState","busy","accessibilityRole","style","flexShrink","alignSelf","children","jsxs","View","IOButtonStyles","button","buttonSizeDefault","overflow","paddingHorizontal","opacity","buttonInner","entering","enterTransitionInnerContentSmall","undefined","exiting","exitTransitionInnerContent","LoadingSpinner","columnGap","flexDirection","enterTransitionInnerContent","Icon","allowFontScaling","name","size","ButtonText","numberOfLines","ellipsizeMode","accessibilityElementsHidden","importantForAccessibility","_default"],"sourceRoot":"../../../../src","sources":["components/buttons/ButtonSolid.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAOA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,0BAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAL,uBAAA,CAAAC,OAAA;AAKA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAOA,IAAAO,MAAA,GAAAP,OAAA;AAEA,IA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EAAE,KAAM;UAClBiC,2BAA2B;UAC3BC,yBAAyB,EAAC,qBAAqB;UAAA3B,QAAA,EAE9CrD;QAAK,CACI,CAAC;MAAA,CACA,CAChB;IAAA,CACY;EAAC,CACP,CAAC;AAEhB,CACF,CAAC;AAAC,IAAAiF,QAAA,GAAApF,OAAA,CAAArB,OAAA,GAEaoB,WAAW","ignoreList":[]}
@@ -1,152 +0,0 @@
1
- "use strict";
2
-
3
- import React, { forwardRef } from "react";
4
- import { Pressable } from "react-native";
5
- import Animated, { interpolateColor, useAnimatedProps, useAnimatedStyle, useReducedMotion } from "react-native-reanimated";
6
- import { useIONewTypeface, useIOTheme } from "../../context";
7
- import { IOButtonStyles, IOColors, hexToRgba } from "../../core";
8
- import { useScaleAnimation } from "../../hooks";
9
- import { AnimatedIcon, AnimatedIconWithColorTransition } from "../icons";
10
- import { IOText, buttonTextFontSize, buttonTextLineHeight } from "../typography";
11
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
- const DISABLED_OPACITY = 0.5;
13
- const ICON_MARGIN = 8;
14
-
15
- /**
16
- * @deprecated Use `Button` with variant `link` instead
17
- */
18
- export const ButtonLink = /*#__PURE__*/forwardRef(({
19
- color = "primary",
20
- label,
21
- disabled = false,
22
- icon,
23
- iconPosition = "start",
24
- onPress,
25
- accessibilityLabel,
26
- accessibilityRole = "button",
27
- accessibilityHint,
28
- numberOfLines = 1,
29
- textAlign = "auto",
30
- testID
31
- }, ref) => {
32
- const theme = useIOTheme();
33
- const {
34
- newTypefaceEnabled
35
- } = useIONewTypeface();
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
- foreground: {
47
- default: IOColors[theme["interactiveElem-default"]],
48
- pressed: IOColors[theme["interactiveElem-pressed"]],
49
- disabled: hexToRgba(IOColors[theme["interactiveElem-default"]], 0.85)
50
- }
51
- },
52
- contrast: {
53
- foreground: {
54
- default: IOColors.white,
55
- pressed: hexToRgba(IOColors.white, 0.85),
56
- disabled: hexToRgba(IOColors.white, 0.5)
57
- }
58
- }
59
- };
60
- const AnimatedIOText = Animated.createAnimatedComponent(IOText);
61
- const pressedColorLabelAnimationStyle = useAnimatedStyle(() => {
62
- // Link color states to the pressed states
63
-
64
- const labelColor = interpolateColor(progress.value, [0, 1], [mapColorStates[color].foreground.default, mapColorStates[color].foreground.pressed]);
65
- return {
66
- color: labelColor
67
- };
68
- });
69
-
70
- // Animate the <Icon> color prop
71
- const pressedColorIconAnimationStyle = useAnimatedProps(() => {
72
- const iconColor = interpolateColor(progress.value, [0, 1], [mapColorStates[color].foreground.default, mapColorStates[color].foreground.pressed]);
73
- return {
74
- color: iconColor
75
- };
76
- });
77
-
78
- // Icon size
79
- const iconSize = 24;
80
- const iconMargin = 8;
81
- return /*#__PURE__*/_jsx(Pressable, {
82
- ref: ref,
83
- accessibilityLabel: accessibilityLabel || label,
84
- accessibilityHint: accessibilityHint,
85
- accessibilityRole: accessibilityRole,
86
- accessibilityState: {
87
- disabled
88
- },
89
- testID: testID,
90
- onPress: onPress,
91
- onPressIn: onPressIn,
92
- onPressOut: onPressOut,
93
- onTouchEnd: onPressOut,
94
- accessible: true,
95
- disabled: disabled,
96
- hitSlop: {
97
- top: 14,
98
- right: 24,
99
- bottom: 14,
100
- left: 24
101
- },
102
- style: {
103
- alignSelf: "flex-start"
104
- },
105
- children: /*#__PURE__*/_jsxs(Animated.View, {
106
- style: [IOButtonStyles.buttonLink, iconPosition === "end" && {
107
- flexDirection: "row-reverse"
108
- }, {
109
- columnGap: iconMargin
110
- }, disabled ? {
111
- opacity: DISABLED_OPACITY
112
- } : {}, {
113
- columnGap: ICON_MARGIN
114
- },
115
- /* Prevent Reanimated from overriding background colors
116
- if button is disabled */
117
- !disabled && !reducedMotion && scaleAnimatedStyle],
118
- children: [icon && (!disabled ? /*#__PURE__*/_jsx(AnimatedIconWithColorTransition, {
119
- allowFontScaling: true,
120
- name: icon,
121
- animatedProps: pressedColorIconAnimationStyle,
122
- color: mapColorStates[color]?.foreground?.default,
123
- size: iconSize
124
- }) : /*#__PURE__*/_jsx(AnimatedIcon, {
125
- allowFontScaling: true,
126
- name: icon,
127
- color: mapColorStates[color]?.foreground?.disabled,
128
- size: iconSize
129
- })), /*#__PURE__*/_jsx(AnimatedIOText, {
130
- accessible: false,
131
- accessibilityElementsHidden: true,
132
- importantForAccessibility: "no-hide-descendants",
133
- font: newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
134
- weight: "Semibold",
135
- size: buttonTextFontSize,
136
- lineHeight: buttonTextLineHeight,
137
- style: [disabled ? {
138
- color: mapColorStates[color]?.foreground?.disabled
139
- } : {
140
- ...pressedColorLabelAnimationStyle
141
- }, {
142
- textAlign
143
- }],
144
- numberOfLines: numberOfLines,
145
- ellipsizeMode: "tail",
146
- children: label
147
- })]
148
- })
149
- });
150
- });
151
- export default ButtonLink;
152
- //# sourceMappingURL=ButtonLink.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","forwardRef","Pressable","Animated","interpolateColor","useAnimatedProps","useAnimatedStyle","useReducedMotion","useIONewTypeface","useIOTheme","IOButtonStyles","IOColors","hexToRgba","useScaleAnimation","AnimatedIcon","AnimatedIconWithColorTransition","IOText","buttonTextFontSize","buttonTextLineHeight","jsx","_jsx","jsxs","_jsxs","DISABLED_OPACITY","ICON_MARGIN","ButtonLink","color","label","disabled","icon","iconPosition","onPress","accessibilityLabel","accessibilityRole","accessibilityHint","numberOfLines","textAlign","testID","ref","theme","newTypefaceEnabled","progress","onPressIn","onPressOut","scaleAnimatedStyle","reducedMotion","mapColorStates","primary","foreground","default","pressed","contrast","white","AnimatedIOText","createAnimatedComponent","pressedColorLabelAnimationStyle","labelColor","value","pressedColorIconAnimationStyle","iconColor","iconSize","iconMargin","accessibilityState","onTouchEnd","accessible","hitSlop","top","right","bottom","left","style","alignSelf","children","View","buttonLink","flexDirection","columnGap","opacity","allowFontScaling","name","animatedProps","size","accessibilityElementsHidden","importantForAccessibility","font","weight","lineHeight","ellipsizeMode"],"sourceRoot":"../../../../src","sources":["components/buttons/ButtonLink.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAGEC,SAAS,QAGJ,cAAc;AACrB,OAAOC,QAAQ,IACbC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,EAChBC,gBAAgB,QACX,yBAAyB;AAChC,SAASC,gBAAgB,EAAEC,UAAU,QAAQ,eAAe;AAC5D,SACEC,cAAc,EACdC,QAAQ,EAERC,SAAS,QACJ,YAAY;AACnB,SAASC,iBAAiB,QAAQ,aAAa;AAE/C,SACEC,YAAY,EACZC,+BAA+B,QAG1B,UAAU;AACjB,SACEC,MAAM,EACNC,kBAAkB,EAClBC,oBAAoB,QACf,eAAe;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA6BvB,MAAMC,gBAAgB,GAAG,GAAG;AAC5B,MAAMC,WAAW,GAAG,CAAC;;AAErB;AACA;AACA;AACA,OAAO,MAAMC,UAAU,gBAAGxB,UAAU,CAClC,CACE;EACEyB,KAAK,GAAG,SAAS;EACjBC,KAAK;EACLC,QAAQ,GAAG,KAAK;EAChBC,IAAI;EACJC,YAAY,GAAG,OAAO;EACtBC,OAAO;EACPC,kBAAkB;EAClBC,iBAAiB,GAAG,QAAQ;EAC5BC,iBAAiB;EACjBC,aAAa,GAAG,CAAC;EACjBC,SAAS,GAAG,MAAM;EAClBC;AACF,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,KAAK,GAAG9B,UAAU,CAAC,CAAC;EAC1B,MAAM;IAAE+B;EAAmB,CAAC,GAAGhC,gBAAgB,CAAC,CAAC;EACjD,MAAM;IAAEiC,QAAQ;IAAEC,SAAS;IAAEC,UAAU;IAAEC;EAAmB,CAAC,GAC3D/B,iBAAiB,CAAC,CAAC;E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